「利用者:Dragoniez/scripts/AN Reporter.js」の版間の差分
削除された内容 追加された内容
v4.1: ANR-B002, ダイアログの表示バグの改善試行 |
v4.2: ウィキテキストからテンプレートを抽出する関数のマイナーバグを修正、コードのクリーンナップ |
||
2行目:
* AN Reporter (ANR)
* Author: Dragoniez
* Version: 4.
*************************************/
//<nowiki>
113行目:
let checkDuplicateReportsBeforeEdit = true;
// Add ANR tab ('報告β' when debugging)
$(mw.util.addPortletLink(btnPosition, '#', '報告', 'ca-anr', '管理者伝言板に利用者を報告', null, '#ca-move'))
.click(function(e){
159行目:
// Sections on WP:AN/I
//<div class="anr-section-div">
` <label for="anr-section-options-i" style="${labelCSS}">節</label>` +
173行目:
// Sections on WP:AN/S
//<div class="anr-section-div">
` <label for="anr-section-options-s" style="${labelCSS}">名称</label>` +
313行目:
// The whole html contour
`<div class="anr-modal-dialog" title="AN Reporter" style="max-height: 80vh;">` +
` <div class="anr-modal-header">` +
376行目:
'modal': true,
'position': { my: 'center', at: 'top', of: window },
'open':
'buttons': [{▼
'text': 'プレビュー',▼
'click': previewBtn▼
}, {▼
'text': '報告',▼
'click': reportBtn▼
}]▼
});▼
// ********** EVENT HANDLERS AND FUNCTIONS
dialogCSS();▼
// Show VIP list▼
VIPList();▼
// Function to initialze the modal
function
checkDuplicateReportsBeforeEdit = true;▼
/* NOTE: The value of Logids is inherited from before reopening the dialog.▼
* If any bug is reported, consider resetting the variable here as well. */▼
checkBlockStatusBeforeEdit = true;
// Get the name
let
// Workaround to pick up IP
username = relUsername;▼
let relUsername = $('#firstHeading').text().replace('の投稿記録',
username = relUsername;
// Exit function if the current user is on his/her own page or username has remained undefined or null▼
▲ if (!username || username === mw.config.get('wgUserName')) {
return;▼
}
}▼
▲
if (!username || username === mw.config.get('wgUserName')) {
const inputID =
const selectID =
const
$(inputID).val(username); // Fill the input with the
▲ }
▲ 'buttons': [{
▲ 'text': 'プレビュー',
▲ 'click': previewBtn
▲ }, {
▲ 'text': '報告',
▲ 'click': reportBtn
▲ }]
▲ });
// Function to change the CSS of the dialog
1,097 ⟶ 1,095行目:
}
}
//console.log('The contents of each section:');
//console.log(sectionContent);
// Get all the reportees in the inputs, and if user, try to get logids
1,772 ⟶ 1,770行目:
const textSplit = text.split('{{');
let templates = [];
//console.log(textSplit);
/* Explanation
1,783 ⟶ 1,782行目:
} else { // If the text has some templates in it
let nest = []; // Array to store element numbers of the split segments that involving nested templates
for (let i = 1; i < textSplit.length; i++) { // Loop through all elements (but arr[0]) in the split array
1,791 ⟶ 1,792行目:
switch(true) {
case TLCloseCnt === 0: // If the split segment doesn't have any '}}' (= it nests another template)
nest.push(i); //
break;
1,821 ⟶ 1,822行目:
} else { // Nesting templates
let curSegSplit = textSplit[i].split('}}'); // Array of the current segment split by '}}'
temp = '{{' + textSplit
if (!isInArray(temp, templates)) {
templates.push(temp);
}
▲ /* Explanation
}
1,844 ⟶ 1,839行目:
default:
// Do nothing
}
}
1,852 ⟶ 1,847行目:
// Check if the optional parameter is specified
if (templateName !== undefined && templates.length !== 0) {
let templateRegExp = new RegExp(templateName, 'i');
for (let i = templates.length -1; i >= 0; i--) {
if (templates[i].split('|')[0].search(templateRegExp) === -1) { // If the array element doesn't contain the template name
templates.splice(i, 1); // Remove the element
}
2,644 ⟶ 2,639行目:
*/
function isInArray (el, arr) {
}
2,672 ⟶ 2,663行目:
*/
function userIsInGroup(group) {
}
2,692 ⟶ 2,679行目:
}
return false;
▲ return 0;
}
|