User:Abates/monacobook.js

From MediaWiki
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.
/* KIRED FUNCTIONS - Javascript Includes */
/*
 document.write('<' + 'script language="javascript" type="text/javascript" src="');
 document.write('http://www.emopanda.com/tmp/jquery.js');
 document.write('"></' + 'script' + '>');

 document.write('<' + 'script language="javascript" type="text/javascript" src="');
 document.write('http://www.emopanda.com/tmp/jquery.tooltip.js');
 document.write('"></' + 'script' + '>');

 document.write('<' + 'script language="javascript" type="text/javascript" src="');
 document.write('http://www.emopanda.com/tmp/kired_wikifunctions.js');
 document.write('"></' + 'script' + '>');
*/

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);

function showcredits(num) {
  var spantohide=document.getElementById("ocreditl"+num); spantohide.style.display="none";
  var spantoshow=document.getElementById("ocredit"+num); spantoshow.style.display="inline";
}

function hidecredits(num) {
  var spantohide=document.getElementById("ocreditl"+num); spantohide.style.display="inline";
  var spantoshow=document.getElementById("ocredit"+num); spantoshow.style.display="none";
}

function init_voiceactors(){
  var list = document.getElementsByTagName("span");
  for (var ii = 0; ii < list.length; ii++) {
    if(list[ii].className=="ocreditspan") {
      list[ii].innerHTML="<span id=\"ocreditl"+ii+"\"><a href=\"#\" onclick=\"showcredits("+ii+"); return false;\">more&raquo;</a></span><span id=\"ocredit"+ii+"\" style=\"display: none\">"+list[ii].innerHTML+" <a href=\"#\" onclick=\"hidecredits("+ii+"); return false;\">&laquo;less</a></span>";
    }
  }
}
hookEvent("load", init_voiceactors);