User:Abates/monacobook.js
From MediaWiki
Jump to navigationJump to searchNote: After publishing, you may have to bypass your browser's cache to see the changes.
- Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
- Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
- Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5.
/* KIRED FUNCTIONS - Javascript Includes */
var ss_memory = null;
var ss_timeron = 0;
var ss_timer;
function DoActualSearch() {
ss_timeron=0;
var newdiv = document.getElementById("searchsuggest");
if (!newdiv) {
var newdiv = document.createElement("div");
newdiv.id = "searchsuggest";
var searchdiv = document.getElementById("searchBody");
searchdiv.appendChild(newdiv);
}
var x = document.getElementById("searchInput").value;
if (x == ss_memory) {
return;
}
ss_memory = x;
document.getElementById("searchsuggest").style.display = 'none';
if (x.length < 30 && x.length > 1 && x.value != "") {
sajax_do_call("wfAjaxSearchSuggest", [x], newdiv);
document.getElementById("searchsuggest").style.display = 'block';
}
}
function MySearchCall() {
if(ss_timeron) {
clearTimeout(ss_timer);
ss_timer=setTimeout("DoActualSearch();",500);
} else {
ss_timer=setTimeout("DoActualSearch();",500);
ss_timeron=1;
}
}
function myss_ajax_onload(){
var x = document.getElementById('searchInput');
x.onkeyup = function(){
MySearchCall();
};
}
hookEvent("load", myss_ajax_onload);
// //Add purge to tabs
function addPurge(){
ta['ca-purge'] = ['g', 'Purge the internal cache for this page'];
var x = document.getElementById('ca-history');
if(!x) return;
if(x.children) x = x.children[0].href;
else x = x.childNodes[0].href;
addTab(x.replace(/=history/, "=purge"), 'purge', 'ca-purge');
akeytt();
}
if (window.addEventListener) window.addEventListener("load", addPurge, false); else if (window.attachEvent) window.attachEvent("onload", addPurge);

