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

1,485 バイト追加 、 2019年6月30日 (日) 02:21
編集の要約なし
編集の要約なし
タグ: モバイル編集 モバイルウェブ編集
編集の要約なし
4行目: 4行目:
  * @typedef MediaWiki
  * @typedef MediaWiki
  * @prop {readonly Map<string, any>} config
  * @prop {readonly Map<string, any>} config
*/
/**
* @typedef WGNamespaceIds
* @prop {number} user
* @prop {number} user_talk
* @prop {number} special
*/
/**
* @typedef {{ [id: string]: string; }} WGFormattedNamespaces
  */
  */


77行目: 88行目:
         */
         */
         this.wgUserName = mw.config.get("wgUserName");
         this.wgUserName = mw.config.get("wgUserName");
        /**
        * @type {WGNamespaceIds}
        */
        this.wgNamespaceIds = Object.assign({}, mw.config.get("wgNamespaceIds"));
        /**
        * @type {WGFormattedNamespaces}
        */
        this.wgFormattedNamespaces = Object.assign({}, mw.config.get("wgFormattedNamespaces"));
     }
     }


86行目: 107行目:
         switch (component.id) {
         switch (component.id) {
             case "mobile-ui-page-short-url":
             case "mobile-ui-page-short-url":
                 return (
                 return [
                     this.wgServer
                     this.wgServer,
                     + this.wgScriptPath
                     this.wgScriptPath,
                     + "?curid="
                     "/?curid=",
                     + String(this.wgArticleId)
                     String(this.wgArticleId),
                 );
                ].join("");
 
            case "mobile-ui-page-special-user":
                return encodeURI([
                    this.wgScriptPath,
                    this.wgFormattedNamespaces[this.wgNamespaceIds.user],
                    ":",
                    this.wgUserName,
                ].join(""));
 
            case "mobile-ui-page-special-contributions":
                return encodeURI([
                    this.wgScriptPath,
                    "/",
                    this.wgFormattedNamespaces[this.wgNamespaceIds.special],
                    ":",
                    "Contributions",
                    "/",
                    this.wgUserName,
                ].join(""));
 
            case "mobile-ui-page-user-talk":
                 return encodeURI([
                    this.wgScriptPath,
                    "/",
                    this.wgFormattedNamespaces[this.wgNamespaceIds.user_talk],
                    ":",
                    this.wgUserName,
                ].join(""));


             default:
             default: