User:RyaNayR/global.js

/******************************************************************************/ ///* ChatRefresh // *  By IAmAPersson ( http://community.wikia.com/wiki/User:IAmAPersson ) // * Original release date: January 20, 2014 // */ // //console.log('ChatRefresh: Init.'); //if (refreshTime === 0) { //   var refreshTime = 300000; //   alert('ChatRefresh: Setting refreshTime = 300000'); //} // //if (wgCanonicalSpecialPageName === 'Chat') { //   console.log('ChatRefresh: Chat namespace detected.'); //   setInterval(function { //            alert('ChatRefresh: Attempting to clear chat window.'); //            active.clearWindow; //        }, refreshTime //    ); //}

/********************/

var toolbarCSS  = mw.util.addCSS('.WikiaBarWrapper{background:linear-gradient(to bottom,#3264af 25%,#00327d 50%,#00194b 75%)}.WikiaBarWrapper .toolbar .tools li a{color:#0ff;font-weight:700}.WikiaBarWrapper .tools-menu{background:linear-gradient(#000064,#6496ff,#000064) repeat scroll 0 0 transparent;border-radius:8px;border:2px solid silver;min-width:90px;text-align:center}.WikiaBarWrapper .toolbar .tools .arrow-icon{border-color:transparent transparent lime}'), toolbarCSS1 = mw.util.addCSS('.WikiaBarWrapper a{transition:color 500ms ease-in-out!important}'), tpwCSS      = mw.util.addCSS('.WikiaHeader .page-width-container,.WikiaPage,.WikiaMainContentContainer{margin:0}.WikiaRail{display:none}body.skin-oasis>.global-notification,.WikiaHeader .page-width-container,.WikiaPage{max-width:99.5%;width:99.5%}.WikiaArticle .diff-article-content,.diff-article-content{margin-right:0;width:99.5%}'), modalCSS    = mw.util.addCSS('.modal{width:calc(100% - 320px)!important}');

toolbarCSS.disabled = false; modalCSS.disabled  = true; tpwCSS.disabled    = true;

$(window).load(function {   if (tpwCSS.disabled === false) {        togglePageWidth;    } });

function togglePageWidth { if ($('#code')) $('#WikiaMainContent').removeAttr('style'); tpwCSS.disabled = !tpwCSS.disabled; } function toggleModalWidth { modalCSS.disabled = !modalCSS.disabled; } function toggleCustomToolbar { toolbarCSS.disabled = !toolbarCSS.disabled; }

$('#WikiaBarWrapper .toolbar > .tools').append('Toggle Page Width'); $('#WikiaBarWrapper .toolbar > .tools').append('Toggle Custom Toolbar ');

$(document).on('DOMNodeInserted', function (e) {   if (e.target.id === 'wikiDiff') {        $('.modal > header > h3').append('Toggle Width ');    } });

// Keyboard shortcuts: $("body").bind("keydown", keyDown);

function keyDown (e) { //Alt + P:   if ((e.altKey) && (e.keyCode === 80)) { togglePageWidth; }   //Alt + M:    if ((e.altKey) && (e.keyCode === 77)) { toggleModalWidth; } }

/*** toggleAds ***/ var adsVisible = true; mw.util.addCSS('#ToggleAds-checkbox{margin:0 4px 0 0;position:relative;top:2px}');

$('.toolbar .tools').append('Hide ads '); $('#ToggleAds-checkbox').prop('checked', true); $('#ToggleAds-checkbox').change( toggleAds );

function hideAds { $('.home-top-right-ads, .WikiaTopAds').css('display', 'none'); adsVisible = false; } function showAds { $('.home-top-right-ads, .WikiaTopAds').css('display', 'block'); adsVisible = true; } function toggleAds { if ( $('#ToggleAds-checkbox').prop('checked') || adsVisible ) { hideAds; $('#ToggleAds-checkbox').prop('checked', true); } else { showAds; $('#ToggleAds-checkbox').prop('checked', false); } }

/******* Misc ********/ $('.topNav').remove;

/********************/ window.DisplayClockJS = { hoverText: '', interval: 200, monofonts: 'Consolas, monospace', location: 'global' };

mw.user.options.set({   'nocache'        : 1,    'norollbackdiff' : 1, });

importArticles({   type: 'script',    articles: [        //'u:community:User:RyaNayR/Code/code.js',        'u:dev:Code/code.js',        'u:dev:AutoEditDropdown/code.js',        'u:dev:QQX/code.js',        'u:dev:PortableCSSPad/code.js',        'u:dev:View_Source/code.js',        'u:dev:HeaderLinks/code.js',        'u:dev:UnsafeScripts/personal.js',        'u:dev:AjaxBatchDelete/code.js'            //:community:User:RyaNayR/CustomToolbarToggle.js',            //'u:community:User:RyaNayR/Code/code.js',            //'u:dev:MiniComplete/code.js',            //'u:dev:QuickTools/advanced.js',            //'u:dev:ListFiles/code.js',            //'u:dev:HideRail/code.js',            //'u:dev:DisplayClock/code.js'    ] });

/******************************************************************************/