MediaWiki:Cosmos.js

/* All JavaScript here will be loaded for users of the Cosmos skin */ $(function{ if(window.JSloaded){ return; }

$( "#discord-widget" ).html(' ');

window.JSloaded = true; if(mw.config.get('wgCanonicalSpecialPageName') == 'UpdateProfile'){ $('.page-Special_UpdateProfile div.profile-update:nth-of-type(1) > .profile-update-title').append('    Edit Bio'); }

mw.config.set({'wgAjaxLicensePreview' : true}); if(mw.config.get('wgCanonicalSpecialPageName') == "AdminLinks" ){ $('#mw-content-text').html($('#mw-content-text').html.replace(/·/g, '•')); $('a[href*="MediaWiki:Sidebar"]').replaceWith('Edit JavaScript file'); } if(mw.config.get('wgCanonicalSpecialPageName') == "AdminLinks" && !mw.config.get('wgUserGroups').includes('sysop')){ $('#firstHeading').html('Permission error'); $('title').html('Permission error - ' + mw.config.get("wgSiteName")); $('#mw-content-text').html(' You do not have permission to view admin links, for the following reason: You are not allowed to execute the action you have requested. '); }

if((mw.config.get("wgNamespaceNumber") == 2 || mw.config.get("wgNamespaceNumber") == 202) && $('#profile-top').length > 0 && mw.config.get("wgAction") == "view"){ if(!$('body').hasClass('mw-wiki-user-page') && !$('body').hasClass('mw-social-profile-page')){ $('body').addClass('mw-social-profile-page'); }

if(mw.config.get("wgPageName").replace('User_profile:', 'User:') == "User:TheDemon08"){ $('.hgroup').append(' Founder '); $('.hgroup').append('Team Lead: Titans '); }else if(mw.config.get("wgPageName").replace('User_profile:', 'User:') == "User:Universal_Omega"){ $('.hgroup').append('Team Lead: Stargirl '); }else if(mw.config.get("wgPageName").replace('User_profile:', 'User:') == "User:Zomlouis"){ $('.hgroup').append('Team Lead: The Flash (1990) '); }else if(mw.config.get("wgPageName").replace('User_profile:', 'User:') == "User:IC228"){ $('.hgroup').append('Team Lead: The Flash (2014) '); }else if(mw.config.get("wgPageName").replace('User_profile:', 'User:') == "User:Rman41"){ $('.hgroup').append('Team Lead: Superman Anthology '); } }

$.urlParam = function (name) { var results = new RegExp("[?&]" + name + "=([^&#]*)").exec(     window.location.href    ); if (results == null) { return null; }   return decodeURI(results[1]) || 0; }; $.extend({    _urlVars: null,    getUrlVars: function  {      if ($._urlVars === null) {        var i,          j,          hash,          hashes = window.location.search            .slice(window.location.search.indexOf("?") + 1)            .split("&");        $._urlVars = {};        for (i = 0, j = hashes.length; i < j; i++) {          hash = hashes[i].split("=");          $._urlVars[hash[0]] = hash[1];        }      }      return $._urlVars;    },    getUrlVar: function (name) {      return $.getUrlVars[name];    },  }); window.getElementsByClassName = function (oElm, strTagName, oClassNames) { var arrReturnElements = []; if (!oElm) { return arrReturnElements; }   if (typeof oElm.getElementsByClassName == "function") { var arrNativeReturn = oElm.getElementsByClassName(oClassNames); if (strTagName == "*") { return arrNativeReturn; }     for (var h = 0; h < arrNativeReturn.length; h++) { if (         arrNativeReturn[h].tagName.toLowerCase == strTagName.toLowerCase        ) { arrReturnElements[arrReturnElements.length] = arrNativeReturn[h]; }     }      return arrReturnElements; }   var arrElements = strTagName == "*" && oElm.all ? oElm.all : oElm.getElementsByTagName(strTagName); var arrRegExpClassNames = []; if (typeof oClassNames == "object") { for (var i = 0; i < oClassNames.length; i++) { arrRegExpClassNames[arrRegExpClassNames.length] = new RegExp(         "(^|\\s)" + oClassNames[i].replace(/\-/g, "\\-") + "(\\s|$)"        ); }   } else { arrRegExpClassNames[arrRegExpClassNames.length] = new RegExp(       "(^|\\s)" + oClassNames.replace(/\-/g, "\\-") + "(\\s|$)"      ); }   var oElement; var bMatchesAll; for (var j = 0; j < arrElements.length; j++) { oElement = arrElements[j]; bMatchesAll = !0; for (var k = 0; k < arrRegExpClassNames.length; k++) { if (!arrRegExpClassNames[k].test(oElement.className)) { bMatchesAll = !1; break; }     }      if (bMatchesAll) { arrReturnElements[arrReturnElements.length] = oElement; }   }    return arrReturnElements; }; mw.hook( 've.saveDialog.stateChanged' ).add( function { mw.loader.load('/w/index.php?title=MediaWiki:Standard Edit Summaries.js&action=raw&ctype=text/javascript'); }); mw.hook( 've.activationComplete' ).add( function {    $('.ve-activated .firstHeading').html($('title').html.replace(' - ' + mw.config.get("wgSiteName"), '')); var surface = ve.init.target.getSurface; });

window.category = ["Candidates for deletion", "Unused images"]; window.reason = "Housekeeping"; window.quickDeleteDelay = "800";

window.fdButtons = [ {     summary: "Housekeeping", label: "Housekeeping", },   {      summary: "Vandalism", label: "Vandalism", },   {      summary: "Spam", label: "Spam", },   {      summary: "Low quality article; not really needed like this. ", label: "Low Quality", },   {      summary: "Copyright Violation", label: "Copyright", },   {      summary: "Marked for Deletion", label: "Marked for Deletion", }, ];

mw.loader.using(["mediawiki.jqueryMsg", "mediawiki.api"], function { if ( ( mw.config.get("wgUserGroups").includes("autoconfirmed") ||   mw.config.get("wgUserGroups").includes("confirmed") === true ) && mw.config.get('wgCanonicalSpecialPageName') == 'MultiUpload' ) { $.when(mw.loader.using(["mediawiki.api"])).then(function  { return new mw.Api .get({       action: "query",        meta: "siteinfo",        siprop: "fileextensions",        format: "json",      }) .then(function (data) { var extensions = data.query.fileextensions,		e; var FileExtensions = [];	for ( e in extensions ) {     FileExtensions.push(extensions[e].ext);

} mw.config.set({'wgFileExtensions' :FileExtensions});

mw.loader.load('/w/index.php?title=MediaWiki:MultiUpload.js&action=raw&ctype=text/javascript'); }); }); }

// Have categories added to images from upload description if (mw.config.get("wgCanonicalSpecialPageName") === "Upload") { if (!$.getUrlVar("wpForReUpload")) jQuery(function ($) {       "use strict";        var $desc = $("#wpUploadDescription");        if ($desc.val) {          return; // If not empty then don't do anything (i.e. error message confirm page)        }

var params = { action: "parse", page: "Template:Default Upload Summary", format: "json", prop: "wikitext", };       var api = new mw.Api;

api.get(params).done(function (data) {         return $desc.val(data.parse.wikitext["*"]);        });

if (window.location.href.indexOf("wpForReUpload") > -1) { return; } else { function verifyLicense { if (!$("#wpLicense").val) { window.alert("Licensing must be complete."); return false; }         }          $desc.closest("form").submit(verifyLicense); }     });  }          if (mw.config.get("wgArticleId") == 0) {            if ( mw.config.get("wgNamespaceNumber") == 0 && ($.urlParam("action") == "edit" ||               $.urlParam("veaction") == "edit" ||                $.urlParam("veaction") == "editsource") ) {             var ParseParams = {                action: "parse",                page: "Template:AutoNewPageButtons",                format: "json",              };              var ParseAPI = new mw.Api;

ParseAPI.get(ParseParams).done(function (data) {               $(".firstHeading").before(data.parse.text["*"]);                $(".AutoNewPageButtons").replaceWith( " " +                   $(".AutoNewPageButtons") .html .replace(                       /Template:AutoNewPageButtons/g,                        mw.config.get("wgPageName")                      ) );               $('a[href*="&preload="]').attr("target", "_self");              }); }         } else { return; }     });  //Custom page styles based on shows  //There is nothing in MediaWiki:Series Themes.css that could possibly violate tos as I have been accused of. There is nothing there that hides anything, certantly not ads! If there is, I am sorry, it will be fixed, but at least re-approve everything.  //Ads show for me even with these styles on. I do not know what you mean by they are hidden by it, so I am resubmitting this.

