User:Chaotic Enby/Unblock wizard.js: Difference between revisions
From Test Wiki
Content deleted Content added
Chaotic Enby (talk | contribs) No edit summary |
Chaotic Enby (talk | contribs) No edit summary |
||
| Line 99: | Line 99: | ||
function init() { |
function init() { |
||
for (var key in messages) { |
for (var key in messages) { |
||
mw.messages.set(' |
mw.messages.set('ubw-' + key, messages[key]); |
||
} |
} |
||
| Line 270: | Line 270: | ||
// Attach |
// Attach |
||
$('#unblock-wizard-container').empty().append(ui.fieldset.$element, ui.footerLayout.$element); |
$('#unblock-wizard-container').empty().append(ui.fieldset.$element, ui.footerLayout.$element); |
||
mw.track('counter.gadget_afcsw.opened'); |
|||
ui.submitButton.on('click', handleSubmit); |
ui.submitButton.on('click', handleSubmit); |
||
| Line 371: | Line 369: | ||
setMainStatus('process', msg('status-processing')); |
setMainStatus('process', msg('status-processing')); |
||
mw.track('counter.gadget_afcsw.submit_attempted'); |
|||
ui.submitButton.setDisabled(true); |
ui.submitButton.setDisabled(true); |
||
ui.mainStatusLayout.scrollElementIntoView(); |
ui.mainStatusLayout.scrollElementIntoView(); |
||
| Line 377: | Line 374: | ||
if (blockType == "IP_hardblock") { |
if (blockType == "IP_hardblock") { |
||
setMainStatus('redirect', msg('status-redirecting-utrs')); |
setMainStatus('redirect', msg('status-redirecting-utrs')); |
||
mw.track('counter.gadget_afcsw.submit_succeeded'); |
|||
$(window).off('beforeunload', wizard.beforeUnload); |
$(window).off('beforeunload', wizard.beforeUnload); |
||
setTimeout(function () { |
setTimeout(function () { |
||
| Line 427: | Line 423: | ||
saveUserTalkPage(userTalk, apiPage.revisions[0].slots.main.content + text).then(function () { |
saveUserTalkPage(userTalk, apiPage.revisions[0].slots.main.content + text).then(function () { |
||
setMainStatus('success', msg('status-redirecting')); |
setMainStatus('success', msg('status-redirecting')); |
||
mw.track('counter.gadget_afcsw.submit_succeeded'); |
|||
$(window).off('beforeunload', wizard.beforeUnload); |
$(window).off('beforeunload', wizard.beforeUnload); |
||
| Line 437: | Line 432: | ||
ui.fieldset.removeItems([ui.mainStatusLayout, ui.talkStatusLayout]); |
ui.fieldset.removeItems([ui.mainStatusLayout, ui.talkStatusLayout]); |
||
ui.captchaLayout.scrollElementIntoView(); |
ui.captchaLayout.scrollElementIntoView(); |
||
mw.track('counter.gadget_afcsw.submit_captcha'); |
|||
} else { |
} else { |
||
setMainStatus('error', msg('status-error')); |
setMainStatus('error', msg('status-error')); |
||
mw.track('counter.gadget_afcsw.submit_failed'); |
|||
mw.track('counter.gadget_afcsw.submit_failed_' + code); |
|||
} |
} |
||
ui.submitButton.setDisabled(false); |
ui.submitButton.setDisabled(false); |
||
| Line 449: | Line 441: | ||
setMainStatus('error', msg('status-error')); |
setMainStatus('error', msg('status-error')); |
||
ui.submitButton.setDisabled(false); |
ui.submitButton.setDisabled(false); |
||
mw.track('counter.gadget_afcsw.submit_failed'); |
|||
mw.track('counter.gadget_afcsw.submit_failed_' + code); |
|||
}); |
}); |
||
} |
} |
||
| Line 593: | Line 583: | ||
function msg(key) { |
function msg(key) { |
||
var messageArgs = Array.prototype.slice.call(arguments, 1); |
var messageArgs = Array.prototype.slice.call(arguments, 1); |
||
return mw.msg.apply(mw, [' |
return mw.msg.apply(mw, ['ubw-' + key].concat(messageArgs)); |
||
} |
} |
||