MediaWiki:Global.js: Difference between revisions

From Wiki Grepolis EN
Jump to navigation
mNo edit summary
m (Undo revision 11213 by Theonlythomas (talk))
Line 68: Line 68:


});
});
/ / Makes the sidebar foldable (by Menidan)
sidebar_settings var = JSON.parse (localStorage.getItem ("sidebar_settings")) | | {};
save_sidebar function () {
localStorage.setItem ("sidebar_settings", JSON.stringify (sidebar_settings));
}
set_sidebar function (id, folded) {
if (document.getElementById (id). parentElement.id! = "column-one")
return;
if (folded)
sidebar_settings [id] = true;
else
sidebar_settings delete [id];
save_sidebar ();
}
var fold = "http://wiki.de.grepolis.com/images/7/7e/Einklappen.png";
unfold var = "http://wiki.de.grepolis.com/images/0/06/Ausklappen.png";
sidebar_click function (node) {
var content = $ (node.parentElement.lastElementChild);
if (content.css ("display") == "none") {
content.css ("display", "block");
node.firstElementChild.alt = "[-]";
node.firstElementChild.src = fold;
set_sidebar (node.parentElement.id, false);
Else {}
content.css ("display", "none");
node.firstElementChild.alt = "[+]";
node.firstElementChild.src = unfold;
set_sidebar (node.parentElement.id, true);
}
return false;
}
sidebar_links var = $ ("# column-one. generated sidebar.portlet-h5"). Slice (1). replaceWith (function () {
if (sidebar_settings [this.parentElement.id])
return $ ('<a href="#" style="text-align:center"> <img src="' + fold +'" style="float:left" alt="[-]" /> <h5 > '+ this.innerHTML +' </ h5> </ a> '). click (function () {
sidebar_click return (this);
});
. $ (This.nextElementSibling) css ("display", "none");
return $ ('<a href="#" style="text-align:center"> <img src="' + unfold +'" style="float:left" alt="[+]" /> <h5 > '+ this.innerHTML +' </ h5> </ a> '). click (function () {
sidebar_click return (this);
});
});
console.log ("sidebar ready");

Revision as of 12:21, 1 November 2013

var anunt_list
var nr_anunturi
var anunt_curent
var anunt_timer, hint_timer;

function ch_hints() {
   var hint_nr=Math.round(Math.random()*45);
   $("#grepo_nl_hints").slideUp("slow");
   hint_nr++;
   $.get("/index.php",{title:"Overleg:FAQ",action:"raw",section:hint_nr}, function(response,succes) {
      if (succes) {
      resp= "__NOEDITSECTION__" + response
      $.get("/api.php",{action:"parse",text:resp,format:"xml"},function(xresp,succ) {
          if (succ) {
              $("#grepo_nl_hints").html(xresp.getElementsByTagName("text")[0].childNodes[0].nodeValue);
          }
      },"xml");
      };
},"html");
   $("#grepo_nl_hints").slideDown("slow");
}


function ch_anunt() {
        $(anunt_list[anunt_curent]).fadeOut("normal",function() {
             anunt_curent++;
             if (anunt_curent >= nr_anunturi) {
                 anunt_curent=0;
             }
             $(anunt_list[anunt_curent]).fadeIn();
        });
}


$(document).ready(function() {
   $(".Aankondiging_Hoofdpagina").hide();
   anunt_list = $(".Aankondiging_Hoofdpagina").toArray();
   nr_anunturi=anunt_list.length;
   anunt_curent=0;
  // console.info("a:"+anunt_list+"; nr:"+nr_anunturi);
   if (nr_anunturi > 1) {
       $(anunt_list[0]).fadeIn();
       anunt_timer=window.setInterval("ch_anunt()",5000);
   } else {
       if (nr_anunturi > 0) {
            $(".anunt_primapagina").fadeIn();
        }
   }
   if ((wgAction != "edit") && (wgCanonicalNamespace != "Special") && (wgCanonicalNamespace != "Template") && (wgCanonicalNamespace != "Help") && (wgCanonicalNamespace != "Project") && (wgCanonicalNamespace != "File") && (wgTitle != "Global.js") && (wgTitle != "Overleg:FAQ") ) {
$("#content").before("<div style='clear:both'></div><div id='grepo_nl_hints_container' style='padding: 10px 15px; background: url(&quot;/skins/grepolis/content_bg.jpg&quot;) repeat scroll 0% 0% transparent; width: 772px; min-height:100px; text-align: center;'><a title='Close' href='#' id='grepo_nl_close_hints'><img style='float:right; height:20px; width:20px;' src='http://wiki.nl.grepolis.com/images/a/ab/Sluiten.png'/></a><img id='grepo_nl_hints_image' style='position:relative; float:right; height:75px; width:75; top:35px; left:0px;' src='http://wiki.nl.grepolis.com/images/5/56/Vraagteken.png' alt='Instructions' /> <span id='grepo_nl_hints' style='width:80%'></span></div>");
   ch_hints();
   hint_timer=window.setInterval("ch_hints()",30000);
   $("#grepo_nl_close_hints").click(function() {
        hint_timer=window.clearInterval(hint_timer);
        $("#grepo_nl_hints").slideUp("slow", function() {
             $("#grepo_nl_close_hints").hide();
             $("#grepo_nl_hints_image").hide();
             $("#grepo_nl_hints_container").css("min-height","0px");
        });
   });
        
   }
   
   if ((wgTitle == "Global.js") && (wgAction != "edit") && (wgAction != "history") && (wgAction != "historysubmit")) {
     $("#bodyContent").html("<p>Deze pagina is gesloten!</p><p>Team <a href='http://nl.grepolis.com'>Grepolis.nl</a>!</p>");
    }


});