User:Cheeseskates/global.js

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

//———————————————————————————————————————————————————————————————————————————— // Direct JavaScript code. /* Direct Javascript code is here either because a page does not exist for it  here on Wikia's and Wikimedia's domain or if it is too small to be worthy of   a pastebin import compression. */ //————————————————————————————————————————————————————————————————————————————

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

// Add a clear reason button on Special:Delete if (mw.config.get("wgAction") === "delete") { $("#wpReason").after(' ⌫ '); $("#wpClearReason").click(function {   $("#wpReason").val("").focus;  }); }

// Add a history button on diff pages if ($('strong:contains("Changes:")').length) { $("#WikiaPageHeader").find("p").children("a").after(' (history)'); }

// Add a powerusers checkbox in Special:ListUsers if (wgCanonicalSpecialPageName == "Listusers") { $("fieldset.lu_fieldset tr:last-child").prepend('  Power Users '); }

// Add a separate list of uncreated categories on Special:Categories if (mw.config.get("wgCanonicalSpecialPageName") === "Categories") { var $newCats = $(" ").css("float", "right").text("Uncreated categories:"); var $newCatsList = $("").appendTo($newCats); $(".mw-spcontent > ul").before($newCats); $(".mw-spcontent > ul > li").has(".newcategory").clone.appendTo($newCatsList); }

// Add an edit links on Special:WhatLinksHere if (mw.config.get("wgCanonicalSpecialPageName") === "Whatlinkshere") { $("#mw-whatlinkshere-list > li").each(function(dataAndEvents, context) {   var fontSize = $(context).children("a").attr("href") + "?action=edit";    $(context).find(".mw-whatlinkshere-tools > a:last-child").after(" | ", $("").attr("href", fontSize).text("edit"));  }); }

// Disable Soundcloud auto-play even when set to "true" $(function { $('[data-wikia-widget="soundcloud"]').each(function { var $imageElement = $(this); var input = new mw.Uri($imageElement.attr("src")); if (input.query) { delete input.query.auto_play; }   $imageElement.attr("src", input.toString); }); });

// Disable the 5 sec. edit save delay $(function { $("#editform").off("submit").on("submit", function { $(window).unbind(".leaveconfirm"); }); });

// Prevent Special:TemplateBuilder redirecting that disables "undo" feature if (mw.config.get("wgCanonicalSpecialPageName") === "InfoboxBuilder") { var $pageName = "Template:" + mw.config.get("wgPageName").split("/")[1] + "?action=edit&useeditor=source"; window.location.href = mw.config.get("wgArticlePath").replace("$1", $pageName); }

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

/// // ——————————————————— End Direct Import JavaScript Code ———————————————————— / ///

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

//———————————————————————————————————————————————————————————————————————————— // Script Configurations /* All of the confgurations below contribute to how the JavaScript imports function. It only works with imports like this, not direct JavaScript code, hence why it is in between here and the mentioned section above. */ //————————————————————————————————————————————————————————————————————————————

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

// AjaxDelete Configuration window.AjaxDelete = { deleteReasons: { "w:Help:Vandalism"      : "Vandalism", "w:Help:Spam"           : "Spam", "Marked for speedy deletion" : "Speedy", "Empty page"                : "Empty", "Author's request"          : "Author request", "Irrelevant to " : "Irrelevant" }, imageDeleteReasons: { "Offensive"                 : "Offensive", "inappropriate"             : "inappropriate", "Harassment"                : "Harassment", "Housekeeping/Unused"       : "Unused", "Copyright infringement"    : "Copyright", "Author's request"          : "Author request" }, autoCheckWatch: false, noUndelete: true };

// AjaxRC: Used to Make imputted pages refresh in Ajax. window.ajaxRefresh           = 1E3; window.AjaxRCRefreshText     = 'Auto-refresh'; window.AjaxRCRefreshHoverText = 'Automatically refresh the page'; window.ajaxPages = [

