Note: After saving, you have to bypass your browser's cache to see the changes. Internet Explorer: press Ctrl-F5, Mozilla: hold down Shift while clicking Reload (or press Ctrl-Shift-R), Opera/Konqueror: press F5, Safari: hold down Shift + Alt while clicking Reload, Chrome: hold down Shift while clicking Reload.
// <source lang="javascript">// Log filter script//// Created by [[w:User:Splarka|Splarka]] // Amended by [[b:User:Mike.lifeguard]] & [[User:Lupo]]// Partially rewritten by DieBuche//// <li> element Filter Script, version [0.2]// Should currently work on all known skins (with a #contentSub or #topbar)//if(typeof(filterLists)=='undefined'){// Guard against double inclusionsvarfilterLists={rightsLogOnly:(document.location.href.indexOf('type=rights')==-1&&document.location.href.indexOf('Log/rights')==-1)?false:true,lastClicked:false,makeButton:function(){mw.util.addPortletLink('p-cactions','javascript:filterLists.buildForm()','Filter','ca-rxfilter','Open interactive log entry regex filter thingy');if(window.AutoLoadLogsFilter||mw.util.getParamValue('lifilter')!=null)filterLists.buildForm();},buildForm:function(){varinstructions=(this.rightsLogOnly)?'Regex filter the space-delimited list of rights.':'Regex filter the plain text representation of this list.';$('#ca-rxfilter').hide();varpageTop=$('#contentSub, #topbar');if(!pageTop.length)return;// Set up configvarvalue=mw.util.getParamValue('lifilterexpr');varcasing=(mw.util.getParamValue('lifiltercase')=='1');varinverted=(mw.util.getParamValue('lifilterinv')=='1');// Generate the formvar$fieldSet=$('<fieldset id="rightsFilter"></fieldset>');$fieldSet.append(instructions);var$legend=$('<legend></legend>');$legend.text('Filter <li> list');$fieldSet.append($legend);if(this.rightsLogOnly){varsel=$('<select id=rfSelect></select>');sel.append('<option>Added rights</option>');sel.append('<option>Removed rights</option>');sel.append('<option>Added OR removed</option>');sel.append('<option>Added/removed/static</option>');$fieldSet.append(sel);}$fieldSet.append('<label for="rfRegex"> Regex string: </label><input id="rfRegex">');$fieldSet.append('<input id="rfInvert" type="checkbox"><label for="rfInvert">Invert </label>');$fieldSet.append('<input id="rfCase" type="checkbox"><label for="rfCase">Case insensitive </label>');$fieldSet.append('<button type="button" value="0">Filter</button>');$fieldSet.append('<button type="button" value="1">Highlight</button>');pageTop.after($fieldSet);//Set passed values$('#rfRegex').val(value);$('#rfCase').attr('checked',!casing);$('#rfInvert').attr('checked',inverted);//Bind click and change handlers$('#rightsFilter input').on('keyup change',function(){filterLists.filterLi();});$fieldSet.find('button').click(function(){filterLists.lastClicked=$(this).val();filterLists.filterLi();});if(value.length>0)this.filterLi(mw.util.getParamValue('lifilterhilight')=='1');},filterLi:function(hilight){//grab options from formif(this.rightsLogOnly)vartype=$('#rfSelect').attr('selectedIndex');varinvert=$('#rfInvert').attr('checked');varsearch=$('#rfRegex').val();varflags=($('#rfCase').attr('checked'))?'ig':'g';varhilight=(this.lastClicked=='1')?true:false;varrx=newRegExp(search,flags);//grab the list of all <li> in the contentvarlistItems=$('#bodyContent li');if(!listItems.length)return;//iteratevarrightrx=/^.*?User\:.*? from (.*?) to (.*?) \u200E.*?$/i;//the regex used to grab the Special:Log/rights changeslistItems.each(function(){if(this.rightsLogOnly){//Special:Log/rightsvaroldr=$(this).text().replace(rightrx,'$1');varnewr=$(this).text().replace(rightrx,'$2');varoldrl=oldr.split(', ');varnewrl=newr.split(', ');for(varj=0;j<oldrl.length;j++){for(vark=0;k<newrl.length;k++){if(oldrl[j]==newrl[k]){oldrl[j]='';newrl[k]='';}}}varremr=oldrl.join();varaddr=newrl.join();switch(type){case0:varlook=addr;break;case1:varlook=remr;break;case2:varlook=remr+' '+addr;break;case3:varlook=oldr+' '+newr;break;}}else{//Any other list of <li> objectsvarlook=$(this).text();}$(this).show();$(this).css('background-color','');if((look.search(rx)!=-1&&!invert)||(look.search(rx)==-1&&invert)){if(hilight)$(this).css('background-color','#ffff99');}else{if(!hilight)$(this).hide();}});}};//When to enable all thisif(mw.config.get('wgAction')=='history'||wgCanonicalSpecialPageName&&wgCanonicalSpecialPageName.match(/^(Activeusers|CheckUser|Contributions|Ipblocklist|LinkSearch|Log|Search|(Uncategoriz|Unus|Want)ed(categori|templat)es|Wantedfiles|(Short|Long|Ancient|Uncategorized|Unwatched|Wanted|Protected|Deadend|Lonely|New)pages|Fewestrevisions|Withoutinterwiki|(Double|Broken)Redirects|Protectedtitles|CrossNamespaceLinks|Recentchanges|Categories|Disambiguations|Listredirects|GlobalUsers|GlobalBlockList|Listusers|Watchlist|Most(linked|revisions|categories)|Nuke|Whatlinkshere)$/i)||mw.util.getParamValue('lifilter')){$(document).ready(filterLists.makeButton);}}// end if (guard)// </source>