“MediaWiki:Gadgets-definition”与“MediaWiki talk:Gadget-mobileEdit.js”:页面之间的差异

H萌娘,万物皆可H的百科全书!
(页面间差异)
跳到导航 跳到搜索
imported>=海豚=
无编辑摘要
 
imported>Bhsd
(加个章节标题)
 
第1行: 第1行:
==View==
== 创建请求==
* CommentsinLocalTime[ResourceLoader|dependencies=ext.gadget.site-lib|default|targets=desktop,mobile]|CommentsinLocalTime.js
请求创建小工具页面,内容如下:
* Purgecache[ResourceLoader|type=general|rights=purge]|Purgecache.js
<pre class="hljs">
* hantsect[ResourceLoader|type=general|targets=desktop,mobile]|hantsect.css
//&lt;nowiki&gt;
* FlowthreadTOC[ResourceLoader|type=general|default]|FlowthreadTOC.js
/**
* moveEditsectionBack[ResourceLoader]|moveEditsectionBack.css
* @Source: https://llwiki.org/zh/mediawiki:gadget-mobileEdit.js
* edit-count[ResourceLoader|type=general|rights=edit|default]|edit-count.js
* @Author: [[User:Bhsd]]
* ShowAvatar[ResourceLoader|type=general|default]|ShowAvatar.js|ShowAvatar.css
* @License: CC BY-NC-SA 4.0
* UserLinkAvatar[ResourceLoader|type=general|default|dependencies=user.options|targets=desktop,mobile]|UserLinkAvatar.js|UserLinkAvatar.css
* @Dependencies: ext.gadget.site-lib, mediawiki.util, oojs-ui-windows, user.options
* CollapsibleSidebar[ResourceLoader|default|dependencies=jquery.cookie|targets=desktop]|CollapsibleSidebar.js|CollapsibleSidebar.css
*/
* HeimuSemiOff[ResourceLoader|type=general]|heimu-semioff.js|heimu-semioff.css
"use strict";
* Navbox-link[ResourceLoader|type=general|rights=skipcaptcha|targets=desktop,mobile]|Navbox-link.js
const script = mw.config.get( 'wgScript' ),
* FloatToc[ResourceLoader|type=general|default]|FloatToc.js|FloatToc.css
   pagename = mw.util.wikiUrlencode( mw.config.get( 'wgPageName' ) ),
* ShowToc|ShowToc.css
   id = mw.config.get( 'wgRevisionId' ),
* ReferenceTooltips[ResourceLoader|dependencies=mediawiki.util,ext.gadget.site-lib|default|type=general|targets=desktop,mobile]|ReferenceTooltips.js|ReferenceTooltips.css
   action = mw.config.get( 'wgAction' );
* BanBackgroundImage[ResourceLoader|type=general]|BanBackgroundImage.css
* Backtotop[ResourceLoader|type=general|default]|Backtotop.js|Backtotop.css
* Live2dGirl[ResourceLoader|type=general|default]|Live2dGirl.js|Live2dGirl.css


==Edit==
$('body').on('click', 'a.new', function() {
* editTopSection[ResourceLoader|type=general|rights=edit|default]|editTopSection.js|editTopSection.css
   $(this).attr('href', function(i, val) { return val.replace('&action=edit', '&action=submit'); });
* HotCat[ResourceLoader|type=general|rights=edit,skipcaptcha|default]|HotCat.js
});
* Wikiplus[ResourceLoader|type=general|rights=edit,skipcaptcha]|Wikiplus.js|Wikiplus.css
* DotsSyntaxHighlighter[ResourceLoader|type=general|rights=edit|default|targets=desktop,mobile]|DotsSyntaxHighlighter.js
* wikEd[ResourceLoader|type=general|targets=desktop,mobile]|wikEd.js|wikEd.css
* InPageEdit-v2[ResourceLoader|type=general|rights=edit,skipcaptcha]|InPageEdit-v2.js|InPageEdit-v2.css


