Jdlrobson has submitted this change and it was merged. Change subject: Initial commit ......................................................................
Initial commit Adds access to turning on vector.skin-beta styles within the BetaFeatures preferences. Change-Id: I4fd58550b602651901e6af2fd4a055f5b09d4ffd --- A VectorBeta.hooks.php A VectorBeta.i18n.php A VectorBeta.php 3 files changed, 113 insertions(+), 0 deletions(-) Approvals: Jdlrobson: Verified; Looks good to me, approved diff --git a/VectorBeta.hooks.php b/VectorBeta.hooks.php new file mode 100644 index 0000000..88238ce --- /dev/null +++ b/VectorBeta.hooks.php @@ -0,0 +1,48 @@ +<?php +/* + * This file is part of the MediaWiki extension VectorBeta. + * + * VectorBeta is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * VectorBeta is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with VectorBeta. If not, see <http://www.gnu.org/licenses/>. + * + * @file + * @ingroup extensions + */ + +class VectorBetaHooks { + static function getPreferences( $user, &$prefs ) { + global $wgScriptPath; + + $prefs['betafeatures-vector-typography-update'] = array( + 'label-message' => 'vector-beta-feature-typography-message', + 'desc-message' => 'vector-beta-feature-typography-description', + 'info-link' => 'https://www.mediawiki.org/wiki/Wikimedia_Foundation_Design/Typography', + 'discussion-link' => 'https://www.mediawiki.org/wiki/Talk:Wikimedia_Foundation_Design/Typography', + 'screenshot' => $wgScriptPath . '/resources/mediawiki/images/typography-beta.svg', + ); + + return true; + } + + static function skinVectorStyleModules( $skin, &$modules ) { + if ( BetaFeatures::isFeatureEnabled( $skin->getUser(), 'betafeatures-vector-typography-update' ) ) { + $index = array_search( 'skins.vector', $modules ); + if ( $index !== false ) { + array_splice( $modules, $index, 1 ); + } + $modules[] = 'skins.vector-beta'; + } + + return true; + } +} diff --git a/VectorBeta.i18n.php b/VectorBeta.i18n.php new file mode 100644 index 0000000..4fb7269 --- /dev/null +++ b/VectorBeta.i18n.php @@ -0,0 +1,38 @@ +<?php +/* + * This file is part of the MediaWiki extension VectorBeta. + * + * VectorBeta is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * VectorBeta is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with VectorBeta. If not, see <http://www.gnu.org/licenses/>. + * + * @file + * @ingroup extensions + */ + +$messages = array(); + +/** + * English + */ +$messages['en'] = array( + 'vector-beta-feature-typography-message' => 'Vector typography refresh', + 'vector-beta-feature-typography-description' => 'Updates typography of the Vector skin to improve readability, accessibility and consistency.', +); + +/** + * Message documentation (Message documentation) + */ +$messages['qqq'] = array( + 'vector-beta-feature-typography-message' => 'Name shown in user preferences for Vector typography beta feature experiment.', + 'vector-beta-feature-typography-description' => 'Brief explanation of Vector typography beta feature experiment.', +); diff --git a/VectorBeta.php b/VectorBeta.php new file mode 100644 index 0000000..0cafef5 --- /dev/null +++ b/VectorBeta.php @@ -0,0 +1,27 @@ +<?php +/* + * This file is part of the MediaWiki extension VectorBeta. + * + * VectorBeta is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * VectorBeta is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with VectorBeta. If not, see <http://www.gnu.org/licenses/>. + * + * @file + * @ingroup extensions + */ + +$wgAutoloadClasses['VectorBetaHooks'] = __DIR__ . '/VectorBeta.hooks.php'; + +$wgExtensionMessagesFiles['VectorBeta'] = __DIR__ . '/VectorBeta.i18n.php'; + +$wgHooks['GetBetaFeaturePreferences'][] = 'VectorBetaHooks::getPreferences'; +$wgHooks['SkinVectorStyleModules'][] = 'VectorBetaHooks::skinVectorStyleModules'; -- To view, visit https://gerrit.wikimedia.org/r/88643 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I4fd58550b602651901e6af2fd4a055f5b09d4ffd Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/VectorBeta Gerrit-Branch: master Gerrit-Owner: Trevor Parscal <tpars...@wikimedia.org> Gerrit-Reviewer: Jdlrobson <jrob...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits