summaryrefslogtreecommitdiff
path: root/extensions/WikiEditor/modules/jquery.wikiEditor.highlight.js
diff options
context:
space:
mode:
Diffstat (limited to 'extensions/WikiEditor/modules/jquery.wikiEditor.highlight.js')
-rw-r--r--extensions/WikiEditor/modules/jquery.wikiEditor.highlight.js41
1 files changed, 13 insertions, 28 deletions
diff --git a/extensions/WikiEditor/modules/jquery.wikiEditor.highlight.js b/extensions/WikiEditor/modules/jquery.wikiEditor.highlight.js
index f646e456..9d964fa7 100644
--- a/extensions/WikiEditor/modules/jquery.wikiEditor.highlight.js
+++ b/extensions/WikiEditor/modules/jquery.wikiEditor.highlight.js
@@ -20,21 +20,13 @@ $.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 );
}
},
- /**
- * @param context
- * @param event
- */
- ready: function ( context ) {
+ ready: function ( context, event ) {
$.wikiEditor.modules.highlight.fn.scan( context );
$.wikiEditor.modules.highlight.fn.mark( context, 'ready' );
}
@@ -47,22 +39,19 @@ $.wikiEditor.modules.highlight = {
/**
* Creates a highlight module within a wikiEditor
*
- * @param context
* @param config Configuration object to create module from
*/
- create: function ( context ) {
+ create: function ( context, config ) {
context.modules.highlight.markersStr = '';
},
/**
* Scans text division for tokens
*
- * @param context
* @param division
*/
- scan: function ( context ) {
+ scan: function ( context, division ) {
var tokenArray, text, module, exp,
- left, right, match,
- regex, label, markAfter, offset;
+ left, right, match;
/*jshint eqnull: true */
// Remove all existing tokens
@@ -76,11 +65,11 @@ $.wikiEditor.modules.highlight = {
if ( module in $.wikiEditor.modules && 'exp' in $.wikiEditor.modules[module] ) {
for ( exp in $.wikiEditor.modules[module].exp ) {
// Prepare configuration
- regex = $.wikiEditor.modules[module].exp[exp].regex;
- label = $.wikiEditor.modules[module].exp[exp].label;
- markAfter = $.wikiEditor.modules[module].exp[exp].markAfter || false;
+ 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;
// Search for tokens
- offset = 0;
+ var offset = 0;
while ( ( match = text.substr( offset ).match( regex ) ) != null ) {
right = ( left = offset + match.index ) + match[0].length;
tokenArray[tokenArray.length] = {
@@ -106,19 +95,16 @@ $.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 ) {
- /*jshint eqeqeq:false, onevar:false */
- var i, subtracted, oldLength, j, o,
- markers;
+ mark: function ( context, division, tokens ) {
+ var i, subtracted, oldLength, j, o;
// Reset markers
- markers = [];
+ var markers = [];
// Recycle markers that will be skipped in this run
if ( context.modules.highlight.markers && division !== '' ) {
@@ -367,9 +353,8 @@ $.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' );