「利用者:Dragoniez/scripts/AN Reporter.js」の版間の差分
削除された内容 追加された内容
v2.1 | v2.2: 報告試行後のボタンの表示方法を変更 | ||
2行目: * AN Reporter (ANR) * Author: Dragoniez * Version: 2. *************************************/ //<nowiki> 396行目: // For debugging //pageToEdit = ' //editSummary = 'Test edit via mediawiki API'; // Get the wiki pagename for link var wikiPagename = pageToEdit + '#' + sectionToEdit; // Boolean value to pass to function when edit attempt is done // Get the latest revision 447 ⟶ 450行目: '<p style="color: MediumVioletRed">取得に失敗しました</p>' + '<p>指定されたセクションが見つかりませんでした</p>' + '<br>' + ▼ '<p>ページ名:</p>' + ▼ `<a href="${mw.util.getUrl(wikiPagename)}" target="_blank">${wikiPagename}</a>` +▼ '<br><br>' +▼ '<p>考えられる原因:</p>' + `<p>1. 編集先のページの節構成が変更された</p>` + 457 ⟶ 456行目: '<br>' + '<p>手動編集用:</p>' + `<textarea disabled rows=" '<br>' + '<p>要約:</p>' + 464 ⟶ 463行目: $dialog.dialog('option', 'width', width); editDone($dialog, editFailed, wikiPagename); } else { // If section title in the dropdown is found 521行目: 'に連絡をお願いします</p>' + '<br>' + '<p>ページ名:</p>' + ▼ '<br><br>' +▼ '<p>手動編集用:</p>' + `<textarea disabled rows=" '<br>' + '<p>要約:</p>' + 532 ⟶ 529行目: $dialog.dialog('option', 'width', width); return; 564 ⟶ 562行目: // If the edit was successful if (res4 && res4.edit && res4.edit.result == 'Success') { // Get diff▼ setTimeout(async function(){ var ▲ var diff; if (diffUrl !== undefined) {▼ // Show message $('.anr-editing').append($(`<p style="color: MediumSeaGreen">報告が完了しました $dialog.dialog('option', 'width', width); editDone($dialog, editFailed, wikiPagename, diffNum); }, 0); 588 ⟶ 579行目: '<p style="color: MediumVioletRed">報告に失敗しました</p>' + '<br>' + '<p>詳細:</p>' + `<p>${res4.error.info}</p>` + '<br>' + '<p>手動編集用:</p>' + `<textarea disabled rows=" '<br>' + '<p>要約:</p>' + 602 ⟶ 590行目: $dialog.dialog('option', 'width', width); // If unknown error occurs 611 ⟶ 600行目: '<p style="color: MediumVioletRed">不明なエラーが発生しました</p>' + '<br>' + '<p>手動編集用:</p>' + `<textarea disabled rows=" '<br>' + '<p>要約:</p>' + 622 ⟶ 608行目: $dialog.dialog('option', 'width', width); } 645 ⟶ 632行目: msgDone = '<p style="color: MediumVioletRed">エラー: '<br>' + '<p>ページ名:</p>' + ▼ '<br><br>' +▼ '<p>手動編集用:</p>' + `<textarea disabled rows=" '<br>' + '<p>要約:</p>' + 658 ⟶ 642行目: $dialog.dialog('option', 'width', width); editDone($dialog, editFailed, wikiPagename); } 673 ⟶ 658行目: '<p style="color: MediumVioletRed">取得に失敗しました</p>' + '<br>' + '<p>ページ名:</p>' + ▼ '<br><br>' +▼ '<p>手動編集用:</p>' + `<textarea disabled rows=" '<br>' + '<p>要約:</p>' + 684 ⟶ 666行目: $dialog.dialog('option', 'width', width); editDone($dialog, editFailed, wikiPagename); } } 914 ⟶ 897行目: // Action for when edit is done (in any way) function editDone($dialog, editFailed, wikiPagename, diffNum) { // // Button to jump var btns = var diffBtn, destBtn, closeBtn; if (diffNum !== undefined) { // Show the button only if diff number is available 'click': function(){ } curPage === AN3RR ||▼ curPage === '利用者:Dragoniez/test'▼ ▲ ) { location.reload(true);▼ ▲ } // Button to jump to the report page if (editFailed || mw.config.get('wgPageName') !== tarPage) { // Show the button if the edit failed or if the user is NOT on the page destBtn = { 'text': '報告先', 'click': function(){ ▲ } } btns.push(destBtn); } // Button to close the dialog (always shown) closeBtn = { 'text': '閉じる', 'click': function(){ var curPage = mw.config.get('wgPageName'); curPage === ANS || curPage === Iccic || curPage === ISECHIKA || curPage === KAGE || curPage === KIYOSHIMA || curPage === SHINJU || curPage === '利用者:Dragoniez/test2' ) { } } }; btns.push(closeBtn); // Show the button(s) on the dialog $dialog.dialog({ 'position': { my: 'center', at: 'top+20%', of: window }, 'buttons': btns }); 1,169 ⟶ 1,188行目: // Function to get diff number and its URL after edit async function return new Promise(function(resolve, reject) { new mw.Api().get({ 1,185 ⟶ 1,204行目: for (let i = 0; i < revArr.length; i++) { if (revArr[i].revisions[0].timestamp === curtimestamp) { resolve( } } }); |