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.js24
1 files changed, 13 insertions, 11 deletions
diff --git a/extensions/WikiEditor/modules/jquery.wikiEditor.toolbar.js b/extensions/WikiEditor/modules/jquery.wikiEditor.toolbar.js
index 7a72c923..20d8ecd9 100644
--- a/extensions/WikiEditor/modules/jquery.wikiEditor.toolbar.js
+++ b/extensions/WikiEditor/modules/jquery.wikiEditor.toolbar.js
@@ -438,13 +438,13 @@ fn: {
}
},
buildBookmark : function( context, id, page ) {
- var label = $.wikiEditor.autoMsg( page,
- 'label' );
+ var label = $.wikiEditor.autoMsg( page, 'label' );
return $( '<div/>' )
.text( label )
.attr( 'rel', id )
.data( 'context', context )
.mousedown( function( e ) {
+ context.fn.saveCursorAndScrollTop();
// No dragging!
e.preventDefault();
return false;
@@ -464,6 +464,7 @@ fn: {
if ( $.trackAction !== undefined){
$.trackAction(section + '.' + $(this).attr('rel'));
}
+ context.fn.restoreCursorAndScrollTop();
// No dragging!
event.preventDefault();
return false;
@@ -488,7 +489,7 @@ fn: {
html += $.wikiEditor.modules.toolbar.fn.buildRow( context, page.rows[i] );
}
}
- $page.html( html );
+ $page.html( html + '</table>');
break;
case 'characters':
$page.addClass( 'page-characters' );
@@ -534,7 +535,7 @@ fn: {
for ( var i = 0; i< headings.length; i++ ) {
html += '<th>' + $.wikiEditor.autoMsg( headings[i], ['html', 'text'] ) + '</th>';
}
- return html;
+ return html + '</tr>';
},
buildRow : function( context, row ) {
var html = '<tr>';
@@ -542,8 +543,7 @@ fn: {
html += '<td class="cell cell-' + cell + '" valign="top"><span>' +
$.wikiEditor.autoMsg( row[cell], ['html', 'text'] ) + '</span></td>';
}
- html += '</tr>';
- return html;
+ return html + '</tr>';
},
buildCharacter : function( character, actions ) {
if ( typeof character == 'string' ) {
@@ -557,7 +557,7 @@ fn: {
}
}
};
- } else if ( 0 in character && 1 in character ) {
+ } else if ( character && 0 in character && 1 in character ) {
character = {
'label' : character[0],
'action' : {
@@ -569,10 +569,12 @@ fn: {
}
};
}
- if ( 'action' in character && 'label' in character ) {
+ if ( character && 'action' in character && 'label' in character ) {
actions[character.label] = character.action;
return '<span rel="' + character.label + '">' + character.label + '</span>';
}
+ mw.log( "A character for the toolbar was undefined. This is not supposed to happen. Double check the config." );
+ return ""; // bug 31673; also an additional fix for bug 24208...
},
buildTab : function( context, id, section ) {
var selected = $.cookie( 'wikiEditor-' + context.instance + '-toolbar-section' );
@@ -580,7 +582,7 @@ fn: {
if ( selected !== null ) {
$.cookie( 'wikiEditor-' + context.instance + '-toolbar-section', selected, { expires: 30, path: '/' } );
}
- var $link =
+ var $link =
$( '<a/>' )
.addClass( selected == id ? 'current' : null )
.attr( 'href', '#' )
@@ -661,7 +663,7 @@ fn: {
var $section = $( '<div/>' ).attr( { 'class': section.type + ' section section-' + id, 'rel': id } );
var selected = $.cookie( 'wikiEditor-' + context.instance + '-toolbar-section' );
var show = selected == id;
-
+
if ( section.deferLoad !== undefined && section.deferLoad && id !== 'main' && !show ) {
// This class shows the spinner and serves as a marker for the click handler in buildTab()
$section.addClass( 'loading' ).append( $( '<div/>' ).addClass( 'spinner' ) );
@@ -672,7 +674,7 @@ fn: {
} else {
$.wikiEditor.modules.toolbar.fn.reallyBuildSection( context, id, section, $section );
}
-
+
// Show or hide section
if ( id !== 'main' ) {
$section.css( 'display', show ? 'block' : 'none' );