User:KurwaAntics/global.js

// AjaxRC settings // window.ajaxPages = ["Special:RecentChanges","Special:Log","Special:WikiActivity"];

// Load scripts // importArticles({   type: "script",    articles: [        "w:c:dev:RelocateEditDiscussionButtons/code.js",        "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:UnsafeScripts/code.js",        "w:c:dev:AntiUnicruft/code.js",        "w:c:dev:View_Source/code.js",        "w:c:dev:AjaxRC/code.js",        "w:c:dev:AjaxUndo/code.js"    ] });

// Full resolution images // 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);    }); }

$("img").click(function(e) {   if ( e.ctrlKey || e.metaKey ) {        var src = $(this).attr("src").split("/scale-to-width-down", 1);        $(this).attr("src", src).css({"max-width": "100%"});        event.preventDefault;        return false;    } });

// Google Custom Search // 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);

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

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

if ( cx.length > 0 ){ $('.search-form-wrapper').html('<gcse:searchbox-only newWindow="true" enableAutoComplete="false"></gcse:search-only>'); }

mw.util.addCSS('.gsc-input { padding: 0; } .gsc-search-button { display: none; }');

// Google Custom Search HTML // /*$('body').prepend(' <gcse:searchbox-only newWindow="true" enableAutoComplete="false"></gcse:search-only> ');

$("#gcse").click(function(e) {   if (e.ctrlKey || e.metaKey || !cx) {        window.location.href = "/wiki/Special:Search";    } else {        $('#google-custom-search-panel').toggle;        $('#google-custom-search-backdrop').toggle;        $("#google-custom-search-blackout").toggle;        if (!$("#google-custom-search-panel").hasClass("hide")){            $('input.gsc-input').focus;        }    } });

$("#google-custom-search-blackout").click(function {   $('#google-custom-search-panel').toggle;    $('#google-custom-search-backdrop').toggle;    $("#google-custom-search-blackout").toggle; });

$('input.gsc-input').keydown(function(e) {   if(e.which == 13) {        $('input.gsc-search-button').click;    } });*/

// Ctrl+S to save page // $(document).keydown(function(event) {       if((event.ctrlKey || event.metaKey) && event.which == 83) {            $('#wpSave').click;            event.preventDefault;            return false;        }    } );

// Case redirect // if ( $('.noarticletext .mw-headline a').length > 0 ) { window.location = $('.noarticletext .mw-headline a').attr('href'); }

// Page load completion indicator // $(window).bind("load", function {  console.log('Everything is ready');   $('#WikiaBar .toolbar').append('  Ready '); });