User:452/global.js

/* Custom "NewPhotosModule" by 452 - displays Special:NewFiles in the right rail */ if ($('#WikiaRail').length) { //only on pages where the rail is present $('#WikiaRail').bind('DOMNodeInserted', function(event) { //fires after lazy-loading takes place.   if ($('.ChatModule').length && !$("#NewPhotosModule").length) { // Only add it once      if (typeof $temp == "undefined") { // Only load it once        $temp = $(' '); // this line, and the next, originate from http://dev.wikia.com/wiki/AjaxRC/code.js <3        $temp.load("/Special:NewFiles/13" + " #gallery-", function  { $('.ChatModule').after(" New PhotosUpload "); $("#NewPhotosModule").append($('#gallery-', $temp)); $("#NewPhotosModule .wikia-photogallery-add").remove; delete $temp; //delete it, in case the rail is wiped after this point. });     }    }  });  //end of DOMNodeInserted block $('head').append('\n#gallery- { height:452px; overflow-y:auto; clear: both; text-align:center; padding-bottom: 5em;}\n#NewPhotosModule .wikia-gallery-item { padding: 0 0 1em !important; height: auto !important; border: none !important; }\n#NewPhotosModule .thumb { height:auto !important; }\n#NewPhotosModule .gallery-image-wrapper { top:0 !important; }\n#NewPhotosModule h1 {margin: 0 2em 0 0;}\n#NewPhotosModule h1 a:first-child {color:inherit;}\n#NewPhotosModule .wikia-gallery-item .lightbox-caption { display: none; }\n#NewPhotosModule .wikia-gallery-item:hover .lightbox-caption { display: block; }\n '); } /* End of custom "NewPhotosModule" */

function toggleCSS { $('link[href*="oasis/site"]').attr( "disabled",function(idx, oldAttr){return !oldAttr;}); $(window).trigger('resize'); } function toggleUserCSS { $("link[rel='stylesheet'][href*='"+wgUserName+"'][href$='/user']").attr("disabled",function(idx,oldAttr){return!oldAttr;}); $(window).trigger('resize'); }

if (!$("#toggleCSS").length) $("#WikiaBarWrapper .toolbar .tools").append("Toggle CSSToggle User CSS");

if (wgCanonicalNamespace == "Special") $(".WikiaArticle ul:not(.countLI)").each(function{ if ($(">li", this).size != 50 && $(">li", this).size > 15) $(this).addClass("countLI").prepend("Displaying "+$(">li", this).size+"");  });

if ($(".WikiaPageHeaderDiffHistory").length) { /* change the "edit" link of a diff page to edit the current version, as there is already an edit link for both diffs */ oldhref = $(".wikia-button[data-id=edit]").attr("href"); var newhref = oldhref.split("&oldid=")[0]; $(".wikia-button[data-id=edit]").attr("href", newhref); } if (!$("#ca-diff").length && $("a[data-id='history']").closest("ul")) { //adapted from NullEditButton script $("a[data-id='history']").closest("ul").prepend($('<a/>').find("a").attr({ href: wgServer+"/"+wgPageName+"?diff=cur", accesskey: "0", id: "ca-diff", title: mw.config.get('wgPageName') }).text("Last diff")) } console.log("global.js loaded");