Permanently protected page

MediaWiki:Common.js: Difference between revisions

From Screamer Wiki
Jump to navigation Jump to search
imported>UncoveredAgent200
No edit summary
No edit summary
 
(235 intermediate revisions by 10 users not shown)
Line 1: Line 1:
/* We are to warn our viewers about any possible shocks that may come from this Wiki. */
/* Any JavaScript here will be loaded for all users on every page load. */
function getCookie(c_name) {
 
    var c_value = ' ' + document.cookie;
setInterval(function () {
    var c_start = c_value.indexOf(' ' + c_name + '=');
  var elements = document.getElementsByClassName('blink');
     if (c_start == -1) {
  for (index = 0; index < elements.length; index++) {
        c_value = null;
     if (elements[index].style.visibility === 'visible') {
      elements[index].style.visibility = 'hidden';
     } else {
     } else {
        c_start = c_value.indexOf('=', c_start) + 1;
      elements[index].style.visibility = 'visible';
        var c_end = c_value.indexOf(';', c_start);
        if (c_end == -1) {
            c_end = c_value.length;
        }
        c_value = unescape(c_value.substring(c_start, c_end));
     }
     }
    return c_value;
  }
}
}, 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>');
$("#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">');


function setCookie(cname, cvalue, exdays) {
/* Replaces {{Username}} with the name of the user browsing the page.
    var d = new Date();
  Requires copying Template:Username. */
    d.setTime(d.getTime() + (exdays * 24 * 60 * 60 * 1000));
    var expires = 'expires=' + d.toUTCString();
    document.cookie = cname + '=' + cvalue + '; ' + expires;
}
/* In no way are we using this to steal accounts. We are using this for per-PC verification. */


var msg = 'This Wiki may contain grotesque/horrifying images, screamers and epilepsy-inducing flashing lights. By clicking "Agree", you agree that you are alright with this. If you feel uncomfortable with this, clicking "Disagree" will direct you to Wikia\'s homepage.';
    $wgGroupPermissions['annoymous']['createpage'] = false;
var cookiename = 'DiscretionVerification';
     $wgGroupPermissions['annoymous']['edit'] = false;
if (getCookie(cookiename) === null) {
 
     var WikiaPage = document.getElementById('WikiaMainContent');
 
    var MonobookPage = document.getElementById('bodyContent');
/*
   
* Script Name: InputUsername
    if (WikiaPage !== null) {
* Author: Ihojose
        WikiaPage.innerHTML = '';
*
        var Header = document.createElement('h2');
* Adds the username of the user viewing the page.
        Header.innerHTML = 'Before you visit this wiki...';
* Only works for logged in users.
        WikiaPage.appendChild(Header);
*
        var Content = document.createElement('div');
* Added by Spottra 5-Apr-2015:
        Content.innerHTML = msg;
* Individual users can define "window.disableUsernameReplace = true;" in their
        WikiaPage.appendChild(Content);
* global.js or local common.js file to disable the replacement for themselves if
        var AgreeButton = document.createElement('button');
* they so desire.
        AgreeButton.className = 'wikia-button';
*/
        AgreeButton.innerHTML = 'Agree';
 
        WikiaPage.appendChild(AgreeButton);
/* global $, mw */
        var DisagreeButton = document.createElement('button');
;(function (window, $, mw) {
        DisagreeButton.className = 'wikia-menu-button secondary';
    'use strict';
        DisagreeButton.innerHTML = 'Disagree';
    var username = mw.config.get('wgUserName');
        WikiaPage.appendChild(DisagreeButton);
    if (
        AgreeButton.onclick = function() {
         window.disableUsernameReplace ||
            setCookie(cookiename, 'true', 365);
         !username
            location.reload();
    ) {
         };
         return;
         DisagreeButton.onclick = function() {
            window.location.href = 'http://wikia.com';
         };
     }
     }
      
     window.disableUsernameReplace = true;
    if (MonobookPage !== null) {
    var $rail = $('#WikiaRail'),
        MonobookPage.innerHTML = '';
         customSelector = window.UsernameReplaceSelector
        var Header = document.createElement('h2');
            ? ', ' + window.UsernameReplaceSelector
         Header.innerHTML = 'Before you visit this wiki...';
            : '';
        MonobookPage.appendChild(Header);
    function inputUsername($content) {
         var Content = document.createElement('div');
         $content.find('.InputUsername, .insertusername' + customSelector).text(username);
        Content.innerHTML = msg;
    }
        MonobookPage.appendChild(Content);
    mw.hook('wikipage.content').add(inputUsername);
        var AgreeButton = document.createElement('button');
    if ($rail.hasClass('loaded')) {
        AgreeButton.className = 'wikia-button';
         inputUsername($rail);
         AgreeButton.innerHTML = 'Agree';
    } else if ($rail.length) {
        MonobookPage.appendChild(AgreeButton);
         $rail.on('afterLoad.rail',
         var DisagreeButton = document.createElement('button');
            $.proxy(inputUsername, null, $rail)
         DisagreeButton.className = 'wikia-menu-button secondary';
         );
        DisagreeButton.innerHTML = 'Disagree';
    }
        MonobookPage.appendChild(DisagreeButton);
})(window, jQuery, mediaWiki);
        AgreeButton.onclick = function() {
 
            setCookie(cookiename, 'true', 365);
$(document).ready(function () {
            location.reload();
    $("a.external").each(function () {
         };
         let url = new URL(this.href);
         DisagreeButton.onclick = function() {
         if (!url.searchParams.has("utm_source")) {
             window.location.href = 'http://wikia.com';
             url.searchParams.set("utm_source", "screamer.wiki");
         };
            this.href = url.toString();
     }  
         }
}
     });
});

Latest revision as of 20:34, 25 September 2025

/* Any JavaScript here will be loaded for all users on every page load. */

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';
    } 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>');
$("#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();
        }
    });
});