Monobook.js
Talk0
1,634pages on
this wiki
this wiki
MediaWiki page
Note: After saving, you have to bypass your browser's cache to see the changes.
- Internet Explorer: hold down the Ctrl key and click the Refresh or Reload button, or press Ctrl+F5.
- Firefox: hold down the Shift key while clicking Reload; alternatively press Ctrl+F5 or Ctrl-Shift-R.
- Opera users have to clear their caches through Tools→Preferences
- Konqueror and Safari users can just click the Reload button.
- Chrome: press Ctrl+F5 or Shift+F5
importScriptURI(wgServer+wgScriptPath+wgScript+'?title=MediaWiki:Common.js/Countdown.js&action=raw&ctype=text/javascript'); /* Any JavaScript here will be loaded for users using the MonoBook skin */ /* See also: [[MediaWiki:Common.js]] */ /* Query string helper */ // get querystring as an array split on "&" var querystring = location.search.replace( '?', '' ).split( '&' ); // declare object var queryObj = {}; // loop through each name-value pair and populate object for ( var i=0; i<querystring.length; i++ ) { // get name and value var name = querystring[i].split('=')[0]; var value = querystring[i].split('=')[1]; // populate object queryObj[name] = value; } var VectorStyle="false"; importScriptPage("User:" + wgUserName + "/monobook.js"); //Load here to see if VectorStyle is there. if (queryObj["vector"]=="true") { VectorStyle = "true"; //Add new CSS var cssLink = document.createElement('link'); cssLink.setAttribute("rel", "stylesheet"); cssLink.setAttribute("type", "text/css"); cssLink.setAttribute("href", "http://layton.wikia.com/index.php?title=MediaWiki:Vector.css&action=raw&ctype=text/css"); document.getElementsByTagName("head")[0].appendChild(cssLink); } /** Sub navigation menus (Monobook version) ***************************** * * Allows you to create dynamic sub navigation menus. * Can be tweaked to contain an infinite amount of submenus. * * Code by [[User:Tjcool007]] from http://layton.wikia.com/ */ $.get('http://layton.wikia.com/index.php?title=MediaWiki:SuperSidebar&action=raw&templates=expand&usemsgcache=yes', function(data) { $('#p-Navigation').html(data); /** Vector Improvements **************************************** * * Not part of the Subnav menus, only for vector js. */ if (VectorStyle=="true") { //Add read button if (wgAction=="view") { $('div#p-cactions ul li#ca-edit').before('<li id="ca-read" class="selected"><a href="/wiki/' + wgPageName + '" title="Read the page.">Read</a></li>'); } else { $('div#p-cactions ul li#ca-edit').before('<li id="ca-read"><a href="/wiki/' + wgPageName + '" title="Read the page.">Read</a></li>'); } //FF fix if (/Firefox[\/\s](\d+\.\d+)/.test(navigator.userAgent)){ $('div#content').css("left", "-1px"); } //Opera fix if (/opera/i.test(navigator.userAgent)) { $('div#content').css({left:"-5px", top: "39px"}); } //expandable boxes on the left $("#column-one div.portlet h5").click(function() { $(this).parent().find('.pBody').toggle(30); }); } /* END VECTOR CODE */ $(".WikiaPage .subnav li").hover(function() { $(this).parent().css({width: $(this).parent().innerWidth()}); if (/opera/i.test(navigator.userAgent)) { //innerwidth instead of outerwidth, also a bit less high. $(this).find('ul:first').css({visibility: "visible !important", display: "none", left: $(this).innerWidth(), top: "-25px"}).show(150); } else { if (/msie/i.test(navigator.userAgent)) { //Problems with :first, so let's do it the old way. $(this).find('ul').eq(0).css({visibility: "visible !important", display: "none", left: $(this).outerWidth()}).show(150); } else { $(this).find('ul:first').css({visibility: "visible !important", display: "none", left: $(this).outerWidth()}).show(150); } } }, function() { $(this).find('ul').css({visibility: "hidden !important"}).hide(); }); });