「User:Irukaza/js/queryWhatlinkshere.js」:修訂間差異

無編輯摘要
imported>=海豚=
無編輯摘要
imported>=海豚=
無編輯摘要
第12行: 第12行:
    const upperFirstCase = (s) => /^[a-z]/.test(s) ? s.substring(0, 1).toUpperCase() + s.substring(1) : s;
    const upperFirstCase = (s) => /^[a-z]/.test(s) ? s.substring(0, 1).toUpperCase() + s.substring(1) : s;
    const api = new mw.Api();
    const api = new mw.Api();
    const p = $('<fieldset><legend>链入情况</legend><p id="queryWhatlinkshere"> ……</p></fieldset>').insertAfter("#mw-content-text > form").find("#queryWhatlinkshere");
    const p = $('<fieldset><legend>链入情况</legend><p id="queryWhatlinkshere">......</p></fieldset>').insertAfter("#mw-content-text > form").find("#queryWhatlinkshere");
    const list = await (async () => {
    const list = await (async () => {
      const result = [];
      const result = [];
第32行: 第32行:
          lhcontinue = eol;
          lhcontinue = eol;
        }
        }
     result.push(...(Object.values(_result.query.pages)[0].linkshere || []));
       result.push(...Object.entries(_result.query.pages)[0][1].linkshere);
      }
      }
      return result;
      return result;
第93行: 第93行:
    };
    };
    const global = { redirect: 0 };
    const global = { redirect: 0 };
    p.text(`共有${list.length}个页面含有到本页面的站内链接,其中有${list.filter((item) => "redirect" in item).length}个重定向页面。`);
    p.text(`共有${list.length}个页面含有到本页面的站内链接,其中有${list.filter((item) => "redirect" in item).length}个重定向页面。按名字空间划分如下:`);
    if (list.length > 0) { p.append(" 按名字空间划分如下:"); }
    const ul = $("<ul/>");
    const ul = $("<ul/>");
    list.forEach((item) => {
    list.forEach((item) => {
匿名用戶