מדיה ויקי:סקריפטים/69.js
הערה: לאחר הפרסום, ייתכן שיהיה צורך לנקות את זיכרון המטמון (cache) של הדפדפן כדי להבחין בשינויים.
- פיירפוקס / ספארי: להחזיק את המקש Shift בעת לחיצה על טעינה מחדש (Reload) או ללחוץ על צירוף המקשים Ctrl-F5 או Ctrl-R (במחשב מק: ⌘-R).
- גוגל כרום: ללחוץ על צירוף המקשים Ctrl-Shift-R (במחשב מק: ⌘-Shift-R).
- אדג': להחזיק את המקש Ctrl בעת לחיצה על רענן (Refresh) או ללחוץ על צירוף המקשים Ctrl-F5.
// script 69: filter in recentchanges page, based on keyword.
if (mw.config.get( 'wgCanonicalSpecialPageName' ) == "Recentchanges")
$(function() {
var
inputBox = $('<input>'),
storageKey = 'recentChangesFilter',
state = 0,
selector = 'table.mw-enhanced-rc, li.mw-line-even, li.mw-line-odd',
buttonName = ['הסתרה', 'הצגה'],
button = $('<input>', {type: 'button', value: buttonName[0]})
.click(function() {
state ^= 1;
this.value = buttonName[state];
if (state) {
if (localStorage && localStorage.setItem)
localStorage.setItem(storageKey, inputBox.val());
var filter = new RegExp(inputBox.val());
$(selector)
.filter(function(){return filter.test($(this).text())})
.toggle(false);
} else
$(selector).toggle(true);
});
if (localStorage && localStorage.getItem)
inputBox.val(localStorage.getItem(storageKey));
$('table.mw-recentchanges-table .mw-input:last')
.append('סינון לפי טקסט')
.append(inputBox)
.append(button);
});