==patroller==
$(function() {
* CleanDeleteReasons[ResourceLoader|type=general|rights=delete|default|hidden|targets=desktop,mobile]|CleanDeleteReasons.js
   if (action == 'view' || mw.config.get( 'wgNamespaceNumber') >= 0) {
* rollback-summary[ResourceLoader|type=general|rights=rollback|default|hidden|targets=desktop,mobile]|rollback-summary.js
     $( 'a.edit-page' ).filter(function() { return /^T-/.test( $(this).data('section') ); }).remove();
* no-auto-autoblock[ResourceLoader|type=general|rights=block|dependencies=mw.Api|default|hidden]|no-auto-autoblock.js
     $( 'a.edit-page' ).off( 'click' ).on('click', function(e) {
* registerToDelete[ResourceLoader|type=general|rights=patrolleredit|default|hidden]|registerToDelete.js
       e.stopImmediatePropagation();
* patrolPlus[ResourceLoader|type=general|rights=patrol|dependencies=mediawiki.api,mediawiki.Uri|default|hidden]|patrolPlus.js
       const section = $(this).data('section'),
* deletion[ResourceLoader|type=general|rights=delete|default|hidden]|deletion.js|deletion.css
         param = section ? '&section=' + section : '';
       location.href = script + '?action=submit&title=' + pagename + '&oldid=' + id + param;
     }).removeAttr('href');
   }


==System==
   if (["edit", "submit"].includes( action )) {
* site-lib[ResourceLoader|type=general|dependencies=mediawiki.legacy.wikibits,mediawiki.util|rights=hidden|hidden|targets=desktop,mobile]|site-lib.js
     const warning = mw.user.options.get( 'useeditwarning' ),
* SendWelcomeMessage[ResourceLoader|type=general|default|hidden|targets=desktop,mobile]|SendWelcomeMessage.js
       id = mw.util.getParamValue( 'oldid' ),
* queryContributions[ResourceLoader|type=general|default|hidden]|queryContributions.js
       cid = mw.config.get( 'wgCurRevisionId' ),
* queryWhatlinkshere[ResourceLoader|type=general|default|hidden]|queryWhatlinkshere.js
       href = script + (id && id < cid ? '?oldid=' + id : '/' + pagename),
* Edittools[ResourceLoader|dependencies=mediawiki.user|default|hidden]|Edittools.js|Edittools.css
       cancelBtn = new OO.ui.ButtonWidget( {label: wgULS("取消编辑", "取消編輯"),
* editConflict[ResourceLoader|type=general|rights=edit|default|hidden]|editConflict.js
       flags: ['primary', 'destructive'], href: href} );
* userLinkAvatarMagnifier[ResourceLoader|type=general|default|dependencies=ext.gadget.UserLinkAvatar|hidden]|UserLinkAvatarMagnifier.css
     cancelBtn.$element.appendTo( '.editButtons' );
* mwPanel[ResourceLoader|type=general|default|hidden]|mwPanel.js
     if (warning) {
* commentEmoji[ResourceLoader|type=general|default|hidden|targets=desktop,mobile]|Emotion.js|Emotion.css
       cancelBtn.$element.on('click', 'a', function(e) {
* EditDraft[ResourceLoader|type=general|default|hidden]|EditDraft.js
         e.preventDefault();
* code-prettify[ResourceLoader|type=general|default|hidden|targets=desktop,mobile]|code-prettify.js|code-prettify.css
         OO.ui.confirm( wgULS("您要放弃这次更改吗?", "您要放棄這次更改嗎?"), {actions: [{label: "取消"},
* Tabs-styles[ResourceLoader|type=styles|default|hidden|targets=desktop,mobile]|Tabs.css
           {label: wgULS("确定", "確認"), flags: ['primary', 'destructive'], action: 'accept'}]} )
* localforage[ResourceLoader|type=general|rights=hidden|hidden|targets=desktop,mobile]|localforage.js
           .then(function(confirm) {
* jquery.ui[ResourceLoader|type=general|rights=hidden|hidden|targets=desktop,mobile]|jquery.ui.js|jquery.ui.css
           if (confirm) { location.href = href; }
         });
       });
     }
   }
});
//&lt;/nowiki&gt;
</pre>
使用这个小工具需要在[[mediawiki:gadgets-definition]] 添加
<pre>* mobileEdit[ResourceLoader|dependencies=ext.gadget.site-lib,mediawiki.util,oojs-ui-windows,user.options|rights=edit|targets=mobile]|mobileEdit.js</pre>
如果导入后不可用,请再与我联系。谢谢![[ 用户:Bhsd|Bhsd]]([[用户讨论:Bhsd| 讨论]] ) 2021年5月7日 (五) 23:41 (CST)<br/>
{{@|1== 海豚=}}请来看看-- [[:zhmoe:萌娘百科:巡查姬|<span style="color:orange">Patroller</span>]][[用户:SD hehua|SD hehua]] ([[ 用户讨论:SD hehua| 聊天室]] ) 2021年5月8日 (六) 18:40 (CST)
 
