User:Sophiedp/global.js

/* Cache check settings */ window.topLevelCat = '';

/* QuickTools settings */ var QuickToolsAdvancedtop = false;

/* AnchoredRollback settings */ anchoredRollbackBot = true;

/* Show removed replies */ $(".message-removed.hide").removeClass("hide");

/* FastDelete settings */ var fdButtons = []; fdButtons.push({   'summary': 'Housekeeping',    'label': 'HK' });

/* AjaxRC settings */ window.ajaxRefresh = 30000; //30 seconds window.ajaxPages = [ "Special:WikiActivity", "Special:RecentChanges", "Special:Watchlist", "Special:Log", "Special:Contributions" ];

/* Full screen width RCM page */ if ($(".rc-content-multiple").length && wgAction == 'view') { mw.util.addCSS('.WikiaPage {\       border: none !important;\        padding: 0 8px;\        width: calc(100% - 16px);\    }'); }

/* Make RC show bot edits and Newwikis show english wikis */ //@author-Foodbandlt if (wgPageName == "Special:RecentChanges") { if (window.location.href.indexOf("hidebots=") == -1 && window.location.href.indexOf("?") == -1) { window.location.href = window.location.href + "?hidebots=0"; } else if (window.location.href.indexOf("hidebots=") == -1 && window.location.href.indexOf("?") !== -1) { window.location.href = window.location.href + "&hidebots=0"; } } else if (wgPageName == "Special:Newwikis") { if (window.location.href.indexOf("language=") == -1 && window.location.href.indexOf("?") == -1) { window.location.href = window.location.href + "?language=en"; } else if (window.location.href.indexOf("language=") == -1 && window.location.href.indexOf("?") != -1) { window.location.href = window.location.href + "&language=en"; } }

/* Not autoedit redlinks */ $(function {    var head = $('a[href$="?action=edit&redlink=1"]');    if (head.attr("href")) {        head.attr("href", head.attr("href").replace("?action=edit&redlink=1", ""));    } });

/* Remove help from the global nav menu */ $('.wds-global-navigation__user-menu > div > ul.wds-list > li:has(a[data-tracking-label="account.help"])').remove;

