SHOW:
|
|
- or go back to the newest paste.
| 1 | - | javascript:(function(){function showToast(message,isError){const existingToast=document.getElementById('nitter-toast');if(existingToast){existingToast.remove();}const toast=document.createElement('div');toast.id='nitter-toast';toast.style.position='fixed';toast.style.bottom='20px';toast.style.right='20px';toast.style.padding='10px 15px';toast.style.borderRadius='4px';toast.style.zIndex='9999';toast.style.fontSize='14px';toast.style.fontWeight='bold';if(isError){toast.style.backgroundColor='rgba(220,0,0,0.9)';}else{toast.style.backgroundColor='rgba(0,128,0,0.9)';}toast.style.color='white';toast.style.boxShadow='0 2px 5px rgba(0,0,0,0.3)';toast.textContent=message;document.body.appendChild(toast);setTimeout(()=>{if(toast.parentNode){toast.remove();}},3000);}const form=document.querySelector('form[action="/saveprefs"]');if(!form){showToast('This doesn\'t appear to be a Nitter instance',true);return;}const formData=new FormData(form);const settings={theme:'Nitter',infiniteScroll:'on',stickyProfile:'on',mp4Playback:'on',hlsPlayback:'on',autoplayGifs:'on'};for(const[key,value]of Object.entries(settings)){formData.set(key,value);}const params=new URLSearchParams();for(const[key,value]of formData.entries()){params.append(key,value);}const formAction=form.getAttribute('action')||'/saveprefs';showToast('Saving preferences...',false);fetch(formAction,{method:'POST',headers:{'Content-Type':'application/x-www-form-urlencoded','Accept':'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8'},body:params.toString(),credentials:'include'}).then(response=>{if(response.ok){showToast('Preferences saved successfully!',false);setTimeout(()=>window.location.reload(),1000);}else{showToast('Failed to save preferences (Status: '+response.status+')',true);}}).catch(error=>{showToast('Error: '+error.message,true);console.error('Nitter preferences error:',error);});})(); |
| 1 | + | javascript:(function() {
|
| 2 | function hasTargetVideo(el) {
| |
| 3 | if (!el) return false; | |
| 4 | return el.innerHTML.includes('video.twimg.com%2Ftweet_video%2F') || el.innerHTML.includes('video.twimg.com/tweet_video/');
| |
| 5 | } | |
| 6 | var items = document.querySelectorAll('.timeline-item, article, [data-testid="tweet"]');
| |
| 7 | var removed = 0; | |
| 8 | items.forEach(function(item) {
| |
| 9 | if (hasTargetVideo(item)) {
| |
| 10 | item.remove(); | |
| 11 | removed++; | |
| 12 | } | |
| 13 | }); | |
| 14 | function showToast(msg) {
| |
| 15 | var existing = document.getElementById('tweet-toast');
| |
| 16 | if (existing) existing.remove(); | |
| 17 | var isDark = window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches;
| |
| 18 | var toast = document.createElement('div');
| |
| 19 | toast.id = 'tweet-toast'; | |
| 20 | toast.textContent = msg; | |
| 21 | toast.style.position = 'fixed'; | |
| 22 | toast.style.bottom = '24px'; | |
| 23 | toast.style.right = '24px'; | |
| 24 | toast.style.zIndex = 9999; | |
| 25 | toast.style.maxWidth = '90vw'; | |
| 26 | toast.style.padding = '14px 24px'; | |
| 27 | toast.style.borderRadius = '8px'; | |
| 28 | toast.style.fontSize = '16px'; | |
| 29 | toast.style.boxShadow = '0 4px 24px rgba(0,0,0,0.11)'; | |
| 30 | toast.style.transition = 'opacity 0.4s'; | |
| 31 | toast.style.opacity = 1; | |
| 32 | toast.style.background = isDark ? '#222' : '#fff'; | |
| 33 | toast.style.color = isDark ? '#fff' : '#222'; | |
| 34 | toast.style.border = '1px solid ' + (isDark ? '#444' : '#e0e0e0'); | |
| 35 | document.body.appendChild(toast); | |
| 36 | setTimeout(function() {
| |
| 37 | toast.style.opacity = 0; | |
| 38 | setTimeout(function() { toast.remove(); }, 400);
| |
| 39 | }, 2500); | |
| 40 | } | |
| 41 | showToast('Removed ' + removed + ' items w/ tweet_video links.');
| |
| 42 | })(); | |
| 43 |