From: Bartosz Dziewoński Date: Wed, 20 Aug 2014 13:13:43 +0000 (+0200) Subject: Revamp classic edit toolbar not to hardcode paths in HTML X-Git-Tag: 1.31.0-rc.0~14004^2 X-Git-Url: http://git.cyclocoop.org/%7B%24admin_url%7Dcompta/comptes/journal.php?a=commitdiff_plain;h=285c52039bf4d2f9ba78f07656400dac7ba0fef7;p=lhc%2Fweb%2Fwiklou.git Revamp classic edit toolbar not to hardcode paths in HTML Also, try out a way to have per-module LESS variables defined in PHP. This might come in handy in the future… Maybe for skin theme support? (I recommend reviewing the file changes in the order below. :D) includes/resourceloader/ResourceLoaderFileModule.php * Pass the context (ResourceLoaderContext) deeper down via readStyleFiles() and readStyleFile(). We need it to compile the .less files for the right language. * Extract LESS compiler creation to getLessCompiler(). * Allow passing a LESS compiler instance to compileLessFile(), rather than getting one after the method is called. All of the changes are backwards-compatible. includes/resourceloader/ResourceLoaderEditToolbarModule.php * New module to support getting the language data and passing it to LESS variables. It might be a good idea to factor out a reusable class for a LESS module with additional variables, but that would require more attention to design than I gave it. resources/src/mediawiki.action/mediawiki.action.edit.toolbar/mediawiki.action.edit.toolbar.less * Glue code to use the language data defined by the module above and put it in final CSS. includes/EditPage.php * Do not hardcode image URLs in output HTML, as they are provided in CSS now. This gets rid of some usage of globals. In fact, we should be able to finally move the inline JavaScript calls out of getEditToolbar(), but I'm already introducing too many changes for one patch. That can be done later. languages/Language.php * Add getImageFiles() to complement existing getImageFile() method. Misleadingly named, it returns paths for images for the toolbar only (and no other ones at all). skins/common/ → resources/src/mediawiki.action/mediawiki.action.edit.toolbar/ * Moved all of the button images to new location. Also, boring cleanup that was harder before because we treated the paths as public API: * Placed default ones in en/ subdirectory. * Renamed cyrl/ to ru/. * Renamed ksh/button_S_italic.png → ksh/button_italic.png. languages/messages/ * Adjusting paths and filenames for the changes above. resources/src/mediawiki.action/mediawiki.action.edit.css resources/src/mediawiki.action/mediawiki.action.edit.js * Added styles and updated the script to make it possible to have non- elements as toolbar buttons. * Consolidated styles that were already required, but defined somewhere else: * `cursor: pointer;` (from shared.css) * `vertical-align: middle;` (from commonElements.css) Bug: 69277 Change-Id: I39d8ed4258c7da0fe4fe4c665cdb26c86420769c --- diff --git a/includes/AutoLoader.php b/includes/AutoLoader.php index 1f8b483f34..390d1342cc 100644 --- a/includes/AutoLoader.php +++ b/includes/AutoLoader.php @@ -873,6 +873,7 @@ $wgAutoloadLocalClasses = array( 'includes/resourceloader/DerivativeResourceLoaderContext.php', 'ResourceLoader' => 'includes/resourceloader/ResourceLoader.php', 'ResourceLoaderContext' => 'includes/resourceloader/ResourceLoaderContext.php', + 'ResourceLoaderEditToolbarModule' => 'includes/resourceloader/ResourceLoaderEditToolbarModule.php', 'ResourceLoaderFileModule' => 'includes/resourceloader/ResourceLoaderFileModule.php', 'ResourceLoaderFilePageModule' => 'includes/resourceloader/ResourceLoaderFilePageModule.php', 'ResourceLoaderFilePath' => 'includes/resourceloader/ResourceLoaderFilePath.php', diff --git a/includes/EditPage.php b/includes/EditPage.php index a14191a035..1e12f57274 100644 --- a/includes/EditPage.php +++ b/includes/EditPage.php @@ -3553,22 +3553,22 @@ HTML * @return string */ static function getEditToolbar() { - global $wgStylePath, $wgContLang, $wgLang, $wgOut; + global $wgContLang, $wgOut; global $wgEnableUploads, $wgForeignFileRepos; $imagesAvailable = $wgEnableUploads || count( $wgForeignFileRepos ); /** * $toolarray is an array of arrays each of which includes the - * filename of the button image (without path), the opening - * tag, the closing tag, optionally a sample text that is + * opening tag, the closing tag, optionally a sample text that is * inserted between the two when no selection is highlighted * and. The tip text is shown when the user moves the mouse * over the button. + * + * Images are defined in ResourceLoaderEditToolbarModule. */ $toolarray = array( array( - 'image' => $wgLang->getImageFile( 'button-bold' ), 'id' => 'mw-editbutton-bold', 'open' => '\'\'\'', 'close' => '\'\'\'', @@ -3576,7 +3576,6 @@ HTML 'tip' => wfMessage( 'bold_tip' )->text(), ), array( - 'image' => $wgLang->getImageFile( 'button-italic' ), 'id' => 'mw-editbutton-italic', 'open' => '\'\'', 'close' => '\'\'', @@ -3584,7 +3583,6 @@ HTML 'tip' => wfMessage( 'italic_tip' )->text(), ), array( - 'image' => $wgLang->getImageFile( 'button-link' ), 'id' => 'mw-editbutton-link', 'open' => '[[', 'close' => ']]', @@ -3592,7 +3590,6 @@ HTML 'tip' => wfMessage( 'link_tip' )->text(), ), array( - 'image' => $wgLang->getImageFile( 'button-extlink' ), 'id' => 'mw-editbutton-extlink', 'open' => '[', 'close' => ']', @@ -3600,7 +3597,6 @@ HTML 'tip' => wfMessage( 'extlink_tip' )->text(), ), array( - 'image' => $wgLang->getImageFile( 'button-headline' ), 'id' => 'mw-editbutton-headline', 'open' => "\n== ", 'close' => " ==\n", @@ -3608,7 +3604,6 @@ HTML 'tip' => wfMessage( 'headline_tip' )->text(), ), $imagesAvailable ? array( - 'image' => $wgLang->getImageFile( 'button-image' ), 'id' => 'mw-editbutton-image', 'open' => '[[' . $wgContLang->getNsText( NS_FILE ) . ':', 'close' => ']]', @@ -3616,7 +3611,6 @@ HTML 'tip' => wfMessage( 'image_tip' )->text(), ) : false, $imagesAvailable ? array( - 'image' => $wgLang->getImageFile( 'button-media' ), 'id' => 'mw-editbutton-media', 'open' => '[[' . $wgContLang->getNsText( NS_MEDIA ) . ':', 'close' => ']]', @@ -3624,7 +3618,6 @@ HTML 'tip' => wfMessage( 'media_tip' )->text(), ) : false, array( - 'image' => $wgLang->getImageFile( 'button-nowiki' ), 'id' => 'mw-editbutton-nowiki', 'open' => "", 'close' => "", @@ -3632,7 +3625,6 @@ HTML 'tip' => wfMessage( 'nowiki_tip' )->text(), ), array( - 'image' => $wgLang->getImageFile( 'button-sig' ), 'id' => 'mw-editbutton-signature', 'open' => '--~~~~', 'close' => '', @@ -3640,7 +3632,6 @@ HTML 'tip' => wfMessage( 'sig_tip' )->text(), ), array( - 'image' => $wgLang->getImageFile( 'button-hr' ), 'id' => 'mw-editbutton-hr', 'open' => "\n----\n", 'close' => '', @@ -3656,7 +3647,8 @@ HTML } $params = array( - $wgStylePath . '/common/images/' . $tool['image'], + // Images are defined in ResourceLoaderEditToolbarModule + false, // Note that we use the tip both for the ALT tag and the TITLE tag of the image. // Older browsers show a "speedtip" type message only for ALT. // Ideally these should be different, realistically they diff --git a/includes/resourceloader/ResourceLoaderEditToolbarModule.php b/includes/resourceloader/ResourceLoaderEditToolbarModule.php new file mode 100644 index 0000000000..004942147d --- /dev/null +++ b/includes/resourceloader/ResourceLoaderEditToolbarModule.php @@ -0,0 +1,102 @@ + '\\\\', '"' => '\\"' ) ); + $value = preg_replace_callback( '/[\x01-\x1f\x7f-\x9f]/', function ( $match ) { + return '\\' . base_convert( ord( $match[0] ), 10, 16 ) . ' '; + }, $value ); + return '"' . $value . '"'; + } + + /** + * Get language-specific LESS variables for this module. + * + * @return array + */ + private function getLessVars( ResourceLoaderContext $context ) { + $language = Language::factory( $context->getLanguage() ); + + // This is very conveniently formatted and we can pass it right through + $vars = $language->getImageFiles(); + + // lessc tries to be helpful and parse our variables as LESS source code + foreach ( $vars as $key => &$value ) { + $value = self::cssSerializeString( $value ); + } + + return $vars; + } + + /** + * @param ResourceLoaderContext $context + * @return int UNIX timestamp + */ + public function getModifiedTime( ResourceLoaderContext $context ) { + return max( + parent::getModifiedTime( $context ), + $this->getHashMtime( $context ) + ); + } + + /** + * @param ResourceLoaderContext $context + * @return string Hash + */ + public function getModifiedHash( ResourceLoaderContext $context ) { + return md5( + parent::getModifiedHash( $context ) . + serialize( $this->getLessVars( $context ) ) + ); + } + + /** + * Get a LESS compiler instance for this module. + * + * Set our variables in it. + * + * @throws MWException + * @param ResourceLoaderContext $context + * @return lessc + */ + protected function getLessCompiler( ResourceLoaderContext $context ) { + $compiler = parent::getLessCompiler(); + $compiler->setVariables( $this->getLessVars( $context ) ); + return $compiler; + } +} diff --git a/includes/resourceloader/ResourceLoaderFileModule.php b/includes/resourceloader/ResourceLoaderFileModule.php index 6128f19c79..fee78d1ab7 100644 --- a/includes/resourceloader/ResourceLoaderFileModule.php +++ b/includes/resourceloader/ResourceLoaderFileModule.php @@ -385,7 +385,8 @@ class ResourceLoaderFileModule extends ResourceLoaderModule { public function getStyles( ResourceLoaderContext $context ) { $styles = $this->readStyleFiles( $this->getStyleFiles( $context ), - $this->getFlip( $context ) + $this->getFlip( $context ), + $context ); // Collect referenced files $this->localFileRefs = array_unique( $this->localFileRefs ); @@ -816,14 +817,14 @@ class ResourceLoaderFileModule extends ResourceLoaderModule { * * @param array $styles List of media type/list of file paths pairs, to read, remap and * concetenate - * * @param bool $flip + * @param ResourceLoaderContext $context (optional) * * @throws MWException * @return array List of concatenated and remapped CSS data from $styles, * keyed by media type */ - public function readStyleFiles( array $styles, $flip ) { + public function readStyleFiles( array $styles, $flip, $context = null ) { if ( empty( $styles ) ) { return array(); } @@ -831,7 +832,7 @@ class ResourceLoaderFileModule extends ResourceLoaderModule { $uniqueFiles = array_unique( $files, SORT_REGULAR ); $styleFiles = array(); foreach ( $uniqueFiles as $file ) { - $styleFiles[] = $this->readStyleFile( $file, $flip ); + $styleFiles[] = $this->readStyleFile( $file, $flip, $context ); } $styles[$media] = implode( "\n", $styleFiles ); } @@ -845,11 +846,12 @@ class ResourceLoaderFileModule extends ResourceLoaderModule { * * @param string $path File path of style file to read * @param bool $flip + * @param ResourceLoaderContext $context (optional) * * @return string CSS data in script file * @throws MWException If the file doesn't exist */ - protected function readStyleFile( $path, $flip ) { + protected function readStyleFile( $path, $flip, $context = null ) { $localPath = $this->getLocalPath( $path ); $remotePath = $this->getRemotePath( $path ); if ( !file_exists( $localPath ) ) { @@ -859,7 +861,8 @@ class ResourceLoaderFileModule extends ResourceLoaderModule { } if ( $this->getStyleSheetLang( $localPath ) === 'less' ) { - $style = $this->compileLessFile( $localPath ); + $compiler = $this->getLessCompiler( $context ); + $style = $this->compileLessFile( $localPath, $compiler ); $this->hasGeneratedStyles = true; } else { $style = file_get_contents( $localPath ); @@ -908,12 +911,29 @@ class ResourceLoaderFileModule extends ResourceLoaderModule { * @since 1.22 * @throws Exception If lessc encounters a parse error * @param string $fileName File path of LESS source + * @param lessc $compiler Compiler to use, if not default * @return string CSS source */ - protected function compileLessFile( $fileName ) { - $compiler = ResourceLoader::getLessCompiler( $this->getConfig() ); + protected function compileLessFile( $fileName, $compiler = null ) { + if ( !$compiler ) { + $compiler = $this->getLessCompiler(); + } $result = $compiler->compileFile( $fileName ); $this->localFileRefs += array_keys( $compiler->allParsedFiles() ); return $result; } + + /** + * Get a LESS compiler instance for this module in given context. + * + * Just calls ResourceLoader::getLessCompiler() by default to get a global compiler. + * + * @param ResourceLoaderContext $context + * @throws MWException + * @since 1.24 + * @return lessc + */ + protected function getLessCompiler( ResourceLoaderContext $context = null ) { + return ResourceLoader::getLessCompiler( $this->getConfig() ); + } } diff --git a/languages/Language.php b/languages/Language.php index 2bc4554e5d..15de225aa1 100644 --- a/languages/Language.php +++ b/languages/Language.php @@ -784,6 +784,14 @@ class Language { return self::$dataCache->getSubitem( $this->mCode, 'imageFiles', $image ); } + /** + * @return array + * @since 1.24 + */ + function getImageFiles() { + return self::$dataCache->getItem( $this->mCode, 'imageFiles' ); + } + /** * @return array */ diff --git a/languages/messages/MessagesEn.php b/languages/messages/MessagesEn.php index ccdd310ecb..7541f31943 100644 --- a/languages/messages/MessagesEn.php +++ b/languages/messages/MessagesEn.php @@ -512,16 +512,16 @@ $linkPrefixCharset = 'a-zA-Z\\x{80}-\\x{10ffff}'; * basis if needed. */ $imageFiles = array( - 'button-bold' => 'button_bold.png', - 'button-italic' => 'button_italic.png', - 'button-link' => 'button_link.png', - 'button-extlink' => 'button_extlink.png', - 'button-headline' => 'button_headline.png', - 'button-image' => 'button_image.png', - 'button-media' => 'button_media.png', - 'button-nowiki' => 'button_nowiki.png', - 'button-sig' => 'button_sig.png', - 'button-hr' => 'button_hr.png', + 'button-bold' => 'en/button_bold.png', + 'button-italic' => 'en/button_italic.png', + 'button-link' => 'en/button_link.png', + 'button-extlink' => 'en/button_extlink.png', + 'button-headline' => 'en/button_headline.png', + 'button-image' => 'en/button_image.png', + 'button-media' => 'en/button_media.png', + 'button-nowiki' => 'en/button_nowiki.png', + 'button-sig' => 'en/button_sig.png', + 'button-hr' => 'en/button_hr.png', ); /** diff --git a/languages/messages/MessagesKsh.php b/languages/messages/MessagesKsh.php index 2f6c650511..e338b42edd 100644 --- a/languages/messages/MessagesKsh.php +++ b/languages/messages/MessagesKsh.php @@ -209,6 +209,6 @@ $magicWords = array( ); $imageFiles = array( - 'button-italic' => 'ksh/button_S_italic.png', + 'button-italic' => 'ksh/button_italic.png', ); diff --git a/languages/messages/MessagesRu.php b/languages/messages/MessagesRu.php index 9098d85c16..a96b7663d7 100644 --- a/languages/messages/MessagesRu.php +++ b/languages/messages/MessagesRu.php @@ -433,9 +433,9 @@ $fallback8bitEncoding = 'windows-1251'; $linkPrefixExtension = false; $imageFiles = array( - 'button-bold' => 'cyrl/button_bold.png', - 'button-italic' => 'cyrl/button_italic.png', - 'button-link' => 'cyrl/button_link.png', + 'button-bold' => 'ru/button_bold.png', + 'button-italic' => 'ru/button_italic.png', + 'button-link' => 'ru/button_link.png', ); $linkTrail = '/^([a-zабвгдеёжзийклмнопрстуфхцчшщъыьэюя]+)(.*)$/sDu'; diff --git a/resources/Resources.php b/resources/Resources.php index 07f3cf9d1b..947f6224e8 100644 --- a/resources/Resources.php +++ b/resources/Resources.php @@ -984,8 +984,10 @@ return array( 'mediawiki.action.edit' => array( 'scripts' => 'resources/src/mediawiki.action/mediawiki.action.edit.js', + 'styles' => 'resources/src/mediawiki.action/mediawiki.action.edit.css', 'dependencies' => array( 'mediawiki.action.edit.styles', + 'mediawiki.action.edit.toolbar', 'jquery.textSelection', 'jquery.byteLimit', ), @@ -995,6 +997,10 @@ return array( 'styles' => 'resources/src/mediawiki.action/mediawiki.action.edit.styles.css', 'position' => 'top', ), + 'mediawiki.action.edit.toolbar' => array( + 'class' => 'ResourceLoaderEditToolbarModule', + 'styles' => 'resources/src/mediawiki.action/mediawiki.action.edit.toolbar/mediawiki.action.edit.toolbar.less', + ), 'mediawiki.action.edit.collapsibleFooter' => array( 'scripts' => 'resources/src/mediawiki.action/mediawiki.action.edit.collapsibleFooter.js', 'styles' => 'resources/src/mediawiki.action/mediawiki.action.edit.collapsibleFooter.css', diff --git a/resources/src/mediawiki.action/mediawiki.action.edit.css b/resources/src/mediawiki.action/mediawiki.action.edit.css new file mode 100644 index 0000000000..45ba543759 --- /dev/null +++ b/resources/src/mediawiki.action/mediawiki.action.edit.css @@ -0,0 +1,18 @@ +/*! + * Styles for elements of the editing form, loaded only when JavaScript is enabled. + */ + +.mw-toolbar-editbutton { + width: 23px; + height: 22px; + cursor: pointer; + vertical-align: middle; + /* Cross-browser inline-block */ + /* Firefox 2 */ + display: -moz-inline-block; + /* Modern browsers */ + display: inline-block; + /* IE7 */ + zoom: 1; + *display: inline; +} diff --git a/resources/src/mediawiki.action/mediawiki.action.edit.js b/resources/src/mediawiki.action/mediawiki.action.edit.js index e850276a03..4519b04927 100644 --- a/resources/src/mediawiki.action/mediawiki.action.edit.js +++ b/resources/src/mediawiki.action/mediawiki.action.edit.js @@ -15,6 +15,8 @@ * @private */ function insertButton( b, speedTip, tagOpen, tagClose, sampleText, imageId ) { + var $button; + // Backwards compatibility if ( typeof b !== 'object' ) { b = { @@ -26,15 +28,24 @@ imageId: imageId }; } - var $image = $( '' ).attr( { - width: 23, - height: 22, + + if ( b.imageFile ) { + $button = $( '' ).attr( { src: b.imageFile, alt: b.speedTip, title: b.speedTip, id: b.imageId || undefined, 'class': 'mw-toolbar-editbutton' - } ).click( function ( e ) { + } ); + } else { + $button = $( '
' ).attr( { + title: b.speedTip, + id: b.imageId || undefined, + 'class': 'mw-toolbar-editbutton' + } ); + } + + $button.click( function ( e ) { if ( b.onClick !== undefined ) { b.onClick( e ); } else { @@ -44,7 +55,7 @@ return false; } ); - $toolbar.append( $image ); + $toolbar.append( $button ); } isReady = false; @@ -74,7 +85,7 @@ * @param {Object} button Object with the following properties. * You are required to provide *either* the `onClick` parameter, or the three parameters * `tagOpen`, `tagClose` and `sampleText`, but not both (they're mutually exclusive). - * @param {string} button.imageFile Image to use for the button. + * @param {string} [button.imageFile] Image to use for the button. * @param {string} button.speedTip Tooltip displayed when user mouses over the button. * @param {Function} [button.onClick] Function to be executed when the button is clicked. * @param {string} [button.tagOpen] @@ -82,7 +93,8 @@ * @param {string} [button.sampleText] Alternative to `onClick`. `tagOpen`, `tagClose` and * `sampleText` together provide the markup that should be inserted into page text at * current cursor position. - * @param {string} [button.imageId] `id` attribute of the button HTML element. + * @param {string} [button.imageId] `id` attribute of the button HTML element. Can be + * used to define the image with CSS if it's not provided as `imageFile`. */ addButton: function () { if ( isReady ) { diff --git a/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/ar/button_bold.png b/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/ar/button_bold.png new file mode 100644 index 0000000000..e524f6cbad Binary files /dev/null and b/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/ar/button_bold.png differ diff --git a/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/ar/button_headline.png b/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/ar/button_headline.png new file mode 100644 index 0000000000..398e5614fe Binary files /dev/null and b/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/ar/button_headline.png differ diff --git a/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/ar/button_italic.png b/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/ar/button_italic.png new file mode 100644 index 0000000000..6ec73e9e32 Binary files /dev/null and b/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/ar/button_italic.png differ diff --git a/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/ar/button_link.png b/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/ar/button_link.png new file mode 100644 index 0000000000..c9c63f6c56 Binary files /dev/null and b/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/ar/button_link.png differ diff --git a/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/ar/button_nowiki.png b/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/ar/button_nowiki.png new file mode 100644 index 0000000000..743ea61b1e Binary files /dev/null and b/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/ar/button_nowiki.png differ diff --git a/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/be-tarask/button_bold.png b/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/be-tarask/button_bold.png new file mode 100644 index 0000000000..5c10cfe205 Binary files /dev/null and b/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/be-tarask/button_bold.png differ diff --git a/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/be-tarask/button_italic.png b/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/be-tarask/button_italic.png new file mode 100644 index 0000000000..72209d74ba Binary files /dev/null and b/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/be-tarask/button_italic.png differ diff --git a/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/be-tarask/button_link.png b/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/be-tarask/button_link.png new file mode 100644 index 0000000000..09c86fb14a Binary files /dev/null and b/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/be-tarask/button_link.png differ diff --git a/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/de/button_bold.png b/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/de/button_bold.png new file mode 100644 index 0000000000..367d5bc149 Binary files /dev/null and b/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/de/button_bold.png differ diff --git a/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/de/button_italic.png b/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/de/button_italic.png new file mode 100644 index 0000000000..fdd8c9f924 Binary files /dev/null and b/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/de/button_italic.png differ diff --git a/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/en/button_bold.png b/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/en/button_bold.png new file mode 100644 index 0000000000..75c3f1094a Binary files /dev/null and b/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/en/button_bold.png differ diff --git a/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/en/button_extlink.png b/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/en/button_extlink.png new file mode 100644 index 0000000000..458943c1d1 Binary files /dev/null and b/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/en/button_extlink.png differ diff --git a/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/en/button_headline.png b/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/en/button_headline.png new file mode 100644 index 0000000000..9cf751d9d2 Binary files /dev/null and b/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/en/button_headline.png differ diff --git a/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/en/button_hr.png b/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/en/button_hr.png new file mode 100644 index 0000000000..47e1ca4013 Binary files /dev/null and b/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/en/button_hr.png differ diff --git a/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/en/button_image.png b/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/en/button_image.png new file mode 100644 index 0000000000..69192965c4 Binary files /dev/null and b/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/en/button_image.png differ diff --git a/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/en/button_italic.png b/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/en/button_italic.png new file mode 100644 index 0000000000..527fbd1455 Binary files /dev/null and b/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/en/button_italic.png differ diff --git a/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/en/button_link.png b/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/en/button_link.png new file mode 100644 index 0000000000..eb5634b910 Binary files /dev/null and b/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/en/button_link.png differ diff --git a/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/en/button_media.png b/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/en/button_media.png new file mode 100644 index 0000000000..4194ec1875 Binary files /dev/null and b/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/en/button_media.png differ diff --git a/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/en/button_nowiki.png b/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/en/button_nowiki.png new file mode 100644 index 0000000000..2ba818de2b Binary files /dev/null and b/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/en/button_nowiki.png differ diff --git a/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/en/button_sig.png b/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/en/button_sig.png new file mode 100644 index 0000000000..fe34b3fb9a Binary files /dev/null and b/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/en/button_sig.png differ diff --git a/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/fa/button_bold.png b/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/fa/button_bold.png new file mode 100644 index 0000000000..c54d094cad Binary files /dev/null and b/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/fa/button_bold.png differ diff --git a/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/fa/button_headline.png b/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/fa/button_headline.png new file mode 100644 index 0000000000..9890d15504 Binary files /dev/null and b/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/fa/button_headline.png differ diff --git a/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/fa/button_italic.png b/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/fa/button_italic.png new file mode 100644 index 0000000000..33f91ed613 Binary files /dev/null and b/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/fa/button_italic.png differ diff --git a/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/fa/button_link.png b/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/fa/button_link.png new file mode 100644 index 0000000000..76b939e6af Binary files /dev/null and b/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/fa/button_link.png differ diff --git a/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/fa/button_nowiki.png b/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/fa/button_nowiki.png new file mode 100644 index 0000000000..743ea61b1e Binary files /dev/null and b/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/fa/button_nowiki.png differ diff --git a/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/ksh/LICENSE b/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/ksh/LICENSE new file mode 100644 index 0000000000..47ecfe4ed2 --- /dev/null +++ b/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/ksh/LICENSE @@ -0,0 +1,7 @@ + +button_italic.png +------------------- +Source : http://commons.wikimedia.org/wiki/Image:Button_S_italic.png +License: Public domain +Author : Purodha Blissenbach, http://ksh.wikipedia.org/wiki/User:Purodha + diff --git a/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/ksh/button_italic.png b/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/ksh/button_italic.png new file mode 100644 index 0000000000..15496c082c Binary files /dev/null and b/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/ksh/button_italic.png differ diff --git a/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/ru/LICENSE b/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/ru/LICENSE new file mode 100644 index 0000000000..bedcec6621 --- /dev/null +++ b/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/ru/LICENSE @@ -0,0 +1,17 @@ +button_bold.png +--------------- +Source : http://commons.wikimedia.org/wiki/Image:Button_bold_ukr.png +License: Public domain +Author : Alexey Belomoev + +button_italic.png +------------------------ +Source : http://commons.wikimedia.org/wiki/Image:Button_italic_ukr.png +License: Public domain +Author : Alexey Belomoev + +button_link.png +----------------- +Source : http://commons.wikimedia.org/wiki/Image:Button_internal_link_ukr.png +License: GPL +Author : Saproj, Erik Möller diff --git a/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/ru/button_bold.png b/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/ru/button_bold.png new file mode 100644 index 0000000000..eae30d98e5 Binary files /dev/null and b/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/ru/button_bold.png differ diff --git a/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/ru/button_italic.png b/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/ru/button_italic.png new file mode 100644 index 0000000000..b958d2205c Binary files /dev/null and b/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/ru/button_italic.png differ diff --git a/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/ru/button_link.png b/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/ru/button_link.png new file mode 100644 index 0000000000..12ad373192 Binary files /dev/null and b/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/ru/button_link.png differ diff --git a/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/mediawiki.action.edit.toolbar.less b/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/mediawiki.action.edit.toolbar.less new file mode 100644 index 0000000000..d65b284217 --- /dev/null +++ b/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/mediawiki.action.edit.toolbar.less @@ -0,0 +1,42 @@ +@import "mediawiki.mixins"; + +#mw-editbutton-bold { + .background-image("images/@{button-bold}"); +} + +#mw-editbutton-italic { + .background-image("images/@{button-italic}"); +} + +#mw-editbutton-link { + .background-image("images/@{button-link}"); +} + +#mw-editbutton-extlink { + .background-image("images/@{button-extlink}"); +} + +#mw-editbutton-headline { + .background-image("images/@{button-headline}"); +} + +#mw-editbutton-image { + .background-image("images/@{button-image}"); +} + +#mw-editbutton-media { + .background-image("images/@{button-media}"); +} + +#mw-editbutton-nowiki { + .background-image("images/@{button-nowiki}"); +} + +// Who decided to make only this single one different than the name of the data item? +#mw-editbutton-signature { + .background-image("images/@{button-sig}"); +} + +#mw-editbutton-hr { + .background-image("images/@{button-hr}"); +} diff --git a/resources/src/mediawiki.legacy/shared.css b/resources/src/mediawiki.legacy/shared.css index 6e7dd9a1c3..15bea60f3b 100644 --- a/resources/src/mediawiki.legacy/shared.css +++ b/resources/src/mediawiki.legacy/shared.css @@ -135,10 +135,6 @@ span.texhtml { clear: both; } -#toolbar img { - cursor: pointer; -} - /** * File description page */ diff --git a/skins/common/images/ar/button_bold.png b/skins/common/images/ar/button_bold.png deleted file mode 100644 index e524f6cbad..0000000000 Binary files a/skins/common/images/ar/button_bold.png and /dev/null differ diff --git a/skins/common/images/ar/button_headline.png b/skins/common/images/ar/button_headline.png deleted file mode 100644 index 398e5614fe..0000000000 Binary files a/skins/common/images/ar/button_headline.png and /dev/null differ diff --git a/skins/common/images/ar/button_italic.png b/skins/common/images/ar/button_italic.png deleted file mode 100644 index 6ec73e9e32..0000000000 Binary files a/skins/common/images/ar/button_italic.png and /dev/null differ diff --git a/skins/common/images/ar/button_link.png b/skins/common/images/ar/button_link.png deleted file mode 100644 index c9c63f6c56..0000000000 Binary files a/skins/common/images/ar/button_link.png and /dev/null differ diff --git a/skins/common/images/ar/button_nowiki.png b/skins/common/images/ar/button_nowiki.png deleted file mode 100644 index 743ea61b1e..0000000000 Binary files a/skins/common/images/ar/button_nowiki.png and /dev/null differ diff --git a/skins/common/images/be-tarask/button_bold.png b/skins/common/images/be-tarask/button_bold.png deleted file mode 100644 index 5c10cfe205..0000000000 Binary files a/skins/common/images/be-tarask/button_bold.png and /dev/null differ diff --git a/skins/common/images/be-tarask/button_italic.png b/skins/common/images/be-tarask/button_italic.png deleted file mode 100644 index 72209d74ba..0000000000 Binary files a/skins/common/images/be-tarask/button_italic.png and /dev/null differ diff --git a/skins/common/images/be-tarask/button_link.png b/skins/common/images/be-tarask/button_link.png deleted file mode 100644 index 09c86fb14a..0000000000 Binary files a/skins/common/images/be-tarask/button_link.png and /dev/null differ diff --git a/skins/common/images/button_bold.png b/skins/common/images/button_bold.png deleted file mode 100644 index 75c3f1094a..0000000000 Binary files a/skins/common/images/button_bold.png and /dev/null differ diff --git a/skins/common/images/button_extlink.png b/skins/common/images/button_extlink.png deleted file mode 100644 index 458943c1d1..0000000000 Binary files a/skins/common/images/button_extlink.png and /dev/null differ diff --git a/skins/common/images/button_headline.png b/skins/common/images/button_headline.png deleted file mode 100644 index 9cf751d9d2..0000000000 Binary files a/skins/common/images/button_headline.png and /dev/null differ diff --git a/skins/common/images/button_hr.png b/skins/common/images/button_hr.png deleted file mode 100644 index 47e1ca4013..0000000000 Binary files a/skins/common/images/button_hr.png and /dev/null differ diff --git a/skins/common/images/button_image.png b/skins/common/images/button_image.png deleted file mode 100644 index 69192965c4..0000000000 Binary files a/skins/common/images/button_image.png and /dev/null differ diff --git a/skins/common/images/button_italic.png b/skins/common/images/button_italic.png deleted file mode 100644 index 527fbd1455..0000000000 Binary files a/skins/common/images/button_italic.png and /dev/null differ diff --git a/skins/common/images/button_link.png b/skins/common/images/button_link.png deleted file mode 100644 index eb5634b910..0000000000 Binary files a/skins/common/images/button_link.png and /dev/null differ diff --git a/skins/common/images/button_media.png b/skins/common/images/button_media.png deleted file mode 100644 index 4194ec1875..0000000000 Binary files a/skins/common/images/button_media.png and /dev/null differ diff --git a/skins/common/images/button_nowiki.png b/skins/common/images/button_nowiki.png deleted file mode 100644 index 2ba818de2b..0000000000 Binary files a/skins/common/images/button_nowiki.png and /dev/null differ diff --git a/skins/common/images/button_sig.png b/skins/common/images/button_sig.png deleted file mode 100644 index fe34b3fb9a..0000000000 Binary files a/skins/common/images/button_sig.png and /dev/null differ diff --git a/skins/common/images/cyrl/LICENSE b/skins/common/images/cyrl/LICENSE deleted file mode 100644 index bedcec6621..0000000000 --- a/skins/common/images/cyrl/LICENSE +++ /dev/null @@ -1,17 +0,0 @@ -button_bold.png ---------------- -Source : http://commons.wikimedia.org/wiki/Image:Button_bold_ukr.png -License: Public domain -Author : Alexey Belomoev - -button_italic.png ------------------------- -Source : http://commons.wikimedia.org/wiki/Image:Button_italic_ukr.png -License: Public domain -Author : Alexey Belomoev - -button_link.png ------------------ -Source : http://commons.wikimedia.org/wiki/Image:Button_internal_link_ukr.png -License: GPL -Author : Saproj, Erik Möller diff --git a/skins/common/images/cyrl/button_bold.png b/skins/common/images/cyrl/button_bold.png deleted file mode 100644 index eae30d98e5..0000000000 Binary files a/skins/common/images/cyrl/button_bold.png and /dev/null differ diff --git a/skins/common/images/cyrl/button_italic.png b/skins/common/images/cyrl/button_italic.png deleted file mode 100644 index b958d2205c..0000000000 Binary files a/skins/common/images/cyrl/button_italic.png and /dev/null differ diff --git a/skins/common/images/cyrl/button_link.png b/skins/common/images/cyrl/button_link.png deleted file mode 100644 index 12ad373192..0000000000 Binary files a/skins/common/images/cyrl/button_link.png and /dev/null differ diff --git a/skins/common/images/de/button_bold.png b/skins/common/images/de/button_bold.png deleted file mode 100644 index 367d5bc149..0000000000 Binary files a/skins/common/images/de/button_bold.png and /dev/null differ diff --git a/skins/common/images/de/button_italic.png b/skins/common/images/de/button_italic.png deleted file mode 100644 index fdd8c9f924..0000000000 Binary files a/skins/common/images/de/button_italic.png and /dev/null differ diff --git a/skins/common/images/fa/button_bold.png b/skins/common/images/fa/button_bold.png deleted file mode 100644 index c54d094cad..0000000000 Binary files a/skins/common/images/fa/button_bold.png and /dev/null differ diff --git a/skins/common/images/fa/button_headline.png b/skins/common/images/fa/button_headline.png deleted file mode 100644 index 9890d15504..0000000000 Binary files a/skins/common/images/fa/button_headline.png and /dev/null differ diff --git a/skins/common/images/fa/button_italic.png b/skins/common/images/fa/button_italic.png deleted file mode 100644 index 33f91ed613..0000000000 Binary files a/skins/common/images/fa/button_italic.png and /dev/null differ diff --git a/skins/common/images/fa/button_link.png b/skins/common/images/fa/button_link.png deleted file mode 100644 index 76b939e6af..0000000000 Binary files a/skins/common/images/fa/button_link.png and /dev/null differ diff --git a/skins/common/images/fa/button_nowiki.png b/skins/common/images/fa/button_nowiki.png deleted file mode 100644 index 743ea61b1e..0000000000 Binary files a/skins/common/images/fa/button_nowiki.png and /dev/null differ diff --git a/skins/common/images/ksh/LICENSE b/skins/common/images/ksh/LICENSE deleted file mode 100644 index ba56f97f94..0000000000 --- a/skins/common/images/ksh/LICENSE +++ /dev/null @@ -1,7 +0,0 @@ - -button_S_italic.png -------------------- -Source : http://commons.wikimedia.org/wiki/Image:Button_S_italic.png -License: Public domain -Author : Purodha Blissenbach, http://ksh.wikipedia.org/wiki/User:Purodha - diff --git a/skins/common/images/ksh/button_S_italic.png b/skins/common/images/ksh/button_S_italic.png deleted file mode 100644 index 15496c082c..0000000000 Binary files a/skins/common/images/ksh/button_S_italic.png and /dev/null differ diff --git a/tests/phpunit/LessFileCompilationTest.php b/tests/phpunit/LessFileCompilationTest.php index 62157d28d8..71e0f4b2c6 100644 --- a/tests/phpunit/LessFileCompilationTest.php +++ b/tests/phpunit/LessFileCompilationTest.php @@ -6,7 +6,7 @@ * @see https://github.com/sebastianbergmann/phpunit/blob/master/src/Extensions/PhptTestCase.php * @author Sam Smith */ -class LessFileCompilationTest extends MediaWikiTestCase { +class LessFileCompilationTest extends ResourceLoaderTestCase { /** * @var string $file @@ -38,7 +38,13 @@ class LessFileCompilationTest extends MediaWikiTestCase { "$thisString must refer to a readable file" ); - $compiler = ResourceLoader::getLessCompiler( RequestContext::getMain()->getConfig() ); + $rlContext = static::getResourceLoaderContext(); + + // Bleh + $method = new ReflectionMethod( $this->module, 'getLessCompiler' ); + $method->setAccessible( true ); + $compiler = $method->invoke( $this->module, $rlContext ); + $this->assertNotNull( $compiler->compileFile( $this->file ) ); }