User:Cheeseskates/CHAT.javascript

// window.QuickModTools = { quickreasons: [ "Gross incivility", "Excessive misconduct", "Troll", "Spam", "Disruption-only account", "Flooding", "Accessory before the fact", "Conformity to disruption", "Harassment", "False accusation", "Defamation", "GTS", "fraudulent impersonation", "Compromised", "Unauthorized bot", "Unsolicited canvassing", "Cross-wiki drama (Preventive)", "Banditry", "Shock", "Sockpuppetry", "Sockpuppet", "Meatpuppet", "Sharing illegal content", "Violating Fandom's ToU" ] };

// 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 = [ "chees", ];

// 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 = "aqua";

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

// Long code

// c

// Swearlist. // Using a double backslash '\\' is a substitute for a barrier: word\\ would trigger on forword but not on wordgame, etc. var SWEAR_LIST = [ "fuck", "shit", "\\fag", "bitch", "\\cunt\\", "\\coon", "\\cum\\", "nigg", "niglet", "\\gtfo\\", "\\stfu\\", "\\wtf\\", "\\idfk\\", "\\idfc\\", "\\idgaf\\", "\\jfc\\", "\\omf", "\\bs\\", "\\ffs\\", "***", "w t f", "wt*", "sh*t", "s***", "s**t", "f*ck", "f***", "f**k" ];

// Ask our end-user if we want notifications for the script. Notification.requestPermission;

// Function itself. $(function {  if (mw.config.get('wgCanonicalSpecialPageName') == 'Chat') {    console.log("Swearchecking activated!");    var groups = mw.config.get('wgUserGroups').join(' ');    if ((groups.indexOf('bureaucrat') + groups.indexOf('sysop') + groups.indexOf('chatmoderator') + groups.indexOf('helper') + groups.indexOf('vstf') + groups.indexOf('staff')) > -6) {      $('.Chat').on('DOMNodeInserted', function (e) { var msg = $.parseHTML(e.target.innerHTML)[7]; var mid = e.target.id; var usr = e.target.getAttribute('data-user'); if (msg !== void 0) { for (var i = 0; i < SWEAR_LIST.length; i++) { if (new RegExp(SWEAR_LIST[i].replace(/\\/g, '\\b'), "mi").test(msg.innerHTML) === true) { // Play the sound. $(' ', {               id: 'mod-ping',                src: 'http://images.wikia.com/monchbox/images/0/01/Beep-sound.ogg',                autoplay: true              }).appendTo('body');

// Display desktop notifications. if (Notification.permission === 'granted') { var notification = new Notification(usr + " swore!", {                 body: msg.innerHTML,                  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 ($('#mod-ping').length) $('#mod-ping').remove;          }, 1000); }     });    }  } });

$("a[href='/wiki/Steven_Universe_Wiki']").attr('href', '/wiki/'); //