summaryrefslogtreecommitdiff
path: root/extensions/WikiEditor/modules/jquery.wikiEditor.toolbar.js
diff options
context:
space:
mode:
Diffstat (limited to 'extensions/WikiEditor/modules/jquery.wikiEditor.toolbar.js')
-rw-r--r--extensions/WikiEditor/modules/jquery.wikiEditor.toolbar.js120
1 files changed, 60 insertions, 60 deletions
diff --git a/extensions/WikiEditor/modules/jquery.wikiEditor.toolbar.js b/extensions/WikiEditor/modules/jquery.wikiEditor.toolbar.js
index 454b42a0..29899a38 100644
--- a/extensions/WikiEditor/modules/jquery.wikiEditor.toolbar.js
+++ b/extensions/WikiEditor/modules/jquery.wikiEditor.toolbar.js
@@ -7,15 +7,15 @@
/**
* API accessible functions
*/
-api : {
- addToToolbar : function ( context, data ) {
+api: {
+ addToToolbar: function ( context, data ) {
var smooth = true, type, i;
for ( type in data ) {
switch ( type ) {
case 'sections':
- var $sections = context.modules.toolbar.$toolbar.find( 'div.sections' ),
+ var $sections = context.modules.toolbar.$toolbar.find( 'div.sections' ),
$tabs = context.modules.toolbar.$toolbar.find( 'div.tabs' );
for ( var section in data[type] ) {
if ( section === 'main' ) {
@@ -41,7 +41,7 @@ api : {
if ( !( 'section' in data ) ) {
continue;
}
- var $section = context.modules.toolbar.$toolbar.find( 'div[rel="' + data.section + '"].section' );
+ var $section = context.modules.toolbar.$toolbar.find( 'div[rel="' + data.section + '"].section' );
for ( var group in data[type] ) {
// Group
$section.append(
@@ -145,7 +145,7 @@ api : {
}
}
},
- removeFromToolbar : function ( context, data ) {
+ removeFromToolbar: function ( context, data ) {
if ( typeof data.section === 'string' ) {
// Section
var tab = 'div.tabs span[rel="' + data.section + '"].tab';
@@ -158,7 +158,7 @@ api : {
// Save for later checking if empty
group = target;
// Tool
- target = target + ' a[rel="' + data.tool + '"].tool, ' + target + ' img[rel="' + data.tool + '"].tool';
+ target = target + ' [rel="' + data.tool + '"].tool';
}
} else if ( typeof data.page === 'string' ) {
// Booklet page
@@ -217,7 +217,7 @@ fn: {
* @param {Object} context Context object of editor to create module in
* @param {Object} config Configuration object to create module from
*/
- create : function ( context, config ) {
+ create: function ( context, config ) {
if ( '$toolbar' in context.modules.toolbar ) {
return;
}
@@ -234,14 +234,14 @@ fn: {
* @param {Object} action
* @param {Object} source
*/
- doAction : function ( context, action ) {
+ doAction: function ( context, action ) {
switch ( action.type ) {
case 'replace':
case 'encapsulate':
var parts = {
- 'pre' : $.wikiEditor.autoMsg( action.options, 'pre' ),
- 'peri' : $.wikiEditor.autoMsg( action.options, 'peri' ),
- 'post' : $.wikiEditor.autoMsg( action.options, 'post' )
+ 'pre': $.wikiEditor.autoMsg( action.options, 'pre' ),
+ 'peri': $.wikiEditor.autoMsg( action.options, 'peri' ),
+ 'post': $.wikiEditor.autoMsg( action.options, 'post' )
};
var replace = action.type === 'replace';
if ( 'regex' in action.options && 'regexReplace' in action.options ) {
@@ -270,8 +270,8 @@ fn: {
default: break;
}
},
- buildGroup : function ( context, id, group ) {
- var $group = $( '<div>' ).attr( { 'class' : 'group group-' + id, 'rel' : id } );
+ buildGroup: function ( context, id, group ) {
+ var $group = $( '<div>' ).attr( { 'class': 'group group-' + id, 'rel': id } );
var label = $.wikiEditor.autoMsg( group, 'label' );
if ( label ) {
var $label = $( '<span />' )
@@ -296,7 +296,7 @@ fn: {
}
return $group;
},
- buildTool : function ( context, id, tool ) {
+ buildTool: function ( context, id, tool ) {
if ( 'filters' in tool ) {
for ( var i = 0; i < tool.filters.length; i++ ) {
if ( $( tool.filters[i] ).size() === 0 ) {
@@ -316,11 +316,11 @@ fn: {
if ( typeof offsetOrIcon === 'object' ) {
$button = $( '<a>' )
.attr( {
- 'href' : '#',
- 'title' : label,
- 'rel' : id,
- 'role' : 'button',
- 'class' : 'tool tool-button wikiEditor-toolbar-spritedButton'
+ 'href': '#',
+ 'title': label,
+ 'rel': id,
+ 'role': 'button',
+ 'class': 'tool tool-button wikiEditor-toolbar-spritedButton'
} )
.text( label )
.css( 'backgroundPosition', offsetOrIcon[0] + 'px ' + offsetOrIcon[1] + 'px' );
@@ -329,14 +329,14 @@ fn: {
if ( !$button ) {
$button = $( '<img>' )
.attr( {
- 'src' : src,
- 'width' : 22,
- 'height' : 22,
- 'alt' : label,
- 'title' : label,
- 'rel' : id,
- 'role' : 'button',
- 'class' : 'tool tool-button'
+ 'src': src,
+ 'width': 22,
+ 'height': 22,
+ 'alt': label,
+ 'title': label,
+ 'rel': id,
+ 'role': 'button',
+ 'class': 'tool tool-button'
} );
}
if ( 'action' in tool ) {
@@ -360,7 +360,7 @@ fn: {
return $button;
case 'select':
var $select = $( '<div>' )
- .attr( { 'rel' : id, 'class' : 'tool tool-select' } );
+ .attr( { 'rel': id, 'class': 'tool tool-select' } );
var $options = $( '<div>' ).addClass( 'options' );
if ( 'list' in tool ) {
for ( var option in tool.list ) {
@@ -416,7 +416,7 @@ fn: {
return null;
}
},
- buildBookmark : function ( context, id, page ) {
+ buildBookmark: function ( context, id, page ) {
var label = $.wikiEditor.autoMsg( page, 'label' );
return $( '<div>' )
.text( label )
@@ -445,17 +445,17 @@ fn: {
return false;
} );
},
- buildPage : function ( context, id, page ) {
+ buildPage: function ( context, id, page ) {
var html, i;
var $page = $( '<div>' ).attr( {
- 'class' : 'page page-' + id,
- 'rel' : id
+ 'class': 'page page-' + id,
+ 'rel': id
} );
switch ( page.layout ) {
case 'table':
$page.addClass( 'page-table' );
html =
- '<table cellpadding=0 cellspacing=0 ' + 'border=0 width="100%" class="table table-' + id + '">';
+ '<table class="table-' + id + '">';
if ( 'headings' in page ) {
html += $.wikiEditor.modules.toolbar.fn.buildHeading( context, page.headings );
}
@@ -510,14 +510,14 @@ fn: {
}
return $page;
},
- buildHeading : function ( context, headings ) {
+ buildHeading: function ( context, headings ) {
var html = '<tr>';
for ( var i = 0; i< headings.length; i++ ) {
html += '<th>' + $.wikiEditor.autoMsg( headings[i], ['html', 'text'] ) + '</th>';
}
return html + '</tr>';
},
- buildRow : function ( context, row ) {
+ buildRow: function ( context, row ) {
var html = '<tr>';
for ( var cell in row ) {
html += '<td class="cell cell-' + cell + '"><span>' +
@@ -525,14 +525,14 @@ fn: {
}
return html + '</tr>';
},
- buildCharacter : function ( character, actions ) {
+ buildCharacter: function ( character, actions ) {
if ( typeof character === 'string' ) {
character = {
- 'label' : character,
- 'action' : {
- 'type' : 'replace',
- 'options' : {
- 'peri' : character,
+ 'label': character,
+ 'action': {
+ 'type': 'replace',
+ 'options': {
+ 'peri': character,
'selectPeri': false
}
}
@@ -541,11 +541,11 @@ fn: {
// character that gets inserted (e.g. Hebrew vowels)
} else if ( character && 0 in character && 1 in character ) {
character = {
- 'label' : character[0],
- 'action' : {
- 'type' : 'replace',
- 'options' : {
- 'peri' : character[1],
+ 'label': character[0],
+ 'action': {
+ 'type': 'replace',
+ 'options': {
+ 'peri': character[1],
'selectPeri': false
}
}
@@ -567,7 +567,7 @@ fn: {
// bug 31673; also an additional fix for bug 24208...
return '';
},
- buildTab : function ( context, id, section ) {
+ buildTab: function ( context, id, section ) {
var selected = $.cookie( 'wikiEditor-' + context.instance + '-toolbar-section' );
// Re-save cookie
if ( selected !== null ) {
@@ -625,8 +625,8 @@ fn: {
if ( show ) {
$section.removeClass( 'section-hidden' )
.attr( 'aria-expanded', 'true' )
- .animate( {opacity: 100.0}, 'fast', 'linear', function () {
- $(this).addClass( 'section-visible' );
+ .animate( { opacity: 100.0 }, 'fast', 'linear', function () {
+ $( this ).addClass( 'section-visible' );
} );
if ( $section.hasClass( 'loading' ) ) {
@@ -661,8 +661,8 @@ fn: {
} );
return $( '<span>' )
.attr( {
- 'class' : 'tab tab-' + id,
- 'rel' : id
+ 'class': 'tab tab-' + id,
+ 'rel': id
} )
.append( $link );
},
@@ -728,7 +728,7 @@ fn: {
break;
}
},
- updateBookletSelection : function ( context, id, $pages, $index ) {
+ updateBookletSelection: function ( context, id, $pages, $index ) {
/*jshint eqnull:true */
var cookie = 'wikiEditor-' + context.instance + '-booklet-' + id + '-page';
var selected = $.cookie( cookie );
@@ -747,7 +747,7 @@ fn: {
$index.children().removeClass( 'current' );
$selectedIndex.addClass( 'current' );
},
- build : function ( context, config ) {
+ build: function ( context, config ) {
var $tabs = $( '<div>' ).addClass( 'tabs' ).appendTo( context.modules.toolbar.$toolbar );
var $sections = $( '<div>' ).addClass( 'sections' ).appendTo( context.modules.toolbar.$toolbar );
context.modules.toolbar.$toolbar.append( $( '<div>' ).css( 'clear', 'both' ) );
@@ -759,17 +759,17 @@ fn: {
);
} else {
sectionQueue.push( {
- '$sections' : $sections,
- 'context' : context,
- 'id' : section,
- 'config' : config[section]
+ '$sections': $sections,
+ 'context': context,
+ 'id': section,
+ 'config': config[section]
} );
$tabs.append( $.wikiEditor.modules.toolbar.fn.buildTab( context, section, config[section] ) );
}
}
$.eachAsync( sectionQueue, {
- 'bulk' : 0,
- 'end' : function () {
+ 'bulk': 0,
+ 'end': function () {
// HACK: Opera doesn't seem to want to redraw after these bits
// are added to the DOM, so we can just FORCE it!
var oldValue = $( 'body' ).css( 'position' );
@@ -778,7 +778,7 @@ fn: {
context.$textarea.trigger( 'wikiEditor-toolbar-doneInitialSections' );
},
- 'loop' : function ( i, s ) {
+ 'loop': function ( i, s ) {
s.$sections.append( $.wikiEditor.modules.toolbar.fn.buildSection( s.context, s.id, s.config ) );
var $section = s.$sections.find( '.section-visible' );
if ( $section.size() ) {