Extension:MobileFrontend/ja

「MobileFrontend」拡張機能はモバイルフレンドリーな表示を提供します. このページは開発インスタンスにインストールしたいエンドユーザー向けに作られています. 開発および改良の支援を望まれる場合は、ぜひご参加ください.

要件

 * MediaWiki には不要ですが、この拡張機能の動作のため PHP に mbstring サポートが必要です.
 * MobileFrontend の MediaWiki ≤ 1.24 向けリリースには Mantle 拡張機能が必要です.

環境設定
LocalSettings.php において、 を呼び出した後、以下の変数を定義することができます. 単純なサイトでは、ただ動かすために必要なのは  の追加のみかもしれないことに留意してください.

Example: "{$wgScriptPath}/mf-logo.png" for the file mf-logo.png in your wiki's root folder. If this value is not set, it will default to the top domain of the host name (eg en.wikipedia.org = .wikipedia.org). If you want to set this to a top domain (to cover all subdomains), be sure to include the preceding '.' (eg .wikipedia.org NOT wikipedia.org). If this option is set to  file cache must be disabled by setting $wgUseFileCache to   (otherwise autodetection won't be reliable due to cached copies being shown). 「百科事典スタイル」にするには、既定の  のままにしてください. このスタイルでは、既定で節 0 のリード文は常に表示され、続く節は折り畳まれる可能性があります. 「辞書スタイル」にするには  に設定してください. このスタイルでは節は折り畳まれません.
 * MobileFrontendのデフォルトのスキン.
 * $wgMFEditorOptions
 * Options to control several functions of the mobile editor. 'anonymousEditing': Whether or not anonymous (not logged in) users should be able to edit. 'skipPreview': Should the mobile edit workflow contain an edit preview (before save) to give the user the possibility to review the new text resulting of their changes or not.
 * $wgMFUseCentralAuthToken
 * 利用者がログインできないかもしれない外部の CentralAuth が有効な wiki への編集（アップロード）を許可します.
 * $wgMFPhotoUploadEndpoint
 * URL of MediaWiki API entry point to which upload images. If it's an empty string, upload locally.
 * $wgMFUploadMinEdits
 * 0
 * 利用者がモバイルアップロードを使用するのに必要な編集回数を指定します.
 * $wgMFNearbyEndpoint
 * An optional alternative API to query for nearby pages, e.g. https://en.m.wikipedia.org/w/api.php. If set forces nearby to operate in JSONP mode.
 * $wgMFContentNamespace
 * 特別:付近および特別:おまかせ表示が利用するコンテンツ名前空間. パイプで区切られた 1 つ以上の NS_* 定数でなければなりません.
 * $wgMFPhotoUploadWiki
 * ID/database name of the wiki with uploaded images. If null, use local database.
 * $wgMobileFrontendLogo
 * , default no logo
 * URL to the logo used in mobile login and signup form. Should have a height of 72px.
 * An optional alternative API to query for nearby pages, e.g. https://en.m.wikipedia.org/w/api.php. If set forces nearby to operate in JSONP mode.
 * $wgMFContentNamespace
 * 特別:付近および特別:おまかせ表示が利用するコンテンツ名前空間. パイプで区切られた 1 つ以上の NS_* 定数でなければなりません.
 * $wgMFPhotoUploadWiki
 * ID/database name of the wiki with uploaded images. If null, use local database.
 * $wgMobileFrontendLogo
 * , default no logo
 * URL to the logo used in mobile login and signup form. Should have a height of 72px.
 * ID/database name of the wiki with uploaded images. If null, use local database.
 * $wgMobileFrontendLogo
 * , default no logo
 * URL to the logo used in mobile login and signup form. Should have a height of 72px.
 * , default no logo
 * URL to the logo used in mobile login and signup form. Should have a height of 72px.
 * $wgMobileUrlTemplate
 * Template used to transcode regular URLs into mobile URLs (optional, and probably an overkill for low-traffic sites). Can either be set as a static domain (eg 'mobile.mydomain.com'), or can use a template based off the host portion of your desktop domain. The token '%h0' represents the first portion of the hostname, '%h1' the second, and so on. For example, to achieve http://en.m.wikipedia.org from http://en.wikipedia.org, you would use:
 * $wgMobileFrontendFormatCookieExpiry
 * The number of seconds the 'useformat' cookie should be valid (used to keep you on mobile or desktop view of site when manually toggling between the two). If unset, defaults to $wgCookieExpiration.
 * $wgMFRemovableClasses
 * Make the classes, tags and IDs stripped from page content configurable. Each item will be stripped from the page. The extension adds some classes by default.
 * $wgMFCustomLogos
 * Makes the logos configurable. Example:  Note that 'copyright' controls the image shown in the footer of the mobile page.
 * $wgMFNoindexPages
 * Set to false to allow search engines to index your mobile pages. So far, Google seems to mix mobile and non-mobile pages in its search results, creating confusion.
 * $wgMFStopRedirectCookieHost
 * Set the domain of the stopMobileRedirect cookie.
 * $wgMFCustomLogos
 * Makes the logos configurable. Example:  Note that 'copyright' controls the image shown in the footer of the mobile page.
 * $wgMFNoindexPages
 * Set to false to allow search engines to index your mobile pages. So far, Google seems to mix mobile and non-mobile pages in its search results, creating confusion.
 * $wgMFStopRedirectCookieHost
 * Set the domain of the stopMobileRedirect cookie.
 * Set to false to allow search engines to index your mobile pages. So far, Google seems to mix mobile and non-mobile pages in its search results, creating confusion.
 * $wgMFStopRedirectCookieHost
 * Set the domain of the stopMobileRedirect cookie.
 * $wgMFStopRedirectCookieHost
 * Set the domain of the stopMobileRedirect cookie.
 * Set the domain of the stopMobileRedirect cookie.
 * $wgMFTrademarkSitename
 * Whether to append a trademark notice to the sitename in the page footer. If set to true or 'unregistered', adds a ™ to the sitename. If set to 'registered' adds a ® to the sitename. If set to false, adds nothing (the default). You can also edit the  interface message directly.
 * $wgDeviceDetectionClass
 * モバイルデバイス検出のために利用されるクラスの名前. このクラスは IDeviceDetector を継承しなければなりません.
 * $wgMFNearby
 * Whether geodata related functionality should be enabled, such as Special:Nearby. Requires GeoData extension.
 * $wgMFNearbyRange
 * The range in meters that should be searched to find nearby pages on Special:Nearby (defaults to 10km).
 * $wgMFMinCachedPageSize
 * Pages with smaller parsed HTML size are not cached. Set to 0 to cache everything or to some large value to disable caching completely.
 * $wgMFAutodetectMobileView
 * Whether or not the MobileFrontend extension autodetects devices for mobile view on its own, rather than using detection at the proxy/webserver layer, or using third party tools like Apache AMF. Depending on your setup, this is probably the easiest method of device detection, though least performant.
 * $wgMFNearbyRange
 * The range in meters that should be searched to find nearby pages on Special:Nearby (defaults to 10km).
 * $wgMFMinCachedPageSize
 * Pages with smaller parsed HTML size are not cached. Set to 0 to cache everything or to some large value to disable caching completely.
 * $wgMFAutodetectMobileView
 * Whether or not the MobileFrontend extension autodetects devices for mobile view on its own, rather than using detection at the proxy/webserver layer, or using third party tools like Apache AMF. Depending on your setup, this is probably the easiest method of device detection, though least performant.
 * Pages with smaller parsed HTML size are not cached. Set to 0 to cache everything or to some large value to disable caching completely.
 * $wgMFAutodetectMobileView
 * Whether or not the MobileFrontend extension autodetects devices for mobile view on its own, rather than using detection at the proxy/webserver layer, or using third party tools like Apache AMF. Depending on your setup, this is probably the easiest method of device detection, though least performant.
 * $wgMFAutodetectMobileView
 * Whether or not the MobileFrontend extension autodetects devices for mobile view on its own, rather than using detection at the proxy/webserver layer, or using third party tools like Apache AMF. Depending on your setup, this is probably the easiest method of device detection, though least performant.
 * Whether or not the MobileFrontend extension autodetects devices for mobile view on its own, rather than using detection at the proxy/webserver layer, or using third party tools like Apache AMF. Depending on your setup, this is probably the easiest method of device detection, though least performant.
 * $wgMFEnableSiteNotice
 * Site notices が表示されるかどうかを制御します.
 * $wgMFShowMobileViewToTablets
 * Controls whether tablets should be shown the mobile site. Works only if  is.
 * $wgMFPhotoUploadAppendToDesc
 * (wiki)text to append to photo description during photo upload.
 * $wgMFEnableXAnalyticsLogging
 * Whether or not to enable the use of the X-Analytics HTTP response header. This header is used for analytics purposes; see Analytics/Kraken/Data Formats/X-Analytics.
 * $wgMFLeadPhotoUploadCssSelector
 * A CSS selector which is used by mf-photo.js to test whether to prompt the user photo uploads on the current page. When the selector matches no elements the photo uploader will show.
 * $wgMFEnableCssAnimations
 * 対応しているすべてのブラウザで CSS アニメーションを有効にします.
 * $wgMFNoMobileCategory
 * Database key (=page title with underscores instead of spaces etc.) of the category which members will never display mobile view
 * $wgMFNoMobilePages
 * Prefixed names of pages that will never display mobile view
 * $wgMFAjaxUploadProgressSupport
 * Temporary boolean variable to enable/disable progress bars in the photo uploader
 * $wgMFDeviceWidthTablet
 * Minimum available screen width (in pixels) at which a device can be considered a tablet/desktop
 * $wgMFDeviceWidthMobileSmall
 * Devices with available screen of this value and less will have some styles adapted for improved reading on small screens.
 * $wgMFKeepGoing
 * Whether or not to use the KeepGoing feature.
 * $wgMFTidyMobileViewSections
 * Controls whether API action=mobileview should have every HTML section tidied for invalid markup
 * $wgMFMobileHeader
 * Requests containing header with this name will be considered as coming from mobile devices. The default value is for backwards compatibility. Set to false to explicitly disable this way of detection.
 * $wgMFEnableMinervaBetaFeature
 * デスクトップスキンとしての Minerva ベータ機能を有効にするかどうかを制御します.
 * $wgMFEnableNearbyPagesBetaFeature
 * 付近のページのベータ機能を有効にするかどうかを制御します.
 * $wgMFCollapseSectionsByDefault
 * 既定で節を折り畳むかどうかを制御します.
 * Temporary boolean variable to enable/disable progress bars in the photo uploader
 * $wgMFDeviceWidthTablet
 * Minimum available screen width (in pixels) at which a device can be considered a tablet/desktop
 * $wgMFDeviceWidthMobileSmall
 * Devices with available screen of this value and less will have some styles adapted for improved reading on small screens.
 * $wgMFKeepGoing
 * Whether or not to use the KeepGoing feature.
 * $wgMFTidyMobileViewSections
 * Controls whether API action=mobileview should have every HTML section tidied for invalid markup
 * $wgMFMobileHeader
 * Requests containing header with this name will be considered as coming from mobile devices. The default value is for backwards compatibility. Set to false to explicitly disable this way of detection.
 * $wgMFEnableMinervaBetaFeature
 * デスクトップスキンとしての Minerva ベータ機能を有効にするかどうかを制御します.
 * $wgMFEnableNearbyPagesBetaFeature
 * 付近のページのベータ機能を有効にするかどうかを制御します.
 * $wgMFCollapseSectionsByDefault
 * 既定で節を折り畳むかどうかを制御します.
 * Controls whether API action=mobileview should have every HTML section tidied for invalid markup
 * $wgMFMobileHeader
 * Requests containing header with this name will be considered as coming from mobile devices. The default value is for backwards compatibility. Set to false to explicitly disable this way of detection.
 * $wgMFEnableMinervaBetaFeature
 * デスクトップスキンとしての Minerva ベータ機能を有効にするかどうかを制御します.
 * $wgMFEnableNearbyPagesBetaFeature
 * 付近のページのベータ機能を有効にするかどうかを制御します.
 * $wgMFCollapseSectionsByDefault
 * 既定で節を折り畳むかどうかを制御します.
 * $wgMFEnableNearbyPagesBetaFeature
 * 付近のページのベータ機能を有効にするかどうかを制御します.
 * $wgMFCollapseSectionsByDefault
 * 既定で節を折り畳むかどうかを制御します.
 * $wgMFCollapseSectionsByDefault
 * 既定で節を折り畳むかどうかを制御します.
 * 既定で節を折り畳むかどうかを制御します.
 * 既定で節を折り畳むかどうかを制御します.
 * $wgMFAppPackageId
 * ID of the App to deep link to replacing the browser. Set  to have no such link. See https://developers.google.com/app-indexing/webmasters/details
 * $wgMFAppScheme
 * ディープリンクにおいて使用するスキーム. 既定では「http」が使用されます.
 * $wgMFPageActions
 * どのページアクションが表示・非表示になるかを制御します. 以下が許可されています：edit, talk, upload, watch
 * $wgMFEnableBeta
 * ベータ版およびアルファ版モードが有効かどうか.
 * $wgMFSpecialCaseMainPage
 * If set to true, main page HTML will receive special massaging that removes everything but a few select pieces.
 * $wgMFNamespacesWithoutCollapsibleSections
 * $wgMFRSSFeedLink
 * false
 * Sets RSS feed being outputted or not while on mobile version.
 * $wgMinervaAlwaysShowLanguageButton
 * true
 * Whether to show the language switcher button even if no languages are available for the page.
 * }
 * If set to true, main page HTML will receive special massaging that removes everything but a few select pieces.
 * $wgMFNamespacesWithoutCollapsibleSections
 * $wgMFRSSFeedLink
 * false
 * Sets RSS feed being outputted or not while on mobile version.
 * $wgMinervaAlwaysShowLanguageButton
 * true
 * Whether to show the language switcher button even if no languages are available for the page.
 * }
 * Sets RSS feed being outputted or not while on mobile version.
 * $wgMinervaAlwaysShowLanguageButton
 * true
 * Whether to show the language switcher button even if no languages are available for the page.
 * }
 * }

