MediaWiki:Mobile.js:修订间差异

imported>Irukaza
无编辑摘要
wth
标签移动版编辑 移动版网页编辑
 
(未显示2个用户的2个中间版本)
第13行: 第13行:
     } catch (err) { /* */ }
     } catch (err) { /* */ }
     /* 函数定义体 */
     /* 函数定义体 */
    //用户资料页相关
    function isUserProfile() {
        return mw.config.get('wgCanonicalSpecialPageName') === "UserProfile" && mw.config.get('wgArticleId') === "0";
    }
     //页顶提示模板相关
     //页顶提示模板相关
     function commonBoxs() {
     function commonBoxs() {
第55行: 第51行:
         return 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"
    });
  };
         //需要时载入对应的 scripts
         //需要时载入对应的 scripts
         if (mw.config.get("wgAction") === "edit" || mw.config.get("wgAction") === "submit" || mw.config.get("wgCanonicalSpecialPageName") === "Search") { mw.loader.load("/index.php?title=MediaWiki:Common.js/edit.js&action=raw&ctype=text/javascript"); }
         if (mw.config.get("wgAction") === "edit" || mw.config.get("wgAction") === "submit" || mw.config.get("wgCanonicalSpecialPageName") === "Search") { mw.loader.load("/index.php?title=MediaWiki:Common.js/edit.js&action=raw&ctype=text/javascript"); }
第62行: 第75行:
         //页顶提示模板相关
         //页顶提示模板相关
         commonBoxs();
         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="https://img.moegirl.org.cn/common/a/a4/Placeholder-upload.png" style="height:32px" /></div>');
        }
         //黑幕
         //黑幕
         $('.heimu a').on("click", function() {
         $('.heimu a').on("click", function() {
第85行: 第89行:
                     if (ele instanceof HTMLAnchorElement) {
                     if (ele instanceof HTMLAnchorElement) {
                         var url = new mw.Uri(ele.href);
                         var url = new mw.Uri(ele.href);
                         if (/www\.hmoegirl\.com?$/.test(url.host) && url.query.mobileaction !== "toggle_view_desktop") {
                         if (/www\.hmoegirl\.info?$/.test(url.host) && url.query.mobileaction !== "toggle_view_desktop") {
                             url.host = mw.config.get("wgServer").replace(/^(?:(?:https?:)?\/\/)?www/, "m");
                             url.host = mw.config.get("wgServer").replace(/^(?:(?:https?:)?\/\/)?www/, "m");
                             ele.href = url;
                             ele.href = url;