//Batman: Classic TV Series if ($("aside").hasClass("pi-theme-Batman_-Classic-TV-Series")) { $(document.body).addClass("Batman-Classic-TV-Series-Article"); } //The Green Hornet if ($("aside").hasClass("pi-theme-The-Green-Hornet")) { $(document.body).addClass("The-Green-Hornet-Article"); } //The Flash (1990) if ($("aside").hasClass("pi-theme-The-Flash-_1990")) { $(document.body).addClass("The-Flash-1990-Article"); } //Birds of Prey if ($("aside").hasClass("pi-theme-Birds-of-Prey")) { $(document.body).addClass("Birds-of-Prey-Article"); } //Smallville if ($("aside").hasClass("pi-theme-Smallville")) { $(document.body).addClass("Smallville-Article"); } //Arrow if ($("aside").hasClass("pi-theme-Arrow")) { $(document.body).addClass("Arrow-Article"); } //Arrow - Blood Rush if ($("aside").hasClass("pi-theme-Blood-Rush")) { $(document.body).addClass("Arrow-Article"); } //Arrow - Year One if ($("aside").hasClass("pi-theme-Year-One")) { $(document.body).addClass("Arrow-Article"); } //Arrow - Arrow: Hitting the Bullseye if ($("aside").hasClass("pi-theme-Arrow_-Hitting-the-Bullseye")) { $(document.body).addClass("Arrow-Article"); } //The Flash (2014) if ($("aside").hasClass("pi-theme-The-Flash-_2014")) { $(document.body).addClass("The-Flash-2014-Article"); } //The Flash (2014) - Stretched Scene if ($("aside").hasClass("pi-theme-Stretched-Scene")) { $(document.body).addClass("The-Flash-2014-Article"); } //The Flash (2014) - Chronicles of Cisco if ($("aside").hasClass("pi-theme-Chronicles-of-Cisco")) { $(document.body).addClass("The-Flash-2014-Article"); } //The Flash (2014) - Chasing Lightning if ($("aside").hasClass("pi-theme-Chasing-Lightning")) { $(document.body).addClass("The-Flash-2014-Article"); } //Constantine if ($("aside").hasClass("pi-theme-Constantine")) { $(document.body).addClass("Constantine-Article"); } //Constantine - John Con Noir if ($("aside").hasClass("pi-theme-John-Con-Noir")) { $(document.body).addClass("Constantine-Article"); } //Constantine - Constantine: The Legend Continues if ($("aside").hasClass("pi-theme-Constantine_-The-Legend-Continues")) { $(document.body).addClass("Constantine-Article"); } //Vixen if ($("aside").hasClass("pi-theme-Vixen")) { $(document.body).addClass("Vixen-Article"); } //Vixen: The Movie if ($("aside").hasClass("pi-theme-Vixen_-The-Movie")) { $(document.body).addClass("Vixen-Article"); } //Supergirl if ($("aside").hasClass("pi-theme-Supergirl")) { $(document.body).addClass("Supergirl-Article"); } //DC's Legends of Tomorrow if ($("aside").hasClass("pi-theme-DC_s-Legends-of-Tomorrow")) { $(document.body).addClass("Legends-of-Tomorrow-Article"); } //Mr. Parker's Cul-De-Sac if ($("aside").hasClass("pi-theme-Mr_-Parker_s-Cul-De-Sac")) { $(document.body).addClass("Mr-Parkers-Cul-De-Sac-Article"); } //DC's Legends of Tomorrow - DC's Legends of Tomorrow: Their Time Is Now if (   $("aside").hasClass("pi-theme-DC_s-Legends-of-Tomorrow_-Their-Time-Is-Now")  ) { $(document.body).addClass("Legends-of-Tomorrow-Article"); } //Lucifer if ($("aside").hasClass("pi-theme-Lucifer")) { $(document.body).addClass("Lucifer-Article"); } //Freedom Fighters: The Ray if ($("aside").hasClass("pi-theme-Freedom-Fighters_-The-Ray")) { $(document.body).addClass("Freedom-Fighters_-The-Ray-Article"); } //Freedom Fighters: The Ray (Movie) if ($("aside").hasClass("pi-theme-Freedom-Fighters_-The-Ray-_Movie")) { $(document.body).addClass("Freedom-Fighters-The-Ray-Article"); } //Black Lightning if ($("aside").hasClass("pi-theme-Black-Lightning")) { $(document.body).addClass("Black-Lightning-Article"); } //Titans if ($("aside").hasClass("pi-theme-Titans")) { $(document.body).addClass("Titans-Article"); } //Swamp Thing if ($("aside").hasClass("pi-theme-Swamp-Thing")) { $(document.body).addClass("Swamp-Thing-Article"); } //Doom Patrol if ($("aside").hasClass("pi-theme-Doom-Patrol")) { $(document.body).addClass("Doom-Patrol-Article"); } //Batwoman if ($("aside").hasClass("pi-theme-Batwoman")) { $(document.body).addClass("Batwoman-Article"); } //Stargirl if ($("aside").hasClass("pi-theme-Stargirl")) { $(document.body).addClass("Stargirl-Article"); } //Stargirl - Stargirl Aftershow if ($("aside").hasClass("pi-theme-Stargirl-Aftershow")) { $(document.body).addClass("Stargirl-Article"); } //Superman & Lois if ($("aside").hasClass("pi-theme-Superman-_-Lois")) { $(document.body).addClass("Superman-and-Lois-Article"); } //Green Arrow and the Canaries if ($("aside").hasClass("pi-theme-Green-Arrow-and-the-Canaries")) { $(document.body).addClass("Green-Arrow-and-the-Canaries-Article"); } //Green Lantern if ($("aside").hasClass("pi-theme-Green-Lantern")) { $(document.body).addClass("Green-Lantern-Article"); } //Superman: The Motion Picture Anthology if ($("aside").hasClass("pi-theme-Superman_-The-Motion-Picture-Anthology")) { $(document.body).addClass("Superman-The-Motion-Picture-Anthology-Article"); } //Batman: The Motion Picture Anthology if ($("aside").hasClass("pi-theme-Batman_-The-Motion-Picture-Anthology")) { $(document.body).addClass("Batman-The-Motion-Picture-Anthology-Article"); } //Arrowverse if ($("aside").hasClass("pi-theme-Arrowverse")) { $(document.body).addClass("Arrowverse-Article"); } //Arrowverse - Crisis Aftermath if ($("aside").hasClass("pi-theme-Crisis-Aftermath")) { $(document.body).addClass("Arrowverse-Article"); } //DC Extended Universe if ($("aside").hasClass("pi-theme-DC-Extended-Universe")) { $(document.body).addClass("DC-Extended-Universe-Article"); } //DC Extended Universe - DC Films Presents: The Dawn of the Justice League if (   $("aside").hasClass( "pi-theme-DC-Films-Presents_-The-Dawn-of-the-Justice-League" ) ) {    $(document.body).addClass("DC-Extended-Universe-Article"); } //Default (to prevent the other background from loading first) $(document.body).addClass( "DC-Multiverse-Wiki-Body" ); });

