MediaWiki:Common.js

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

/* UserTags */ window.UserTagsJS = { modules: { inactive: 60, mwGroups: ['autoconfirmed'], autoconfirmed: true, newuser: true, nonuser: true, metafilter: {'autoconfirmed': ['inactive', 'bot', 'bot-global', 'nonuser'],}, // removes BanG Dreamer tag from all inactive, bots and global accounts with no edits },	tags: { fuee: 'Fuee Fuee Time', chooco: 'Gazumi', autoconfirmed: 'BanG Dreamer', newuser: 'New BanG Dreamer', transcripter: 'Transcripter', unordinary: 'unOrdinary', } };

UserTagsJS.modules.custom = { 'Kagerou98': ['fuee'], 'Choocolatiah': ['chooco'], 'Isovas': ['transcripter'], 'NikkiBunny816': ['transcripter', 'unordinary'], };

/* MessageWallUserTags */ window.MessageWallUserTags = { tagColor: '#FF2D54', txtSize: '10px', glow: true, glowSize: '12px', glowColor: '#f77', users: { 'Suichune': 'Founder', 'Choocolatiah': 'Administrator', 'Kagerou98': 'Administrator', 'SharingIiiisCaring': 'Administrator', 'Isovas': 'Content Moderator', 'Aceticke': 'Content Moderator', } };

/* for CopyText */ mw.hook('dev.i18n').add(function (i18n) {   i18n.loadMessages('CopyText').done(function (i18n) { $('body').on('click', '.copy-to-clipboard-button', function(e){           var text = $(this).data('text'),            $input = $(' ', { type: 'text' })                .val($('.copy-to-clipboard-text').filter(function {                    return $(this).data('text') == text;                }).first.text)                .appendTo('body')                .select;            document.execCommand('Copy');            $input.remove;            new BannerNotification(i18n.msg('success').escape, 'confirm').show;        }); }); });

// 1. AjaxRC configuration option window.ajaxRefresh = 30000; // 2. AjaxRC import template list for case-by-case basis window.preloadTemplates_subpage = "case-by-case";

/* Replaces with the name of the user browsing the page. Requires copying Template:USERNAME. */ $(function {   if (window.disableUsernameReplace || mw.config.get('wgUserName') === null) { return; }    $('span.insertusername').text(mw.config.get('wgUserName')); }); /* End of the replacement */

/* to convert a date/time in one timezone to user's local time, code copied from u:valkyriecrusade:MediaWiki:Common.js */ function jstzConvertAll { var l = document.querySelectorAll("[data-jstz]"); for (var i=0; i<l.length;i++) { var date = new Date(l[i].dataset.jstz); var format = l[i].dataset.jstzformat ? l[i].dataset.jstzformat : "Y/m/d h:i A"; l[i].innerHTML=jstzFormatDate(date,format); } } // this function formats the date similarly to the wikis #time function // see https://www.mediawiki.org/wiki/Help:Extension:ParserFunctions#.23time // not all options are supported function jstzFormatDate(date, format, utc) { var MMMM = ["\x00", "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]; var MMM = ["\x01", "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]; var dddd = ["\x02", "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]; var ddd = ["\x03", "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"]; function ii(i, len) { var s = i + ""; len = len || 2; while (s.length < len) s = "0" + s;       return s;    } var y = utc ? date.getUTCFullYear : date.getFullYear; format = format.replace(/(^|[^\\])Y+/g, "$1" + y); format = format.replace(/(^|[^\\])y/g, "$1" + y.toString.substr(2, 2)); var M = (utc ? date.getUTCMonth : date.getMonth) + 1; format = format.replace(/(^|[^\\])F+/g, "$1" + MMMM[0]); format = format.replace(/(^|[^\\])M/g, "$1" + MMM[0]); format = format.replace(/(^|[^\\])m/g, "$1" + ii(M)); format = format.replace(/(^|[^\\])n/g, "$1" + M); var d = utc ? date.getUTCDate : date.getDate; format = format.replace(/(^|[^\\])l+/g, "$1" + dddd[0]); format = format.replace(/(^|[^\\])D/g, "$1" + ddd[0]); format = format.replace(/(^|[^\\])d/g, "$1" + ii(d)); format = format.replace(/(^|[^\\])j/g, "$1" + d); var H = utc ? date.getUTCHours : date.getHours; format = format.replace(/(^|[^\\])H+/g, "$1" + ii(H)); format = format.replace(/(^|[^\\])G/g, "$1" + H); var h = H > 12 ? H - 12 : H === 0 ? 12 : H;   format = format.replace(/(^|[^\\])h+/g, "$1" + ii(h)); format = format.replace(/(^|[^\\])g/g, "$1" + h); var m = utc ? date.getUTCMinutes : date.getMinutes; format = format.replace(/(^|[^\\])i+/g, "$1" + ii(m)); var s = utc ? date.getUTCSeconds : date.getSeconds; format = format.replace(/(^|[^\\])s+/g, "$1" + ii(s)); var tz = -date.getTimezoneOffset; var P = utc || !tz ? "Z" : tz > 0 ? "+" : "-";   var O = P;    if (!utc) { tz = Math.abs(tz); var tzHrs = Math.floor(tz / 60); var tzMin = tz % 60; P += ii(tzHrs) + ":" + ii(tzMin); O += ii(tzHrs) + ii(tzMin); }   format = format.replace(/(^|[^\\])P/g, "$1" + P); format = format.replace(/(^|[^\\])O/g, "$1" + O); var T = H < 12 ? "AM" : "PM"; format = format.replace(/(^|[^\\])A+/g, "$1" + T); var t = T.toLowerCase; format = format.replace(/(^|[^\\])a+/g, "$1" + t); var day = (utc ? date.getUTCDay : date.getDay) + 1; format = format.replace(new RegExp(dddd[0], "g"), dddd[day]); format = format.replace(new RegExp(ddd[0], "g"), ddd[day]); format = format.replace(new RegExp(MMMM[0], "g"), MMMM[M]); format = format.replace(new RegExp(MMM[0], "g"), MMM[M]); format = format.replace(/\\(.)/g, "$1"); return format; } addOnloadHook(jstzConvertAll);

/* Adapted from YouTubePlayer & DraggableYouTubePlayer for video previews. */ mw.hook('wikipage.content').add(function($content) {   $content.find('.episodepreview-video').each(function { var $this = $(this), data = $this.data, uri = new mw.Uri('https://www.youtube.com/embed/'), id = (data.id || '').trim, loop = ('' + data.loop).trim; if (data.loaded || id === '') { return; }       uri.path += id; uri.query = { autoplay: window.YoutubePlayerDisableAutoplay ? '0' : ('' + data.autoplay).trim, loop: loop, playlist: (loop === '1') ? id : '', start: ('' + data.start).trim, list: (data.list || '').trim, controls: 0, fs: 0, showinfo: 0, rel: 0, };       $this.html(mw.html.element('iframe', { width: ('' + data.width).trim, height: ('' + data.height).trim, src: uri.toString, frameborder: '0', allowfullscreen: 'true' }));       data.loaded = true; }); });

/* AddRailModule on top */ window.AddRailModule = [ {page: 'Template:RailModule', prepend: true}, 'Template:Spotify', ];

/* BackToTop */ window.BackToTopModern = true;

/* For card details on card icon hover */ var tooltips_list = [ {       classname: 'card-images', parse: '' } ]; var tooltips_config = { offsetX: 10, offsetY: 10 };

// Add template to the upload page // @author: UltimateSupreme (http://c.wikia.com/wiki/User:UltimateSupreme) // source and all audio file params are optional

if (mw.config.get('wgCanonicalSpecialPageName') === 'MultipleUpload' || mw.config.get('wgCanonicalSpecialPageName') === 'Upload') { if (!$.getUrlVar('wpForReUpload') && !$('#wpUploadDescription').val) { jQuery(function ($) {           'use strict';            $('#wpUploadDescription').val( '');       });    } }