User:KurwaAntics/global.js

importArticles({   type: "script",    articles: [        "w:c:dev:DisplayClock/code.js",        "w:c:dev:ReferencePopups/code.js",        "w:c:dev:FindAndReplace/code.js",        "w:c:dev:RevealAnonIP/usercode.js",        //"w:c:dev:YouTubeModal/code.js",        "w:c:dev:RelocateEditDiscussionButtons/code.js",        "w:c:dev:View_Source/code.js"    ] });

function clearimage{ $("img").each(function {       var src = $(this).attr("src").split("/scale-to-width-down", 1);        $(this).attr("src", src).css({"max-width": "100%"});    }); $("a.image-thumbnail").each(function {       var href = $(this).attr("href").split("/revision", 1);        $(this).attr("href", href);    }); }

//$('.wikia-bar .toolbar').prepend('');

if ( window.location.hostname == "agk.wikia.com" ) { var cx = '015628384834097629555:uhhcz8yhzgq'; } else if ( window.location.hostname == "evchk.wikia.com" ) { var cx = '015628384834097629555:vlu13fmjasg'; } else if ( window.location.hostname == "hitlerparody.wikia.com" ) { var cx = '015628384834097629555:4kr1xm1aay8'; } else if ( window.location.hostname == "polandball.wikia.com" ) { var cx = '015628384834097629555:9n3lb2lscm0'; } else if ( window.location.hostname == "dev.wikia.com" ) { var cx = '015628384834097629555:2iatjrjxan8'; }

var gcse = document.createElement('script'); gcse.type = 'text/javascript'; gcse.async = true; gcse.src = 'https://cse.google.com/cse.js?cx=' + cx; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(gcse, s); var body = $('body');

mw.util.addCSS('#findfielddiv { overflow-y: auto; }');

$('.toolbar .tools').append(' '+ '  '+ 'User'+ ''+ 'My user page'+ '' + $('a[data-id="mytalk"]').text + ''+ 'My preferences</li>'+ '<a href="/wiki/Special:Contact/general">Contact Wikia</a></li>'+ '</ul></li>'+ ' '+ '   '+ '<a href="#">Edit JS</a>'+ '<ul id="my-user-menu" class="tools-menu" style="right: auto; display: none;">'+ '<a href="/wiki/MediaWiki:Common.js?action=edit">This Wiki</a></li>'+    '<a href="/wiki/User:Yhynerson1/common.js?action=edit">Personal</a></li>'+    '<a href="http://community.wikia.com/wiki/User:Yhynerson1/global.js?action=edit">Global</a></li>'+    '<a href="/wiki/MediaWiki:ImportJS?action=edit">List of imports</a></li>'+ '<a href="/wiki/Special:JSPages">Review status</a></li>'+ '</ul></li>'+ ' '+ '  '+ '<a href="#">Edit CSS</a>'+ '<ul id="my-user-menu" class="tools-menu" style="right: auto; display: none;">'+ '<a href="/wiki/MediaWiki:Wikia.css?action=edit">This Wiki</a></li>'+ '<a href="/wiki/User:Yhynerson1/wikia.css?action=edit">Personal</a></li>'+ '<a href="http://community.wikia.com/wiki/User:Yhynerson1/global.css?action=edit">Global</a></li>'+ '</ul></li>'+ '<a onclick="clearimage" style="cursor:pointer">Clear images</a></li>'+ '<a onclick="togglesearch" style="cursor:pointer">Search</a></li>');

function togglesearch(e) { if (e.ctrlKey || e.metaKey) { window.location.href = "/wiki/Special:Search"; } else { $('#google-custom-search-sidebar').toggleClass("sidebar-hide"); } }

body.prepend(' </gcse:search> ');

// Ctrl+S to save page $(document).keydown(function(event) {       // If Control or Command key is pressed and the S key is pressed        // run save function. 83 is the key code for S.        if((event.ctrlKey || event.metaKey) && event.which == 83) {            // Save Function            $('#wpSave').click;            event.preventDefault;            return false;        }    } );

console.log('global.js loaded.');