Minecraft Wiki

除另有声明,转载时均必须注明出处若簡繁轉換出錯,請以遊戲內為準请勇于扩充与修正内容有兴趣逛逛我们的微博沟通交流,欢迎到社区专页需要协助,请在告示板留言

了解更多

Minecraft Wiki
Advertisement
[创建 | 历史 | 清除缓存]文档页面
此脚本没有文档页面。如果你知道此脚本的使用方法,请帮助为其创建文档页面。
注意:在保存之后,您可能需要清除浏览器缓存才能看到所作出的更改的影响。
  • Firefox或Safari:按住Shift的同时单击刷新,或按Ctrl-F5或Ctrl-R(Mac为⌘-R)
  • Google Chrome:按Ctrl-Shift-R(Mac为⌘-Shift-R)
  • Internet Explorer:按住Ctrl的同时单击刷新,或按Ctrl-F5
  • Opera:前往菜单 → 设置(Mac为Opera → 选项),然后隐私和安全 → 清除浏览数据 → 缓存的图片和文件。
//[[en:User:Jeremylin0511/common.js]]
//{{DISPLAYTITLE:<center>User:Jeremylin0511/common.js</center>}}
mw.loader.load('https://cdn.jsdelivr.net/gh/dragon-fish/inpageedit-v2@master/script.min.js');

/**
 * @name IPE-edit-any-page
 * @author 机智的小鱼君
 * InPageEdit自定义小addon
 * 在toolbox添加一个可以编辑任何指定页面的按钮
 */
mw.hook('InPageEdit.toolbox').add(function () {
  $('#ipe-edit-toolbox .btn-group.group1').append(
    $('<li>', { class: 'btn-tip-group' }).append(
      $('<div>', { class: 'btn-tip', text: '编辑指定页面' }),
      $('<button>', { class: 'ipe-toolbox-btn material-icons', text: 'edit' }).click(function () {
        ssi_modal.show({
          className: 'in-page-edit',
          sizeClass: 'dialog',
          center: true,
          outSideClose: false,
          title: '快速编辑页面',
          content: $('<div>').append(
            $('<label>').append(
              $('<b>', { text: '请指定页面名' }),
              $('<br>'),
              $('<input>', { id: 'which-page', style: 'width: 96%', value: mw.config.get('wgPageName') }).click(function () { $(this).css('box-shadow', ''); })
            )
          ),
          buttons: [{
            label: '确定',
            className: 'btn btn-primary IPE-anypage-ok',
            keyPress: 13, // Enter
            method: function (a, modal) {
              var page = $('#which-page').val();
              if (page === '' || page === undefined) {
                $('#which-page').css('box-shadow', '0 0 4px red');
                return false;
              }
              modal.close();
              InPageEdit.quickEdit({
                page: page,
                reload: false
              });
            }
          }, {
            label: '取消',
            className: 'btn btn-secondary IPE-anypage-cancel',
            keyPress: 27, // Esc
            method: function (a, modal) {
              modal.close();
            }
          }]
        });
      })
    )
  );
});

window.InPageEdit = window.InPageEdit || {}; // 务必在之前添加这一行否则会报错
InPageEdit.buttons =[{
  open: '<-- ', // 添加到光标前的内容
  middle: '注释文字', // 选区内容占位符,选填
  close: ' -->', // 添加到光标后的内容
  text: '<span class="material-icons">description</span>' // 按钮文字,被解析为html
}, { // 再举个栗子
  open: '<s>',
  middle: '删除线',
  close: '</s>',
  text: '<span class="material-icons">strikethrough_s</span>'
}];
Advertisement