/// // ——————————————————— Temporary Watchlist (for vandals) ———————————————————— / /// //Add below when necessary.

/*———————————————————————————————————————————————————————————————————————————————— ———————————————————————————————————————————————————————————————————————————————— /*
 * // Interlanguage Wiki Pages //                           |
 * Note 1: The order is according to the Language Brigade Wiki and alphabetical.   |
 * Note 2: The first language name is the English word. The second language        |
 * name is the language's word/original word. The two letters after are the        |
 * abbreviations for the second language names.                                    |
 * 1. Always add the language names in this order: English word -> Original ↓      |
 * -> Abbreviation (e.g. fr for french)                                            |
 * 2. Always add the page names in this order: WikiActivity -> RecentChanges -> Log |
 * Note 3: The Chinese and Romanian's WikiActivity are the same as the English     |
 * WikiActivity page, and the Brazilian Portuguese (including their Log page),     |
 * Catalan, Galician, and occitan's WikiActivity are the same as the Spanish       |
 * WikiActivity page. Because of this, They are not added to prevent duplication.  |
 * WikiActivity page, and the Brazilian Portuguese (including their Log page),     |
 * Catalan, Galician, and occitan's WikiActivity are the same as the Spanish       |
 * WikiActivity page. Because of this, They are not added to prevent duplication.  |

////* Afrikaans (af) *//// "Spesiaal:WikiActivity", "Spesiaal:Onlangse_wysigings", "Spesiaal:Logboek",

////* Arabic (العرب) (ar) *//// "خاص:WikiActivity", "خاص:أحدث_التغييرات", "خاص:سجل",

////* Belorussian (Беларуская) (be) *//// "Адмысловае:WikiActivity", "Адмысловае:RecentChanges", "Адмысловае:Log",

////* Brazilian Portuguese (Português do Brasil) (pt-br) *//// "Especial:Mudanças_recentes",

////* Bulgarian (Български) (bg) *//// "Специални:WikiActivity", "Специални:Последни_промени", "Специални:Дневници",

////* Catalan (Català) (ca) *//// "Especial:Canvis_recents", "Especial:Registre",

////* Chinese (中文) (zh) *//// "Special:最近更改", "Special:日志",

////* Chinese (Taiwan) ( 中文(台灣) ) (zh-tw) *//// "特殊:WikiActivity", "特殊:近期變動", "特殊:日誌",

////* English (en) *//// "Special:WikiActivity", "Special:RecentChanges", "Special:Watchlist", "Special:AbuseLog", "Special:Log", "Special:Log/upload", "Special:Log/newusers", "Special:Images", "Special:Videos", "Special:Newwikis",

////* Estonia (Eesti) (et) *//// "Eri:WikiActivity", "Eri:Viimased_muudatused", "Eri:Logid",

////* Farsi (فارسی) (fa) *//// "ویژه:WikiActivity", "ویژه:تغییرات_اخیر", "ویژه:سیاهه‌ها",

////* French (Français) (fr) *//// "Spécial:WikiActivity", "Spécial:Modifications_récentes", "Spécial:Journal",

////* Galician (Galego) (gl) *//// "Especial:Cambios_recentes", "Especial:Rexistros",

////* German (Deutsch) (de) *//// "Spezial:WikiActivity", "Spezial:Letzte_Änderungen", "Spezial:Logbuch",

////* Greek (Ελληνικά) (el) *//// "Ειδικό:WikiActivity", "Ειδικό:ΠρόσφατεςΑλλαγές", "Ειδικό:Μητρώο",

////* Hungarian (Magyar) (hu) *//// "Speciális:WikiActivity", "Speciális:Friss_változtatások", "Speciális:Rendszernaplók",

////* Indonesian (Bahasa Indonesia) (id) *//// "Istimewa:WikiActivity", "Istimewa:Perubahan_terbaru", "Istimewa:Catatan",

