משתמש:רובין בוט/קטגוריות מבוקשות.js: הבדלים בין גרסאות בדף
קפיצה לניווט
קפיצה לחיפוש
(יצירת דף עם התוכן "←jshint esversion: 8: mw.loader.using(["mediawiki.api", "ext.gadget.mw-import", "oojs-ui-windows"]).then(async () => { if ( mw.config.get("wgPageName") == "מיוחד:קטגוריות_מבוקשות" && (mw.config.get("wgUserGroups").indexOf("bot") !== -1 || mw.config.get("wgUserId") === 4436) ) { const num = prompt("כמה קטגוריות לקבל?"); if (!num) return; const api = new mw.Api(); const importer = new mw...") |
(אין הבדלים)
|
גרסה מ־12:56, 4 בספטמבר 2025
/* jshint esversion: 8 */
mw.loader.using(["mediawiki.api", "ext.gadget.mw-import", "oojs-ui-windows"]).then(async () => {
if (
mw.config.get("wgPageName") == "מיוחד:קטגוריות_מבוקשות" &&
(mw.config.get("wgUserGroups").indexOf("bot") !== -1 ||
mw.config.get("wgUserId") === 4436)
) {
const num = prompt("כמה קטגוריות לקבל?");
if (!num) return;
const api = new mw.Api();
const importer = new mw.import();
const queryParams = {
list: "querypage",
qppage: "Wantedcategories",
qplimit: num,
};
const { query } = await api.get(queryParams);
if (!query) {
console.log("no response");
return;
}
for (const cat of query.querypage.results) {
try {
const { text, summary } = await importer.importWikitext({ page: cat.title });
if (text) {
const elementText = $(`<div class="cdx-message" aria-live="polite"><div class="cdx-message__content">${text}</div></div>`);
const confirmd = await OO.ui.confirm(elementText, {title: "תוכן הקטגוריה בחב\"דפדיה});
if (confirmd) {
await api.postWithEditToken({
action: "edit",
format: "json",
bot: true,
title: cat.title,
text,
summary: summary,
}).then(d => console.log(d));
}
}
} catch (error) {
console.error(error);
}
}
}
})