User:TheGreatBird453/wikia.js

// Future socking. // if (/Saness|SANESS|/g.test(wgUserName) && wgAction == 'edit'){ // alert('You have been suspected as a sock and therefore you edits will not be accepted. Please appeal to Ditto Creeper Bot, Doork, MasterSlenderTR or GlitchtaleFan123 if you have good intentions. You will be redirected to the Wiki Activity.'); // function out{ // window.location.href = wgServer + '/wiki/Special:WikiActivity' // } // setTimeout(out, 5000); // } /// @ DOORK YOU BUM ALWAYS MAKE SURE TO HAVE THE EMAIL TOKEN ATTACHED TO THE Summary before requesting such a script, ya BUM!!! EEeeeeeeeeeeeeeeeeeeeeeeeeeee

/*******************************************************************************
 * 1) START GLITCHTALE WIKIA JAVASCRIPT ############################

/////////////////////////////////////////////////////////////////////////////// ////////////////////////////// USER TAGS ////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////

window.UserTagsJS = { modules: {}, tags: { Leader: { u: 'Leader', link: 'Special:Community' },       Founder: { u: 'Founder', link: 'Special:Community' },       ExLeader: { u: 'Ex-Leader', link: 'Special:Community' },       ExBureaucrat: { u: 'Ex-Bureaucrat', link: 'Special:Community' },       ExAdministrator: { u: 'Ex-Administrator', link: 'Special:Community' },       ExModerator: { u: 'Ex-Moderator', link: 'Special:Community' },       ExRollback: { u: 'Ex-Rollback', link: 'Special:Community' },       rollback: { link: 'Special:Community' },       newuser: { link: 'Special:Community' },       bureaucrat: { link: 'Special:Community' },       sysop: { link: 'Special:Community' },       'content-moderator': { link: 'Special:Community' },       chatmoderator: { link: 'Special:Community' },       bot: { link: 'Special:Community' },       founder: { link: 'Special:Community' },       threadmoderator: { link: 'Special:Community' },      'moderator': { link: 'Special:Community', u: 'Moderator' }   } }; UserTagsJS.modules.custom = { 'Vultarix': ['Founder'], 'MasterSlenderTR': ['Leader'], 'Doork': ['ExLeader'], 'Ditto Duck Penguin': ['ExLeader'], 'Artty Chan': ['ExBureaucrat'], 'GlitchtaleBot': ['ExBureaucrat'], 'PrincessXofSilverdale': ['ExBureaucrat'], 'LunaDeaminac': ['ExBureaucrat'], 'Chaos711lalokilla': ['ExBureaucrat'], 'Lience': ['ExAdministrator'], 'Jman005': ['ExAdministrator'], 'Puns-Are-Not-Sans%27s-Thing': ['ExAdministrator'], 'CinderSky98': ['ExModerator'], 'Chara49': ['ExModerator'], 'Prince Avaline': ['ExModerator'], 'SliverEmperor': ['ExRollback'], 'AngeRenard': ['ExRollback'], }; UserTagsJS.modules.newuser = { days: 7, edits: 10, namespaces: 0 }; UserTagsJS.modules.autoconfirmed = false; UserTagsJS.modules.mwGroups = ['bureaucrat', 'chatmoderator', 'threadmoderator', 'patroller', 'content-moderator', 'rollback', 'sysop', 'bannedfromchat', 'blocked', 'bot', 'bot-global', 'staff', 'vstf', 'newuser', 'helper']; UserTagsJS.modules.metafilter = { bureaucrat: ['bot'], sysop: ['bot'], newuser: ['bureaucrat', 'chatmoderator', 'threadmoderator', 'patroller', 'content-moderator', 'rollback', 'sysop', 'bannedfromchat', 'blocked', 'bot', 'bot-global', 'staff', 'vstf', 'newuser', 'helper'], rollback: ['content-moderator', 'sysop', 'bureaucrat', 'founder', 'bot'], 'content-moderator': ['bot', 'sysop', 'bureaucrat'], bot: ['bot-global'] }; UserTagsJS.modules.implode = { // Combine all three moderator tags in one if a user has all three of them 'moderator': ['content-moderator', 'chatmoderator', 'threadmoderator'] };

UserTagsJS.modules.inactive = 80; /* User is marked as inactive after 80 days of no activity */ UserTagsJS.modules.nonuser = true; // Tag users with no edits UserTagsJS.modules.stopblocked = false; // Keep tags if user is banned UserTagsJS.modules.isblocked = true; UserTagsJS.modules.explode = { // Add Banned from Chat tag to all blocked users 'bannedfromchat': ['blocked'] };