モバイルブラウザ自動検出の設定
/Configuring browser auto-detection を参照してください.

メインページの設定
モバイル版のメインページは、既定ではデスクトップ PC 版と同じです. メインページを最適化してモバイル利用者に示すには、単に次の規則2点のとおり PC 版のメインページを無効にして、モバイル版専用のコンテンツを追加します. 例:
 * プロジェクトに関わらず、mf- will の接頭辞をつけた選択子をモバイル版のメインページに追加. これらの要素により設定してあるタイトル属性は、節の前に置いた見出しにレベル上げ. タイトル属性は最適化する.
 * 'nomobile' 類の要素はモバイル版に表示しない.

Hello

これは 'Hello' という文章を含む Wikimedia Blog という名前の節を作成します. メインページの保存後、モバイルデバイスでは、追加したこれらの規則に従った節のみが表示されます.

Nearby のインストール
MobileFrontend はわずかな設定で特別:付近ページを提供します. これを得るためには数段階のオプションステップを行うことが必要です：

Alternatively you can use an alien MediaWiki instance for Nearby with the following 2 lines in your LocalSettings. The nearby endpoint will be used to find related content to a given location.
 * Install GeoData
 * Run update.php
 * in LocalSettings.php add $wgMFNearby = true;
 * Add data to your articles to one or more pages   see the documentation for GeoData for syntax details

