「利用者:Dragoniez/scripts/AN Reporter.js」の版間の差分
削除された内容 追加された内容
タグ: 取り消し |
v4.5 (修正版): 定型文報告機能の追加 |
||
2行目:
* AN Reporter (ANR)
* Author: Dragoniez
* Version: 4.
*************************************/
//<nowiki>
336行目:
const modalHtml =
`<div class="anr-modal-dialog" title="AN Reporter" style="max-height: 80vh;">` +
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
//
`
`
userHtml +
`
`
`
`
`
`
`
` <option selected>定型文を使用する場合は選択してください</
`
`
`
`
` <textarea id="anr-reason-text" rows="6" style="width: 100%"></
` </div>` +
` <div class="anr- `
`
` <textarea id="anr-summary-text" rows="3" style="width: 100%; display: none;"><
`
`
` <
` <label for="anr-blockstatus-checkbox">報告前にブロック状態をチェック</
` <
` <input checked id="anr-duplicatereport-checkbox" type="checkbox">` +
` <label for="anr-duplicatereport-checkbox">報告前に重複報告をチェック</label>` +
` </div>` +▼
` </form>` +
` </div>` +
`</div>`;
408 ⟶ 414行目:
function initializeDialog(){
//
// Show VIP list
470 ⟶ 476行目:
}
/
* Function to change the CSS of the dialog and to get predifined reasons
function dialogCSS() {▼
* @param {Boolean} getPredifinedReasons Get fixed reasons from the user's common.js
* @returns
*/
// CSS for the dialog
$('.ui-dialog-content, .ui-dialog-buttonpane, .ui-corner-all, .ui-draggable, .ui-resizable').css('background', '#FFF0E4');
$('.ui-button').css({
479 ⟶ 491行目:
$('.ui-dialog-titlebar, .ui-dialog-titlebar-close').attr('style', 'background: #FEC493 !important;');
$('.ui-dialog').css('font-size', fSize);
// Show the select div for predefined report reasons if they're predefined
if (!getPredifinedReasons) return; // If the parameter is not true, don't run the code below
if (typeof anrPredefinedReasons !== 'undefined') { // If the user has fixed reasons prepared
if (Array.isArray(anrPredefinedReasons)) { // If the fixed reasons are prepared as an array
if (anrPredefinedReasons.length === 0) return;
const $reasons = $('#anr-predefinedreasons-select');
$reasons.css('width', $('#anr-target-options').width()).select2();
let reasonsArr = [];
for (let i = 0; i < anrPredefinedReasons.length; i++) {
reasonsArr.push(`<option>${anrPredefinedReasons[i]}</option>`);
}
$reasons.append(reasonsArr.join(''));
$('.anr-predefinedreasons-div').css('display', 'block');
} else { // If the fixed reasons are NOT prepared as an array
alert('エラー: common.js内の定型文の変数定義が不正です。配列 "[理由1, 理由2...]" 形式で指定してください。');
}
}
}
528 ⟶ 564行目:
` <button type="button" class="anr-viplist-btn" style="${btnCSS}">コピー</button>` +
'</div>';
$('.anr-
$('#anr-viplist-select').select2();
resolve();
638 ⟶ 674行目:
let sectionToEdit = '選択してください';
const ANSOptSelected = $('#anr-section-options-s').find('option').filter(':selected').text();
let fixedReason = $('#anr-predefinedreasons-select').find('option').filter(':selected').text();
let reportToANS = false;
683 ⟶ 720行目:
}
// The reason of the report
fixedReason = fixedReason === '定型文を使用する場合は選択してください' ? '': fixedReason;
let reason = fixedReason + $('#anr-reason-text').val().trim2();▼
// Check if necessary fields are filled
688 ⟶ 729行目:
pageToEdit === '選択してください' || // The page dropdown's remained 選択してください
sectionToEdit === '選択してください' || // The section dropdown's remained 選択してください
users.length === 0 // No username is given
) {
rqFieldsEmpty = true;
}
//
▲ let reason = $('#anr-reason-text').val().trim2();
reason = reason + '--~~~~';
}
711 ⟶ 750行目:
// Get text to add to the page
let textToSubmit = '';
const UserAN = '{{UserAN|t=TYPE|USER}}';
if (users.length < 2) { // If user to report is just one
textToSubmit = '\* ' + UserAN.replaceAll2('TYPE', types[0], 'USER', users[0]) + ' - ' + reason;
791 ⟶ 831行目:
'open': async function(){
//
// Convert text on the dialog to html
1,689 ⟶ 1,729行目:
'open': async function(){
//
// Convert the wikitext to an html form
2,032 ⟶ 2,072行目:
$('.anr-section-div').append(sectionsI);
$('#anr-section-options-i-date').text(getSectionI(false));
$('#anr-section-options-i').css({'width': $(this).width()});
$('.anr-section-div').css('display', 'block');
$('.anr-target-pagelink-div').css('display', 'block');
|