//////////////////////////////////////////////////////////////////////////////// ////////////////////////// END OF USER TAGS //////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////

// AjaxRC Configuration

window.ajaxSpecialPages = [ "Recentchanges", "Recentchangeslinked", "WikiActivity", "Watchlist", "Log", "Contributions", "NewPages", "Images", "Following", "UncategorizedPages", "Categories", "BlockList", "ListFiles", "Withoutimages", "DoubleRedirects", "Whatlinkshere"]; window.ajaxPages = ["Blog:Recent posts"]; window.ajaxRefresh = 30000; window.AjaxRCRefreshText = 'Auto-refresh'; window.AjaxRCRefreshHoverText = 'Automatically refresh the page'; window.ajaxIndicator = 'https://vignette.wikia.nocookie.net/glitchtale/images/6/60/Rainbow_Soul_Refresh.gif';

/*window.InactiveUsers = { months: 2, gone: ['Gebruiker1', 'Gebruiker2'], text: 'Inactive' };*/

// Inserts the viewer's username where specified

$(function UserNameReplace {   if (typeof(disableUsernameReplace) != 'undefined' && disableUsernameReplace || wgUserName === null) return; $("span.insertusername").text(wgUserName); });

// setStyle("-fx-cursor:url('//vignette3.wikia.nocookie.net/undertale-rp/images/8/80/SoulBetter.png/revision/latest?cb=20151111100248'),auto");

// Locking Old Blogs

window.LockOldBlogs = { expiryDays: 60, expiryMessage: "This blog is considered archived because it hasn\'t been commented on in over  days, please don\'t bump this blog!", nonexpiryCategory: "Archived blogs" };

// Allows one to update file-links across all pages when renaming an image window.LIRoptions = { bottomMessage: '', editSummary: 'Updating file links after renaming of image (automatic)', singleButtonText: 'Rename and update', queueButtonText: 'Add to queue', delay: 1000 }; if (wgPageName.indexOf('Special:MovePage/File:') !== -1 || (wgCanonicalNamespace === 'File' && Storage)) { importScriptPage('FileUsageAuto-update/code.js', 'dev'); } //////////////////////////////////////////////////////////////////////////////// ///////////////// START CODES TAKEN FROM ONETWOTHREEFALL'S GLOBAL JS /////////// ////////////////////////////////////////////////////////////////////////////////

// Adds links to Special:WhatLinksHere to edit pages linked on it.

if (mw.config.get('wgCanonicalSpecialPageName') === 'Whatlinkshere') { $('#mw-whatlinkshere-list > li').each(function (ignore, element) {       var link = new mw.Uri($(element).children('a').attr('href'));        link.extend({action: 'edit'});        $(element).find('.mw-whatlinkshere-tools > a:last-child')            .after(' | ', $('').attr('href', link.toString).text('edit'));    }); }

// Adds 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); }

// Adds a button to clear Deletion reasons

if (mw.config.get('wgAction') === 'delete') { $('#wpReason').after(' \u232b '); $('#wpClearReason').click(function {        $('#wpReason').val('').focus;    }); }

// Expand collapsed information on Recent Changes and Watchlist

if ($.inArray(mw.config.get('wgCanonicalSpecialPageName'), ['Recentchanges', 'Recentchangeslinked', 'Watchlist']) !== -1) { $(window).load(function {        $('.mw-collapsible-toggle-collapsed').click;    }); }

//////////////////////////////////////////////////////////////////////////////// ///////////////// END CODES TAKEN FROM ONETWOTHREEFALL'S GLOBAL JS ///////////// ////////////////////////////////////////////////////////////////////////////////

