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; |