////* Italian (Italiano) (it) *//// "Speciale:WikiActivity", "Speciale:UltimeModifiche", "Speciale:Registri",

////* Japanese (日本語) (ja) *//// "特別:WikiActivity", "特別:最近の更新", "特別:ログ",

////* Korean (한국어) (ko) *//// "특수기능:위키활동내역", "특수기능:최근바뀜", "특수기능:기록",

////* Limburg (Limburgs in Dutch) (li) *//// /* Note: Wikiactivity is the same as the Nederlands' WikiActivity page, so it is not included. */ "Speciaal:Lètste_verangeringe", "Speciaal:Logbeuk",

////* Lithuanian (Lietuvių) (lt) *//// "Specialus:WikiActivity", "Specialus:Naujausi_keitimai", "Specialus:Sąrašas",

////* Nederlands (nl) *//// "Speciaal:WikiActivity", "Speciaal:RecenteWijzigingen", "Speciaal:Logboeken",

////* Norwegian Bokmål ( ‪Norsk (bokmål) ‬) (no) *//// "Spesial:WikiActivity", "Spesial:Siste_endringer", "Spesial:Logg",

////* Occitan (oc) *//// "Especial:Darrièrs_cambiaments", "Especial:Jornal",

////* Polish (Polski) (pl) *//// "Specjalna:Aktywność_na_wiki", "Specjalna:Ostatnie_zmiany", "Specjalna:Rejestr",

////* Russian (Русский) (ru) *//// "Служебная:WikiActivity", "Служебная:RecentChanges", "Служебная:Log",

////* Romanian (Română) (ro) *//// "Special:Schimbări_recente", "Special:Jurnal",

////* Serbian / serbian (Српски / Srpski) (sr) *//// "Посебно:WikiActivity", "Посебно:СкорашњеИзмене", "Посебно:Извештај",

////* Spanish (Español) (es) *//// "Especial:WikiActivity", "Especial:CambiosRecientes", "Especial:Registro",

////* Suomi (Finnish) (fi) *//// "Toiminnot:WikiActivity", "Toiminnot:Tuoreet_muutokset", "Toiminnot:Loki",

////* Ukrainian (Українська) (uk) *//// "Спеціальна:WikiActivity", "Спеціальна:RecentChanges", "Спеціальна:Log",

////* Vietnamese (Tiếng Việt) (vi) *//// "Đặc_biệt:Hoạt_động_wiki", "Đặc_biệt:Thay_đổi_gần_đây", "Đặc_biệt:Nhật_trình"

//// // —————————————————————————— End AjaxRC Section ———————————————————————————— // ////

];

// AutoFormatter Configuration var autoFormatWikimediaLinks   = true;  // Format localized hyperlink syntax var autoFormatLocalisation     = true;  // Format deprecated keywords and syntaxes var autoFormatMaskedLinks      = false; // Format masked hyperlinked text var autoFormatShortYearRanges  = true;  // Format year ranges

// CacheCheck Configuration /* Add between the brackets the pages this script does not activate on. */ window.cacheSkip = [];

/* The number of links it will check and cross out before going no futher. */ window.cacheSkipLimit = 1E3;

/* I'm not entirely sure what this does, so I left it blank. */ window.topLevelCat = "";

// Fast Delete Configuration var fdButtons = [];          /*  Delete Summaries --- */ /* Button Labels */ fdButtons[fdButtons.length] = {"summary" : "spam",          "label" : "S"     }; fdButtons[fdButtons.length] = {"summary" : "Broken file",                   "label" : "B"     }; fdButtons[fdButtons.length] = {"summary" : "Duplicate",                     "label" : "D"     }; fdButtons[fdButtons.length] = {"summary" : "Housekeeping",                  "label" : "HK"    }; fdButtons[fdButtons.length] = {"summary" : "Cleanup",                       "label" : "C"     }; fdButtons[fdButtons.length] = {"summary" : "Unused",                        "label" : "U"     }; fdButtons[fdButtons.length] = {"summary" : "Unofficial/Irrelevant",         "label" : "UI"    }; fdButtons[fdButtons.length] = {"summary" : "ToU", "label" : "ToU"   };

