User:Stargaze Sprinkles/global.js

window.ajaxIndicator = 'https://images.wikia.nocookie.net/software/images/a/a9/Indicator.gif'; window.ajaxRefresh = 30000; window.ajaxSpecialPages = [ "Recentchanges", "WikiActivity", "Watchlist", "Log", "Contributions" ];

$.extend(true, window, {   dev: {        i18n: {            overrides: {                AjaxRC: {                    'ajaxrc-refresh-text': 'AJAX',                    'ajaxrc-refresh-hover': 'Enable page auto-refresh',                }            }        }    } });

importArticles({   type: 'script',    articles: [        'u:dev:MediaWiki:AjaxRC.js',    ] });

var miniTemplate = function (template, data) { Object.keys(data).forEach(function (key) {       template = template.replace( new RegExp('\\$' + key, 'g'), data[key] )   })    return template; }

var adoptionForm = function { var form = [ '', '', '', '', '', '', '', '', ' ' ].join(' ') var template = [ "Adoption requests → ", "",       "What is your username? User:$au", "Please link to the wiki here: $wn", "How many edits have you made on that wiki? $em", "How many days/months have you been editing there? $te", "On the Special Pages → Special:ListAdmins when was the last time an admin edited, and who was it? $la (contributions) $le", "Any other information: $oi" ].join('\n\n') var handler = function { var keys = ['au', 'wf', 'wn', 'em', 'te', 'la', 'le', 'oi'] var data = Array.from(document.querySelectorAll('.modalContent div input')) .map(function (e) {               return e.value            }) .reduce(function (obj, val, i) {               return Object.assign(obj, (function (k, v) {                    var o = {}                    o[k] = v                    return o                })(keys[i], val))            }, {}) var processed = miniTemplate(template, data)

document.getElementById('ss-af-oa').value = processed }

$.showCustomModal('Adoption Generator', form, {       buttons: [            {                message: "Generate",                handler: handler            }        ]    }) }

document.addEventListener('keyup', function (e) {   if (e.altKey && e.keyCode === 65) {        e.preventDefault;         adoptionForm    } }, {    capture: false })