/* QuickCreateUserPage and QuickCreateMessageWall */ if (wgCityId !== "621556") { //Modified version of QuickCreateUserPage $('', {       id: 'qcup',    }).html('Create user page') .prependTo('.toolbar .tools') .click(function {       $.ajax( { type: 'POST', url: mw.util.wikiScript( 'api' ), dataType: 'json', data: { action: 'edit', title: 'User:Sophiedp', summary: 'Creating user page (script)', text: '', format: 'json', token: mw.user.tokens.get( 'editToken' ) }       } ).done( function ( data ) { if ( data.edit.result === 'Success' ) { new BannerNotification("Successfully created page!","confirm").show; } else { new BannerNotification("An error occurred.","error").show; }       } ).fail( function ( data ) { new BannerNotification("An error occurred.","error").show; } );   });    //Modified version of QuickCreateMessageWallGreeting $('', {       id: 'qcmwg',    }).html('Create Greeting') .prependTo('#my-tools-menu') .click(function {       $.ajax( { type: 'POST', url: mw.util.wikiScript( 'api' ), dataType: 'json', data: { action: 'edit', title: 'Message_Wall_Greeting:Sophiedp', summary: 'Creating message wall greeting (script)', text: '', format: 'json', token: mw.user.tokens.get( 'editToken' ) }       } ).done( function ( data ) { if ( data.edit.result === 'Success' ) { new BannerNotification("Successfully created page!","confirm").show; } else { new BannerNotification("An error occurred.","error").show; }       } ).fail( function ( data ) { new BannerNotification("An error occurred.","error").show; } );   }); }

//———————————————————————————————— ! ! ! ————————————————————————————————// /* Place imports below this line. Place everything else above this line. */

/* Staff/VSTF/Bot/Helper highlights */ importStylesheetPage('Highlight/code.css', 'dev');

/* WLB highlights */ importStylesheetPage('MediaWiki:WLBhighlight.css', 'wlb');

/* Imports */ importArticles({   type: "script",    articles: [        'u:kocka:User:KockaAdmiralac/AutoWideCodeeditor.javascript',        'u:steven-universe:MediaWiki:BoardThreadAlerts.js',        'u:dev:MediaWiki:CacheCheck/code.js',        'u:dev:MediaWiki:HeaderLinks/code.js',        'u:dev:MediaWiki:NoImageLightbox/code.js',        'u:dev:MediaWiki:RevealAnonIP/usercode.js',        'u:dev:MediaWiki:MarkBlocked.js',        'u:dev:MediaWiki:FindAndReplace/code.js',        'u:dev:MediaWiki:Wikimarks/code.js',        'u:dev:MediaWiki:AjaxRC/code.js',        'u:dev:MediaWiki:LastEdited/code.js',        'u:dev:MediaWiki:AjaxUndo/code.js',        'u:dev:MediaWiki:FixWantedFiles/code.js',        'u:dev:MediaWiki:SignatureCheck/code.js',        'u:dev:MediaWiki:AntiUnicruft/code.js',        'u:dev:MediaWiki:DiscussionsFeed.js',        'u:dev:MediaWiki:UnsafeScripts/personal.js',        'u:dev:MediaWiki:HoverEditCount/code.js', 'u:dev:MediaWiki:OldFilePages/code.js', 'u:dev:MediaWiki:PageRenameAuto-update/code.js', 'u:dev:MediaWiki:FileUsageAuto-update/code.js', 'u:dev:MediaWiki:CategoryRenameAuto-update/code.js', 'u:dev:MediaWiki:QuickDiff/code.js', 'u:dev:MediaWiki:WHAM/code.2.js', 'u:dev:MediaWiki:MarkForDeletion/code.js', 'u:dev:MediaWiki:AnchoredRollback/code.js', 'u:dev:MediaWiki:Quick_Management/code.js', //remove once WHAM gets user rights 'u:dev:MediaWiki:Rollback/code.js', 'u:dev:MediaWiki:AbuseLogRC.js', 'u:dev:MediaWiki:ContribsLink/code.js', 'u:dev:MediaWiki:DupImageList/code.js', 'u:dev:MediaWiki:DisplayTimer/code.js', 'u:dev:MediaWiki:FastDelete/code.js', 'u:dev:MediaWiki:Linksweeper/code.js', 'u:dev:MediaWiki:RecentChangesMultiple/code.2.js' ] });

//———————————————————————————————— ! ! ! ————————————————————————————————// /* Place imports above this line. Place chat javascript below this line. */

/* Make only run in chat */ if ( wgCanonicalSpecialPageName == 'Chat' ) {

/* Pings */ // Using a double backslash '\\b' is a substitute for a barrier: word\\b would trigger on forword but not on wordgame, etc. var PING_LIST = [ "zach", "soph", "sharkie" ]; var PING_SOUND = 'https://discordapp.com/assets/c7b42941e1257a98d4086fcde3f6bc9a.mp3'; // Ask our end-user if we want notifications for the script. Notification.requestPermission; // Function itself. console.log("Pingchecking activated!"); var afterChat = function (chat) { var t = chat.attributes.text, n = chat.attributes.name, isInline = chat.attributes.isInlineAlert || false, context = mainRoom.viewDiscussion.chatUL.children.last; if (new RegExp(PING_LIST.join('|'), 'mi').test(t)) { $(' ', {       id: 'ping',        src: PING_SOUND,        autoplay: true    }).appendTo('body'); // Display desktop notifications. if (Notification.permission === 'granted') { new Notification(n + " pinged you!", {           body: t,            icon: context.children('.avatar').attr('src').slice(0, -2) + '150'        }); }   // Change the look of the triggered message. context.children('.message').wrap(''); } var chatMain = mainRoom.viewDiscussion.chatDiv[0]; if (chatMain.scrollHeight - chatMain.scrollTop - chatMain.clientHeight > 150) return; mainRoom.viewDiscussion.scrollToBottom; }; mainRoom.model.chats.bind('afteradd', afterChat);

/* For ChatTimestamps */ mw.util.addCSS('.Chat .message { display: inline !important; }');

/* Imports */ importScriptPage('User:Sophiedp/chat.js', 'embercastle'); //ChatPlugins importScriptPage('MediaWiki:EscapeEmoticons/code.js', 'dev'); importScriptPage('MediaWiki:NewMessageCount.js', 'dev'); importScriptPage('MediaWiki:ResponsivePrivateList/code.js', 'dev'); importScriptPage('MediaWiki:ChatTimestamps/code.js','dev');

} //keep this