User:Abates/monacobook.js

From MediaWiki
Revision as of 21:08, 20 January 2016 by Abates (talk | contribs)
Jump to navigationJump to search

Note: 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.
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);

$('h2:contains("Fiction") ~ h3').css('text-align', 'center');
$('h2:not(:contains("Fiction")) ~ h3').css('text-align', 'left');