User:Chaotic Enby/Unblock wizard.js: Difference between revisions
From Test Wiki
Content deleted Content added
Chaotic Enby (talk | contribs) doing some renaming |
Chaotic Enby (talk | contribs) No edit summary |
||
| Line 38: | Line 38: | ||
var config = { |
var config = { |
||
debounceDelay: 500, |
debounceDelay: 500, |
||
redirectionDelay: 1000 |
redirectionDelay: 1000, |
||
}; |
}; |
||
| Line 68: | Line 68: | ||
"status-redirecting": "Submission succeeded. Redirecting you to your talk page ...", |
"status-redirecting": "Submission succeeded. Redirecting you to your talk page ...", |
||
"status-redirecting-utrs": "Redirecting you to UTRS ...", |
"status-redirecting-utrs": "Redirecting you to UTRS ...", |
||
"status-not-blocked": "You are not currently blocked |
"status-not-blocked": "You are not currently blocked.", |
||
"status-error": "Due to an error, your unblock request could not be parsed. You can try to submit an unblock request manually by pasting the following on [[Special:MyTalk|your talk page]]:<br /><code>{{unblock | reason=Your reason here ~~" + "~~}}</code><br />If you are having difficulties, please [https://utrs-beta.wmflabs.org/ make a request through UTRS] and inform them of the issues you are encountering.", |
"status-error": "Due to an error, your unblock request could not be parsed. You can try to submit an unblock request manually by pasting the following on [[Special:MyTalk|your talk page]]:<br /><code>{{unblock | reason=Your reason here ~~" + "~~}}</code><br />If you are having difficulties, please [https://utrs-beta.wmflabs.org/ make a request through UTRS] and inform them of the issues you are encountering.", |
||
"captcha-label": "Please enter the letters appearing in the box below", |
"captcha-label": "Please enter the letters appearing in the box below", |
||
| Line 129: | Line 129: | ||
} |
} |
||
console.log(blockType) |
console.log(blockType) |
||
| ⚫ | |||
blockType = blockType[blockType.length - 1]; |
blockType = blockType[blockType.length - 1]; |
||
| ⚫ | |||
| ⚫ | |||
} |
|||
| ⚫ | |||
switch (blockType) { |
switch (blockType) { |
||
case "Sockpuppet": |
case "Sockpuppet": |
||
| Line 311: | Line 308: | ||
// re-initialize |
// re-initialize |
||
wizard.oresTopics = null; |
|||
wizard.talktext = null; |
|||
wizard.pagetext = null; |
wizard.pagetext = null; |
||
| Line 362: | Line 357: | ||
mainPosition = ui.fieldset.items.length; |
mainPosition = ui.fieldset.items.length; |
||
ui.fieldset.addItems([ |
ui.fieldset.addItems([ |
||
ui.mainStatusLayout = new OO.ui. |
ui.mainStatusLayout = new OO.ui.FieldLayout(ui.mainStatusArea = new OO.ui.LabelWidget({ |
||
label: $('<tr>').append('<td style="vertical-align:top; padding-right: 5px;">' + imglink(infoLevels[type]) + '</td><td style="vertical-align:middle;">' + linkify(message)+ '</td>') |
|||
| ⚫ | |||
}), { |
|||
| ⚫ | |||
label: $("<span/>").append(linkify(message)) |
|||
}) |
}) |
||
]); |
]); |
||
} else { |
} else { |
||
ui.mainStatusArea.setLabel($('<tr>').append('<td style="vertical-align:top; padding-right: 5px;">' + imglink(infoLevels[type]) + '</td><td style="vertical-align:middle;">' + linkify(message)+ '</td>')); |
|||
ui.mainStatusLayout.setIcon(type); |
|||
ui.mainStatusLayout.setLabel($('<span/>').append(linkify(message))); |
|||
} |
} |
||
} |
} |
||
| Line 376: | Line 370: | ||
function handleSubmit() { |
function handleSubmit() { |
||
setMainStatus(' |
setMainStatus('process', msg('status-processing')); |
||
mw.track('counter.gadget_afcsw.submit_attempted'); |
mw.track('counter.gadget_afcsw.submit_attempted'); |
||
ui.submitButton.setDisabled(true); |
ui.submitButton.setDisabled(true); |
||
| Line 388: | Line 382: | ||
location.href = "https://utrs-beta.wmflabs.org/public/appeal/account"; |
location.href = "https://utrs-beta.wmflabs.org/public/appeal/account"; |
||
}, config.redirectionDelay); |
}, config.redirectionDelay); |
||
| ⚫ | |||
| ⚫ | |||
} else { |
} else { |
||
for(var [i, label] of questionLabels.entries()){ |
for(var [i, label] of questionLabels.entries()){ |
||
| Line 395: | Line 391: | ||
} |
} |
||
if (emptyFields && !emptyFieldsWarned) { |
if (emptyFields && !emptyFieldsWarned) { |
||
setMainStatus(' |
setMainStatus('warning', msg('status-blank')); |
||
emptyFieldsWarned = true; |
emptyFieldsWarned = true; |
||
ui.submitButton.setDisabled(false); |
ui.submitButton.setDisabled(false); |
||
| Line 425: | Line 421: | ||
var text = prepareUserTalkText(); |
var text = prepareUserTalkText(); |
||
setMainStatus(' |
setMainStatus('process', msg('status-saving')); |
||
if (demoMode) { |
if (demoMode) { |
||
setMainStatus('success', '<code style="display: block">' + text + '</code>'); |
setMainStatus('success', '<code style="display: block">' + text + '</code>'); |
||