「利用者:Dragoniez/scripts/AN Reporter.js」の版間の差分
削除された内容 追加された内容
m Dragoniez がページ「利用者:Dragoniez/Vandal Reporter.js」を「利用者:Dragoniez/AN Reporter.js」に移動しました |
m v1.4 - 名称変更に伴う軽微な修正 |
||
1行目:
/*************************************
*
* Author: Dragoniez
* Version: 1.
**************************************/
//<nowiki>
15行目:
// Add VR tab
$(mw.util.addPortletLink('p-cactions', '#', '報告', 'ca-
.click(function(e){
37行目:
// Sections on WP:AN/I
var sectionsI =
` <label for="
` <select id="
` <option selected disabled hidden>選択してください</option>` +
` <option>${getSectionI()}</option>` +
49行目:
// Sections on WP:AN/S
var sectionsS =
` <label for="
` <input id ="
` <datalist id="
` <optgroup label="系列が立てられていないもの">` +
` <option>著作権侵害・犯罪予告</option>` +
177行目:
// Username input
var userHtml =
// <div class="
` <div id="
` <label id="
` <input id="
` <select disabled id="
` <option class="
` <option class="
` <option class="
` <option class="
` <option class="
` <option selected class="
` </select>` +
` </div>` +
` <div id="
` <label class="
` <input type="checkbox" id="
` <label id="
` </div>` +
` <div id="
` <label id="
` <a id="
` </div>`;
// </div>
203行目:
// The whole html contour
var modalHtml =
// <div class="
` <div class="
` <h2>利用者を報告</h2>` +
` </div>` +
` <div class="
` <form>` +
` <div class="
` <label for="
` <select id="
` <option selected disabled hidden>選択してください</option>` +
` <option>${ANI}</option>` +
217行目:
` <option>${AN3RR}</option>` +
` </select>` +
` <div class="
` <label class="
` <a id="
` </div>` +
` </div>` +
` <div class="
// sectionsX +
` </div>` +
` <div class="
userHtml +
` <div class="
` <button type="button" class="
` </div>` +
` </div>` +
` <div class="
` <label for="
` <textarea id="
` </div>` +
` <div class="
` <input id="
` <label for="
` <textarea id="
` </div>` +
` </form>` +
245行目:
// Add the frame div to the page
$('body').append($('<div class="
// Create html elements inside the div
$('.
// Show dialog
$('.
'minHeight': 50,
'minWidth': 300,
264行目:
username = '';
}
$('#
typeDropdown('#
if (username === mw.config.get('wgRelevantUserName') && !mw.util.isIPAddress(username, true)) {
$('#
}
281行目:
var types = [];
for (let i = 1; i < Infinity; i++) { // Loop through all inputs
if ($(`#
break; // exit for
} else { // if selector is found
if (trimA($(`#
users.push(trimA($(`#
types.push($(`#
}
}
292行目:
// Get the name of the section to edit
var pageToEdit = $('#
var sectionToEdit;
if (pageToEdit === ANI) {
sectionToEdit = $('#
} else if (pageToEdit === ANS) {
sectionToEdit = $('#
} else if (pageToEdit === AN3RR) {
sectionToEdit = '3RR';
305行目:
pageToEdit === '選択してください' || // The page dropdown's remained 選択してください
sectionToEdit === undefined || // The section dropdown's remained 選択してください
trimA($('#
users.length === 0 // No username is given
) {
318行目:
$dialog.dialog('option', 'width', width);
$dialog.dialog({'buttons': [] }); // Hide the button
$dialog.append($('<p class="
// Get UserAN information
const UserAN = '{{UserAN|t=TYPE|USER}}';
var reason = trimA($('#
const scriptAd = ' ([[User:Dragoniez/
const editSummarySection = '/*' + sectionToEdit + '*/';
var editSummary =
trimA($('#
genEditSummary() + scriptAd:
trimA($('#
// If reason doesn't contain signature, add one
366行目:
// Show the details of the error
$('.
msgDone =
426行目:
if(result && result.edit && result.edit.result == 'Success') {
$('.
$dialog.append($(`<p>報告が完了しました</p>`));
$dialog.dialog('option', 'width', width);
435行目:
// Show the details of the error
$('.
msgDone =
460行目:
// Show message
$('.
msgDone =
482行目:
} else { // If the page doesn't exist
$('.
msgDone =
504行目:
} else { // If page info retrieval fails
$('.
msgDone =
531行目:
// Reset dialog when closed
$('.
$(this).remove();
});
// Dynamically change the content of the section dropdown depending the value selected in '報告先'
$(document).on('change', '#
var selectedTar = $(this).children('option').filter(':selected').text();
switch(selectedTar) {
case ANI:
$('.
$('.
$('.
$('.
$('#
break;
case ANS:
$('.
$('.
$('.
$('.
$('#
break;
case AN3RR:
$('.
$('.
$('.
$('#
break;
}
563行目:
// Dynamically change the display of the form depending on the UserAN type
$(document).on('change','.
var selectID = '#' + e.target.id;
599行目:
// When username is typed in, change dropdown options for UserAN types
$(document).on('input', '.
var inputID = '#' + e.target.id; // #
var selectID = '#' + e.target.id.replace('input', 'select'); // #
typeDropdown(inputID, selectID);
resetDropdown(inputID, selectID);
610行目:
// When 'hide username' is clicked, get logid, change dropdown options, show href and so on
var objLogid = {};
$(document).on('change', '.
var checkboxID = '#' + e.target.id; // #
var selectID = checkboxID.replace('checkbox', 'select'); // #
var inputID = checkboxID.replace('checkbox', 'input'); // #
var inputVal = trimA($(inputID).val());
var aID = checkboxID.replace('checkbox', 'a');
623行目:
// Function to update type dropdown
var updateDropdown = function(logid) {
$(selectID).children('.
$(selectID).children('.
$(selectID).children('.
$(selectID).children('.
$(selectID).children('.
$(selectID).children('.
$(aDivID).css('display', 'block');
$(aID).attr('href', url + 'Special:redirect/logid/' + logid).text('特別:転送/logid/' + logid);
679行目:
$(inputID).val(objLogid[inputVal]); // if the object knows the username for the logid, retrieve the data
$(selectID).children('.
$(selectID).children('.
$(selectID).children('.
$(selectID).children('.
$(selectID).children('.
$(selectID).children('.
$(aDivID).css('display', 'none');
701行目:
// When the 'add' button is hit, add another input layer
var userCnt = 1;
$('.
userCnt++;
userHtml = userHtml.replaceAll(`${userCnt-1}-`, `${userCnt}-`); // 1 → 2, 2 → 3 and so forth
$('.
$(`#
});
// When the summary checkbox is (un)checked
$('#
var $textarea = $('#
if ($(this).is(':checked')) { // Box is checked
766行目:
while (inputRemains) {
if ($(`#
inputRemains = false; // No inputs remain to be checked
} else {
type = $(`#
reportee = trimA($(`#
if (reportee !== '') { // Skip if the input value is a null string
902行目:
if (mw.util.isIPAddress(tarVal, true)) { // if IP
$(selectID).children('.
$(selectID).children('.
$(selectID).children('.
$(selectID).children('.
$(selectID).children('.
$(selectID).children('.
$(checkboxDivID).css('display', 'none'); // hide 'hide username' checkbox
$(checkboxID).prop('checked', false); // uncheck the checkbox
913行目:
} else if (await userExists(tarVal)) { // if user
$(selectID).children('.
$(selectID).children('.
$(selectID).children('.
$(selectID).children('.
$(selectID).children('.
$(selectID).children('.
$(checkboxDivID).css('display', 'block'); // show 'hide username' checkbox
$(checkboxID).prop('checked', false); // uncheck the checkbox
924行目:
} else { // if something else (like random numbers or strings)
$(selectID).children('.
$(selectID).children('.
$(selectID).children('.
$(selectID).children('.
$(selectID).children('.
if (setNone) {
$(selectID).children('.
} else {
$(selectID).children('.
}
$(checkboxDivID).css('display', 'none'); // hide 'hide username' checkbox
951行目:
if (trimA($(inputID).val()) === '') {
$(selectID).children('.
$(checkboxDivID).css('display', 'none');
$(aDivID).css('display', 'none');
|