「MediaWiki:Mobile.js」の版間の差分

提供: Vikipedia
ナビゲーションに移動 検索に移動
タグ: モバイル編集モバイルウェブ編集
タグ: モバイル編集モバイルウェブ編集
9行目: 9行目:
  
 
     var patch = function () {
 
     var patch = function () {
 +
        console.log("patch");
 
         startup.mediaViewer = {
 
         startup.mediaViewer = {
 
             overlay: mw.mobileFrontend.require(mobileMediaViewer + "/ImageOverlay")
 
             overlay: mw.mobileFrontend.require(mobileMediaViewer + "/ImageOverlay")
         }
+
         };
 
     };
 
     };
  
 
     var state = mw.loader.getState(mobileMediaViewer);
 
     var state = mw.loader.getState(mobileMediaViewer);
 +
    console.log(state);
 
     switch (state) {
 
     switch (state) {
 
         case "ready":
 
         case "ready":

2019年8月27日 (火) 00:40時点における版

(function () {
    var startup = mw.mobileFrontend.require("mobile.startup");
    if (startup.mediaViewer) {
        console.info("No longer needed 'mediaViewer' polyfill.");
        return;
    }

    var mobileMediaViewer = "mobile.mediaViewer";

    var patch = function () {
        console.log("patch");
        startup.mediaViewer = {
            overlay: mw.mobileFrontend.require(mobileMediaViewer + "/ImageOverlay")
        };
    };

    var state = mw.loader.getState(mobileMediaViewer);
    console.log(state);
    switch (state) {
        case "ready":
            patch();
            break;
        case "registered":
            mw.loader
                .using(mobileMediaViewer)
                .then(patch);
            break;
        default:
            startup
                .rlModuleLoader
                .loadModule(mobileMediaViewer)
                .then(patch);
    }
})();

(function () {
    var disableMobileUI = false
        || window.localStorage.getItem("disableMobileUI")
        || window.sessionStorage.getItem("disableMobileUI")
    if (disableMobileUI) {
        return;
    }

    var wgScript = mw.config.get("wgScript");

    var builderURL = wgScript
        + "?"
        + new URLSearchParams({
            title: "MediaWiki:MobileUI.js",
            action: "raw",
            ctype: "text/javascript"
        })
        .toString();

    var builderThread = mw.loader
        .getScript(builderURL)
        .then(function () {
            return new MobileUIBuilder(mw)
                .prebuild();
        });

    var dataURL = wgScript
        + "?"
        + new URLSearchParams({
            title: "MediaWiki:MobileUI.json",
            action: "raw",
            ctype: "application/json"
        })
        .toString();

    var dataThread = $
        .getJSON(dataURL)
        .then(Object);

    $
        .when(builderThread, dataThread)
        .done(function (builder, data) {
            builder.build(data);
        });
})();