mw.loader.load( '/w/index.php?title=MediaWiki:FastDelete.js&action=raw&ctype=text/javascript' ); if($('#profile-top').length > 0 === false){ mw.loader.load( '/w/index.php?title=MediaWiki:PageRenameAuto-Update.js&action=raw&ctype=text/javascript' ); } mw.loader.load( '/w/index.php?title=MediaWiki:CategoryRenameAuto-Update.js&action=raw&ctype=text/javascript' ); // mw.loader.load( '/w/index.php?title=MediaWiki:EditConflictAlert.js&action=raw&ctype=text/javascript' ); mw.loader.load( '/w/index.php?title=MediaWiki:AjaxUndo.js&action=raw&ctype=text/javascript' ); // mw.loader.load( '/w/index.php?title=MediaWiki:MisspelledPage.js&action=raw&ctype=text/javascript' ); mw.loader.load( '/w/index.php?title=MediaWiki:AddCategories.js&action=raw&ctype=text/javascript' ); mw.loader.load( '/w/index.php?title=MediaWiki:AjaxEdit.js&action=raw&ctype=text/javascript' ); /*mw.loader.load( '/w/index.php?title=MediaWiki:AjaxRC.js&action=raw&ctype=text/javascript' ); mw.loader.load( '/w/index.php?title=MediaWiki:MassEdit.js&action=raw&ctype=text/javascript' ); mw.loader.load( '/w/index.php?title=MediaWiki:MassProtect.js&action=raw&ctype=text/javascript' ); mw.loader.load( '/w/index.php?title=MediaWiki:MassDelete.js&action=raw&ctype=text/javascript' );*/ mw.loader.load( '/w/index.php?title=MediaWiki:QuickDelete.js&action=raw&ctype=text/javascript' );

