Esanders has uploaded a new change for review. (
https://gerrit.wikimedia.org/r/400697 )
Change subject: Remove browser compatibility checks
......................................................................
Remove browser compatibility checks
WikiEditor works in all browsers that MW supports,
and should do going forward.
Change-Id: I189516917d805dff3819e742a9fd8ad96a161159
---
M WikiEditorHooks.php
M modules/ext.wikiEditor.dialogs.js
M modules/ext.wikiEditor.toolbar.js
M modules/ext.wikiEditor.toolbar.styles.less
M modules/jquery.wikiEditor.dialogs.js
M modules/jquery.wikiEditor.js
6 files changed, 8 insertions(+), 87 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/WikiEditor
refs/changes/97/400697/1
diff --git a/WikiEditorHooks.php b/WikiEditorHooks.php
index 149a75d..591096a 100644
--- a/WikiEditorHooks.php
+++ b/WikiEditorHooks.php
@@ -154,12 +154,7 @@
public static function EditPageBeforeEditToolbar( &$toolbar ) {
global $wgUser;
if ( $wgUser->getOption( 'usebetatoolbar' ) ) {
- $toolbar = Html::rawElement(
- 'div', [
- 'class' => 'wikiEditor-oldToolbar'
- ],
- $toolbar
- );
+ $toolbar = '';
// Return false to signify that the toolbar has been
over-written, so
// the old toolbar code shouldn't be added to the page.
return false;
diff --git a/modules/ext.wikiEditor.dialogs.js
b/modules/ext.wikiEditor.dialogs.js
index 271c170..13972dd 100644
--- a/modules/ext.wikiEditor.dialogs.js
+++ b/modules/ext.wikiEditor.dialogs.js
@@ -2,10 +2,6 @@
* JavaScript for WikiEditor Dialogs
*/
jQuery( function ( $ ) {
- if ( !$.wikiEditor.isSupported( $.wikiEditor.modules.dialogs ) ) {
- return;
- }
-
// Replace icons
$.wikiEditor.modules.dialogs.config.replaceIcons( $( '#wpTextbox1' ) );
diff --git a/modules/ext.wikiEditor.toolbar.js
b/modules/ext.wikiEditor.toolbar.js
index df0400d..0c38d40 100644
--- a/modules/ext.wikiEditor.toolbar.js
+++ b/modules/ext.wikiEditor.toolbar.js
@@ -2,10 +2,6 @@
* JavaScript for WikiEditor Toolbar
*/
jQuery( function ( $ ) {
- if ( !$.wikiEditor.isSupported( $.wikiEditor.modules.toolbar ) ) {
- $( '.wikiEditor-oldToolbar' ).show();
- return;
- }
// The old toolbar is still in place and needs to be removed so there
aren't two toolbars
$( '#toolbar' ).remove();
// Add toolbar module
diff --git a/modules/ext.wikiEditor.toolbar.styles.less
b/modules/ext.wikiEditor.toolbar.styles.less
index 1e77c82..016a56c 100644
--- a/modules/ext.wikiEditor.toolbar.styles.less
+++ b/modules/ext.wikiEditor.toolbar.styles.less
@@ -22,9 +22,7 @@
resize: vertical;
}
-/* Hide the old toolbar until the wikiEditor toolbar is deemed not supported,
- * hide the WikiEditor toolbar until it's css has loaded */
-.wikiEditor-oldToolbar,
+/* Hide the WikiEditor toolbar until its css has loaded */
.wikiEditor-ui-toolbar {
display: none;
}
@@ -38,7 +36,7 @@
/* Set a margin on the textarea while we load, matching the height,
* of the wikieditor toolbar to prevent reflow. After the wikieditor ui is
loaded,
* the textarea is wrapped inside wikieditor-ui div and no longer matches */
-.client-js .wikiEditor-oldToolbar + #wpTextbox1 {
+.client-js .mw-editform > #wpTextbox1 {
/* Toolbar height + padding + bottom border = 26 + 2*3 + 1 */
margin-top: 33px;
}
diff --git a/modules/jquery.wikiEditor.dialogs.js
b/modules/jquery.wikiEditor.dialogs.js
index 0a284bb..a5d44d4 100644
--- a/modules/jquery.wikiEditor.dialogs.js
+++ b/modules/jquery.wikiEditor.dialogs.js
@@ -75,7 +75,7 @@
// Defer building of modules, unless they
require immediate creation
for ( mod in config ) {
module = config[ mod ];
- // Only create the dialog if it's
supported, isn't filtered and doesn't exist yet
+ // Only create the dialog if it isn't
filtered and doesn't exist yet
filtered = false;
if ( typeof module.filters !==
'undefined' ) {
for ( i = 0; i <
module.filters.length; i++ ) {
@@ -92,7 +92,7 @@
}
// Re-select from the DOM, we might
have removed the dialog just now
$existingDialog = $( '#' + module.id );
- if ( !filtered &&
$.wikiEditor.isSupported( module ) && $existingDialog.length === 0 ) {
+ if ( !filtered &&
$existingDialog.length === 0 ) {
$.wikiEditor.modules.dialogs.modules[ mod ] = module;
context.$textarea.trigger(
'wikiEditor-dialogs-setup-' + mod );
// If this dialog requires
immediate creation, create it now
diff --git a/modules/jquery.wikiEditor.js b/modules/jquery.wikiEditor.js
index c1769a8..dd50e05 100644
--- a/modules/jquery.wikiEditor.js
+++ b/modules/jquery.wikiEditor.js
@@ -55,66 +55,10 @@
instances: [],
/**
- * For each browser name, an array of conditions that must be
met are supplied in [operation, value]-form where
- * operation is a string containing a JavaScript compatible
binary operator and value is either a number to be
- * compared with $.browser.versionNumber or a string to be
compared with $.browser.version. If a browser is not
- * specifically mentioned, we just assume things will work.
- */
- browsers: {
- // Left-to-right languages
- ltr: {
- msie: [ [ '>=', 9 ] ],
- firefox: [ [ '>=', 4 ] ],
- opera: [ [ '>=', '10.5' ] ],
- safari: [ [ '>=', 5 ] ],
- chrome: [ [ '>=', 5 ] ],
- netscape: [ [ '>=', 9 ] ],
- blackberry: false,
- ipod: [ [ '>=', 6 ] ],
- iphone: [ [ '>=', 6 ] ]
- },
- // Right-to-left languages
- rtl: {
- msie: [ [ '>=', 9 ] ],
- firefox: [ [ '>=', 4 ] ],
- opera: [ [ '>=', '10.5' ] ],
- safari: [ [ '>=', 5 ] ],
- chrome: [ [ '>=', 5 ] ],
- netscape: [ [ '>=', 9 ] ],
- blackberry: false,
- ipod: [ [ '>=', 6 ] ],
- iphone: [ [ '>=', 6 ] ]
- }
- },
-
- /**
* Path to images - this is a bit messy, and it would need to
change if this code (and images) gets moved into the
* core - or anywhere for that matter...
*/
imgPath: mw.config.get( 'wgExtensionAssetsPath' ) +
'/WikiEditor/modules/images/',
-
- /**
- * Checks the current browser against the browsers object to
determine if the browser has been black-listed or not.
- * Because these rules are often very complex, the object
contains configurable operators and can check against
- * either the browser version number or string. This process
also involves checking if the current browser is among
- * those which we have configured as compatible or not. If the
browser was not configured as compatible we just go on
- * assuming things will work - the argument here is to prevent
the need to update the code when a new browser comes
- * to market. The assumption here is that any new browser will
be built on an existing engine or be otherwise so
- * similar to another existing browser that things actually do
work as expected. The merits of this argument, which
- * is essentially to blacklist rather than whitelist are
debatable, but at this point we've decided it's the more
- * "open-web" way to go.
- *
- * @return {boolean}
- */
- isSupported: function () {
- // Fallback to the wikiEditor browser map if no special
map is provided in the module
- // Check for and make use of cached value and early
opportunities to bail
- if ( typeof $.wikiEditor.supported === 'undefined' ) {
- // Run a browser support test and then cache
and return the result
- $.wikiEditor.supported = $.client.test(
$.wikiEditor.browsers );
- }
- return $.wikiEditor.supported;
- },
/**
* Checks if a module has a specific requirement
@@ -250,11 +194,6 @@
var context, profile, hasFocus, cursorPos,
args, modules, module, e, call;
- // Skip any further work when running in browsers that are
unsupported
- if ( !$.wikiEditor.isSupported() ) {
- return $( this );
- }
-
// Save browser profile for detailed tests.
profile = $.client.profile();
@@ -307,10 +246,8 @@
modules = data;
}
for ( module in modules ) {
- // Check for the existence of
an available / supported module with a matching name and a create function
- if ( typeof module === 'string'
&& typeof $.wikiEditor.modules[ module ] !== 'undefined' &&
-
$.wikiEditor.isSupported( $.wikiEditor.modules[ module ] )
- ) {
+ // Check for the existence of
an available module with a matching name and a create function
+ if ( typeof module === 'string'
&& typeof $.wikiEditor.modules[ module ] !== 'undefined' ) {
// Extend the context's
core API with this module's own API calls
if ( 'api' in
$.wikiEditor.modules[ module ] ) {
for ( call in
$.wikiEditor.modules[ module ].api ) {
@@ -568,8 +505,7 @@
modules[ args[ 1 ] ] = '';
}
for ( module in modules ) {
- // Only allow modules which are supported (and
thus actually being turned on) affect the decision to extend
- if ( module in $.wikiEditor.modules &&
$.wikiEditor.isSupported( $.wikiEditor.modules[ module ] ) ) {
+ if ( module in $.wikiEditor.modules ) {
// Activate all required core
extensions on context
for ( e in $.wikiEditor.extensions ) {
if (
--
To view, visit https://gerrit.wikimedia.org/r/400697
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I189516917d805dff3819e742a9fd8ad96a161159
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/WikiEditor
Gerrit-Branch: master
Gerrit-Owner: Esanders <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits