Site Notice

hello, world

MediaWiki:Js-InPageEdit-v2.js

From Project-EPB Commons
Revision as of 20:12, 16 October 2019 by 机智的小鱼君 (talk | contribs) (Created page with "→‎* *『Wjghj Project Static』 * This _JavaScript_ code is from https://common.wjghj.cn * CC BY-NC-SA *: // Modal plugin mw.loader.load('https://common.wjghj.cn/js/SsiMo...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Invoke this: https://common.wjghj.cn/js/{{#replace:{{#replace:Js-InPageEdit-v2.js|Js-|}}|.js|}}

Note: After saving, you may have to bypass your browser's cache to see the changes.

  • Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
  • Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
  • Internet Explorer: Hold Ctrl while clicking Refresh, or press Ctrl-F5
  • Opera: Go to Menu → Settings (Opera → Preferences on a Mac) and then to Privacy & security → Clear browsing data → Cached images and files.
/**
 *『Wjghj Project Static』
 * This _JavaScript_ code is from https://common.wjghj.cn
 * CC BY-NC-SA
 **/
// Modal plugin
mw.loader.load('https://common.wjghj.cn/js/SsiModal');

// Main
function InPageEdit(option) {

  ssi_modal.show({
    className: 'ipe',
    title: '<span style="font-style:normal;">123',
    content: '<textarea id="editArea" style="max-width:100%;min-width:100%;min-height:350px"></textarea><label>摘要:<input id="editSummary"/></label><br/><label><input id="editMinor" type="checkbox" style="margin-left:0;margin-right:4px"/>小编辑</label>',
    keepContent: false,
    beforeClose: function(modal) {
      ssi_modal.confirm({
        position: 'top center',
        content: '确定要关闭窗口吗',
        okBtn: {
          className: 'btn btn-primary',
          label: '确定'
        },
        cancelBtn: {
          className: 'btn btn-danger',
          label: '取消'
        }
      },
      function(result) {
        if (result === true) {
          modal.options.keepContent = false;
          modal.options.beforeClose = '';
          modal.close();
          ssi_modal.notify('error', {
            position: 'right top',
            content: "编辑被取消。"
          })
        }
      });
      return false;
    },
    buttons: [{
      label: '预览',
      method: requestPreview
    },
    {
      label: '发布',
      method: function(modal) {
        ssi_modal.confirm({
          content: '是否发布',
          okButton: {
            label: '确定'
          },
          cancelButton: {
            label: '取消'
          },
        },
        function(result) {
          if (result) {
            postArticle();
          }
        })
      }
    }]
  });

  function requestPreview(){
    ssi_modal.show({content:'preview'})
  }
}