// ***************************************************** // * Experimental javascript countdown timer (Splarka) * // * Version 0.0.3                                    * // ***************************************************** //  // Usage example: //   //  Only January 01 2007 00:00:00 PST until New years. //   //  Javascript disabled.

function updatetimer(i) { var now = new Date; var then = timers[i].eventdate; var diff = (count = Math.floor((then.getTime - now.getTime) / 1000)); // catch bad date strings if (isNaN(diff)) { timers[i].firstChild.nodeValue = "** " + timers[i].eventdate + " **"; return; }

// determine plus/minus if (diff < 0) { diff = -diff; var tpm = ""; } else { var tpm = ""; }   // calculate the diff

if (diff % 60 == 1) { var left = (diff % 60) + " second "; } else { left = (diff % 60) + " seconds "; }   diff = Math.floor(diff / 60); if (diff % 60 == 1) { left = (diff % 60) + " minute " + left; } else { if (diff > 0) left = (diff % 60) + " minutes " + left; }

diff = Math.floor(diff / 60); if (diff % 24 == 1) { left = (diff % 24) + " hour " + left; } else { if (diff > 0) left = (diff % 24) + " hours " + left; }   diff = Math.floor(diff / 24); if (diff == 1) { left = diff + " day " + left; } else { if (diff > 0) left = diff + " days " + left; }   timers[i].firstChild.nodeValue = tpm + left; // a setInterval is more efficient, but calling setTimeout // makes errors break the script rather than infinitely recurse timeouts[i] = setTimeout("updatetimer(" + i + ")", 1000); }

function checktimers { //hide 'nocountdown' and show 'countdown' var nocountdowns = getElementsByClassName(document, "span", "nocountdown"); for (var i in nocountdowns) nocountdowns[i].style.display = "none";

var countdowns = getElementsByClassName(document, "span", "countdown"); for (var i in countdowns) countdowns[i].style.display = "inline";

//set up global objects timers and timeouts. timers = getElementsByClassName(document, "span", "countdowndate"); //global timeouts = new Array; // generic holder for the timeouts, global if (timers.length == 0) return; for (var i in timers) { timers[i].eventdate = new Date(timers[i].firstChild.nodeValue); updatetimer(i); //start it up   } } $(checktimers);