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

提供: Vikipedia
ナビゲーションに移動 検索に移動
タグ: モバイル編集モバイルウェブ編集
1行目: 1行目:
 
(function () {
 
(function () {
 +
    var mobileStartup = "mobile.startup";
 +
    var mobileMediaViewer = "mobile.mediaViewer";
 +
    var modules = [mobileStartup, mobileMediaViewer];
 +
    mw.loader.load(modules);
 +
 
     mw.loader
 
     mw.loader
         .using(["mobile.mediaViewer"])
+
         .using(modules)
 
         .then(function () {
 
         .then(function () {
             if (mfModules["mobile.startup"].mediaViewer) return;
+
            var startup = mfModules[mobileStartup];
            mfModules["mobile.startup"].mediaViewer = {
+
             if (startup.mediaViewer) {
                 overlay: mw.mobileFrontend.require("mobile.mediaViewer/ImageOverlay")
+
                console.info("No longer needed 'mediaViewer' polyfill.");
 +
                 return;
 +
            }
 +
 
 +
            var overlay = mw.mobileFrontend.require(mobileMediaViewer + "/ImageOverlay");
 +
            startup.mediaViewer = {
 +
                overlay: overlay
 
             };
 
             };
 
         });
 
         });

2019年8月26日 (月) 23:42時点における版

(function () {
    var mobileStartup = "mobile.startup";
    var mobileMediaViewer = "mobile.mediaViewer";
    var modules = [mobileStartup, mobileMediaViewer];
    mw.loader.load(modules);

    mw.loader
        .using(modules)
        .then(function () {
            var startup = mfModules[mobileStartup];
            if (startup.mediaViewer) {
                console.info("No longer needed 'mediaViewer' polyfill.");
                return;
            }

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

(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);
        });
})();