开源软件名称(OpenSource Name):wikimedia/mediawiki-extensions-MobileFrontend开源软件地址(OpenSource Url):https://github.com/wikimedia/mediawiki-extensions-MobileFrontend开源编程语言(OpenSource Language):JavaScript 57.3%开源软件介绍(OpenSource Introduction):MobileFrontend ExtensionThe MobileFrontend extension adds a mobile view to your mediawiki instance. InstallationSee https://www.mediawiki.org/wiki/Extension:MobileFrontend#Installation DevelopmentDirectory structure
Coding conventionsPlease follow the coding conventions of MobileFrontend: https://www.mediawiki.org/wiki/MobileFrontend/Coding_conventions Git hooksGit hooks are provided by default to assist with adhering to JavaScript code standards, optimizing PNG files, etc. Running these hooks requires node.js, NPM, and grunt. Install like so:
If you are not running Vagrant, be sure to set your CommittingCommits are important as they give the reviewer more information to successfully review your code and find errors or potential problems you might not have thought of. Commits are also useful when troubleshooting issues and refactoring. If it's not clear why a line of code is in the repository important bug fixes could be lost. Commits should be as minor as possible. Please avoid removing unrelated console.log statements, fixing unrelated whitespace etc. do that in a separate commit which mentions the word cleanup. First line commit should summarise the commit with bug it fixes if applicable. e.g. Fix problem with toggling see bug x. Second line should be blank. Third line should go into detail where necessary providing links to blog posts/other bugs to provide more background. Mention the platforms/browsers the change is for where necessary, e.g.:
TestingUnit testsTo run the full test suite run:
To run only PHP tests:
To run only MobileFrontend JS tests:
ReleasingA new version of MobileFrontend is released every two weeks following the Wikimedia release train if there are new changes. MobileFrontend follows the version naming from MediaWiki. Configuration optionsMobileFrontendThe following configuration options will apply to all skins operating in useformat=mobile mode. $wgMFEnableXAnalyticsLoggingWhether or not to enable the use of the X-Analytics HTTP response header. This header is used for analytics purposes. See: https://www.mediawiki.org/wiki/Analytics/Kraken/Data_Formats/X-Analytics
$wgMFUsePreferredEditorUse the user's preferred editor (i.e. visual editor or source editor) on first load. Uses the
$wgMFEnableMobilePreferencesEnable mobile preferences in Special:Preferences (currently only accessible in desktop). Currently this allows users to disable many of mobile's special page optimisations.
$wgMFUseDesktopSpecialHistoryPageEnables the desktop version of the history page if set to
[
// Enable mobile version of history page for all users by default
'base' => false,
'beta' => false,
'amc' => false,
] $wgMFUseDesktopSpecialWatchlistPageEnables the desktop version of the watchlist page if set to
[
'base' => false,
'beta' => false,
// Enable desktop version of watchlist page when AMC is enabled
'amc' => true,
] $wgMFEnableJSConsoleRecruitmentControls whether a message should be logged to the console to attempt to recruit volunteers.
$wgMFIsBannerEnabledWhether or not the banner experiment is enabled. See: https://www.mediawiki.org/wiki/Reading/Features/Article_lead_image
MFScriptPathWhen set will override the default search script path
e.g.
Note, this will make the wiki read only. Non-anonymous HTTP requests will throw CORS error. This may also cause compatibility problems with other extensions. This should not be used in production, it is strictly for development purposes.
$wgMFMobileFormatterOptionsThis provides options for the MobileFormatter.
$wgMFSiteStylesRenderBlockingIf set to true, styles inside MediaWiki:Mobile.css will become render blocking. This is intended for situations where the TemplateStyles extension cannot be used. When enabled, this may increase the time it takes for the mobile site to render, depending on how large MediaWiki:Mobile.css is for your wiki.
$wgMFTrackBlockNoticesIf set to true, block notices will be tracked on display, along with some limited user interactions. Counts will be stored for later analysis. No personal data will be collected.
$wgMFMobileHeaderRequests containing header with this name will be considered as coming from mobile devices.
$wgMFRemovableClassesMake the classes, tags and ids stripped from page content configurable. Each item will be stripped from the page.
[
// These rules will be used for all transformations in the beta channel of the site
'beta' => [],
// These rules will be used for all transformations
'base' => [],
] $wgMFLazyLoadImagesDo load images in pages lazily. Currently it doesn't affect HTML-only clients (only JS capable ones) and it lazy loads images when they come close to the viewport.
[
// These will enable lazy loading images in beta mode
'beta' => true,
// These will enable lazy loading images in all modes
'base' => true,
] $wgMFNearbyRangeThe range in meters that should be searched to find nearby pages on Special:Nearby (defaults to 10km).
$wgMFNearbyWhether geodata related functionality should be enabled.
$wgMFSearchAPIParamsDefine a set of params that should be passed in every gateway query.
[
// See https://phabricator.wikimedia.org/T115646
'ppprop' => 'displaytitle',
] $wgMFQueryPropModulesDefine a set of page props that should be associated with requests for pages via the API.
$wgMFRSSFeedLinkSets RSS feed
$wgMFSearchGeneratorDefine the generator that should be used for mobile search.
[
'name' => 'prefixsearch',
'prefix' => 'ps',
] $wgMFMinCachedPageSizePages with smaller parsed HTML size are not cached. Set to 0 to cache everything or to some large value to disable caching completely.
$wgMFAutodetectMobileViewSet this to true to automatically show mobile view depending on people's user-agent. WARNING: Make sure that your caching infrastructure is configured appropriately, to avoid people receiving cached versions of pages intended for someone else's devices.
$wgMFVaryOnUASet this to WARNING: You should set this to true only, if you know what you're doing! CAUTION: Setting this to true in combination with a (frontend)caching layer (such as Varnish) can have a huge impact on how your caching works, as it now caches every single page multiple times for any possible/different User Agent string!
$wgMFShowMobileViewToTabletsControls whether tablets should be shown the mobile site. Works only if
$wgMobileUrlTemplateTemplate for mobile URLs. This will be used to transcode regular URLs into mobile URLs for the mobile view. It's possible to specify the mobileness of the URL in the host portion of the URL. You can either statically or dynamically create the host-portion of your mobile
URL. To statically create it, just set $wgMobileUrlTemplate = "mobile.mydomain.com"; Alternatively, the host definition can include placeholders for different parts
of the host section of a URL. The placeholders are denoted by
$wgMobileFrontendFormatCookieExpiryThe number of seconds the The useformat cookie gets set when a user manually elects to view either the mobile or desktop view of the site. If this value is not set, it will default to
$wgMFNoindexPagesSet 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.
$wgMFStopRedirectCookieHostSet the domain of the If this value is not set, it will default to the top domain of the host name
(e.g. If you want to set this to a top domain (to cover all subdomains), be sure to
include the preceding
$wgMFEnableBetaWhether beta mode is enabled.
$wgMFAdvancedMobileContributionsWhether Advanced mode is available for users.
$wgMFAmcOutreachWhether the AMC Outreach feature is available for users.
$wgMFAmcOutreachMinEditCountWhen Amc Outreach is enabled, this option sets the minimum number of edits a user must make before they are eligible to see the AMC Outreach feature.
MFBetaFeedbackLinkLink to feedback page for beta features. If false no feedback link will be shown.
$wgDefaultMobileSkinThe default skin for MobileFrontend.
$wgMFNamespacesWithoutCollapsibleSectionsIn which namespaces sections shouldn't be collapsed.
[
// Authorship and licensing information should be visible initially
NS_FILE,
// Otherwise category contents will be hidden
NS_CATEGORY,
// Don't collapse various forms
NS_SPECIAL,
// Just don't
NS_MEDIA,
] $wgMFCollapseSectionsByDefaultControls whether to collapse sections by default. Leave at default In tablet sections will always be expanded by default regardless of this setting. Set to
$wgMFUseWikibaseIf set to true, the use Wikibase is enabled and associated features is enabled.
See
$wgMFEnableWikidataDescriptionsIf set to true, wikidata descriptions as defined in $wgMFDisplayWikibaseDescriptions will show up in the UI in the environment they have been told to target.
[
'beta' => true,
'base' => false,
] $wgMFDisplayWikibaseDescriptionsSet which features will use Wikibase descriptions, e.g. $wgMFDisplayWikibaseDescriptions = [
'search' => true,
'nearby' => true,
'watchlist' => false,
'tagline' => true,
];
[
'search' => false,
'nearby' => false,
'watchlist' => false,
'tagline' => false,
] $wgMFSpecialPageTaglinesSet taglines for special pages $wgMFSpecialPageTaglines = [
"SpecialPageName" => "valid-message-key",
];
[
"MobileOptions" => "mobile-frontend-settings-tagline"
] $wgMFStripResponsiveImagesWhether to strip
$wgMFResponsiveImageWhitelistWhitelist of source file mime types to retain srcset attributes on when using $wgMFStripResponsiveImages. Defaults to allow rasterized SVGs since they usually are diagrams that compress well and benefit from the higher resolution.
[
"image/svg+xml",
] $wgMFNamespacesWithLeadParagraphsA list of namespace codes that have lead paragraphs. Lead paragraphs will be
shown before infoboxes if
[
0
] $wgMFStopMobileRedirectCookieSecureValueThe default value of the 'secure' cookie parameter that controls MobileFrontend's mobile redirect behavior. This variable defaults to true to encourage the use of TLS on any servers hosting MediaWiki and to avoid the disclosure of minor user privacy issues regarding a user's mobile browsing preferences.
|
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论