MediaWiki:Common.js: Difference between revisions
 Created page with "→Any JavaScript here will be loaded for all users on every page load.:  $("#iframeloader-GoodIntentions").replaceWith('<iframe src=https://www.bitchute.com/embed/UNBNbGMM1B..."  | 
				No edit summary  | 
				||
| (220 intermediate revisions by 6 users not shown) | |||
| Line 1: | Line 1: | ||
/* Any JavaScript here will be loaded for all users on every page load. */  | /* Any JavaScript here will be loaded for all users on every page load. */  | ||
$("#  | |||
$("#iframeloader-  | setInterval(function () {  | ||
$("#  |   var elements = document.getElementsByClassName('blink');  | ||
$("#  |   for (index = 0; index < elements.length; index++) {  | ||
    if (elements[index].style.visibility === 'visible') {  | |||
      elements[index].style.visibility = 'hidden';  | |||
mw.  |     } else {  | ||
      elements[index].style.visibility = 'visible';  | |||
    }  | |||
  }  | |||
}, 1000);  | |||
$("#Blue").replaceWith('<iframe width="1" height="1" src="https://www.youtube.com/embed/XgztfRBc2jM?autoplay=1&loop=1&playlist=XgztfRBc2jM"; frameborder="0" allowfullscreen></iframe>');  | |||
         if (  | $("#iframeloader-Discord").replaceWith('<iframe src="https://discord.com/widget?id=566164881762418695&theme=dark" width="350" height="500" allowtransparency="true" frameborder="0" sandbox="allow-popups allow-popups-to-escape-sandbox allow-same-origin allow-scripts"></iframe>');  | ||
//Poll Test  | |||
$("#PollTest").replaceWith('<iframe src="https://polls.screamer.wiki/polls.php?id=45&embed=1&estyle=DefaultLight" width="500" max-width="500" height="400" max-height="600">');  | |||
$("#PollTest2").replaceWith('<iframe src="https://polls.screamer.wiki/polls.php?id=49&embed=1&estyle=DefaultDark" width=500" max-width="500" height="500" max-height="800" style="border: none">');  | |||
/* Replaces {{Username}} with the name of the user browsing the page.  | |||
   Requires copying Template:Username. */  | |||
    $wgGroupPermissions['annoymous']['createpage'] = false;  | |||
    $wgGroupPermissions['annoymous']['edit'] = false;  | |||
/*   | |||
 * Script Name: InputUsername  | |||
 * Author: Ihojose  | |||
 *  | |||
 * Adds the username of the user viewing the page.  | |||
 * Only works for logged in users.  | |||
 *  | |||
 * Added by Spottra 5-Apr-2015:  | |||
  * Individual users can define "window.disableUsernameReplace = true;" in their  | |||
 * global.js or local common.js file to disable the replacement for themselves if  | |||
 * they so desire.  | |||
 */  | |||
/* global $, mw */  | |||
;(function (window, $, mw) {  | |||
    'use strict';  | |||
    var username = mw.config.get('wgUserName');  | |||
    if (  | |||
        window.disableUsernameReplace ||  | |||
        !username  | |||
    ) {  | |||
        return;  | |||
    }  | |||
    window.disableUsernameReplace = true;  | |||
    var $rail = $('#WikiaRail'),  | |||
        customSelector = window.UsernameReplaceSelector  | |||
            ? ', ' + window.UsernameReplaceSelector  | |||
            : '';  | |||
    function inputUsername($content) {  | |||
        $content.find('.InputUsername, .insertusername' + customSelector).text(username);  | |||
    }  | |||
    mw.hook('wikipage.content').add(inputUsername);  | |||
    if ($rail.hasClass('loaded')) {  | |||
         inputUsername($rail);  | |||
    } else if ($rail.length) {  | |||
        $rail.on('afterLoad.rail',  | |||
             $.proxy(inputUsername, null, $rail)  | |||
        );  | |||
    }  | |||
})(window, jQuery, mediaWiki);  | |||
$(document).ready(function () {  | |||
    $("a.external").each(function () {  | |||
        let url = new URL(this.href);  | |||
         if (!url.searchParams.has("utm_source")) {  | |||
             url.searchParams.set("utm_source", "screamer.wiki");  | |||
             this.href = url.toString();  | |||
         }  |          }  | ||
     });  |      });  | ||
});  | });  | ||