מדיה ויקי:FixHistPage.js
הערה: לאחר הפרסום, ייתכן שיהיה צורך לנקות את זיכרון המטמון (cache) של הדפדפן כדי להבחין בשינויים.
- פיירפוקס / ספארי: להחזיק את המקש Shift בעת לחיצה על טעינה מחדש (Reload) או ללחוץ על צירוף המקשים Ctrl-F5 או Ctrl-R (במחשב מק: ⌘-R).
- גוגל כרום: ללחוץ על צירוף המקשים Ctrl-Shift-R (במחשב מק: ⌘-Shift-R).
- אינטרנט אקספלורר / אדג': להחזיק את המקש Ctrl בעת לחיצה על רענן (Refresh) או ללחוץ על צירוף המקשים Ctrl-F5.
- אופרה: ללחוץ על Ctrl-F5.
/*
הסתרת קישורים ותיבות checkbox אצל מפעילים בדף ההיסטוריה והוספת אפשרות להפעלתם באמצעות כפתור מתאים.
*/
function hideHideRevLinks() {
var pagehistory = document.getElementById("pagehistory");
if(!pagehistory) return;
// hide checkboxes (links are hidden in common.css
var inputs = pagehistory.getElementsByTagName('input');
if (!inputs) return;
for (var i = 0; i < inputs.length; i++)
if (inputs[i].type == 'checkbox') inputs[i].style.display = 'none';
// create show button
var showHideLinksBtn = document.createElement('button');
showHideLinksBtn.className = 'mw-history-revisiondelete-button';
showHideLinksBtn.style.cssFloat = 'left'; // FF
showHideLinksBtn.style.styleFloat = 'left'; // IE
showHideLinksBtn.appendChild(document.createTextNode('הפעלת אפשרות ההסתרה'));
showHideLinksBtn.onclick = function() { showHideLinksBtn.disabled="disabled"; showHideRevLinks(); return false; }
var historysubmit = getElementsByClassName(document, 'input', 'historysubmit')[0];
if (historysubmit == null) // only one edit in page - attach button to "pagehistory" id;
historysubmit = document.getElementById('pagehistory');
else
historysubmit.parentNode.insertBefore(showHideLinksBtn, historysubmit);
}
function showHideRevLinks(){
// show "x" (hide) links
var spans = document.getElementsByTagName("span");
for (var i = 0; i < spans.length; i++)
if (spans[i].className == 'mw-revdelundel-link') spans[i].style.display = 'inline';
// show checkboxes
var inputs = document.getElementById("pagehistory").getElementsByTagName('input');
for (var i = 0; i < inputs.length; i++)
if (inputs[i].type == 'checkbox') inputs[i].style.display = 'inline';
}
$(hideHideRevLinks);