User:Cheeseskates/chat.js

// ==UserScript== // @name        Load Chat JS // @match        http://*.wikia.com/* // ==/UserScript==

/* (function {   'use strict';    if ( wgCanonicalSpecialPageName == 'Chat' ) {        console.log("Chat.js loaded in chat");        importScriptPage("User:Cheeseskates/chat.js", "cheeseskates-personal-stuff");    } });

////////////////////////////////////////////////////////////////////////////////

/* -- -- */
 * * Name:       Global Chat JavaScript                                      |
 * * Author:     Sophiedp - Cheeseskates                                     |
 * * Description: This is my chat.js that can load on all wikis like         |
 * global.js can. It is thanks to Sophiedp's script you can   |
 * put in TamperMonkey.                                       |
 * https://openuserjs.org/scripts/LunarTwilight/Load_global.js_in_chat/source |
 * put in TamperMonkey.                                       |
 * https://openuserjs.org/scripts/LunarTwilight/Load_global.js_in_chat/source |
 * https://openuserjs.org/scripts/LunarTwilight/Load_global.js_in_chat/source |

//————————————————————————————————————————————————————————————————————————————// // Script Configurations -// //————————————————————————————————————————————————————————————————————————————//

// ChatBlockButton Configuration chatBlockReason = [ "Vandalism", "Gross incivility", "Excessive misconduct", "Troll", "Spam", "Recidivism", "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" ];

// QuickModTools Configuration window.QuickModTools = { quickreasons: [ "Gross incivility", "Excessive misconduct", "Troll", "Spam", "Recidivism", "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" ],   defbanreason: "Sockpuppet", defbanlength: "infinite" };

//// // ——————————————————————— End Configuration Section ———————————————————————— // ////

//———————————————————————————————————————————————————————————————————————————— // Imports /* Imports minify the rest of the JavaScript or CSS code and combines multiple HTTP requests into a single data transfer, making it save space and load faster than direct code. It is recommended to import this way. */ //————————————————————————————————————————————————————————————————————————————

//--- /* importscriptURL */ //--- // Add here

//--- /* importArticles */ //---

$(function { importArticles({ type: "script", articles: [ "u:dev:MediaWiki:BlinkingTabAlert.js",           // w:c:dev:BlinkingTabAlert "u:dev:MediaWiki:ChatButtonsCollectionDeluxe.js", // w:c:dev:ChatButtonsCollection "u:dev:MediaWiki:ChatModHover/code.js",          // w:c:dev:ChatModHover "u:dev:MediaWiki:FasterBanModule/code.js",       // w:c:dev:FasterBanModule "u:dev:MediaWiki:IsTyping.js",                   // w:c:dev:IsTyping "u:dev:MediaWiki:MessageBlocker/code.js",        // w:c:dev:MessageBlocker "u:dev:MediaWiki:QuickModTools/code.js",         // w:c:dev:QuickModTools "u:dev:MediaWiki:ResponsivePrivateList/code.js", // w:c:dev:ResponsivePrivateList "u:steven-universe:User:Andrey Andrey/chat.js",  // w:c:su:User:Andrey Andrey/chat.js "u:undertale:User:Cheeseskates/CHAT.javascript"  // w:c:ut:User:Cheeseskates/CHAT.javascript ] }); });

// It was recommended to me that I put this code below the import for it to work (function { function htmlEntities(fmt) {    return fmt.replace(/[-\/\\^$*+?.|[\]{}]/g, "\\$&");  }  if (wgCanonicalSpecialPageName != "Chat") {    return;  }  var fmt = mw.messages.get("chat-user-joined");  var name = mw.messages.get("chat-user-parted");  var filename = new RegExp(htmlEntities(fmt).split("\\$1").join("(.+)"));  var digits = new RegExp(htmlEntities(name).split("\\$1").join("(.+)"));  console.log(fmt, name, filename, digits);  mainRoom.model.chats.bind("afteradd", function(a) { if (!window.QuickModTools || !a.attributes.isInlineAlert) { return; }   var line = a.attributes.text; var name = line.match(filename); var num = line.match(digits); var detail = $("#entry-" + a.cid); if (name) { detail.contextmenu(function(evt) {       if (!evt.ctrlKey) {          return;        }        evt.preventDefault;        QuickModTools.fn.openMenu(name[1]);      }); } else { if (num) { detail.contextmenu(function(evt) {         if (!evt.ctrlKey) {            return;          }          evt.preventDefault;          QuickModTools.fn.openMenu(num[1]);        }); }   }  }); });