Site Notice

hello, world

InPageEdit-v2/SDK

From Project-EPB Commons
< InPageEdit-v2
Revision as of 22:43, 23 November 2019 by 机智的小鱼君 (talk | contribs) ([InPageEdit] 没有编辑摘要 (第1部分))

快速编辑

InPageEdit.edit(options)

  • options: {object}
    • page: 必须;编辑的页面名
    • revision: 修订版本号,如果与当前页面版本号不同则取代
    • section: 编辑的段落编号

最基础的调用

InPageEdit.edit({
  page: mw.config.get('wgPageName')
});

<html><button onclick="InPageEdit.edit({

 page: mw.config.get('wgPageName')

});">测试</button></html>

快速重定向

InPageEdit.quickRedirect(type)

  • type: string(to,from)

快速删除

InPageEdit.deletePage()

快速重命名

InPageEdit.renamePage()

InPageEdit设置

InPageEdit.preferences

比较差异

InPageEdit.quickDiff(options)

添加编辑链接

InPageEdit.articleLink()

示例

在编辑链接后添加快速编辑链接

此示例代码已在Vector、Timeless以及Hydra皮肤上测试可用

$(function(){
  $('#ca-view').after(
    $('<li>',{
      id:'ca-quick-edit',
      class:'collapsible'
    }).append(
      $('<span>').append(
        $('<a>',{
          href: 'javascript:void(0)'
        })
        .text('快速编辑')
        .click(function(){
          InPageEdit.edit({
            page: mw.config.get('wgPageName'),
            revision: mw.config.get('wgRevisionId')
          });
        })
      )
    )
  );
});