// Global Navbar Configuration window.globalLinks = { global: { "User"    : "Special:Mypage", "Talk"    : "Special:Mytalk", "Contribs" : "Special:MyContributions", "Admins"  : "Special:ListAdmins", "Activity" : "Special:RecentChanges?hidepatrolled=0&days=99999&hidebots=", "DiscFeed" : "Special:DiscussionsActivity", "Maintain" : "Special:Maintenance", "Chat"    : "Special:Chat", "Purge"   : "%page%?action=purge", "Mobile"  : "%page%?useskin=mercury&mobile-app=true", "Raw"     : "%page%?action=raw", "Help"    : "Help:Index", "Contact" : "Special:Contact" }, community: { "JS"         : "Special:Mypage/global.js", "CSS"        : "Special:Mypage/global.css" } };

// PageCreator Configuration /* List namespace IDs script activates on */ window.pageCreatorNamespaces = Object.keys(mw.config.get("wgFormattedNamespaces")).map(Number);

/* Display avatar */ window.pageCreatorAvatar = true;

/* Display time of creation */ window.pageCreatorTimestamp = true;

/* Change local time to GMT */ window.pageCreatorUTC = false;

/* LastEdited Configuration */ window.lastEdited = { namespaces : { include : Object.keys(mw.config.get("wgFormattedNamespaces")).map(Number) } };

// QuickCreate Series

/* User Page */ var qtUserPageTemplate                  = ''; var qtEnableUserPageOverwrite           = true;

/* Message Wall Greeting */ var qtMessageWallGreetingTemplate       = ''; var qtEnableMessageWallGreetingOverwrite = true;

// RailWAM Configuration window.railWAM = { // This creates the WAM Log page under my user namespace. logPage:"User:Cheeseskates/WAM Log" };

// WHAM Configuration /* WHAM bots me by default */ WHAMBotMe = true;

/* Default reason */ WHAMBotReason = "Cleanup";

/* Ticks equaling 0.1 seconds. 1,000 ticks = 1 second */ WHAMDelay = 100;

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

/// // ——————————————————————— 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 */ //---

// Advisor - Helps with editing suggestions such as whitespace removal, headings nest, etc. importScriptURI("https://en.wikipedia.org/w/index.php?title=User:Cameltrader/Advisor.js&action=raw&ctype=text/javascript");

// AutoFormatter - Formats a page automatically to fix common mistakes in wiki-markup importScriptURI("https://de.wikipedia.org/w/index.php?title=Benutzer:TMg/autoFormatter.js&action=raw&ctype=text/javascript");

// AutoLink - Parses wikilinks, [external links], {templates}, and URLs into clickable links importScriptURI("https://en.wikipedia.org/w/index.php?title=User:Lenore/autolink.js&action=raw&ctype=text/javascript");

// wikEdDiff - Improved diff view between article versions importScriptURI("https://en.wikipedia.org/w/index.php?title=User:Cacycle/wikEdDiff.js&action=raw&ctype=text/javascript");

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