追加の調整
Get the most out of MobileFrontend by adding these other optional dependencies:


 * Extension:Geodata - get Special:Nearby and geotag your articles
 * Extension:PageImages - adds images to search and nearby results
 * Extension:VisualEditor - add Visual editing to your mobile experience.

CSSスタイル
モバイルテーマに CSS を適用するには、MediaWiki:Mobile.css を編集してください. これは MediaWiki:Common.css に対応するものです.

詳細情報
デスクトップブラウザでモバイル拡張機能をテストしたい場合やデバイスがモバイル版を表示しない場合には、以下のキー・値ペアをクエリ文字列に追加することができます：?useformat=mobile 例：https://en.wikipedia.org/wiki/Chuck_Schuldiner?useformat=mobile

If you would like to see the wap version of the mobile extension, use ?useformat=mobile-wap instead.

サイト全体に渡ってベータ機能を有効にすることなくページをベータ版で表示したい場合は、任意のページのクエリ文字列に以下を追加することができます：

Wiki に常にモバイルビューで表示させるためには、LocalSettings.php に以下を追加してください：

拡張された action=parse
action=parse accepts extra parameters:
 * mobileformat=: Return rendered page HTML in a mobile format . Prior to MediaWiki 1.23, you could specify mobileformat=html to output HTML for modern phones or mobileformat=wml to output WML for dumb phones (see mailing list messagefor details).
 * noimages: Disable images in mobile output.
 * mainpage: Apply mobile main page transformations.