// Test if an element has a certain class. // Increases general performance. var hasClass = (function {   var reCache = {};    return function(element, className) {        return (reCache[className] ? reCache[className] : (reCache[className] = new RegExp("(?:\\s|^)" + className + "(?:\\s|$)"))).test(element.className);   }; }); // Collapsible tables; allows tables to be collapsed, showing only the header. // See NavFrame. Taken from Wikipedia's Common.js. var autoCollapse = 2; var collapseCaption = "hide"; var expandCaption = "show"; function collapseTable(tableIndex) { var Button = document.getElementById("collapseButton" + tableIndex); var Table = document.getElementById("collapsibleTable" + tableIndex); if (!Table || !Button) { return false; }   var Rows = Table.rows; if (Button.firstChild.data == collapseCaption) { for (var i = 1; i < Rows.length; i++) { Rows[i].style.display = "none"; }       Button.firstChild.data = expandCaption; } else { for (var i = 1; i < Rows.length; i++) { Rows[i].style.display = Rows[0].style.display; }       Button.firstChild.data = collapseCaption; } } function createCollapseButtons { var tableIndex = 0; var NavigationBoxes = new Object; var Tables = document.getElementsByTagName("table"); for (var i = 0; i < Tables.length; i++) { if (hasClass(Tables[i], "collapsible")) { /* only add button and increment count if there is a header row to work with */ var HeaderRow = Tables[i].getElementsByTagName("tr")[0]; if (!HeaderRow) continue; var Header = HeaderRow.getElementsByTagName("th")[0]; if (!Header) continue; NavigationBoxes[tableIndex] = Tables[i]; Tables[i].setAttribute("id", "collapsibleTable" + tableIndex); var Button = document.createElement("span"); var ButtonLink = document.createElement("a"); var ButtonText = document.createTextNode(collapseCaption); Button.style.styleFloat = "right"; Button.style.cssFloat = "right"; Button.style.fontWeight = "normal"; Button.style.textAlign = "right"; Button.style.width = "6em"; ButtonLink.style.color = Header.style.color; ButtonLink.setAttribute("id", "collapseButton" + tableIndex); ButtonLink.setAttribute("href", "javascript:collapseTable(" + tableIndex + ");"); ButtonLink.appendChild(ButtonText); Button.appendChild(document.createTextNode("[")); Button.appendChild(ButtonLink); Button.appendChild(document.createTextNode("]")); Header.insertBefore(Button, Header.childNodes[0]); tableIndex++; }   }    for (var i = 0; i < tableIndex; i++) { if (hasClass(NavigationBoxes[i], "collapsed") || (tableIndex >= autoCollapse && hasClass(NavigationBoxes[i], "autocollapse"))) { collapseTable(i); }   } } addOnloadHook(createCollapseButtons); // Dynamic Navigation Bars // Description: See NavFrame. // Taken from Wikipedia's Common.js. // set up the words in your language var NavigationBarHide = '[' + collapseCaption + ']'; var NavigationBarShow = '[' + expandCaption + ']'; // shows and hides content and picture (if available) of navigation bars // Parameters: //    indexNavigationBar: the index of navigation bar to be toggled function toggleNavigationBar(indexNavigationBar) {    var NavToggle = document.getElementById("NavToggle" + indexNavigationBar); var NavFrame = document.getElementById("NavFrame" + indexNavigationBar); if (!NavFrame || !NavToggle) { return false; }    // if shown now if (NavToggle.firstChild.data == NavigationBarHide) { for (                var NavChild = NavFrame.firstChild;                 NavChild !== null;                 NavChild = NavChild.nextSibling             ) { if ( hasClass( NavChild, 'NavPic' ) ) { NavChild.style.display = 'none'; }            if ( hasClass( NavChild, 'NavContent') ) { NavChild.style.display = 'none'; }        }     NavToggle.firstChild.data = NavigationBarShow; // if hidden now } else if (NavToggle.firstChild.data == NavigationBarShow) { for (                var NavChild = NavFrame.firstChild;                 NavChild !== null;                 NavChild = NavChild.nextSibling             ) { if (hasClass(NavChild, 'NavPic')) { NavChild.style.display = 'block'; }            if (hasClass(NavChild, 'NavContent')) { NavChild.style.display = 'block'; }        }     NavToggle.firstChild.data = NavigationBarHide; } }  // adds show/hide-button to navigation bars function createNavigationBarToggleButton {    var indexNavigationBar = 0; // iterate over all -elements var divs = document.getElementsByTagName("div"); for(            var i=0;              i< divs.length;              i++         ) { NavFrame = divs[i]; // if found a navigation bar if (hasClass(NavFrame, "NavFrame")) { indexNavigationBar++; var NavToggle = document.createElement("a"); NavToggle.className = 'NavToggle'; NavToggle.setAttribute('id', 'NavToggle' + indexNavigationBar); NavToggle.setAttribute('href', 'javascript:toggleNavigationBar(' + indexNavigationBar + ');'); var NavToggleText = document.createTextNode(NavigationBarHide); for (                 var NavChild = NavFrame.firstChild;                  NavChild !== null;                  NavChild = NavChild.nextSibling                 ) { if ( hasClass( NavChild, 'NavPic' ) || hasClass( NavChild, 'NavContent' ) ) { if (NavChild.style.display == 'none') { NavToggleText = document.createTextNode(NavigationBarShow); break; }                }             }             NavToggle.appendChild(NavToggleText); // Find the NavHead and attach the toggle link (Must be this complicated because Moz's firstChild handling is borked) for(              var j=0;                j < NavFrame.childNodes.length;                j++             ) { if (hasClass(NavFrame.childNodes[j], "NavHead")) { NavFrame.childNodes[j].appendChild(NavToggle); }            }             NavFrame.setAttribute('id', 'NavFrame' + indexNavigationBar); }    }  }  addOnloadHook( createNavigationBarToggleButton );