$(function { importArticles({ type: "script", articles: [ "u:dev:MediaWiki:AjaxCommentDelete/code.js",                 // w:c:dev:MediaWiki:AjaxCommentDelete/code.js "u:dev:MediaWiki:AjaxDelete/code.js",                        // w:c:dev:AjaxDelete "u:dev:MediaWiki:AjaxPatrol/code.js",                        // w:c:dev:AjaxPatrol "u:dev:MediaWiki:AjaxRC/code.js",                            // w:c:dev:AjaxRC "u:dev:MediaWiki:AjaxThreadDelete/code.js",                  // w:c:dev:MediaWiki:AjaxThreadDelete/code.js "u:dev:MediaWiki:AntiUnicruft/code.js",                      // w:c:dev:AntiUnicruft "u:dev:MediaWiki:CacheCheck/code.js",                        // w:c:dev:CacheCheck "u:dev:MediaWiki:ChainQuotes.js",                            // w:c:dev:ChainQuotes "u:dev:MediaWiki:CatFilter/code.js",                         // w:c:dev:CatFilter "u:dev:MediaWiki:CategoryRenameAuto-update/code.js",         // w:c:dev:CategoryRenameAuto-update "u:dev:MediaWiki:DiscussionsActivity.js",                    // w:c:dev:DiscussionsActivity "u:dev:MediaWiki:DisplayTimer/code.js",                      // w:c:dev:DisplayTimer "u:dev:MediaWiki:DupImageList/code.js",                      // w:c:dev:DupImageList "u:dev:MediaWiki:EditConflictAlert/code.js",                 // w:c:dev:EditConflictAlert "u:dev:MediaWiki:FastDelete/code.js",                        // w:c:dev:FastDelete "u:dev:MediaWiki:FastOldImageDelete/code.js",                // w:c:dev:FastOldImageDelete "u:dev:MediaWiki:FindAndReplace/code.js",                    // w:c:dev:FindAndReplace "u:dev:MediaWiki:FileUsageAuto-update/code.js",              // w:c:dev:FileUsageAuto-update "u:dev:MediaWiki:LastEdited/code.js",                        // w:c:dev:LastEdited "u:dev:MediaWiki:LinkThumb.js",                              // w:c:dev:LinkThumb "u:dev:MediaWiki:ListFiles/code.js",                         // w:c:dev:ListFiles "u:dev:MediaWiki:MarkBlocked.js",                            // w:c:dev:MarkBlocked "u:dev:MediaWiki:MarkForDeletion/code.js",                   // w:c:dev:MarkForDeletion "u:dev:MediaWiki:MassCategorization/code.js",                // w:c:dev:MassCategorization "u:dev:MediaWiki:MassPatrol/code.js",                        // w:c:dev:MassPatrol "u:dev:MediaWiki:MassRenameRevert/code.js",                  // w:c:dev:MassRenameRevert "u:dev:MediaWiki:MastheadGender/code.js",                    // w:c:dev:MediaWiki:MastheadGender/code.js "u:dev:MediaWiki:MisspelledPage/code.js",                    // w:c:dev:MisspelledPage "u:dev:MediaWiki:MultipleFileDelete/code.js",                // w:c:dev:MultipleFileDelete "u:dev:MediaWiki:PageCreator/code2.js",                      // w:c:dev:PageCreator "u:dev:MediaWiki:PageRenameAuto-update/code.js",             // w:c:dev:PageRenameAuto-update "u:dev:MediaWiki:PortableCSSPad/code.js",                    // w:c:dev:PortableCSSPad "u:dev:MediaWiki:PowerDelete.js",                            // w:c:dev:PowerDelete "u:dev:MediaWiki:ProtectedHighlight/code.js",                // w:c:dev:ProtectedHighlight "u:dev:MediaWiki:QQX/code.js",                               // w:c:dev:QQX "u:dev:MediaWiki:QuickCreateUserPage/code.js",               // w:c:dev:QuickCreateUserPage "u:dev:MediaWiki:QuickCreateMessageWallGreeting/code.js",    // w:c:dev:QuickCreateMessageWallGreeting "u:dev:MediaWiki:QuickDiff/code.js",                         // w:c:dev:QuickDiff "u:dev:MediaWiki:RailWAM/code.js",                           // w:c:dev:RailWAM "u:dev:MediaWiki:ReaderMode/code.js",                        // w:c:dev:ReaderMode "u:dev:MediaWiki:ReferencePopups/code.js",                   // w:c:dev:ReferencePopups "u:dev:MediaWiki:RefreshThreads/code.js",                    // w:c:dev:RefreshThreads "u:dev:MediaWiki:RevealAnonIP/code.js",                      // w:c:dev:RevealAnonIP "u:dev:MediaWiki:ShowUserGroups.js",                         // w:c:dev:ShowUserGroups "u:dev:MediaWiki:StickySummary.js",                          // w:c:dev:StickySummary "u:dev:MediaWiki:Thread Inspection/code.js",                 // w:c:dev:Thread Inspection "u:dev:MediaWiki:UnhideUserMasthead/code.js",                // w:c:dev:UnhideUserMasthead "u:dev:MediaWiki:UnsafeScripts/code.js",                     // w:c:dev:UnsafeScripts "u:dev:MediaWiki:UserAccountAge/code2.js",                   // w:c:dev:UserAccountAge "u:dev:MediaWiki:UserActivityTab/code.js",                   // w:c:dev:UserActivityTab "u:dev:MediaWiki:UserRightsRecord/code.js",                  // w:c:dev:UserRightsRecordp "u:dev:MediaWiki:ViewDeleted/code.js",                       // w:c:dev:ViewDeleted "u:dev:MediaWiki:ViewRemoved/code.js",                       // w:c:dev:ViewRemoved "u:dev:MediaWiki:VSTFReport.js",                             // w:c:dev:VSTFReport "u:dev:MediaWiki:WHAM/code.2.js",                            // w:c:dev:WHAM "u:dev:MediaWiki:WorkingMoreUsersCount.js",                  // w:c:dev:WorkingMoreUsersCount "u:dev:MediaWiki:YouTubeModal/code.js",                      // w:c:dev:YouTubeModal "u:admintools:MediaWiki:Common.js/ajaxRollback.js",          // w:c:admintools:MediaWiki:Common.js/ajaxRollback.js "u:admintools:MediaWiki:Common.js/extraRollbacks.js",        // w:c:admintools:MediaWiki:Common.js/extraRollbacks.js "u:josephhawk:User:Josephyr/categorycleanup.js",             // w:c:josephhawk:User:Josephyr/categorycleanup.js "u:josephhawk:User:Josephyr/FastActions.js",                 // w:c:josephhawk:User:Josephyr/FastActions.js "u:josephhawk:User:Josephyr/filecleanup.js",                 // w:c:josephhawk:User:Josephyr/filecleanup.js "u:josephhawk:User:Josephyr/linksweeper.js",                 // w:c:josephhawk:User:Josephyr/linksweeper.js "u:josephhawk:User:Josephyr/redirects.js",                   // w:c:josephhawk:User:Josephyr/redirects.js "u:josephhawk:User:Josephyr/tc.js",                          // w:c:josephhawk:User:Josephyr/tc.js "u:kocka:MediaWiki:GlobalNavModifications.js",               // w:c:kocka:MediaWiki:GlobalNavModifications.js "u:kocka:User:KockaAdmiralac/LinkModifications.javascript",  // w:c:kocka:User:KockaAdmiralac/LinkModifications.javascript "u:noreply:MediaWiki:HideWikiaLogs.js",                      // w:c:noreply:MediaWiki:HideWikiaLogs.js "u:noreply:MediaWiki:FileUsage.js",                          // w:c:noreply:MediaWiki:FileUsage.js "u:undertale:User:Cheeseskates/C-WRB.javascript",            // User:Ditto Creeper Bot "u:undertale:User:Cheeseskates/HC.javascript",               // https://commons.wikimedia.org/w/index.php?title=MediaWiki:Gadget-HotCat.js&action=raw&ctype=text%2Fjavascript "u:undertale:User:Cheeseskates/ME.javascript",               // w:c:dev:MassEdit "u:undertale:User:Cheeseskates/MFD.javascript",              // w:c:dev:MultipleFileDelete "u:undertale:User:Cheeseskates/RB.javascript",               // w:c:dev:Rollback ] }); });

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

/// // —————————————————— End ImportArticles section and page ——————————————————— / ///

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