User:Ark25/Bookmarklets
Script for showing only the red lines in a list
javascript:$('.mw-parser-output li').each(function(){if(!$(this).find('a.new').length)this.style.display='none'})
- makes list items without redlinks disapear.
javascript:$('.mw-parser-output li').each(function(){if(!$(this).find('a.new').length)this.innerHTML=''})
- makes the content of the list items without redlinks disapear
Say for example these 4 lines:
- Big Springs - Big Springs, Ohio
- Billingstown - Billingstown, Ohio
- Birds Run - Birds Run, Ohio
- Birmingham - Birmingham, Ohio
After applying the filter, only the 2nd and the 3rd line should be visible (Billingstown and Birds Run are red links at this moment):
Script for removing lines in a list (those lines not containing string)
javascript:$('.mw-parser-output li').css('display','');if(str = prompt('Please enter a string to search for:'))$('.mw-parser-output li').each(function(){if(!$(this).text().includes(str))this.style.display='none'})
- This script works only on Wikipedia
javascript:(function(){for(var a=document.getElementsByTagName("li"),b=prompt("Please enter a string to search for:"),c=0;c<a.length;c++)a[c].style.display=a[c].innerText.includes(b)?"":"none"})()
- This script works anywhere
Script for adding prefix and suffix to all the lines in the <TEXTAREA>
javascript:(function(){for(var e=document.getElementsByTagName('textarea'),i=0;i<e.length;i++)e[i].value='PREFIX'+e[i].value.split("\n").join('SUFIX\nPREFIX')+'SUFIX'})();
- Only works in Firefox