// Purge Button Configuration window.PurgeButtonText = 'RESET'; /* Reference to the power to reset in                                          Undertale */

/* Import new buttons in specific circumstances */ // Imports Null Edit Button if page can be edited and Refresh button if not. // The Null Edit button doesn't load on locked pages. // Therefore, we import a fallback for these pages. // View Source is useless on locked pages because the Edit literally becomes that same button. // So is the EditIntroButton as it won't work at all, being there just for the heck of it. if ($("#ca-edit").length || $("a[data-id='editprofile']").length) { importArticles({       type: 'script',        articles: [            'u:dev:MediaWiki:EditIntroButton/code.js',            'u:dev:MediaWiki:NullEditButton/code.js',            'u:dev:MediaWiki:View Source/code.js'        ]	}); }

// Allows CSS to target pages with a specific template. Made by KockaAdmiralac upon request. $('mw-content-text').attr('data-topic', $('#mw-content-text .article-topic').attr('data-topic')); // Allows the entire box on Help:Contents to be clickable if (wgPageName == 'Help:Contents') { $('.centralhelpbox').click(function {       window.location.href = '/wiki/Help:' + $(this).attr('data-link');    }); } // Opens chat in a window when clicked through a page link or the homepage $(".openchat a").click(function {    window.open('/wiki/Special:Chat', 'wikiachat', 'width=600,height=600,menubar=no,status=no,location=no,toolbar=no,scrollbars=no,resizable=yes');    return false; });

