משתמש:רובין בוט/קטגוריות מבוקשות.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...") |
אין תקציר עריכה |
||
| שורה 1: | שורה 1: | ||
/* jshint esversion: | /* jshint esversion: 5 */ | ||
mw.loader.using(["mediawiki.api", "ext.gadget.mw-import", "oojs-ui-windows"]). | mw.loader.using(["mediawiki.api", "ext.gadget.mw-import", "oojs-ui-windows"]).done(function () { | ||
if ( | if ( | ||
mw.config.get("wgPageName") == "מיוחד:קטגוריות_מבוקשות" && | mw.config.get("wgPageName") === "מיוחד:קטגוריות_מבוקשות" && | ||
(mw.config.get("wgUserGroups").indexOf("bot") !== -1 || | (mw.config.get("wgUserGroups").indexOf("bot") !== -1 || | ||
mw.config.get("wgUserId") === 4436) | mw.config.get("wgUserId") === 4436) | ||
) { | ) { | ||
var num = prompt("כמה קטגוריות לקבל?"); | |||
if (!num) return; | if (!num) return; | ||
var api = new mw.Api(); | |||
var importer = new mw.import(); | |||
var queryParams = { | |||
list: "querypage", | list: "querypage", | ||
qppage: "Wantedcategories", | qppage: "Wantedcategories", | ||
qplimit: num | qplimit: num | ||
}; | }; | ||
api.get(queryParams).done(function (data) { | |||
if (!data || !data.query) { | |||
console.log("no response"); | |||
return; | |||
} | |||
var results = data.query.querypage.results || []; | |||
results.forEach(function (cat) { | |||
importer.importWikitext({ page: cat.title }).done(function (res) { | |||
var text = res.text; | |||
var summary = res.summary; | |||
if (text) { | |||
var elementText = $('<div class="cdx-message" aria-live="polite"><div class="cdx-message__content">' + text + '</div></div>'); | |||
OO.ui.confirm(elementText, {title: "תוכן הקטגוריה בחב\"דפדיה"}).done(function (confirmd) { | |||
if (confirmd) { | |||
api.postWithEditToken({ | |||
action: "edit", | |||
format: "json", | |||
bot: true, | |||
title: cat.title, | |||
text: text, | |||
summary: summary | |||
}).done(function (d) { | |||
console.log(d); | |||
}); | |||
} | |||
}); | |||
} | } | ||
} | }).fail(function (error) { | ||
console.error(error); | |||
}); | |||
} | }); | ||
} | }); | ||
} | } | ||
}) | }); | ||
גרסה אחרונה מ־13:23, 4 בספטמבר 2025
/* jshint esversion: 5 */
mw.loader.using(["mediawiki.api", "ext.gadget.mw-import", "oojs-ui-windows"]).done(function () {
if (
mw.config.get("wgPageName") === "מיוחד:קטגוריות_מבוקשות" &&
(mw.config.get("wgUserGroups").indexOf("bot") !== -1 ||
mw.config.get("wgUserId") === 4436)
) {
var num = prompt("כמה קטגוריות לקבל?");
if (!num) return;
var api = new mw.Api();
var importer = new mw.import();
var queryParams = {
list: "querypage",
qppage: "Wantedcategories",
qplimit: num
};
api.get(queryParams).done(function (data) {
if (!data || !data.query) {
console.log("no response");
return;
}
var results = data.query.querypage.results || [];
results.forEach(function (cat) {
importer.importWikitext({ page: cat.title }).done(function (res) {
var text = res.text;
var summary = res.summary;
if (text) {
var elementText = $('<div class="cdx-message" aria-live="polite"><div class="cdx-message__content">' + text + '</div></div>');
OO.ui.confirm(elementText, {title: "תוכן הקטגוריה בחב\"דפדיה"}).done(function (confirmd) {
if (confirmd) {
api.postWithEditToken({
action: "edit",
format: "json",
bot: true,
title: cat.title,
text: text,
summary: summary
}).done(function (d) {
console.log(d);
});
}
});
}
}).fail(function (error) {
console.error(error);
});
});
});
}
});