:抱歉,因发现本站不遵循CC协议,以上代码需在顶部注明使用CC BY-NC-SA 4.0协议。如果因版权协议冲突造成无法搬运,请求删除此讨论串或讨论页。[[ 用户:Bhsd|Bhsd]]([[用户讨论:Bhsd| 讨论]] ) 2021年5月8日 (六) 19:13 (CST)

2021年5月8日 (六) 22:03的版本

创建请求

请求创建小工具页面,内容如下:

//<nowiki>
/**
 * @Source: https://llwiki.org/zh/mediawiki:gadget-mobileEdit.js
 * @Author: [[User:Bhsd]]
 * @License: CC BY-NC-SA 4.0
 * @Dependencies: ext.gadget.site-lib, mediawiki.util, oojs-ui-windows, user.options
 */
"use strict";
const script = mw.config.get( 'wgScript' ),
    pagename = mw.util.wikiUrlencode( mw.config.get( 'wgPageName' ) ),
    id = mw.config.get( 'wgRevisionId' ),
    action = mw.config.get( 'wgAction' );

$('body').on('click', 'a.new', function() {
    $(this).attr('href', function(i, val) { return val.replace('&action=edit', '&action=submit'); });
});

$(function() {
    if (action == 'view' || mw.config.get( 'wgNamespaceNumber') >= 0) {
        $( 'a.edit-page' ).filter(function() { return /^T-/.test( $(this).data('section') ); }).remove();
        $( 'a.edit-page' ).off( 'click' ).on('click', function(e) {
            e.stopImmediatePropagation();
            const section = $(this).data('section'),
                param = section ? '&section=' + section : '';
            location.href = script + '?action=submit&title=' + pagename + '&oldid=' + id + param;
        }).removeAttr('href');
    }

    if (["edit", "submit"].includes( action )) {
        const warning = mw.user.options.get( 'useeditwarning' ),
            id = mw.util.getParamValue( 'oldid' ),
            cid = mw.config.get( 'wgCurRevisionId' ),
            href = script + (id && id < cid ? '?oldid=' + id : '/' + pagename),
            cancelBtn = new OO.ui.ButtonWidget( {label: wgULS("取消编辑", "取消編輯"),
            flags: ['primary', 'destructive'], href: href} );
        cancelBtn.$element.appendTo( '.editButtons' );
        if (warning) {
            cancelBtn.$element.on('click', 'a', function(e) {
                e.preventDefault();
                OO.ui.confirm( wgULS("您要放弃这次更改吗?", "您要放棄這次更改嗎?"), {actions: [{label: "取消"},
                    {label: wgULS("确定", "確認"), flags: ['primary', 'destructive'], action: 'accept'}]} )
                    .then(function(confirm) {
                    if (confirm) { location.href = href; }
                });
            });
        }
    }
});
//</nowiki>

使用这个小工具需要在mediawiki:gadgets-definition添加

* mobileEdit[ResourceLoader|dependencies=ext.gadget.site-lib,mediawiki.util,oojs-ui-windows,user.options|rights=edit|targets=mobile]|mobileEdit.js

如果导入后不可用,请再与我联系。谢谢!Bhsd讨论) 2021年5月7日 (五) 23:41 (CST)
@=海豚=请来看看-- PatrollerSD hehua聊天室) 2021年5月8日 (六) 18:40 (CST)

抱歉,因发现本站不遵循CC协议,以上代码需在顶部注明使用CC BY-NC-SA 4.0协议。如果因版权协议冲突造成无法搬运,请求删除此讨论串或讨论页。Bhsd讨论) 2021年5月8日 (六) 19:13 (CST)