jenkins-bot has submitted this change and it was merged. Change subject: [BREAKING CHANGE] Rename (View|Mobile)PageTarget to (Desktop|Mobile)ArticleTarget ......................................................................
[BREAKING CHANGE] Rename (View|Mobile)PageTarget to (Desktop|Mobile)ArticleTarget Change-Id: I6a8fa76dc4d70cc04722e30e3fea6a6112d56b40 --- M VisualEditor.hooks.php R VisualEditorDesktopArticleTargetInitModule.php M extension.json R modules/ve-mw/init/styles/ve.init.mw.DesktopArticleTarget-apex.css R modules/ve-mw/init/styles/ve.init.mw.DesktopArticleTarget-monobook.css R modules/ve-mw/init/styles/ve.init.mw.DesktopArticleTarget-shared.css R modules/ve-mw/init/styles/ve.init.mw.DesktopArticleTarget-vector.css R modules/ve-mw/init/styles/ve.init.mw.DesktopArticleTarget.css R modules/ve-mw/init/styles/ve.init.mw.DesktopArticleTarget.init.css R modules/ve-mw/init/styles/ve.init.mw.DesktopArticleTarget.noscript.css R modules/ve-mw/init/styles/ve.init.mw.MobileArticleTarget.css R modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.init.js R modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.js R modules/ve-mw/init/targets/ve.init.mw.MobileArticleTarget.js M modules/ve-mw/init/ve.init.mw.Target.js M modules/ve-mw/tests/browser/features/support/pages/dummy_page.rb M modules/ve-mw/tests/browser/features/support/pages/visual_editor_page.rb R modules/ve-mw/tests/init/targets/ve.init.mw.DesktopArticleTarget.test.js 18 files changed, 179 insertions(+), 171 deletions(-) Approvals: Jforrester: Looks good to me, but someone else must approve Trevor Parscal: Looks good to me, approved jenkins-bot: Verified diff --git a/VisualEditor.hooks.php b/VisualEditor.hooks.php index 17e5117..8a3f3d5 100644 --- a/VisualEditor.hooks.php +++ b/VisualEditor.hooks.php @@ -53,10 +53,10 @@ */ public static function onBeforePageDisplay( OutputPage &$output, Skin &$skin ) { $output->addModules( array( - 'ext.visualEditor.viewPageTarget.init', + 'ext.visualEditor.desktopArticleTarget.init', 'ext.visualEditor.targetLoader' ) ); - $output->addModuleStyles( array( 'ext.visualEditor.viewPageTarget.noscript' ) ); + $output->addModuleStyles( array( 'ext.visualEditor.desktopArticleTarget.noscript' ) ); // add scroll offset js variable to output $veConfig = ConfigFactory::getDefaultInstance()->makeConfig( 'visualeditor' ); $skinsToolbarScrollOffset = $veConfig->get( 'VisualEditorSkinToolbarScrollOffset' ); @@ -586,7 +586,7 @@ 'lib/ve/tests/ui/actions/ve.ui.ListAction.test.js', // VisualEditor initialization Tests 'lib/ve/tests/init/ve.init.Platform.test.js', - 'modules/ve-mw/tests/init/targets/ve.init.mw.ViewPageTarget.test.js', + 'modules/ve-mw/tests/init/targets/ve.init.mw.DesktopArticleTarget.test.js', // IME tests 'lib/ve/tests/ce/ve.ce.TestRunner.js', 'lib/ve/tests/ce/ve.ce.imetests.test.js', @@ -636,8 +636,8 @@ 'ext.visualEditor.mwtransclusion', 'ext.visualEditor.mwalienextension', 'ext.visualEditor.experimental', - 'ext.visualEditor.viewPageTarget.init', - 'ext.visualEditor.viewPageTarget', + 'ext.visualEditor.desktopArticleTarget.init', + 'ext.visualEditor.desktopArticleTarget', ), 'localBasePath' => __DIR__, 'remoteExtPath' => 'VisualEditor', diff --git a/VisualEditorViewPageTargetInitModule.php b/VisualEditorDesktopArticleTargetInitModule.php similarity index 80% rename from VisualEditorViewPageTargetInitModule.php rename to VisualEditorDesktopArticleTargetInitModule.php index c1ba093..295c5ca 100644 --- a/VisualEditorViewPageTargetInitModule.php +++ b/VisualEditorDesktopArticleTargetInitModule.php @@ -1,6 +1,6 @@ <?php /** - * ResourceLoader module for the 'ext.visualEditor.viewPageTarget.init' + * ResourceLoader module for the 'ext.visualEditor.desktopArticleTarget.init' * module. Necessary to incorporate the VisualEditorTabMessages * configuration setting. * @@ -10,7 +10,7 @@ * @license The MIT License (MIT); see LICENSE.txt */ -class VisualEditorViewPageTargetInitModule extends ResourceLoaderFileModule { +class VisualEditorDesktopArticleTargetInitModule extends ResourceLoaderFileModule { public function __construct( $options = array(), diff --git a/extension.json b/extension.json index 99b8040..640c9d1 100644 --- a/extension.json +++ b/extension.json @@ -238,10 +238,10 @@ "mobile" ] }, - "ext.visualEditor.viewPageTarget.init": { - "class": "VisualEditorViewPageTargetInitModule", - "scripts": "modules/ve-mw/init/targets/ve.init.mw.ViewPageTarget.init.js", - "styles": "modules/ve-mw/init/styles/ve.init.mw.ViewPageTarget.init.css", + "ext.visualEditor.desktopArticleTarget.init": { + "class": "VisualEditorDesktopArticleTargetInitModule", + "scripts": "modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.init.js", + "styles": "modules/ve-mw/init/styles/ve.init.mw.DesktopArticleTarget.init.css", "dependencies": [ "jquery.client", "mediawiki.page.startup", @@ -267,9 +267,9 @@ ], "position": "top" }, - "ext.visualEditor.viewPageTarget.noscript": { + "ext.visualEditor.desktopArticleTarget.noscript": { "position": "top", - "styles": "modules/ve-mw/init/styles/ve.init.mw.ViewPageTarget.noscript.css" + "styles": "modules/ve-mw/init/styles/ve.init.mw.DesktopArticleTarget.noscript.css" }, "ext.visualEditor.targetLoader": { "scripts": "modules/ve-mw/init/ve.init.mw.TargetLoader.js", @@ -286,25 +286,25 @@ "mobile" ] }, - "ext.visualEditor.viewPageTarget": { + "ext.visualEditor.desktopArticleTarget": { "scripts": [ - "modules/ve-mw/init/targets/ve.init.mw.ViewPageTarget.js" + "modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.js" ], "styles": [ - "modules/ve-mw/init/styles/ve.init.mw.ViewPageTarget.css" + "modules/ve-mw/init/styles/ve.init.mw.DesktopArticleTarget.css" ], "skinStyles": { "vector": [ - "modules/ve-mw/init/styles/ve.init.mw.ViewPageTarget-shared.css", - "modules/ve-mw/init/styles/ve.init.mw.ViewPageTarget-vector.css" + "modules/ve-mw/init/styles/ve.init.mw.DesktopArticleTarget-shared.css", + "modules/ve-mw/init/styles/ve.init.mw.DesktopArticleTarget-vector.css" ], "apex": [ - "modules/ve-mw/init/styles/ve.init.mw.ViewPageTarget-shared.css", - "modules/ve-mw/init/styles/ve.init.mw.ViewPageTarget-apex.css" + "modules/ve-mw/init/styles/ve.init.mw.DesktopArticleTarget-shared.css", + "modules/ve-mw/init/styles/ve.init.mw.DesktopArticleTarget-apex.css" ], "monobook": [ - "modules/ve-mw/init/styles/ve.init.mw.ViewPageTarget-shared.css", - "modules/ve-mw/init/styles/ve.init.mw.ViewPageTarget-monobook.css" + "modules/ve-mw/init/styles/ve.init.mw.DesktopArticleTarget-shared.css", + "modules/ve-mw/init/styles/ve.init.mw.DesktopArticleTarget-monobook.css" ] }, "dependencies": [ @@ -331,11 +331,19 @@ ] }, "ext.visualEditor.mobileViewTarget": { + "dependencies": [ + "ext.visualEditor.mobileArticleTarget" + ], + "targets": [ + "mobile" + ] + }, + "ext.visualEditor.mobileArticleTarget": { "scripts": [ - "modules/ve-mw/init/targets/ve.init.mw.MobileViewTarget.js" + "modules/ve-mw/init/targets/ve.init.mw.MobileArticleTarget.js" ], "styles": [ - "modules/ve-mw/init/styles/ve.init.mw.MobileViewTarget.css" + "modules/ve-mw/init/styles/ve.init.mw.MobileArticleTarget.css" ], "dependencies": [ "ext.visualEditor.base", @@ -1551,7 +1559,7 @@ "ApiVisualEditorEdit": "ApiVisualEditorEdit.php", "VisualEditorHooks": "VisualEditor.hooks.php", "VisualEditorDataModule": "VisualEditorDataModule.php", - "VisualEditorViewPageTargetInitModule": "VisualEditorViewPageTargetInitModule.php" + "VisualEditorDesktopArticleTargetInitModule": "VisualEditorDesktopArticleTargetInitModule.php" }, "ConfigRegistry": { "visualeditor": "GlobalVarConfig::newInstance" diff --git a/modules/ve-mw/init/styles/ve.init.mw.ViewPageTarget-apex.css b/modules/ve-mw/init/styles/ve.init.mw.DesktopArticleTarget-apex.css similarity index 68% rename from modules/ve-mw/init/styles/ve.init.mw.ViewPageTarget-apex.css rename to modules/ve-mw/init/styles/ve.init.mw.DesktopArticleTarget-apex.css index 7ad7e31..a2e4e4e 100644 --- a/modules/ve-mw/init/styles/ve.init.mw.ViewPageTarget-apex.css +++ b/modules/ve-mw/init/styles/ve.init.mw.DesktopArticleTarget-apex.css @@ -1,5 +1,5 @@ /*! - * VisualEditor MediaWiki Initialization ViewPageTarget Apex skin styles. + * VisualEditor MediaWiki Initialization DesktopArticleTarget Apex skin styles. * * @copyright 2011-2015 VisualEditor Team and others; see AUTHORS.txt * @license The MIT License (MIT); see LICENSE.txt @@ -14,12 +14,12 @@ font-size: 0.8em; } -.ve-init-mw-viewPageTarget-toolbar { +.ve-init-mw-desktopArticleTarget-toolbar { margin: -0.6em -3em 0.8em -3em; position: relative; } -.ve-init-mw-viewPageTarget-toolbar .oo-ui-toolbar-bar { +.ve-init-mw-desktopArticleTarget-toolbar .oo-ui-toolbar-bar { line-height: 1.5em; } diff --git a/modules/ve-mw/init/styles/ve.init.mw.ViewPageTarget-monobook.css b/modules/ve-mw/init/styles/ve.init.mw.DesktopArticleTarget-monobook.css similarity index 73% rename from modules/ve-mw/init/styles/ve.init.mw.ViewPageTarget-monobook.css rename to modules/ve-mw/init/styles/ve.init.mw.DesktopArticleTarget-monobook.css index 7e612c3..3b58936 100644 --- a/modules/ve-mw/init/styles/ve.init.mw.ViewPageTarget-monobook.css +++ b/modules/ve-mw/init/styles/ve.init.mw.DesktopArticleTarget-monobook.css @@ -1,5 +1,5 @@ /*! - * VisualEditor MediaWiki Initialization ViewPageTarget Monobook skin high-definition styles. + * VisualEditor MediaWiki Initialization DesktopArticleTarget Monobook skin high-definition styles. * * @copyright 2011-2015 VisualEditor Team and others; see AUTHORS.txt * @license The MIT License (MIT); see LICENSE.txt @@ -22,12 +22,12 @@ font-size: 0.992187499998em; /* 1/1.00787401575 */ } -.ve-init-mw-viewPageTarget-toolbar { +.ve-init-mw-desktopArticleTarget-toolbar { /* 0.6/0.8, 0.8/0.8, 1/0.6 */ margin: -0.75em -1em 1.25em -1em; } -.ve-init-mw-viewPageTarget-toolbar > .oo-ui-toolbar-bar { +.ve-init-mw-desktopArticleTarget-toolbar > .oo-ui-toolbar-bar { top: -3px; } @@ -35,12 +35,12 @@ border-top: 1px solid #ccc; } -.ve-init-mw-viewPageTarget-surface .ve-ce-documentNode, -.ve-init-mw-viewPageTarget-surface .ve-ui-surface-placeholder { +.ve-init-mw-desktopArticleTarget-surface .ve-ce-documentNode, +.ve-init-mw-desktopArticleTarget-surface .ve-ui-surface-placeholder { padding: 0; } -.ve-init-mw-viewPageTarget-surface .ve-ui-surface-placeholder { +.ve-init-mw-desktopArticleTarget-surface .ve-ui-surface-placeholder { margin-top: -0.45em; } diff --git a/modules/ve-mw/init/styles/ve.init.mw.ViewPageTarget-shared.css b/modules/ve-mw/init/styles/ve.init.mw.DesktopArticleTarget-shared.css similarity index 77% rename from modules/ve-mw/init/styles/ve.init.mw.ViewPageTarget-shared.css rename to modules/ve-mw/init/styles/ve.init.mw.DesktopArticleTarget-shared.css index 4ed56b7..b3f28ef 100644 --- a/modules/ve-mw/init/styles/ve.init.mw.ViewPageTarget-shared.css +++ b/modules/ve-mw/init/styles/ve.init.mw.DesktopArticleTarget-shared.css @@ -1,5 +1,5 @@ /*! - * VisualEditor MediaWiki Initialization ViewPageTarget shared styles. + * VisualEditor MediaWiki Initialization DesktopArticleTarget shared styles. * These are styles that are common to the vector, monobook, and apex skins, but may not * be applied to other skins (for example, minerva). * diff --git a/modules/ve-mw/init/styles/ve.init.mw.ViewPageTarget-vector.css b/modules/ve-mw/init/styles/ve.init.mw.DesktopArticleTarget-vector.css similarity index 81% rename from modules/ve-mw/init/styles/ve.init.mw.ViewPageTarget-vector.css rename to modules/ve-mw/init/styles/ve.init.mw.DesktopArticleTarget-vector.css index 3f2e9ff..14570d5 100644 --- a/modules/ve-mw/init/styles/ve.init.mw.ViewPageTarget-vector.css +++ b/modules/ve-mw/init/styles/ve.init.mw.DesktopArticleTarget-vector.css @@ -1,5 +1,5 @@ /*! - * VisualEditor MediaWiki Initialization ViewPageTarget Vector skin styles. + * VisualEditor MediaWiki Initialization DesktopArticleTarget Vector skin styles. * * @copyright 2011-2015 VisualEditor Team and others; see AUTHORS.txt * @license The MIT License (MIT); see LICENSE.txt @@ -9,7 +9,7 @@ box-shadow: inset 0 -1px 0 #a7d7f9; } -.ve-init-mw-viewPageTarget-surface { +.ve-init-mw-desktopArticleTarget-surface { /* In order to allow placing the text cursor to the start or end of the text by clicking in the margin area, we expand the outer boundary of the surface @@ -23,8 +23,8 @@ margin: 1em -1.25em 0 -1.25em; } -.ve-init-mw-viewPageTarget-surface .ve-ce-documentNode, -.ve-init-mw-viewPageTarget-surface .ve-ui-surface-placeholder { +.ve-init-mw-desktopArticleTarget-surface .ve-ce-documentNode, +.ve-init-mw-desktopArticleTarget-surface .ve-ui-surface-placeholder { padding: 0 1.143em; /* surface-margin-left (1em) / (mw-body-content font-size) 0.875em */ } @@ -40,14 +40,14 @@ font-size: 1.09375em; /* 0.875/0.8 */ } -.ve-init-mw-viewPageTarget-toolbar { +.ve-init-mw-desktopArticleTarget-toolbar { /* 1/0.8 */ margin: -1.25em -1.25em 1.25em -1.25em; position: relative; border-bottom: 1px solid rgba(0,0,0,0.15); } -.ve-init-mw-viewPageTarget-toolbar > .oo-ui-toolbar-bar { +.ve-init-mw-desktopArticleTarget-toolbar > .oo-ui-toolbar-bar { /* Upstream OOjs UI has 2px. We split this between 1px here and 1px on the container to allow a smooth collapse transition where the bottom pixel line sweeps it up. */ @@ -95,17 +95,17 @@ /* High-definition-specific styles (because Vector adds 1em to the leftNav if width is 982px+ */ @media screen and (min-width: 982px) { - .ve-init-mw-viewPageTarget-surface { + .ve-init-mw-desktopArticleTarget-surface { /* 0.8/0.8, 1.5/0.8 */ margin: 1em -1.875em 0 -1.875em; } - .ve-init-mw-viewPageTarget-surface .ve-ce-documentNode, - .ve-init-mw-viewPageTarget-surface .ve-ui-surface-placeholder { + .ve-init-mw-desktopArticleTarget-surface .ve-ce-documentNode, + .ve-init-mw-desktopArticleTarget-surface .ve-ui-surface-placeholder { padding: 0 1.714em; /* surface-margin-left (1.5em) / (mw-body-content font-size) 0.875em */ } - .ve-init-mw-viewPageTarget-toolbar { + .ve-init-mw-desktopArticleTarget-toolbar { /* 1.25/0.8, 1.5/0.8 */ margin: -1.5625em -1.875em 1.875em -1.875em; } @@ -118,6 +118,6 @@ } /* Prevent the progress bar from overlaying the welcome dialog */ -.ve-init-mw-viewPageTarget-windowManager-welcome .oo-ui-dialog { +.ve-init-mw-desktopArticleTarget-windowManager-welcome .oo-ui-dialog { z-index: 2; } diff --git a/modules/ve-mw/init/styles/ve.init.mw.ViewPageTarget.css b/modules/ve-mw/init/styles/ve.init.mw.DesktopArticleTarget.css similarity index 68% rename from modules/ve-mw/init/styles/ve.init.mw.ViewPageTarget.css rename to modules/ve-mw/init/styles/ve.init.mw.DesktopArticleTarget.css index f75355b..f5b190f 100644 --- a/modules/ve-mw/init/styles/ve.init.mw.ViewPageTarget.css +++ b/modules/ve-mw/init/styles/ve.init.mw.DesktopArticleTarget.css @@ -1,5 +1,5 @@ /*! - * VisualEditor MediaWiki Initialization ViewPageTarget styles. + * VisualEditor MediaWiki Initialization DesktopArticleTarget styles. * * @copyright 2011-2015 VisualEditor Team and others; see AUTHORS.txt * @license The MIT License (MIT); see LICENSE.txt @@ -7,8 +7,8 @@ /* Toolbar */ -.ve-activating .ve-init-mw-viewPageTarget-toolbar, -.ve-deactivating .ve-init-mw-viewPageTarget-toolbar { +.ve-activating .ve-init-mw-desktopArticleTarget-toolbar, +.ve-deactivating .ve-init-mw-desktopArticleTarget-toolbar { overflow: hidden; transition: height 0.4s ease; } diff --git a/modules/ve-mw/init/styles/ve.init.mw.ViewPageTarget.init.css b/modules/ve-mw/init/styles/ve.init.mw.DesktopArticleTarget.init.css similarity index 88% rename from modules/ve-mw/init/styles/ve.init.mw.ViewPageTarget.init.css rename to modules/ve-mw/init/styles/ve.init.mw.DesktopArticleTarget.init.css index 3160763..56d76e0 100644 --- a/modules/ve-mw/init/styles/ve.init.mw.ViewPageTarget.init.css +++ b/modules/ve-mw/init/styles/ve.init.mw.DesktopArticleTarget.init.css @@ -1,5 +1,5 @@ /*! - * VisualEditor MediaWiki ViewPageTarget init styles. + * VisualEditor MediaWiki DesktopArticleTarget init styles. * * @copyright 2011-2015 VisualEditor Team and others; see AUTHORS.txt * @license The MIT License (MIT); see LICENSE.txt @@ -10,10 +10,10 @@ /*! * State | <html> classes - * - mw.ViewPageTarget.init.css is loaded + * - mw.DesktopArticleTarget.init.css is loaded * Reading | ve-available * Loading editor | ve-available ve-activated ve-loading - * - mw.ViewPageTarget.css is loaded + * - mw.DesktopArticleTarget.css is loaded * Activate editor | ve-available ve-activated ve-activating * Active | ve-available ve-activated ve-active * Deactivate editor | ve-available ve-deactivating @@ -55,7 +55,7 @@ position: relative; } -.ve-init-mw-viewPageTarget-loading-overlay { +.ve-init-mw-desktopArticleTarget-loading-overlay { position: absolute; left: 0; right: 0; @@ -63,7 +63,7 @@ margin-top: -0.5em; } -.ve-init-mw-viewPageTarget-progress { +.ve-init-mw-desktopArticleTarget-progress { border: 1px solid #347bff; background: #fff; height: 0.75em; @@ -72,7 +72,7 @@ margin: 0 25%; } -.ve-init-mw-viewPageTarget-progress-bar { +.ve-init-mw-desktopArticleTarget-progress-bar { width: 0; height: 0.75em; background: #347bff; diff --git a/modules/ve-mw/init/styles/ve.init.mw.ViewPageTarget.noscript.css b/modules/ve-mw/init/styles/ve.init.mw.DesktopArticleTarget.noscript.css similarity index 95% rename from modules/ve-mw/init/styles/ve.init.mw.ViewPageTarget.noscript.css rename to modules/ve-mw/init/styles/ve.init.mw.DesktopArticleTarget.noscript.css index ca0d6f6..dcd0ac4 100644 --- a/modules/ve-mw/init/styles/ve.init.mw.ViewPageTarget.noscript.css +++ b/modules/ve-mw/init/styles/ve.init.mw.DesktopArticleTarget.noscript.css @@ -1,5 +1,5 @@ /*! - * VisualEditor MediaWiki ViewPageTarget noscript styles + * VisualEditor MediaWiki DesktopArticleTarget noscript styles * * @copyright 2011-2015 VisualEditor Team and others; see AUTHORS.txt * @license The MIT License (MIT); see LICENSE.txt diff --git a/modules/ve-mw/init/styles/ve.init.mw.MobileViewTarget.css b/modules/ve-mw/init/styles/ve.init.mw.MobileArticleTarget.css similarity index 76% rename from modules/ve-mw/init/styles/ve.init.mw.MobileViewTarget.css rename to modules/ve-mw/init/styles/ve.init.mw.MobileArticleTarget.css index 68e9044..726267e 100644 --- a/modules/ve-mw/init/styles/ve.init.mw.MobileViewTarget.css +++ b/modules/ve-mw/init/styles/ve.init.mw.MobileArticleTarget.css @@ -1,5 +1,5 @@ /*! - * VisualEditor MediaWiki Initialization MobileViewTarget styles. + * VisualEditor MediaWiki Initialization MobileArticleTarget styles. * * @copyright 2011-2015 VisualEditor Team and others; see AUTHORS.txt * @license The MIT License (MIT); see LICENSE.txt diff --git a/modules/ve-mw/init/targets/ve.init.mw.ViewPageTarget.init.js b/modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.init.js similarity index 95% rename from modules/ve-mw/init/targets/ve.init.mw.ViewPageTarget.init.js rename to modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.init.js index 12cec86..527c15a 100644 --- a/modules/ve-mw/init/targets/ve.init.mw.ViewPageTarget.init.js +++ b/modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.init.js @@ -1,5 +1,5 @@ /*! - * VisualEditor MediaWiki ViewPageTarget init. + * VisualEditor MediaWiki DesktopArticleTarget init. * * This file must remain as widely compatible as the base compatibility * for MediaWiki itself (see mediawiki/core:/resources/startup.js). @@ -14,7 +14,7 @@ * actual MediaWiki integration and VisualEditor library. * * @class mw.libs.ve - * @alternateClassName ve.init.mw.ViewPageTarget.init + * @alternateClassName ve.init.mw.DesktopArticleTarget.init * @singleton */ ( function () { @@ -32,10 +32,10 @@ function showLoading() { if ( !init.$loading ) { init.$loading = $( - '<div class="ve-init-mw-viewPageTarget-loading-overlay">' + - '<div class="ve-init-mw-viewPageTarget-progress">' + + '<div class="ve-init-mw-desktopArticleTarget-loading-overlay">' + + '<div class="ve-init-mw-desktopArticleTarget-progress">' + // Stylesheets might not have processed yet, so manually set starting width to 0 - '<div class="ve-init-mw-viewPageTarget-progress-bar" style="width: 0;"></div>' + + '<div class="ve-init-mw-desktopArticleTarget-progress-bar" style="width: 0;"></div>' + '</div>' + '</div>' ); @@ -65,7 +65,7 @@ } function setLoadingProgress( target, duration ) { - var $bar = init.$loading.find( '.ve-init-mw-viewPageTarget-progress-bar' ).stop(); + var $bar = init.$loading.find( '.ve-init-mw-desktopArticleTarget-progress-bar' ).stop(); $bar.css( 'transition', 'width ' + duration + 'ms ease-in' ); setTimeout( function () { $bar.css( 'width', target + '%' ); @@ -105,7 +105,7 @@ // Note: it's safe to use .forEach() (ES5) here, because this code will // never be called if the browser doesn't support ES5 [ - 'ext.visualEditor.viewPageTarget', + 'ext.visualEditor.desktopArticleTarget', 'ext.visualEditor.mwgallery', 'ext.visualEditor.mwimage', 'ext.visualEditor.mwmeta' @@ -117,9 +117,9 @@ } ) .then( function () { // Transfer methods - ve.init.mw.ViewPageTarget.prototype.setupSectionEditLinks = init.setupSectionLinks; + ve.init.mw.DesktopArticleTarget.prototype.setupSectionEditLinks = init.setupSectionLinks; - var target = new ve.init.mw.ViewPageTarget(); + var target = new ve.init.mw.DesktopArticleTarget(); $( '#content' ).append( target.$element ); return target; }, function ( e ) { @@ -156,7 +156,7 @@ return mw.libs.ve.targetLoader.requestPageData( mw.config.get( 'wgRelevantPageName' ), uri.query.oldid, - 'mwTarget' // ve.init.mw.ViewPageTarget.static.name + 'mwTarget' // ve.init.mw.DesktopArticleTarget.static.name ); } ) .done( function () { @@ -481,7 +481,7 @@ if ( history.pushState ) { // Replace the current state with one that is tagged as ours, to prevent the // back button from breaking when used to exit VE. FIXME: there should be a better - // way to do this. See also similar code in the ViewPageTarget constructor. + // way to do this. See also similar code in the DesktopArticleTarget constructor. history.replaceState( { tag: 'visualeditor' }, document.title, uri ); // Set veaction to edit history.pushState( { tag: 'visualeditor' }, document.title, veEditUri ); @@ -507,7 +507,7 @@ if ( history.pushState && uri.query.veaction !== 'edit' ) { // Replace the current state with one that is tagged as ours, to prevent the // back button from breaking when used to exit VE. FIXME: there should be a better - // way to do this. See also similar code in the ViewPageTarget constructor. + // way to do this. See also similar code in the DesktopArticleTarget constructor. history.replaceState( { tag: 'visualeditor' }, document.title, uri ); // Change the state to the href of the section link that was clicked. This saves // us from having to figure out the section number again. diff --git a/modules/ve-mw/init/targets/ve.init.mw.ViewPageTarget.js b/modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.js similarity index 87% rename from modules/ve-mw/init/targets/ve.init.mw.ViewPageTarget.js rename to modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.js index f9d682a..5ba005a 100644 --- a/modules/ve-mw/init/targets/ve.init.mw.ViewPageTarget.js +++ b/modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.js @@ -1,5 +1,5 @@ /*! - * VisualEditor MediaWiki Initialization ViewPageTarget class. + * VisualEditor MediaWiki Initialization DesktopArticleTarget class. * * @copyright 2011-2015 VisualEditor Team and others; see AUTHORS.txt * @license The MIT License (MIT); see LICENSE.txt @@ -15,7 +15,7 @@ * * @constructor */ -ve.init.mw.ViewPageTarget = function VeInitMwViewPageTarget() { +ve.init.mw.DesktopArticleTarget = function VeInitMwDesktopArticleTarget() { // A workaround, as default URI does not get updated after pushState (bug 72334) var currentUri = new mw.Uri( location.href ); @@ -99,7 +99,7 @@ /* Inheritance */ -OO.inheritClass( ve.init.mw.ViewPageTarget, ve.init.mw.Target ); +OO.inheritClass( ve.init.mw.DesktopArticleTarget, ve.init.mw.Target ); /* Events */ @@ -115,7 +115,7 @@ * @static * @property */ -ve.init.mw.ViewPageTarget.compatibility = { +ve.init.mw.DesktopArticleTarget.compatibility = { // The key is the browser name returned by jQuery.client // The value is either null (match all versions) or a list of tuples // containing an inequality (<,>,<=,>=) and a version number @@ -158,14 +158,14 @@ * @param {Mixed} popState From PopStateEvent#state * @return {boolean} */ -ve.init.mw.ViewPageTarget.prototype.verifyPopState = function ( popState ) { +ve.init.mw.DesktopArticleTarget.prototype.verifyPopState = function ( popState ) { return popState && popState.tag === 'visualeditor'; }; /** * @inheritdoc */ -ve.init.mw.ViewPageTarget.prototype.setupToolbar = function ( surface ) { +ve.init.mw.DesktopArticleTarget.prototype.setupToolbar = function ( surface ) { var toolbar, wasSetup = !!this.toolbar, target = this; @@ -207,14 +207,14 @@ /** * @inheritdoc */ -ve.init.mw.ViewPageTarget.prototype.attachToolbar = function () { +ve.init.mw.DesktopArticleTarget.prototype.attachToolbar = function () { // Move the toolbar to top of target, before heading etc. // Avoid re-attaching as it breaks CSS animations if ( !this.toolbar.$element.parent().is( this.$element ) ) { this.toolbar.$element // Set 0 before attach (expanded in #setupToolbar) .css( 'height', '0' ) - .addClass( 've-init-mw-viewPageTarget-toolbar' ); + .addClass( 've-init-mw-desktopArticleTarget-toolbar' ); this.$element.prepend( this.toolbar.$element ); } }; @@ -223,7 +223,7 @@ * Set up notices for things like unknown browsers. * Needs to be done on each activation because localNoticeMessages is cleared in clearState. */ -ve.init.mw.ViewPageTarget.prototype.setupLocalNoticeMessages = function () { +ve.init.mw.DesktopArticleTarget.prototype.setupLocalNoticeMessages = function () { if ( mw.config.get( 'wgTranslatePageTranslation' ) === 'source' ) { // Warn users if they're on a source of the Page Translation feature this.localNoticeMessages.push( 'visualeditor-pagetranslationwarning' ); @@ -231,7 +231,7 @@ if ( !( 'vewhitelist' in this.currentUri.query || - $.client.test( ve.init.mw.ViewPageTarget.compatibility.whitelist, null, true ) + $.client.test( ve.init.mw.DesktopArticleTarget.compatibility.whitelist, null, true ) ) ) { // Show warning in unknown browsers that pass the support test // Continue at own risk. @@ -244,7 +244,7 @@ * @param {jQuery.Event} e Event object whih triggered the event * @param {string} actionPerformed 'watch' or 'unwatch' */ -ve.init.mw.ViewPageTarget.prototype.onWatchToggle = function ( e, actionPerformed ) { +ve.init.mw.DesktopArticleTarget.prototype.onWatchToggle = function ( e, actionPerformed ) { if ( !this.active && !this.activating ) { return; } @@ -259,8 +259,8 @@ /** * @inheritdoc */ -ve.init.mw.ViewPageTarget.prototype.bindHandlers = function () { - ve.init.mw.ViewPageTarget.super.prototype.bindHandlers.call( this ); +ve.init.mw.DesktopArticleTarget.prototype.bindHandlers = function () { + ve.init.mw.DesktopArticleTarget.super.prototype.bindHandlers.call( this ); if ( this.onWatchToggleHandler ) { $( '#ca-watch, #ca-unwatch' ).on( 'watchpage.mw', this.onWatchToggleHandler ); } @@ -269,8 +269,8 @@ /** * @inheritdoc */ -ve.init.mw.ViewPageTarget.prototype.unbindHandlers = function () { - ve.init.mw.ViewPageTarget.super.prototype.unbindHandlers.call( this ); +ve.init.mw.DesktopArticleTarget.prototype.unbindHandlers = function () { + ve.init.mw.DesktopArticleTarget.super.prototype.unbindHandlers.call( this ); if ( this.onWatchToggleHandler ) { $( '#ca-watch, #ca-unwatch' ).off( 'watchpage.mw', this.onWatchToggleHandler ); } @@ -283,7 +283,7 @@ * mw.libs.ve.targetLoader#requestPageData, if any * @return {jQuery.Promise} */ -ve.init.mw.ViewPageTarget.prototype.activate = function ( dataPromise ) { +ve.init.mw.DesktopArticleTarget.prototype.activate = function ( dataPromise ) { var surface, pageTarget = this; @@ -344,7 +344,7 @@ * @param {boolean} [noDialog] Do not display a dialog * @param {string} [trackMechanism] Abort mechanism; used for event tracking if present */ -ve.init.mw.ViewPageTarget.prototype.deactivate = function ( noDialog, trackMechanism ) { +ve.init.mw.DesktopArticleTarget.prototype.deactivate = function ( noDialog, trackMechanism ) { var target = this; if ( this.deactivating || ( !this.active && !this.activating ) ) { return; @@ -375,7 +375,7 @@ * * @param {string} [trackMechanism] Abort mechanism; used for event tracking if present */ -ve.init.mw.ViewPageTarget.prototype.cancel = function ( trackMechanism ) { +ve.init.mw.DesktopArticleTarget.prototype.cancel = function ( trackMechanism ) { var abortType, target = this, promises = []; @@ -460,7 +460,7 @@ * @param {string} errorTypeText * @param {string} error */ -ve.init.mw.ViewPageTarget.prototype.onLoadError = function ( errorText, error ) { +ve.init.mw.DesktopArticleTarget.prototype.onLoadError = function ( errorText, error ) { // Don't show an error if the load was manually aborted // The response.status check here is to catch aborts triggered by navigation away from the page if ( @@ -505,7 +505,7 @@ * * @method */ -ve.init.mw.ViewPageTarget.prototype.onSurfaceReady = function () { +ve.init.mw.DesktopArticleTarget.prototype.onSurfaceReady = function () { var surfaceReadyTime = ve.now(), target = this; @@ -553,9 +553,9 @@ * Handle Escape key presses. * @param {jQuery.Event} e Keydown event */ -ve.init.mw.ViewPageTarget.prototype.onDocumentKeyDown = function ( e ) { +ve.init.mw.DesktopArticleTarget.prototype.onDocumentKeyDown = function ( e ) { // Parent method - ve.init.mw.ViewPageTarget.super.prototype.onDocumentKeyDown.apply( this, arguments ); + ve.init.mw.DesktopArticleTarget.super.prototype.onDocumentKeyDown.apply( this, arguments ); var target = this; @@ -578,7 +578,7 @@ * @method * @param {jQuery.Event} e Mouse click event */ -ve.init.mw.ViewPageTarget.prototype.onViewTabClick = function ( e ) { +ve.init.mw.DesktopArticleTarget.prototype.onViewTabClick = function ( e ) { if ( ( e.which && e.which !== 1 ) || e.shiftKey || e.altKey || e.ctrlKey || e.metaKey ) { return; } @@ -598,7 +598,7 @@ * @param {Object} lastModified Object containing user-formatted date and time strings, or undefined if we made no change. */ -ve.init.mw.ViewPageTarget.prototype.onSave = function ( +ve.init.mw.DesktopArticleTarget.prototype.onSave = function ( html, categoriesHtml, newid, isRedirect, displayTitle, lastModified, contentSub ) { var newUrlParams, watchChecked; @@ -673,9 +673,9 @@ /** * @inheritdoc */ -ve.init.mw.ViewPageTarget.prototype.onSaveError = function () { +ve.init.mw.DesktopArticleTarget.prototype.onSaveError = function () { this.pageDeletedWarning = false; - ve.init.mw.ViewPageTarget.super.prototype.onSaveError.apply( this, arguments ); + ve.init.mw.DesktopArticleTarget.super.prototype.onSaveError.apply( this, arguments ); }; /** @@ -683,7 +683,7 @@ * * @method */ -ve.init.mw.ViewPageTarget.prototype.onSaveErrorEmpty = function () { +ve.init.mw.DesktopArticleTarget.prototype.onSaveErrorEmpty = function () { this.showSaveError( ve.msg( 'visualeditor-saveerror', 'Empty server response' ), false /* prevents reapply */ ); }; @@ -693,7 +693,7 @@ * @method * @param {Object} editApi */ -ve.init.mw.ViewPageTarget.prototype.onSaveErrorSpamBlacklist = function ( editApi ) { +ve.init.mw.DesktopArticleTarget.prototype.onSaveErrorSpamBlacklist = function ( editApi ) { this.showSaveError( $( $.parseHTML( editApi.sberrorparsed ) ), false // prevents reapply @@ -706,7 +706,7 @@ * @method * @param {Object} editApi */ -ve.init.mw.ViewPageTarget.prototype.onSaveErrorAbuseFilter = function ( editApi ) { +ve.init.mw.DesktopArticleTarget.prototype.onSaveErrorAbuseFilter = function ( editApi ) { this.showSaveError( $( $.parseHTML( editApi.warning ) ) ); // Don't disable the save button. If the action is not disallowed the user may save the // edit by pressing Save again. The AbuseFilter API currently has no way to distinguish @@ -718,7 +718,7 @@ * * @method */ -ve.init.mw.ViewPageTarget.prototype.onSaveErrorTitleBlacklist = function () { +ve.init.mw.DesktopArticleTarget.prototype.onSaveErrorTitleBlacklist = function () { this.showSaveError( mw.msg( 'visualeditor-saveerror-titleblacklist' ) ); }; @@ -728,7 +728,7 @@ * @method * @param {string|null} username Name of newly logged-in user, or null if anonymous */ -ve.init.mw.ViewPageTarget.prototype.onSaveErrorNewUser = function ( username ) { +ve.init.mw.DesktopArticleTarget.prototype.onSaveErrorNewUser = function ( username ) { var badToken, userMsg; badToken = document.createTextNode( mw.msg( 'visualeditor-savedialog-error-badtoken' ) + ' ' ); // mediawiki.jqueryMsg has a bug with [[User:$1|$1]] (bug 51388) @@ -748,7 +748,7 @@ * @method * @param {Object} editApi */ -ve.init.mw.ViewPageTarget.prototype.onSaveErrorCaptcha = function ( editApi ) { +ve.init.mw.DesktopArticleTarget.prototype.onSaveErrorCaptcha = function ( editApi ) { var $captchaDiv = $( '<div>' ), $captchaParagraph = $( '<p>' ); @@ -803,7 +803,7 @@ * @param {Object} editApi * @param {Object|null} data API response data */ -ve.init.mw.ViewPageTarget.prototype.onSaveErrorUnknown = function ( editApi, data ) { +ve.init.mw.DesktopArticleTarget.prototype.onSaveErrorUnknown = function ( editApi, data ) { this.showSaveError( $( document.createTextNode( ( editApi && editApi.info ) || @@ -821,7 +821,7 @@ * * @method */ -ve.init.mw.ViewPageTarget.prototype.onSaveErrorPageDeleted = function () { +ve.init.mw.DesktopArticleTarget.prototype.onSaveErrorPageDeleted = function () { var continueLabel = mw.msg( 'ooui-dialog-process-continue' ); this.pageDeletedWarning = true; @@ -832,7 +832,7 @@ * Handle MWSaveDialog retry events * So we can handle trying to save again after page deletion warnings */ -ve.init.mw.ViewPageTarget.prototype.onSaveRetry = function () { +ve.init.mw.DesktopArticleTarget.prototype.onSaveRetry = function () { if ( this.pageDeletedWarning ) { this.recreating = true; this.pageExists = false; @@ -849,7 +849,7 @@ * Reset when swapping panels. Assumed to be true unless explicitly set to false. * @param {boolean} [warning=false] Whether or not this is a warning. */ -ve.init.mw.ViewPageTarget.prototype.showSaveError = function ( msg, allowReapply, warning ) { +ve.init.mw.DesktopArticleTarget.prototype.showSaveError = function ( msg, allowReapply, warning ) { this.saveDeferred.reject( [ new OO.ui.Error( msg, { recoverable: allowReapply, warning: warning } ) ] ); }; @@ -859,7 +859,7 @@ * @method * @param {string} diffHtml */ -ve.init.mw.ViewPageTarget.prototype.onShowChanges = function ( diffHtml ) { +ve.init.mw.DesktopArticleTarget.prototype.onShowChanges = function ( diffHtml ) { // Invalidate the viewer diff on next change this.getSurface().getModel().getDocument().once( 'transact', this.saveDialog.clearDiff.bind( this.saveDialog ) @@ -874,7 +874,7 @@ * @param {Object} jqXHR * @param {string} status Text status message */ -ve.init.mw.ViewPageTarget.prototype.onShowChangesError = function ( jqXHR, status ) { +ve.init.mw.DesktopArticleTarget.prototype.onShowChangesError = function ( jqXHR, status ) { alert( ve.msg( 'visualeditor-differror', status ) ); this.saveDialog.popPending(); }; @@ -886,7 +886,7 @@ * @param {jqXHR|null} jqXHR * @param {string} status Text status message */ -ve.init.mw.ViewPageTarget.prototype.onSerializeError = function ( jqXHR, status ) { +ve.init.mw.DesktopArticleTarget.prototype.onSerializeError = function ( jqXHR, status ) { alert( ve.msg( 'visualeditor-serializeerror', status ) ); this.getSurface().getDialogs().closeWindow( 'wikitextswitchconfirm' ); @@ -903,7 +903,7 @@ * * @method */ -ve.init.mw.ViewPageTarget.prototype.onEditConflict = function () { +ve.init.mw.DesktopArticleTarget.prototype.onEditConflict = function () { this.saveDialog.popPending(); this.saveDialog.swapPanel( 'conflict' ); }; @@ -913,7 +913,7 @@ * * @method */ -ve.init.mw.ViewPageTarget.prototype.onNoChanges = function () { +ve.init.mw.DesktopArticleTarget.prototype.onNoChanges = function () { this.saveDialog.popPending(); this.saveDialog.swapPanel( 'nochanges' ); this.saveDialog.getActions().setAbilities( { approve: true } ); @@ -925,7 +925,7 @@ * @method * @param {jQuery.Event} e Mouse click event */ -ve.init.mw.ViewPageTarget.prototype.onToolbarSaveButtonClick = function () { +ve.init.mw.DesktopArticleTarget.prototype.onToolbarSaveButtonClick = function () { if ( this.edited || this.restoring ) { this.showSaveDialog(); } @@ -937,14 +937,14 @@ * @method * @param {jQuery.Event} e Mouse click event */ -ve.init.mw.ViewPageTarget.prototype.onToolbarMetaButtonClick = function () { +ve.init.mw.DesktopArticleTarget.prototype.onToolbarMetaButtonClick = function () { this.getSurface().getDialogs().openWindow( 'meta' ); }; /** * Re-evaluate whether the toolbar save button should be disabled or not. */ -ve.init.mw.ViewPageTarget.prototype.updateToolbarSaveButtonState = function () { +ve.init.mw.DesktopArticleTarget.prototype.updateToolbarSaveButtonState = function () { var isDisabled; this.edited = this.getSurface().getModel().hasBeenModified(); @@ -960,7 +960,7 @@ * @method * @fires saveReview */ -ve.init.mw.ViewPageTarget.prototype.onSaveDialogReview = function () { +ve.init.mw.DesktopArticleTarget.prototype.onSaveDialogReview = function () { if ( !this.saveDialog.$reviewViewer.find( 'table, pre' ).length ) { this.emit( 'saveReview' ); this.saveDialog.getActions().setAbilities( { approve: false } ); @@ -982,7 +982,7 @@ * @method * @param {string} wikitext */ -ve.init.mw.ViewPageTarget.prototype.onSaveDialogReviewComplete = function ( wikitext ) { +ve.init.mw.DesktopArticleTarget.prototype.onSaveDialogReviewComplete = function ( wikitext ) { // Invalidate the viewer wikitext on next change this.getSurface().getModel().getDocument().once( 'transact', this.saveDialog.clearDiff.bind( this.saveDialog ) @@ -996,7 +996,7 @@ * @param {jQuery.Deferred} saveDeferred Deferred object to resolve/reject when the save * succeeds/fails. */ -ve.init.mw.ViewPageTarget.prototype.saveDocument = function ( saveDeferred ) { +ve.init.mw.DesktopArticleTarget.prototype.saveDocument = function ( saveDeferred ) { if ( this.deactivating ) { return false; } @@ -1035,7 +1035,7 @@ * * @method */ -ve.init.mw.ViewPageTarget.prototype.editSource = function () { +ve.init.mw.DesktopArticleTarget.prototype.editSource = function () { if ( !this.getSurface().getModel().hasBeenModified() ) { this.switchToWikitextEditor( true ); return; @@ -1051,7 +1051,7 @@ * * @method */ -ve.init.mw.ViewPageTarget.prototype.onSaveDialogResolveConflict = function () { +ve.init.mw.DesktopArticleTarget.prototype.onSaveDialogResolveConflict = function () { // Get Wikitext from the DOM, and set up a submit call when it's done this.serialize( this.docToSave, @@ -1063,7 +1063,7 @@ * Get save form fields from the save dialog form. * @returns {Object} Form data for submission to the MediaWiki action=edit UI */ -ve.init.mw.ViewPageTarget.prototype.getSaveFields = function () { +ve.init.mw.DesktopArticleTarget.prototype.getSaveFields = function () { var fields = {}; this.$checkboxes .each( function () { @@ -1091,7 +1091,7 @@ * @param {string} wikitext Wikitext to submit * @returns {boolean} Whether submission was started */ -ve.init.mw.ViewPageTarget.prototype.submitWithSaveFields = function ( fields, wikitext ) { +ve.init.mw.DesktopArticleTarget.prototype.submitWithSaveFields = function ( fields, wikitext ) { return this.submit( wikitext, $.extend( this.getSaveFields(), fields ) ); }; @@ -1099,7 +1099,7 @@ * Get edit API options from the save dialog form. * @returns {Object} Save options for submission to the MediaWiki API */ -ve.init.mw.ViewPageTarget.prototype.getSaveOptions = function () { +ve.init.mw.DesktopArticleTarget.prototype.getSaveOptions = function () { var key, options = this.getSaveFields(), fieldMap = { wpSummary: 'summary', @@ -1124,7 +1124,7 @@ * * @return {jQuery.Promise} Promise resolved when surface is torn down */ -ve.init.mw.ViewPageTarget.prototype.tearDownSurface = function () { +ve.init.mw.DesktopArticleTarget.prototype.tearDownSurface = function () { var target = this, promises = []; @@ -1155,11 +1155,11 @@ /** * Modify tabs in the skin to support in-place editing. - * Edit tab is bound outside the module in mw.ViewPageTarget.init. + * Edit tab is bound outside the module in mw.DesktopArticleTarget.init. * * @method */ -ve.init.mw.ViewPageTarget.prototype.setupSkinTabs = function () { +ve.init.mw.DesktopArticleTarget.prototype.setupSkinTabs = function () { var target = this; if ( this.isViewPage ) { // Allow instant switching back to view mode, without refresh @@ -1189,12 +1189,12 @@ * Dummy replaced by init.js so that we can call it again from #onSave after * replacing the page contents with the new html. */ -ve.init.mw.ViewPageTarget.prototype.setupSectionEditLinks = null; +ve.init.mw.DesktopArticleTarget.prototype.setupSectionEditLinks = null; /** * Add content and event bindings to toolbar save button. */ -ve.init.mw.ViewPageTarget.prototype.setupToolbarSaveButton = function () { +ve.init.mw.DesktopArticleTarget.prototype.setupToolbarSaveButton = function () { this.toolbarSaveButton = new OO.ui.ButtonWidget( { label: ve.msg( 'visualeditor-toolbar-savedialog' ), flags: [ 'progressive', 'primary' ], @@ -1219,7 +1219,7 @@ /** * Add the save button to the user interface. */ -ve.init.mw.ViewPageTarget.prototype.attachToolbarSaveButton = function () { +ve.init.mw.DesktopArticleTarget.prototype.attachToolbarSaveButton = function () { this.actionsToolbar = new ve.ui.TargetToolbar( this ); this.actionsToolbar.setup( [ @@ -1243,7 +1243,7 @@ * * @fires saveWorkflowBegin */ -ve.init.mw.ViewPageTarget.prototype.showSaveDialog = function () { +ve.init.mw.DesktopArticleTarget.prototype.showSaveDialog = function () { var target = this; this.emit( 'saveWorkflowBegin' ); this.getSurface().getDialogs().getWindow( 'mwSave' ).done( function ( win ) { @@ -1291,7 +1291,7 @@ * * @fires saveWorkflowEnd */ -ve.init.mw.ViewPageTarget.prototype.onSaveDialogClose = function () { +ve.init.mw.DesktopArticleTarget.prototype.onSaveDialogClose = function () { var target = this; function clear() { @@ -1313,14 +1313,14 @@ /** * Remember the window's scroll position. */ -ve.init.mw.ViewPageTarget.prototype.saveScrollPosition = function () { +ve.init.mw.DesktopArticleTarget.prototype.saveScrollPosition = function () { this.scrollTop = $( window ).scrollTop(); }; /** * Restore the window's scroll position. */ -ve.init.mw.ViewPageTarget.prototype.restoreScrollPosition = function () { +ve.init.mw.DesktopArticleTarget.prototype.restoreScrollPosition = function () { if ( this.scrollTop ) { $( window ).scrollTop( this.scrollTop ); this.scrollTop = null; @@ -1332,7 +1332,7 @@ * * @return {jQuery.Promise} Promise which resolves when toolbar is hidden */ -ve.init.mw.ViewPageTarget.prototype.tearDownToolbar = function () { +ve.init.mw.DesktopArticleTarget.prototype.tearDownToolbar = function () { var target = this, deferred = $.Deferred(); this.toolbar.$element.css( 'height', this.toolbar.$bar.outerHeight() ); @@ -1352,7 +1352,7 @@ * * @return {jQuery.Promise} Promise which resolves when debug bar is hidden */ -ve.init.mw.ViewPageTarget.prototype.tearDownDebugBar = function () { +ve.init.mw.DesktopArticleTarget.prototype.tearDownDebugBar = function () { var target = this; if ( this.debugBar ) { return this.debugBar.$element.slideUp( 'fast' ).promise().then( function () { @@ -1366,7 +1366,7 @@ /** * Change the document title to state that we are now editing. */ -ve.init.mw.ViewPageTarget.prototype.changeDocumentTitle = function () { +ve.init.mw.DesktopArticleTarget.prototype.changeDocumentTitle = function () { var pageName = mw.config.get( 'wgPageName' ), title = mw.Title.newFromText( pageName ); if ( title ) { @@ -1381,14 +1381,14 @@ /** * Restore the original document title. */ -ve.init.mw.ViewPageTarget.prototype.restoreDocumentTitle = function () { +ve.init.mw.DesktopArticleTarget.prototype.restoreDocumentTitle = function () { document.title = this.originalDocumentTitle; }; /** * Page modifications for switching to edit mode. */ -ve.init.mw.ViewPageTarget.prototype.transformPage = function () { +ve.init.mw.DesktopArticleTarget.prototype.transformPage = function () { var uri; // Deselect current mode (e.g. "view" or "history"). In skins like monobook that don't have @@ -1416,7 +1416,7 @@ /** * Page modifications for switching back to view mode. */ -ve.init.mw.ViewPageTarget.prototype.restorePage = function () { +ve.init.mw.DesktopArticleTarget.prototype.restorePage = function () { var uri, keys; // Skins like monobook don't have a tab for view mode and instead just have the namespace tab @@ -1454,7 +1454,7 @@ /** * @param {Event} e Native event object */ -ve.init.mw.ViewPageTarget.prototype.onWindowPopState = function ( e ) { +ve.init.mw.DesktopArticleTarget.prototype.onWindowPopState = function ( e ) { var newUri; if ( !this.verifyPopState( e.state ) ) { @@ -1486,7 +1486,7 @@ and time strings, or undefined if we made no change. * @param {string} contentSub What HTML to show as the content subtitle */ -ve.init.mw.ViewPageTarget.prototype.replacePageContent = function ( +ve.init.mw.DesktopArticleTarget.prototype.replacePageContent = function ( html, categoriesHtml, displayTitle, lastModified, contentSub ) { var $editableContent, $imgContent, @@ -1539,7 +1539,7 @@ * @method * @param {HTMLElement} heading Heading element of section */ -ve.init.mw.ViewPageTarget.prototype.getEditSection = function ( heading ) { +ve.init.mw.DesktopArticleTarget.prototype.getEditSection = function ( heading ) { var $page = $( '#mw-content-text' ), section = 0; $page.find( 'h1, h2, h3, h4, h5, h6' ).not( '#toc h2' ).each( function () { @@ -1557,7 +1557,7 @@ * @method * @param {HTMLElement} heading Heading element of section */ -ve.init.mw.ViewPageTarget.prototype.saveEditSection = function ( heading ) { +ve.init.mw.DesktopArticleTarget.prototype.saveEditSection = function ( heading ) { this.section = this.getEditSection( heading ); }; @@ -1566,7 +1566,7 @@ * * @method */ -ve.init.mw.ViewPageTarget.prototype.setupUnloadHandlers = function () { +ve.init.mw.DesktopArticleTarget.prototype.setupUnloadHandlers = function () { // Remember any already set beforeunload handler this.onBeforeUnloadFallback = window.onbeforeunload; // Attach our handlers @@ -1578,7 +1578,7 @@ * * @method */ -ve.init.mw.ViewPageTarget.prototype.tearDownUnloadHandlers = function () { +ve.init.mw.DesktopArticleTarget.prototype.tearDownUnloadHandlers = function () { // Restore whatever previous onbeforeunload hook existed window.onbeforeunload = this.onBeforeUnloadFallback; this.onBeforeUnloadFallback = null; @@ -1588,7 +1588,7 @@ /** * Show the beta dialog as needed */ -ve.init.mw.ViewPageTarget.prototype.maybeShowWelcomeDialog = function () { +ve.init.mw.DesktopArticleTarget.prototype.maybeShowWelcomeDialog = function () { var usePrefs, prefSaysShow, urlSaysHide, windowManager, target = this; @@ -1598,8 +1598,8 @@ // Set up a temporary window manager windowManager = new OO.ui.WindowManager( { classes: [ - 've-init-mw-viewPageTarget-windowManager', - 've-init-mw-viewPageTarget-windowManager-welcome' + 've-init-mw-desktopArticleTarget-windowManager', + 've-init-mw-desktopArticleTarget-windowManager-welcome' ] } ); $( 'body' ).append( windowManager.$element ); @@ -1667,7 +1667,7 @@ /** * Show the meta dialog as needed on load. */ -ve.init.mw.ViewPageTarget.prototype.maybeShowMetaDialog = function () { +ve.init.mw.DesktopArticleTarget.prototype.maybeShowMetaDialog = function () { var target = this; this.welcomeDialogPromise @@ -1689,7 +1689,7 @@ * * @method */ -ve.init.mw.ViewPageTarget.prototype.onBeforeUnload = function () { +ve.init.mw.DesktopArticleTarget.prototype.onBeforeUnload = function () { var fallbackResult; // Check if someone already set on onbeforeunload hook if ( this.onBeforeUnloadFallback ) { @@ -1712,7 +1712,7 @@ * * @method */ -ve.init.mw.ViewPageTarget.prototype.onUnload = function () { +ve.init.mw.DesktopArticleTarget.prototype.onUnload = function () { if ( !this.submitting ) { ve.track( 'mwedit.abort', { type: this.edited ? 'unknown-edited' : 'unknown', @@ -1726,7 +1726,7 @@ * * @param {boolean} [discardChanges] Whether to discard changes or not. */ -ve.init.mw.ViewPageTarget.prototype.switchToWikitextEditor = function ( discardChanges ) { +ve.init.mw.DesktopArticleTarget.prototype.switchToWikitextEditor = function ( discardChanges ) { var target = this; if ( discardChanges ) { ve.track( 'mwedit.abort', { type: 'switchwithout', mechanism: 'navigate' } ); @@ -1749,6 +1749,6 @@ /** * Resets the document opacity when we've decided to cancel switching to the wikitext editor. */ -ve.init.mw.ViewPageTarget.prototype.resetDocumentOpacity = function () { +ve.init.mw.DesktopArticleTarget.prototype.resetDocumentOpacity = function () { this.getSurface().getView().getDocument().getDocumentNode().$element.css( 'opacity', 1 ); }; diff --git a/modules/ve-mw/init/targets/ve.init.mw.MobileViewTarget.js b/modules/ve-mw/init/targets/ve.init.mw.MobileArticleTarget.js similarity index 71% rename from modules/ve-mw/init/targets/ve.init.mw.MobileViewTarget.js rename to modules/ve-mw/init/targets/ve.init.mw.MobileArticleTarget.js index 8834183..2df8205 100644 --- a/modules/ve-mw/init/targets/ve.init.mw.MobileViewTarget.js +++ b/modules/ve-mw/init/targets/ve.init.mw.MobileArticleTarget.js @@ -1,5 +1,5 @@ /*! - * VisualEditor MediaWiki Initialization MobileViewTarget class. + * VisualEditor MediaWiki Initialization MobileArticleTarget class. * * @copyright 2011-2015 VisualEditor Team and others; see AUTHORS.txt * @license The MIT License (MIT); see LICENSE.txt @@ -16,7 +16,7 @@ * @cfg {number} [section] Number of the section target should scroll to * @cfg {boolean} [isIos=false] Whether the platform is an iOS device */ -ve.init.mw.MobileViewTarget = function VeInitMwMobileViewTarget( config ) { +ve.init.mw.MobileArticleTarget = function VeInitMwMobileArticleTarget( config ) { var currentUri = new mw.Uri(); config = config || {}; @@ -36,11 +36,11 @@ /* Inheritance */ -OO.inheritClass( ve.init.mw.MobileViewTarget, ve.init.mw.Target ); +OO.inheritClass( ve.init.mw.MobileArticleTarget, ve.init.mw.Target ); /* Static Properties */ -ve.init.mw.MobileViewTarget.static.toolbarGroups = [ +ve.init.mw.MobileArticleTarget.static.toolbarGroups = [ // Style { include: [ 'bold', 'italic' ] }, // Link @@ -56,14 +56,14 @@ } ]; -ve.init.mw.MobileViewTarget.static.name = 'mobile'; +ve.init.mw.MobileArticleTarget.static.name = 'mobile'; /* Methods */ /** * Once surface is ready ready, init UI. */ -ve.init.mw.MobileViewTarget.prototype.onSurfaceReady = function () { +ve.init.mw.MobileArticleTarget.prototype.onSurfaceReady = function () { this.restoreEditSection(); this.events.trackActivationComplete(); }; @@ -76,14 +76,14 @@ * @param {Object} [config] Configuration options * @returns {ve.ui.MobileSurface} */ -ve.init.mw.MobileViewTarget.prototype.createSurface = function ( dmDoc, config ) { +ve.init.mw.MobileArticleTarget.prototype.createSurface = function ( dmDoc, config ) { return new ve.ui.MobileSurface( dmDoc, config ); }; /** * @inheritdoc */ -ve.init.mw.MobileViewTarget.prototype.setupToolbar = function ( surface ) { +ve.init.mw.MobileArticleTarget.prototype.setupToolbar = function ( surface ) { // Parent method ve.init.mw.Target.prototype.setupToolbar.call( this, surface ); @@ -94,7 +94,7 @@ /** * @inheritdoc */ -ve.init.mw.MobileViewTarget.prototype.attachToolbar = function () { +ve.init.mw.MobileArticleTarget.prototype.attachToolbar = function () { // Move the toolbar to the overlay header this.toolbar.$element.appendTo( '.overlay-header > .toolbar' ); }; @@ -102,14 +102,14 @@ /** * @inheritdoc */ -ve.init.mw.MobileViewTarget.prototype.goToHeading = function ( headingNode ) { +ve.init.mw.MobileArticleTarget.prototype.goToHeading = function ( headingNode ) { this.scrollToHeading( headingNode ); }; /** * @inheritdoc */ -ve.init.mw.MobileViewTarget.prototype.scrollToHeading = function ( headingNode ) { +ve.init.mw.MobileArticleTarget.prototype.scrollToHeading = function ( headingNode ) { var position, target = this; @@ -118,7 +118,7 @@ position = headingNode.$element.offset().top - target.toolbar.$element.height(); target.surface.$element.closest( '.overlay-content' ).scrollTop( position ); } else { - ve.init.mw.MobileViewTarget.super.prototype.scrollToHeading.call( target, headingNode ); + ve.init.mw.MobileArticleTarget.super.prototype.scrollToHeading.call( target, headingNode ); } } ); }; diff --git a/modules/ve-mw/init/ve.init.mw.Target.js b/modules/ve-mw/init/ve.init.mw.Target.js index 1cbe940..b878191 100644 --- a/modules/ve-mw/init/ve.init.mw.Target.js +++ b/modules/ve-mw/init/ve.init.mw.Target.js @@ -1283,7 +1283,7 @@ ve.track( 'trace.createSurface.exit' ); surface.$element - .addClass( 've-init-mw-viewPageTarget-surface' ) + .addClass( 've-init-mw-desktopArticleTarget-surface' ) .addClass( target.protectedClasses ) .appendTo( target.$element ); diff --git a/modules/ve-mw/tests/browser/features/support/pages/dummy_page.rb b/modules/ve-mw/tests/browser/features/support/pages/dummy_page.rb index 496a28d..184d9c8 100644 --- a/modules/ve-mw/tests/browser/features/support/pages/dummy_page.rb +++ b/modules/ve-mw/tests/browser/features/support/pages/dummy_page.rb @@ -5,6 +5,6 @@ include URL page_url('http://<%=params[:site]%>/wiki/asdfdgfghlkj?veaction=edit') - div(:ve_editing_surface, class: 've-ui-surface ve-init-mw-viewPageTarget-surface') + div(:ve_editing_surface, class: 've-ui-surface ve-init-mw-desktopArticleTarget-surface') div(:ve_editing_toolbar, class: 'oo-ui-toolbar-bar') end diff --git a/modules/ve-mw/tests/browser/features/support/pages/visual_editor_page.rb b/modules/ve-mw/tests/browser/features/support/pages/visual_editor_page.rb index f8b438d..1b450b4 100644 --- a/modules/ve-mw/tests/browser/features/support/pages/visual_editor_page.rb +++ b/modules/ve-mw/tests/browser/features/support/pages/visual_editor_page.rb @@ -53,7 +53,7 @@ span(:decrease_indentation, class: 'oo-ui-iconElement-icon oo-ui-icon-outdent') text_area(:describe_change, index: 0) div(:diff_view, class: 've-ui-mwSaveDialog-viewer') - div(:disabled_save_button, css: 'div.ve-init-mw-viewPageTarget-toolbar .oo-ui-toolbar-actions > div.oo-ui-flaggedElement-progressive.oo-ui-widget-disabled') + div(:disabled_save_button, css: 'div.ve-init-mw-desktopArticleTarget-toolbar .oo-ui-toolbar-actions > div.oo-ui-flaggedElement-progressive.oo-ui-widget-disabled') text_field(:display_title_textbox, css: 'div.oo-ui-fieldLayout-align-inline:nth-child(4) > label:nth-child(1) > div:nth-child(1) > div:nth-child(1) > input:nth-child(1)') div(:enable_redirect, class: 've-test-page-settings-enable-redirect') div(:external_link, class: 've-test-external-link-tab') @@ -151,7 +151,7 @@ li(:ve_edit_tab, id: 'ca-ve-edit') li(:edit_source_tab, id: 'ca-edit') a(:save_page, css: '.oo-ui-flaggedElement-progressive > a:nth-child(1)') - div(:save_enabled, css: 'div.ve-init-mw-viewPageTarget-toolbar .oo-ui-toolbar-actions > div.oo-ui-flaggedElement-progressive.oo-ui-widget-enabled') + div(:save_enabled, css: 'div.ve-init-mw-desktopArticleTarget-toolbar .oo-ui-toolbar-actions > div.oo-ui-flaggedElement-progressive.oo-ui-widget-enabled') div(:search_page_link, class: 'oo-ui-optionWidget-selected') a(:second_reference, text: '[1]', index: 2) span(:second_save_page, css: '.oo-ui-processDialog-actions-primary > div:nth-child(1) > a:nth-child(1) > span:nth-child(2)') @@ -166,7 +166,7 @@ table(:table, class: 've-ce-tableNode') div(:table_of_contents, class: 've-test-page-settings-table-of-contents') span(:template_insert_menu, class: 'oo-ui-tool-name-transclusion') - div(:toolbar, class: 've-init-mw-viewPageTarget-toolbar') + div(:toolbar, class: 've-init-mw-desktopArticleTarget-toolbar') div(:toolbar_actions, class: 'oo-ui-toolbar-actions') if ENV['BROWSER'] == 'chrome' div(:tools_menu, class: 'oo-ui-widget oo-ui-widget-enabled oo-ui-toolGroup oo-ui-iconElement oo-ui-popupToolGroup oo-ui-listToolGroup') diff --git a/modules/ve-mw/tests/init/targets/ve.init.mw.ViewPageTarget.test.js b/modules/ve-mw/tests/init/targets/ve.init.mw.DesktopArticleTarget.test.js similarity index 96% rename from modules/ve-mw/tests/init/targets/ve.init.mw.ViewPageTarget.test.js rename to modules/ve-mw/tests/init/targets/ve.init.mw.DesktopArticleTarget.test.js index 428732b..a412f42 100644 --- a/modules/ve-mw/tests/init/targets/ve.init.mw.ViewPageTarget.test.js +++ b/modules/ve-mw/tests/init/targets/ve.init.mw.DesktopArticleTarget.test.js @@ -1,12 +1,12 @@ /*! - * VisualEditor MediaWiki Initialization ViewPageTarget tests. + * VisualEditor MediaWiki Initialization DesktopArticleTarget tests. * * @copyright 2011-2015 VisualEditor Team and others; see AUTHORS.txt * @license The MIT License (MIT); see LICENSE.txt */ /*global mw */ -QUnit.module( 've.init.mw.ViewPageTarget', ve.test.utils.mwEnvironment ); +QUnit.module( 've.init.mw.DesktopArticleTarget', ve.test.utils.mwEnvironment ); QUnit.test( 'compatibility', function ( assert ) { var i, profile, list, matches, compatibility, @@ -174,7 +174,7 @@ ]; compatibility = { - whitelist: ve.init.mw.ViewPageTarget.compatibility.whitelist, + whitelist: ve.init.mw.DesktopArticleTarget.compatibility.whitelist, // TODO: Fix this mess when we split ve.init from ve.platform blacklist: mw.libs.ve.blacklist }; -- To view, visit https://gerrit.wikimedia.org/r/227706 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I6a8fa76dc4d70cc04722e30e3fea6a6112d56b40 Gerrit-PatchSet: 5 Gerrit-Project: mediawiki/extensions/VisualEditor Gerrit-Branch: master Gerrit-Owner: Esanders <esand...@wikimedia.org> Gerrit-Reviewer: Esanders <esand...@wikimedia.org> Gerrit-Reviewer: Jforrester <jforres...@wikimedia.org> Gerrit-Reviewer: Legoktm <legoktm.wikipe...@gmail.com> Gerrit-Reviewer: Trevor Parscal <tpars...@wikimedia.org> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits