「利用者:Dragoniez/scripts/AN Reporter.js」の版間の差分

削除された内容 追加された内容
m v4.6.1: 前回と同様、またAPIのコードがいじられたような挙動を確認したため対応
v4.7: 予告通り、LTAの名称はAPIから取得する方式に変更 (ANR-R008)
2行目:
* AN Reporter (ANR)
* Author: Dragoniez
* Version: 4.6.17
*************************************/
//<nowiki>
72行目:
var scriptAd = ' ([[User:Dragoniez/AN Reporter|AN Reporter]])';
}
if (debugMode.portletLink) {
var portletLinkText = '報告β';
} else {
var portletLinkText = '報告';
}
 
// Skin-dependent options
178行目:
const KIYOSHIMA = 'Wikipedia:管理者伝言板/投稿ブロック/清島達郎';
const SHINJU = 'Wikipedia:管理者伝言板/投稿ブロック/真珠王子';
 
// Sections on WP:AN/I
const sectionsI =
//<div class="anr-section-div">
` <label for="anr-section-options-i" style="${labelCSS}">節</label>` +
` <select id="anr-section-options-i" style="${siCSS}">` +
` <option selected disabled hidden>選択してください</option>` +
` <option id="anr-section-options-i-date"></option>` +
` <option>不適切な利用者名</option>` +
` <option>公開アカウント</option>` +
` <option>公開プロキシ・ゾンビマシン・ボット・不特定多数</option>` +
` <option>犯罪行為またはその疑いのある投稿</option>` +
` </select>`;
//</div>
// Sections on WP:AN/S
const sectionsS =
//<div class="anr-section-div">
` <label for="anr-section-options-s" style="${labelCSS}">名称</label>` +
` <select id="anr-section-options-s" style="${siCSS}">` +
` <option selected disabled hidden>選択してください</option>` +
` <optgroup label="系列が立てられていないもの">` +
` <option>著作権侵害・犯罪予告</option>` +
` <option>名誉毀損・なりすまし・個人情報</option>` +
` <option>妨害編集・いたずら</option>` +
` <option>その他</option>` +
` </optgroup>` +
` <optgroup label="LTA">` +
` <option>声優・特撮関連荒らし系 (203)</option>` +
` <option>Audia3sb系 (3SB)</option>` +
` <option>愛知@nifty荒らし系(AICHI)</option>` +
` <option>愛の氷系 (AINO)</option>` +
` <option>秋田ぷらら可変IP系(AKITAPLALA)</option>` +
` <option>Akoyano系 (AKY)</option>` +
` <option>Asaklira系(ASA)</option>` +
` <option>麻原英太系 (ASACOV)</option>` +
` <option>アジアンビ系 (ASIANB)</option>` +
` <option>Bulut系 (Asperger、ASPE)</option>` +
` <option>백돌系(BAEG)</option>` +
` <option>ぼかんてぃん系(BOQ)</option>` +
` <option>ブリッ系 (BUR)</option>` +
` <option>Bz.i.yqs系(BZIYQS)</option>` +
` <option>中央アジア史サブスタブ濫造系(CASTUB)</option>` +
` <option>ダルメーター系(DARU)</option>` +
` <option>X-enon147系 (DOI)</option>` +
` <option>ドラえもん・ギャンブル関連のIP系(DORA)</option>` +
` <option>Ellsiemall系 (ELLS)</option>` +
` <option>イギリス可変IP系(ENS)</option>` +
` <option>放送局・送信所の記事で荒らしを行うIP(EOHS)</option>` +
` <option>EricNeedles3系 (ERIC3)</option>` +
` <option>IUCNレッドリスト関連荒らし系(FRL)</option>` +
` <option>Gamui系 (GAMUI)</option>` +
` <option>極楽サタン系 (GOKURAKU)</option>` +
` <option>Gordon S系(GORDON)</option>` +
` <option>Greaseno系 (GREA)</option>` +
` <option>Grimm系 (GRIMM)</option>` +
` <option>はー先輩系 (HAASEN)</option>` +
` <option>HAT系 (HAT)</option>` +
` <option>ヒースロー系 (HEATHROW)</option>` +
` <option>おぉたむすねィく探検隊系(HEBI)</option>` +
` <option>Hero123系 (HERO123)</option>` +
` <option>Hightechodap系 (HGTCHDP)</option>` +
` <option>Iccic系 (Iccic)</option>` + // Has an independent page
` <option>池沼ガイジ系 (IKE)</option>` +
` <option>いせちか系 (ISECHIKA)</option>` + // Has an independent page
` <option>天体名プロジェクト系(JANNET)</option>` +
` <option>Jj9系 (JJ9)</option>` +
` <option>課代さん系(KADAI)</option>` +
` <option>影武者系(KAGE)</option>` + // Has an independent page
` <option>かめでぃー系(KAMEDY)</option>` +
` <option>かなべえコバトン系 (KANAKOBA)</option>` +
` <option>Nbckfkh系(KFKH)</option>` +
` <option>清島達郎系 (清島、KIYOSHIMA)</option>` + // Has an independent page
` <option>木崎妃系 (KIZAKI)</option>` +
` <option>韓国KT系 (KKT)</option>` +
` <option>Masato Koizumi系(KOIZUMI、M.K.)</option>` +
` <option>Konbudon系(KONBU)</option>` +
` <option>テレビ局関連記事を荒らす韓国IP系(KORTV)</option>` +
` <option>久保帯人関連荒らし系 (KUBOREL)</option>` +
` <option>M21系 (M21)</option>` +
` <option>MASA系 (Mr.ちゅらさん、CHURASAN、MASA)</option>` +
` <option>マヤオ系 (MAYAO)</option>` +
` <option>Mikihisa系(MIKI)</option>` +
` <option>Milky palace系 (Milky)</option>` +
` <option>水戸ソフトバンク可変IP系 (MITO)</option>` +
` <option>猛烈な勢いで赤リンクを無差別除去するアカウント群系(MOUAKA)</option>` +
` <option>MShared系 (MShared)</option>` +
` <option>名取の納豆系(NATO)</option>` +
` <option>Die ndbtk系 (NDBTK)</option>` +
` <option>NoSaito・みそかつおにんにく系 (NMT)</option>` +
` <option>NODA系 (NODA)</option>` +
` <option>Notsu (NOTSU)</option>` +
` <option>カテゴリ・リダイレクト・サブスタブ濫造を行うIP系(NTTPC)</option>` +
` <option>(内部リンク除去)大阪ZAQ可変IP系(OSAKAZAQ)</option>` +
` <option>親子他人丼系(OYAKO)</option>` +
` <option>Pingpongpang (PPP)</option>` +
` <option>川野名 倫系(RIN、DEARU)</option>` +
` <option>さんさんさんさん系 (SAN)</option>` +
` <option>詐称コピペ系 (SASHO)</option>` +
` <option>沙耶奈系(SAYANA)</option>` +
` <option>整数関連荒らしIP系 (SEISU)</option>` +
` <option>荒らし自己差し戻しIP系 (SELFREVERT)</option>` +
` <option>真珠王子系(SHINJU)</option>` + // Has an independent page
` <option>すらいむさん系(SLIME)</option>` +
` <option>新川温泉系 (SNKW)</option>` +
` <option>ソウ系(SOH)</option>` +
` <option>埼玉楽天モバイルIP系 (STRM)</option>` +
` <option>相撲関係虚構記事作成荒らし系 (SUMOSONG)</option>` +
` <option>Suzukitaro系 (ツバル、SUZU)</option>` +
` <option>Syun respect for music系 (SYUN)</option>` +
` <option>涼宮ハルヒ20062009系 (SZMY)</option>` +
` <option>TANS系 (TANS)</option>` +
` <option>ゼロタロス系 (TAROSU)</option>` +
` <option>多摩ケーブルネットワークIP系 (T-NET)</option>` +
` <option>若いナマケモノは不要系(WAK)</option>` +
` <option>ホワイト・ジャック系 (カダフィ元帥、WHITE)</option>` +
` <option>Wpcon abuse系 (WPCON)</option>` +
` <option>Yanajin33系(YAN)</option>` +
` <option>揶揄リダイレクト作成荒らし系(YAYURE)</option>` +
` <option>黄色関係のIP系 (YELLOW)</option>` +
` <option>Yqm系(YQM)</option>` +
` <option>隊士蘭堂系</option>` +
` </optgroup>` +
` </select>`;
//</div>
// Username input
let userHtml =
355 ⟶ 230行目:
` </div>` +
` </div>` +
` <div class="anr-section-i-div" style="${marginCSS} display: none;">` +
//` sectionsX <label for="anr-section-i-select" style="${labelCSS}">節</label>` +
` <select id="anr-section-i-select" style="${siCSS}">` +
` <option selected disabled hidden class="anr-section-options-initial">選択してください</option>` +
` <option id="anr-section-i-options-date"></option>` +
` <option>不適切な利用者名</option>` +
` <option>公開アカウント</option>` +
` <option>公開プロキシ・ゾンビマシン・ボット・不特定多数</option>` +
` <option>犯罪行為またはその疑いのある投稿</option>` +
` </select>` +
` </div>` +
` <div class="anr-section-s-div" style="${marginCSS} display: none;">` +
` <label for="anr-section-s-select" style="${labelCSS}">名称</label>` +
` <select id="anr-section-s-select" style="${siCSS}">` +
` <option selected disabled hidden class="anr-section-options-initial">選択してください</option>` +
` <optgroup label="系列が立てられていないもの">` +
` <option>著作権侵害・犯罪予告</option>` +
` <option>名誉毀損・なりすまし・個人情報</option>` +
` <option>妨害編集・いたずら</option>` +
` <option>その他</option>` +
` </optgroup>` +
` <optgroup id="anr-section-s-lta" label="LTA">` +
// getSectionsS()
` </optgroup>` +
` </select>` +
` </div>` +
` <div class="anr-user-div" style="${marginCSS}">` +
414 ⟶ 312行目:
// Function to initialze the modal dialog
function initializeDialog(){
 
// Get sections on WP:AN/S
getSectionsS();
 
// Initialize the design of the dialog
dialogDesigndialogCSS(true);
// Show VIP list
VIPList();
 
// Show the select box for predefined reasons if they're predefined by the user
getPredefinedReasons();
 
// Initialize variables
475 ⟶ 379行目:
}
 
}
 
// Function to get sections on WP:AN/S from the API
function getSectionsS() {
new mw.Api().get({
'action': 'parse',
'page': ANS,
'prop': 'sections',
'formatversion': 2
}).then(function(res){
 
if (res && res.parse) {
 
// Get VIP's names
const sectionInfo = res.parse.sections;
const excludeList = [
'系列が立てられていないもの',
'著作権侵害・犯罪予告',
'名誉毀損・なりすまし・個人情報',
'妨害編集・いたずら',
'その他',
'A. 最優先',
'暫定A',
'休止中A',
'B. 優先度高',
'暫定B',
'休止中B',
'C. 優先度中',
'暫定C',
'休止中C',
'D. 優先度低',
'暫定D',
'休止中D',
'N. 未分類',
'サブページなし',
'休止中N'
];
let sectionList = [];
for (let i = 0; i < sectionInfo.length; i++) {
if (!isInArray(sectionInfo[i].line, excludeList) && sectionInfo[i].index.indexOf('T') === -1) {
sectionList.push(`<option>${sectionInfo[i].line}</option>`);
}
}
 
$('#anr-section-s-lta').append(sectionList.join(''));
 
} else {
alert('WP:AN/Sのセクションリストを取得できませんでした。ダイアログを開き直すと改善する場合があります。');
}
 
}).catch(function(){
alert('WP:AN/Sのセクションリストを取得できませんでした。ダイアログを開き直すと改善する場合があります。');
});
}
// Function to change the CSS of the dialog and to get predifined reasons
/**
function dialogCSS() {
* Function to change the CSS of the dialog and to get predifined reasons
* @param {Boolean} getPredifinedReasons Get fixed reasons from the user's common.js
* @returns
*/
function dialogDesign(getPredifinedReasons) {
 
// CSS for the dialog
493 ⟶ 446行目:
$('.ui-dialog').css('font-size', fSize);
 
}

