Site Notice
hello, world
Difference between revisions of "InPageEdit-v2/SDK"
From Project-EPB Commons
([InPageEdit] 没有编辑摘要 (第6部分)) |
(→比较差异) |
||
Line 45: | Line 45: | ||
== 比较差异 == | == 比较差异 == | ||
<code>InPageEdit.quickDiff(options)</code> | <code>InPageEdit.quickDiff(options)</code> | ||
− | + | ** <code id="fromtitle">fromtitle</code>: First title to compare. | |
− | + | ** <code id="fromid">fromid</code>: First page ID to compare. <b>Type:</b> integer | |
− | + | ** <code id="fromrev">fromrev</code>: First revision to compare. <b>Type:</b> integer | |
− | + | ** <code id="fromtext">fromtext</code>: Use this text instead of the content specified by <code>fromtitle</code>, <code>fromid</code> or <code>fromrev</code>. | |
− | + | ** <code id="frompst">frompst</code>: Do a pre-save transform on <code>fromtext</code>. <b>Type:</b> boolean | |
− | + | ** <code id="totitle">totitle</code>: Second title to compare. | |
− | + | ** <code id="toid">toid</code>: Second page ID to compare. <b>Type:</b> integer | |
− | + | ** <code id="torev">torev</code>: Second revision to compare. <b>Type:</b> integer | |
− | + | ** <code id="torelative">torelative</code>: Compare to a relative revision of <code>fromtitle</code>, <code>fromid</code> or <code>fromrev</code>. All the other "to" options will be ignored. Possible values: <code>prev</code>, <code>next</code>, <code>cur</code> | |
− | + | ** <code id="totext">totext</code>: Use this text instead of the content specified by <code>totitle</code>, <code>toid</code>, <code>torev</code>, or <code>torelative</code>. | |
− | + | ** <code id="topst">topst</code>: Do a pre-save transform on <code>totext</code>. <b>Type:</b> boolean | |
− | |||
== 添加编辑链接 == | == 添加编辑链接 == |
Revision as of 22:53, 23 November 2019
快速编辑
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.redirect(type)
type
: string(to,from)- from 重定向页面至此
- to 将此页面重定向到
最基础的调用
InPageEdit.redirect('from'); InPageEdit.redirect('to');
<html><button onclick="InPageEdit.redirect('from')">测试from</button> <button onclick="InPageEdit.redirect('to')">测试to</button></html>
快速删除
InPageEdit.deletepage()
快速重命名
InPageEdit.renamepage()
InPageEdit设置
InPageEdit.preference()
- 打开设置窗口
<html><button onclick="InPageEdit.preference()">InPageEdit.preference()</button></html>
比较差异
InPageEdit.quickDiff(options)
fromtitle
: First title to compare.fromid
: First page ID to compare. Type: integerfromrev
: First revision to compare. Type: integerfromtext
: Use this text instead of the content specified byfromtitle
,fromid
orfromrev
.frompst
: Do a pre-save transform onfromtext
. Type: booleantotitle
: Second title to compare.toid
: Second page ID to compare. Type: integertorev
: Second revision to compare. Type: integertorelative
: Compare to a relative revision offromtitle
,fromid
orfromrev
. All the other "to" options will be ignored. Possible values:prev
,next
,cur
totext
: Use this text instead of the content specified bytotitle
,toid
,torev
, ortorelative
.topst
: Do a pre-save transform ontotext
. Type: boolean
添加编辑链接
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') }); }) ) ) ); });