User:Bot doubleredirects/Gadget-DoubleRedirectFixer.js: Difference between revisions
No edit summary |
No edit summary |
||
| (5 intermediate revisions by the same user not shown) | |||
| Line 1: | Line 1: | ||
const BOT_USERS = [ | (() => { | ||
const BOT_USERS = [508]; | |||
const api = new mw.Api(); | const api = new mw.Api(); | ||
| Line 38: | Line 39: | ||
if (query?.pages) { | if (query?.pages) { | ||
const page = Object.values(query.pages)[0]; | const page = Object.values(query.pages)[0]; | ||
if (page.ns) { | if (page.ns !== undefined) { | ||
const namespacePrefixes = { | const namespacePrefixes = { | ||
4: " | 4: 'חב"דפדיה:', | ||
6: "קובץ:", | 6: "קובץ:", | ||
10: "תבנית:", | 10: "תבנית:", | ||
12: "עזרה:", | 12: "עזרה:", | ||
14: "קטגוריה:", | |||
}; | }; | ||
return namespacePrefixes[page.ns] ?? ""; | return namespacePrefixes[page.ns] ?? ""; | ||
| Line 56: | Line 58: | ||
action: "edit", | action: "edit", | ||
format: "json", | format: "json", | ||
bot: true, | bot: true, | ||
title: title, | title: title, | ||
text: `#הפניה [[${target}]]`, | text: `#הפניה [[${target}]]`, | ||
summary: "תיקון הפניה כפולה", | |||
}); | }); | ||
mw.notify(`\nstatus:${title} | mw.notify(`\nstatus:${title} success`); | ||
} catch (error) { | } catch (error) { | ||
console.error(error); | console.error(error); | ||