From 4ac9fa081a7c045f6a9f1cfc529d82423f485b2e Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Sun, 8 Dec 2013 09:55:49 +0100 Subject: Update to MediaWiki 1.22.0 --- .../modules/jquery.wikiEditor.highlight.js | 41 +++++++++++++++------- 1 file changed, 28 insertions(+), 13 deletions(-) (limited to 'extensions/WikiEditor/modules/jquery.wikiEditor.highlight.js') diff --git a/extensions/WikiEditor/modules/jquery.wikiEditor.highlight.js b/extensions/WikiEditor/modules/jquery.wikiEditor.highlight.js index 9d964fa7..f646e456 100644 --- a/extensions/WikiEditor/modules/jquery.wikiEditor.highlight.js +++ b/extensions/WikiEditor/modules/jquery.wikiEditor.highlight.js @@ -20,13 +20,21 @@ $.wikiEditor.modules.highlight = { * Internally used event handlers */ evt: { + /** + * @param context + * @param event + */ delayedChange: function ( context, event ) { - if ( event.data.scope == 'realchange' ) { + if ( event.data.scope === 'realchange' ) { $.wikiEditor.modules.highlight.fn.scan( context ); $.wikiEditor.modules.highlight.fn.mark( context, event.data.scope ); } }, - ready: function ( context, event ) { + /** + * @param context + * @param event + */ + ready: function ( context ) { $.wikiEditor.modules.highlight.fn.scan( context ); $.wikiEditor.modules.highlight.fn.mark( context, 'ready' ); } @@ -39,19 +47,22 @@ $.wikiEditor.modules.highlight = { /** * Creates a highlight module within a wikiEditor * + * @param context * @param config Configuration object to create module from */ - create: function ( context, config ) { + create: function ( context ) { context.modules.highlight.markersStr = ''; }, /** * Scans text division for tokens * + * @param context * @param division */ - scan: function ( context, division ) { + scan: function ( context ) { var tokenArray, text, module, exp, - left, right, match; + left, right, match, + regex, label, markAfter, offset; /*jshint eqnull: true */ // Remove all existing tokens @@ -65,11 +76,11 @@ $.wikiEditor.modules.highlight = { if ( module in $.wikiEditor.modules && 'exp' in $.wikiEditor.modules[module] ) { for ( exp in $.wikiEditor.modules[module].exp ) { // Prepare configuration - var regex = $.wikiEditor.modules[module].exp[exp].regex; - var label = $.wikiEditor.modules[module].exp[exp].label; - var markAfter = $.wikiEditor.modules[module].exp[exp].markAfter || false; + regex = $.wikiEditor.modules[module].exp[exp].regex; + label = $.wikiEditor.modules[module].exp[exp].label; + markAfter = $.wikiEditor.modules[module].exp[exp].markAfter || false; // Search for tokens - var offset = 0; + offset = 0; while ( ( match = text.substr( offset ).match( regex ) ) != null ) { right = ( left = offset + match.index ) + match[0].length; tokenArray[tokenArray.length] = { @@ -95,16 +106,19 @@ $.wikiEditor.modules.highlight = { /** * Marks up text with HTML * + * @param context * @param division * @param tokens */ // FIXME: What do division and tokens do? // TODO: Document the scan() and mark() APIs somewhere - mark: function ( context, division, tokens ) { - var i, subtracted, oldLength, j, o; + mark: function ( context, division ) { + /*jshint eqeqeq:false, onevar:false */ + var i, subtracted, oldLength, j, o, + markers; // Reset markers - var markers = []; + markers = []; // Recycle markers that will be skipped in this run if ( context.modules.highlight.markers && division !== '' ) { @@ -353,8 +367,9 @@ $.wikiEditor.modules.highlight = { // Don't remove these either return true; } - if ( marker && typeof marker.beforeUnwrap === 'function' ) + if ( marker && typeof marker.beforeUnwrap === 'function' ) { marker.beforeUnwrap( this ); + } if ( ( marker && marker.anchor === 'tag' ) || $(this).is( 'p' ) ) { // Remove all classes $(this).removeAttr( 'class' ); -- cgit v1.2.3-54-g00ecf