User:Chaotic Enby/Unblock wizard.js: Difference between revisions
From Test Wiki
Content deleted Content added
Chaotic Enby (talk | contribs) figuring out what happened |
Chaotic Enby (talk | contribs) yeah |
||
| (4 intermediate revisions by the same user not shown) | |||
| Line 15: | Line 15: | ||
/* globals mw, $, OO */ |
/* globals mw, $, OO */ |
||
/* <nowiki> */ |
/* <nowiki> */ |
||
| ⚫ | |||
(async function () { |
(async function () { |
||
| ⚫ | |||
var wizard = {}, ui = {}, block = {}; |
var wizard = {}, ui = {}, block = {}; |
||
| Line 33: | Line 29: | ||
var demoMode = !!mw.util.getParamValue("demoMode"); |
var demoMode = !!mw.util.getParamValue("demoMode"); |
||
var usernameBlock = mw.util.getParamValue("usernameBlock"); |
var usernameBlock = mw.util.getParamValue("usernameBlock"); |
||
console.log("console.log"); |
|||
| ⚫ | |||
await new mw.Api().loadMessagesIfMissing(['wikimedia-copyrightwarning', 'copyrightwarning']); |
await new mw.Api().loadMessagesIfMissing(['wikimedia-copyrightwarning', 'copyrightwarning']); |
||
console.log("awawawait"); |
|||
| ⚫ | |||
// TODO: move to a separate JSON subpage, would be feasible once [[phab:T198758]] is resolved |
// TODO: move to a separate JSON subpage, would be feasible once [[phab:T198758]] is resolved |
||
var messages = { |
var messages = { |
||
| Line 79: | Line 72: | ||
"copyright-notice": `<small>${mw.message('wikimedia-copyrightwarning').plain()}</small>`, |
"copyright-notice": `<small>${mw.message('wikimedia-copyrightwarning').plain()}</small>`, |
||
}; |
}; |
||
| ⚫ | |||
var messagesCache = {}; |
var messagesCache = {}; |
||
| Line 98: | Line 92: | ||
var emptyFieldsWarned = false; |
var emptyFieldsWarned = false; |
||
var mainPosition = -1; |
var mainPosition = -1; |
||
| ⚫ | |||
async function parseAndCacheMsg(key, ...messageArgs) { |
async function parseAndCacheMsg(key, ...messageArgs) { |
||
| Line 112: | Line 108: | ||
function init() { |
function init() { |
||
| ⚫ | |||
for (var key in messages) { |
for (var key in messages) { |
||
mw.messages.set('ubw-' + key, messages[key]); |
mw.messages.set('ubw-' + key, messages[key]); |
||
| Line 141: | Line 138: | ||
"uiprop": "blockinfo" |
"uiprop": "blockinfo" |
||
}).then( setBlockData ).then( async function ( block ) { |
}).then( setBlockData ).then( async function ( block ) { |
||
console.log("init?"); |
|||
blockType = mw.config.get('wgPageName').split('/'); |
blockType = mw.config.get('wgPageName').split('/'); |
||
if (blockType.includes("Demo")) { |
if (blockType.includes("Demo")) { |
||
| Line 190: | Line 188: | ||
'#catlinks { display: none } ' |
'#catlinks { display: none } ' |
||
); |
); |
||
| ⚫ | |||
constructUI(); |
constructUI(); |
||
}); |
}); |
||
| Line 666: | Line 664: | ||
} |
} |
||
console.log("await $$$"); |
|||
await $.when( |
await $.when( |
||
$.ready, |
$.ready, |
||
| Line 674: | Line 672: | ||
]) |
]) |
||
); |
); |
||
console.log("im rich now"); |
|||
if (!(mw.config.get('wgPageName').includes('Wikipedia:Unblock_wizard/')) || |
if ((!(mw.config.get('wgPageName').includes('Wikipedia:Unblock_wizard/')) && !(mw.config.get('wgPageName').includes('Chaotic_Enby/'))) || |
||
mw.config.get('wgAction') !== 'view') { |
mw.config.get('wgAction') !== 'view') { |
||
return; |
return; |
||
} |
} |
||
console.log("innit"); |
|||
init(); |
init(); |
||