例:

action=mobileview
Delivers content optimized for mobile devices for use by mobile apps and dynamic section views. Almost like a restricted-functionality action=parse</tt>, but more flexible and returns separate sections that are always obtained from full-page parse.

Parameters:
 * page</tt>: Title of page to process.
 * sections</tt>: Pipe-separated list of section numbers for which to return text or all</tt> for all sections.
 * redirect</tt>: Whether redirects should be followed, yes</tt> (default) or no</tt>. This parameter is intentionally made similar to the one to index.php.
 * prop</tt>: Which information to get:
 * text</tt>: HTML of selected section(s)
 * sections</tt>: Information about all sections on page
 * normalizedtitle</tt>: Normalized page title, will be returned only if it differs from the specified one.
 * sectionprop</tt>: What information about sections to get: pipe-separated list of value types defined by parser. It's the same as in action=parse: toclevel, level, line, number, index, fromtitle, anchor. "byteoffset" has been excluded as it makes no sense for this action.
 * noimages</tt>: Return HTML without images.
 * noheadings</tt>: Return HTML without headings.

Returned section information also includes the id</tt> for every section - its zero-based number; and for sections that contains references added by Cite, there's also references</tt> data member.

例:

Same request for XML:

[//www.mediawiki.org/w/api.php?action=mobileview&page=Extension:MobileFrontend/Example&sections=0&prop=text|sections&format=xmlfm api.php?action=mobileview&page=Extension:MobileFrontend/Example&sections=0&prop=text|sections&format=xml]

prop=extracts
Migrated to 

ウィキメディア財団のサイト群
Wikimedia 財団の運営するサイトでは、デバイスのユーザーエージェントを調べるために Varnish キャッシュサーバーを利用しています. 閲覧者のユーザーエージェントがモバイルデバイス由来であるように見える場合、Varnish サーバーはリクエストに対して適切な 'X-Device' ヘッダを設定し、閲覧者は記事の MobileFrontend 版へリダイレクトされます. また、フッタの「モバイルビュー」をクリックしたり、クエリ文字列に "useformat=mobile" を追加したりすることで、記事をモバイルビューで見ることができます. 例：

X-Device を設定する Varnish サーバーの vcl 設定 記事のモバイル版を見ているがデスクトップ版を見たい場合には、「この記事を通常の＜サイト名＞で閲覧する」をクリックして戻すことができます.

Web ブラウザで恒久的にモバイルビューを無効化したい場合は、「恒久的にモバイルサイトを無効化する」をクリックすることができます. これは WMF のサーバーに常にサイトのデスクトップ版を表示するよう指示する cookie を設定します.

ウィキメディア財団以外のサイト
非 WMF サイトでは、WMF で行われる動作（プロキシ層でのデバイス検出および固有の X-Device ヘッダ設定）を模倣するように設定するか、記事がモバイルビューを使うように切り替えるため単に "?useformat=mobile" を使うことができます.

拡張機能の開発者向け
既定では、拡張機能内のリソースモジュールはモバイルビューでは読み込まれません. Should a module need to be loaded while in mobile view this guide on writing MobileFrontend friendly modules will be of help.

関連項目

 * Wikimedia の MobileFrontend 設定ファイル
 * Wikimedia の MobileFrontend 設定ファイル
 * Wikimedia の MobileFrontend 設定ファイル