User:RyaNayR/global.js

/*jshint multistr: true */ /******************************************************************************/ ///* 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 //    ); //}

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

/* .WikiaHeader .page-width-container,.WikiaPage,.WikiaMainContentContainer{margin:0} */

var toolbarCSS    = mw.util.addCSS('.WikiaBarWrapper{background:linear-gradient(to bottom,#3264af 25%,#00327d 50%,#00194b 75%)}.WikiaBarWrapper .toolbar{width:111%}.WikiaBarWrapper .toolbar .tools li a{color:#0f5;font-weight:700}.WikiaBarWrapper .toolbar .tools .arrow-icon{border-color:transparent transparent lime}.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 .tools-menu>li>a{border-top:1px solid #323232}'), toolbarCSS1   = mw.util.addCSS('.WikiaBarWrapper a{transition:color 500ms ease-in-out!important}'), tpwCSS        = mw.util.addCSS('/*.WikiaRail{display:none}*/body.skin-oasis>.global-notification,.WikiaHeader .page-width-container,.WikiaPage{max-width:90%;width:90%}.WikiaArticle .diff-article-content,.diff-article-content{margin-right:0;width:90%}'), modalCSS      = mw.util.addCSS('.modal{width:calc(100% - 750px)!important}'), editPreviewCSS = mw.util.addCSS('#EditPageDialog{left:41%!important;width:66%!important}.ArticlePreviewInner{width:90%!important}'), buttonFixCSS  = mw.util.addCSS('.wikia-button { height: 22px !important }');

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

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

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

// Add toolbar buttons $('#WikiaBarWrapper .toolbar > .tools').append('Toggle Page Width'); $('#WikiaBarWrapper .toolbar > .tools').append('Toggle Custom Toolbar '); $('#WikiaBarWrapper .toolbar > .tools').append('Toggle Button Fix');

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

// Create TogglePreviewWidth button $(document).on('DOMNodeInserted', function (e) {   if (e.target.id === '#EditPageDialog h1') {        $('#EditPageDialog h1').append('Toggle Width ');    } });

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

function keyDown (e) { // Alt + P:   if ((e.altKey) && (e.keyCode === 80)) { togglePageWidth; }   // Alt + Period: if ((e.altKey) && (e.keyCode === 190)) { togglePreviewWidth; }   // 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</a> </li>'); $('#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').attr('display', 'none'); /*$('ul.tools > li:nth-child(1) > a:nth-child(1)').remove; $('ul.tools > li:nth-child(1)').remove;*/

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

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

window.AdvancedOasisUI = { accountNavFollowedPages : false, accountNavWatchlist    : false, categoryRedlink        : true, RCHeader               : true, DefaultSourceMode      : true, lightbox               : true, randomPageLimitedTo    : '', activity2RC            : true, userLang               : true, };

EditIntroButtonText = 'intro';

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:FixMultipleUpload/code.js',        'u:dev:AdvancedOasisUI/code.js',        'u:dev:EditIntroButton/code.js',        'u:dev:SearchSuggest/code.js'        //'u:dev:Sine/code.js'            //'u: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',            //'u:dev:AjaxBatchDelete/code.js', ] });

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

// Custom toolbar links: function addToolbarLinks { $('.tools-menu > li:nth-child(1)').prepend('\       global.css</a>\        global.js</a>\        CtCD Wikia.js</a>\        CtCD CSS</a>'); return 0; } window.onload = function { if ( addToolbarLinks === 0 ) { console.log("Your custom toolbar links have been added!"); } else { console.log("Failed to add custom toolbar links..."); } };

/* window.onload = function { $('.tools-menu > li:nth-child(1)').prepend('global.css</a>global.js</a>CtCD Wikia.js</a>CtCD CSS</a>'); };