User:Sophiedp/global.js

/* Inport for various scripts */ importArticles({   type: "script",    articles: [        'u:dev:PurgeButton/code.js',        'u:dev:ColoredColors/code.js',        'u:dev:DisplayClock/code.js',        'u:dev:View_Source/code.js',        'u:dev:Sine/code.js',        'u:dev:ViewRemoved/code.js',        'u:dev:AjaxUndo/code.js',        'u:dev:NullEditButton/code.js',        'u:dev:Wikimarks/code.js',        'u:dev:RevealAnonIP/usercode.js',        'u:dev:WallGreetingButton/code.js',        'u:admintools:MediaWiki:Wikia.js/cancelButton.js',        'u:runescape:User:Joeytje50/tabinsert.js',        'u:navid:MediaWiki:BadWords.js'    ] });

/* AutoEditDropdown settings and inport */ window.AutoEditDropdownConfig = { expandedAreaContribute: true, expandedAreaEdit: false }; importScriptPage('AutoEditDropdown/code.js','dev');

/* settings and import for AdvancedOasisUI */ window.AdvancedOasisUI = { accountNavFollowedPages: true, accountNavWatchlist: true, categoryRedlink: true, RCHeader: true, DefaultSourceMode: true, lightbox: true, randomPageLimitedTo: '', activity2RC: false, userLang: true, }; importScriptPage('AdvancedOasisUI/code.js', 'dev');

/* Akri's ping script */ // Pinglist. // Using '\b' is a barrier: word\b would trigger on forword but not on wordgame, etc. Other regex flags work on this. var PING_LIST = [ "sophie", "!mods", "zach" ];

// Ping sound. // Needs to be a valid URL to an .ogg file. var PING_SOUND = 'http://images.wikia.com/monchbox/images/0/01/Beep-sound.ogg';

// Ping color. // Needs to be a valid HTML color code. var PING_COLOR = "red"; // Ask our end-user if we want notifications for the script. Notification.requestPermission; // Function itself. $(function {   if (mw.config.get('wgCanonicalSpecialPageName') == 'Chat') {        console.log("Pingchecking activated!");        $('.Chat').on('DOMNodeInserted', function(e) { var msg = $.parseHTML(e.target.innerHTML)[7]; var mee = $(".User .username").html; var mid = e.target.id; var usr = e.target.getAttribute('data-user'); if (usr == mee) return; if (msg !== void 0) { for (var i = 0; i < PING_LIST.length; i++) { if (new RegExp(PING_LIST[i], "mi").test(msg.innerHTML) === true) { // Play the sound. $(' ', {							id: 'ping',							src: PING_SOUND,							autoplay: true						}).appendTo('body'); // Display desktop notifications. if (Notification.permission === 'granted') { var notification = new Notification(usr + " mentioned you!", {body: msg.innerHTML.replace(/(<(img src[^>]*|(?:\/|)a[^>]*|(?:\/|)span[^>]*)>)/g, ""), icon: $("#" + mid + " .avatar").attr('src')}); }						// Change the look of the triggered message. $("#" + mid + " .message").html("" + msg.innerHTML + "<\/span>"); break; }				}				// Terminate the sound. setTimeout(function {					if ($('#ping').length) $('#ping').remove;				}, 1000); }       });    } });