User:Irukaza/js/editConflict.js:修订间差异

跳到导航 跳到搜索
删除2,640字节 、​ 2021年2月24日 (星期三)
无编辑摘要
imported>=海豚=
无编辑摘要
imported>=海豚=
无编辑摘要
第31行: 第31行:
              });
              });
              const pageid = Object.keys(result.query.pages)[0];
              const pageid = Object.keys(result.query.pages)[0];
             if (pageid > 0 && result.query.pages[pageid].revisions[0].revid > wgCurRevisionId) {
               wpSave.val("保存失败!");
               const pre = $("<pre/>", {
                 css: {
                   position: "absolute",
                   left: "-99999px",
                   "z-index": "-99999",
                 }
               });
               const textarea = $("#wpTextbox1");
               $("#copyCurrentRawCode").on("click", async () => {
                 await mw.loader.using('mediawiki.notification');
                 $("#mw-notification-area").css({
                   position: "fixed",
                   top: 0,
                 }).appendTo("body");
                 const selection = window.getSelection();
                 const rangeCount = selection.rangeCount;
                 let range;
                 if (rangeCount > 0) {
                   range = selection.getRangeAt(0);
                 }
                 pre.text(textarea.val());
                 selection.selectAllChildren(pre[0]);
                 document.execCommand("copy");
                 window.setTimeout(function() {
                   selection.removeAllRanges();
                   if (rangeCount > 0) {
                     selection.addRange(range);
                   }
                   pre.empty();
                 }, 0);
                 mw.notify("复制成功!");
               });
               $("#showNewestRevisionDiff").on("click", () => {
                 window.open(`${mw.config.get("wgServer")}${mw.config.get("wgScriptPath")}/index.php?diff=${result.query.pages[pageid].revisions[0].revid}`, "_blank").focus();
               });
               disable($("#wpPreview, #wpDiff").on("click", () => {
                 setTimeout(() => {
                   alert(conflictAlert);
                 }, 1);
                 return false;
               }).attr("title", conflictAlert));
             } else {
                wpSave.val("正在保存......");
                wpSave.val("正在保存......");
                editform.submit();
                editform.submit();
             }
              await mw.loader.using('mediawiki.notification');
              await mw.loader.using('mediawiki.notification');
              return;
              return;
匿名用户

导航菜单