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

(页面间差异)
添加2,237字节 、​ 2020年6月6日 (星期六)
无编辑摘要
imported>=海豚=
([InPageEdit] 没有编辑摘要)
 
imported>=海豚=
无编辑摘要
 
第1行: 第1行:
==View==
// <pre>
* CommentsinLocalTime[ResourceLoader|dependencies=ext.gadget.site-lib]|CommentsinLocalTime.js
/* 这里的任何JavaScript将只在移动端加载 */
* Purgecache[ResourceLoader|type=general|rights=purge|default]|Purgecache.js
(function($, mw) { //使用匿名函数以避免污染顶级变量
* hantsect|hantsect.css
   /* 函数定义体 */
* FlowthreadTOC[ResourceLoader|type=general|default]|FlowthreadTOC.js
   //用户资料页相关
* code-prettify[ResourceLoader|type=general|default]|code-prettify.js|code-prettify.css
   function isUserProfile() {
* moveEditsectionBack[ResourceLoader]|moveEditsectionBack.css
     return mw.config.get('wgCanonicalSpecialPageName') === "UserProfile" && mw.config.get('wgArticleId') === "0";
* edit-count[ResourceLoader|default]|edit-count.js
   }
* ShowAvatar[ResourceLoader|type=general|default]|ShowAvatar.js|ShowAvatar.css
   //页顶提示模板相关
* UserLinkAvatar[ResourceLoader|type=general|default]|UserLinkAvatar.js|UserLinkAvatar.css
   function commonBoxs() {
* userLinkAvatarMagnifier[ResourceLoader|type=general|default|dependencies=ext.gadget.UserLinkAvatar]|UserLinkAvatarMagnifier.js|UserLinkAvatarMagnifier.css
     if (window.mw && !!mw.config.get('wgNamespaceNumber')) return;
* HeimuSemiOff[ResourceLoader|type=general]|heimu-semioff.js|heimu-semioff.css
     var contentParent = $('#mw-content-text')[0] ? $('#mw-content-text') : $('#content'),
* HeimuToggle[ResourceLoader|type=general|default]|heimu-toggle.js|heimu-toggle.css
       commonBoxes = contentParent.find('.common-box');
* Navbox-link[ResourceLoader|type=general|rights=skipcaptcha]|Navbox-link.js
     if (!commonBoxes[0]) return;
* ReferenceTooltips[ResourceLoader|dependencies=mediawiki.util,ext.gadget.site-lib|default|type=general]|ReferenceTooltips.js|ReferenceTooltips.css
     var commonBoxContainer = $('<div id="commonBoxContainer"><div id="commonBoxInfo"></div></div>').prependTo(contentParent),
* Backtotop[ResourceLoader|type=general|default]|Backtotop.js
       commonBoxList = $('<div id="commonBoxList"></div>').appendTo('#commonBoxInfo');
 
     commonBoxes.each(function() {
==Edit==
       var commonBoxButton = $('<div class="commonBoxButton"></div>').appendTo(commonBoxList),
* editTopSection[ResourceLoader|type=general|rights=edit|default]|editTopSection.js
         commonBox = $(this);
* HotCat[ResourceLoader|type=general|rights=edit,skipcaptcha|default]|HotCat.js
       commonBoxButton.data('element', commonBox).css({
* Wikiplus[ResourceLoader|type=general|rights=edit,skipcaptcha]|Wikiplus.js|Wikiplus.css
         'border-color': commonBox.css('border-left-color'),
* EditDraft[ResourceLoader|type=general|default]|EditDraft.js
         'background-image': 'url(' + commonBox.find('tbody > tr > td:first-child img').prop('src') + ')',
* DotsSyntaxHighlighter[ResourceLoader|type=general|rights=edit]|DotsSyntaxHighlighter.js
       }).on('click', function() {
* wikEd[ResourceLoader]|wikEd.js
         if (commonBox.is(':visible')[0]) {
* InPageEdit-v2[ResourceLoader|type=general|rights=edit,skipcaptcha]|InPageEdit-v2.js
           commonBoxes.hide();
 
           $(this).add($(this).siblings()).removeClass('current');
==System==
           commonBoxList.removeClass('open');
* site-lib[ResourceLoader|type=general|dependencies=mediawiki.legacy.wikibits,mediawiki.util|rights=hidden|hidden]|site-lib.js
         } else {
* SendWelcomeMessage[ResourceLoader|type=general|default|hidden]|SendWelcomeMessage.js
           commonBoxes.filter(':visible').not(commonBox).hide();
* Force_preview[ResourceLoader|type=general|default|hidden]|Force_preview.js
           commonBox.show();
* rollback-summary[ResourceLoader|type=general|rights=rollback|default|hidden]|rollback-summary.js
           $(this).toggleClass('current', commonBox.is(':visible')).siblings().removeClass('current');
* CleanDeleteReasons[ResourceLoader|type=general|rights=delete|default|hidden]|CleanDeleteReasons.js
           commonBoxList.toggleClass('open', commonBox.is(':visible'));
* Tabs[ResourceLoader|type=general|default|hidden|targets=desktop,mobile]|Tabs.js
         }
* Tabs-styles[ResourceLoader|type=styles|default|hidden|targets=desktop,mobile]|Tabs.css
       });
     }).appendTo(commonBoxContainer).hide();
   }
   //uuid
   function uuidv4() {
     var result;
     do {
       result = ([1e7] + -1e3 + -4e3 + -8e3 + -1e11).replace(/[018]/g, function(c) {
         return (c ^ crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> c / 4).toString(16);
       });
     } while (document.querySelector('a[data-linkid="' + result + '"]'));
     return result;
   }
// Mobile Navmenu by GFwiki
function menuadjust(){var a = $("body").height()+"px";document.getElementById("mw-mf-page-left").style.height = a;};
$(function(){menuadjust();});
$(window).resize(function(){menuadjust()});
var navbar = function(data, textStatus, jqxhr) {
   var navlist = data.parse.text["*"];
$(navlist).insertBefore(".menu > .hlist")
  };
var mfSidebar = function() {
   var purl = "/api.php?action=parse&page=MediaWiki:MFSidebar&format=json";
   $.ajax({
    url: purl,
    success: navbar,
    error: function () {console.error("can\'t load customized navmenu")},
    dataType: "json"
   });
  };
$(function(){mfSidebar();});
   /* 函数执行体 */
   $(function() {
     //页顶提示模板相关
     commonBoxs();
     //用户资料页
     if (isUserProfile()) {
       var cardContainer = $('.card-container'),
         containerImage = cardContainer.find('.card'),
         containerImageFile = containerImage.find('a.image'),
         containerImageCaption = containerImage.find('.caption');
       containerImageCaption.css("padding", "0 8px");
       containerImageFile.before('<div id="#containerImage" class="listThumb list-thumb-placeholder" style="text-align: center;"><img src="http://static.mengniang.org/common/a/a4/Placeholder-upload.png" style="height:32px" /></div>');
     }
     //黑幕
     $('.heimu a').on("click", function() {
       if (!$(this).closest('.heimu').is(':active, :focus')) return false;
     });
     //Template:hide
     if ($('.mw-collapsible')[0]) mw.loader.using('jquery.makeCollapsible').then(function() {
       //console.debug('jquery.makeCollapsible is loaded.');
       $('.mw-collapsible').makeCollapsible();
     });
     //桌面版页面外链改为移动端域名
     mw.loader.using("mediawiki.Uri").then(function() {
       $('a[target="_blank"]').each(function() {
         var url = new mw.Uri(this.href);
         if (url.host === "www.hmoegirl.com" && url.query.mobileaction !== "toggle_view_desktop") {
           url.host = "m.hmoegirl.com";
           this.href = url;
         }
       });
     });
   });
})(jQuery, mediaWiki); //立即执行匿名函数并传递原始变量
// </pre>
匿名用户