משתמש:רובין בוט/קטגוריות מבוקשות.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: 8 */
/* jshint esversion: 5 */
mw.loader.using(["mediawiki.api", "ext.gadget.mw-import", "oojs-ui-windows"]).then(async () => {
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)
   ) {
   ) {
     const num = prompt("כמה קטגוריות לקבל?");
     var num = prompt("כמה קטגוריות לקבל?");
     if (!num) return;
     if (!num) return;
     const api = new mw.Api();
     var api = new mw.Api();
     const importer = new mw.import();
     var importer = new mw.import();
     const queryParams = {
     var queryParams = {
       list: "querypage",
       list: "querypage",
       qppage: "Wantedcategories",
       qppage: "Wantedcategories",
       qplimit: num,
       qplimit: num
     };
     };
     const { query } = await api.get(queryParams);
     api.get(queryParams).done(function (data) {
    if (!query) {
      if (!data || !data.query) {
      console.log("no response");
        console.log("no response");
      return;
        return;
    }
      }
    for (const cat of query.querypage.results) {
      var results = data.query.querypage.results || [];
       try {
       results.forEach(function (cat) {
         const { text, summary } = await importer.importWikitext({ page: cat.title });
         importer.importWikitext({ page: cat.title }).done(function (res) {
        if (text) {
          var text = res.text;
          const elementText = $(`<div class="cdx-message" aria-live="polite"><div class="cdx-message__content">${text}</div></div>`);
          var summary = res.summary;
          const confirmd = await OO.ui.confirm(elementText, {title: "תוכן הקטגוריה בחב\"דפדיה});
          if (text) {
          if (confirmd) {
            var elementText = $('<div class="cdx-message" aria-live="polite"><div class="cdx-message__content">' + text + '</div></div>');
            await api.postWithEditToken({
            OO.ui.confirm(elementText, {title: "תוכן הקטגוריה בחב\"דפדיה"}).done(function (confirmd) {
              action: "edit",
              if (confirmd) {
              format: "json",
                api.postWithEditToken({
              bot: true,
                  action: "edit",
              title: cat.title,
                  format: "json",
              text,
                  bot: true,
              summary: summary,
                  title: cat.title,
            }).then(d => console.log(d));
                  text: text,
 
                  summary: summary
                }).done(function (d) {
                  console.log(d);
                });
              }
            });
           }
           }
         }
         }).fail(function (error) {
      } catch (error) {
          console.error(error);
        console.error(error);
        });
       }
       });
     }
     });
 
   }
   }
})
});

תפריט ניווט