// MastheadRightsBadge // User config variables var config = window.MastheadRightsBadgeSettings || {}; var iconSize = config.iconSize || '50px'; // Variables var $user = mw.config.get('wgTitle').split('/'); // Fetch MediaWiki API for user group badge messages, API fetch by Luqgreg function GetMessages(msg) { return new Promise(function(resolve, reject) {       new mw.Api.get({ action: 'query', meta: 'allmessages', ammessages: msg.join("|"), }).done(function (d) { if(d.error) reject(d); var r = {}; d.query.allmessages.forEach(function(e) {               r[e.name] = e["*"];            }); resolve(r); }).error(reject);   }); } GetMessages([   "user-identity-box-group-sysop",    "user-identity-box-group-content-moderator",    "user-identity-box-group-threadmoderator",    "user-identity-box-group-chatmoderator",    "user-identity-box-group-staff",    "user-identity-box-group-helper",    "user-identity-box-group-vstf",    "user-identity-box-group-global-discussions-moderator", ]).then(function(m) {    //    var title = {        'sysop': m["user-identity-box-group-sysop"],        'content-moderator': m["user-identity-box-group-content-moderator"],        'threadmoderator': m["user-identity-box-group-threadmoderator"],        'chatmoderator': m["user-identity-box-group-chatmoderator"],        'staff': m["user-identity-box-group-staff"],        'helper': m["user-identity-box-group-helper"],        'vstf': m["user-identity-box-group-vstf"],        'global-discussions-moderator': m["user-identity-box-group-global-discussions-moderator"] };   // Z-Index variable: user group hierachy groupPriority = { 'sysop': '10070', 'content-moderator': '10060', 'threadmoderator': '10050', 'chatmoderator': '10040', 'staff': '10030', 'helper': '10020', 'vstf': '10010', 'global-discussions-moderator': '10000', };   // Fetch MediaWiki API for user group badges new mw.Api.get({       action: 'query',        list: 'users',        usprop: 'groups',        ususers: $user = $user[1] ? $user[1] : $user[0]    }).then(function (data) {    // Variables    var groups = (data.query.users[0] || {}).groups || [];    // User groups    g = {        'sysop': 'admin',        'content-moderator': 'content-moderator',        'threadmoderator': 'discussion-moderator',        'chatmoderator': 'discussion-moderator',        'staff': 'staff',        'helper': 'helper',        'vstf': 'vstf',        'global-discussions-moderator': 'global-discussions-moderator',    };    // Create badge    groups.forEach(function (group) { mw.hook('dev.wds').add(function(wds) {           if (!g[group]) return;            $('.UserProfileMasthead .masthead-avatar').prepend( $(' ', {                   'class': 'mastrightsbadge ' + 'mastrightsbadge-' + group,                    'title': title[group],                    css: {                        height: iconSize,                        position: 'absolute',                        left: '0',                        top: '0',                        width: iconSize,                        zIndex: groupPriority[group],                    }                }).append(                    $(dev.wds.badge(g[group]))                ) );           });        });    }); });

// Import dependencies

importArticle(   {        type: 'script',        article: 'u:dev:WDSIcons/code.js'    } );

// Refresh Thread Script window.RefreshThreads = { interval: 30000, auto_add: true };

// Adds a new Rail Module listing all of the wiki's active / major Staff Members

var mwApiCounterListStaff = setInterval(function {   if(typeof mw !== 'undefined' && typeof mw.Api !== 'undefined')    {        clearInterval(mwApiCounterListStaff);        if(localStorage.getItem("ListStaff") === "yes" || $("#WikiaRail").length === 0) return;        var ListStaff = {            api: new mw.Api,            config: $.extend({ announceError: false, page: "custom-spoiler-warning", vocab: { fetchError: "An error occurred while fetching list of staff page", dismiss: "Dismiss", pageNotFound: "The following page was not found" }           }, window.ListStaffConfig),            init: function            {                this.i18n = this.config.vocab;                this.checkExist;            },            checkExist: function            {                var url = mw.config.get('wgServer') + mw.config.get('wgArticlePath').replace(/\$1/, "MediaWiki:" + this.config.page);                $.ajax({ url: url, success: $.proxy(this.fetchPage, this), error: $.proxy(function(d)                   {                        this.insertUI(this.i18n.pageNotFound + ": MediaWiki:" + this.config.page + "", 'error').show;                    }, this) });           },            fetchPage: function            {                this.api.get({ action: "parse", text: "" }).done($.proxy(function(d)               {                    if(d.error && this.config.announceError)                        new BannerNotification(this.i18n.fetchError + ": " + d.error.code, 'error');                    else this.insertUI(d.parse.text['*']);                }, this)).fail($.proxy(function                {                    if(this.config.announceError)                        new BannerNotification(this.i18n.fetchError, 'error').show;                }, this));            },            insertUI: function(html)            {                $("#WikiaRail").children.first.before(" \                    List of Staff " + html);                $("#ListStaffButton").click($.proxy(function                {                    localStorage.setItem("ListStaffRead", "yes");                    $(".ListStaffModule").slideToggle; }, this)); }       };        $($.proxy(ListStaff.init, ListStaff)); } }, 100);

// Topic Block Log

TBL_GROUP = "undertale-en";

// SVG Image Scaling Script Config window.dev = window.dev || {}; window.dev.DynamicImages = { svgGallery: true, svgLightbox: true, svgIncreaseSrc: 2 };

// UploadInPage Configuration window.needsLicense = false; window.allowMultiUpload = true; window.maxFiles = 100; window.uploadDetails = true;

// Allows text to be hidden in other text and revealed with a click

$(".container").click(function { $div = $(this).find("div");  $($div).toggleClass("active"); });