// ShowFunction to show the select div for predefined report reasons if they're predefined
function getPredefinedReasons() {
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
 
514 ⟶ 469行目:
alert('エラー: common.js内の定型文の変数定義が不正です。配列 "[理由1, 理由2...]" 形式で指定してください。');
}
 
}
}
561 ⟶ 516行目:
' <select id="anr-viplist-select">' +
' <option selected disabled hidden>[[Wikipedia:進行中の荒らし行為]]を検索</option>' +
vipList.join('') +
' </select>' +
` <button type="button" class="anr-viplist-btn" style="${btnCSS}">コピー</button>` +
673 ⟶ 628行目:
// Get the name of the section to edit
let pageToEdit = $('#anr-target-options').children('option').filter(':selected').text();
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;
680 ⟶ 634行目:
if (pageToEdit === ANI) { // If WP:AN/I is selected as the target page to edit
 
sectionToEdit = $('#anr-section-options-i-select').children('option').filter(':selected').text();
 
// Update the target section for cases in which the date has changed since the date-dependent section was chosen
if (sectionToEdit.match(/^\d{4}年\d{1,2}月\d{1,2}日 - \d{1,2}日新規報告$/) !== null) {
sectionToEdit = getSectionI(false);
$('#anr-section-options-i-options-date').text(getSectionI(false));
}
 
691 ⟶ 645行目:
 
reportToANS = true;
const ANSOptSelected = $('#anr-section-s-select').find('option').filter(':selected').text();
switch(ANSOptSelected) {
case 'Iccic系 (Iccic)':
722 ⟶ 677行目:
}
// The reason of the report
fixedReason = fixedReason === '定型文を使用する場合は選択してください' ? '': fixedReason;
let reason = fixedReason + $('#anr-reason-text').val().trim2();
833 ⟶ 788行目:
 
// Initialize the design of the dialog
dialogDesigndialogCSS(false);
 
// Convert text on the dialog to html
1,735 ⟶ 1,690行目:
 
// Initialize the design of the dialog
dialogDesigndialogCSS(false);
 
// Convert the wikitext to an html form
2,072 ⟶ 2,027行目:
$(document).off('change', '#anr-target-options').on('change', '#anr-target-options', function(){
const selectedTar = $(this).children('option').filter(':selected').text();
$('.anr-section-options-initial').prop('selected', true); // Reset the dropdown value
switch(selectedTar) {
case ANI:
$('.anr-section-i-div').emptycss('display', 'block');
$('.anr-section-s-div').appendcss(sectionsI'display', 'none');
$('#anr-section-options-i-options-date').text(getSectionI(false));
$('#anr-section-options-i-select').css({'width': $(this).width()});
$('.anr-section-div').css('display', 'block');
$('.anr-target-pagelink-div').css('display', 'block');
$('#anr-target-pagelink').attr('href', mw.util.getUrl(ANI));
break;
case ANS:
$('.anr-section-i-div').emptycss('display', 'none');
$('.anr-section-s-div').appendcss(sectionsS'display', 'block');
$('#anr-section-options-s-select').select2({'width': $(this).width()});
//$('#select2-anr-section-options-s-select-container').attr('style', rlsCSS);
$('.anr-section-div').css('display', 'block');
$('.anr-target-pagelink-div').css('display', 'block');
$('#anr-target-pagelink').attr('href', mw.util.getUrl(ANS));
break;
case AN3RR:
$('.anr-section-i-div').emptycss('display', 'none');
$('.anr-section-s-div').css('display', 'none');
$('.anr-target-pagelink-div').css('display', 'block');
$('#anr-target-pagelink').attr('href', mw.util.getUrl(AN3RR));
2,101 ⟶ 2,055行目:
 
// Add section name to the '報告先' link when section is specified
$(document).off('change', '#anr-section-options-i-select, #anr-section-options-s-select')
.on('change', '#anr-section-options-i-select, #anr-section-options-s-select', function(){
let tarSection = '';
let tarPage = '';
if ($(this).attr('id') === 'anr-section-options-i-select') {
tarPage = ANI;
} else if ($(this).attr('id') === 'anr-section-options-s-select') {
tarPage = ANS;
}
2,629 ⟶ 2,583行目:
} else {
resolve(res.query.logevents[0].logid);
}
});
});