Table of contents is working now - fixed dependency issues and removed some globals that are no longer needed.

This commit is contained in:
Trevor Parscal 2010-09-16 22:20:17 +00:00
parent 94c8be537b
commit ff8e204ccd
3 changed files with 9 additions and 10 deletions

View file

@ -79,7 +79,11 @@ class WikiEditorHooks {
'scripts' => 'extensions/WikiEditor/modules/jquery.wikiEditor.toc.js', 'scripts' => 'extensions/WikiEditor/modules/jquery.wikiEditor.toc.js',
'styles' => 'extensions/WikiEditor/modules/jquery.wikiEditor.toc.css', 'styles' => 'extensions/WikiEditor/modules/jquery.wikiEditor.toc.css',
'dependencies' => array( 'dependencies' => array(
'jquery.wikiEditor', 'jquery.ui.draggable', 'jquery.ui.resizable' 'jquery.wikiEditor',
'jquery.ui.draggable',
'jquery.ui.resizable',
'jquery.autoEllipsis',
'jquery.color',
), ),
), ),
'jquery.wikiEditor.toolbar' => array( 'jquery.wikiEditor.toolbar' => array(
@ -548,11 +552,6 @@ class WikiEditorHooks {
'modules' => array( 'modules' => array(
'wikiEditor.toc', 'wikiEditor.toc',
), ),
'configurations' => array(
// These are probably only for testing purposes?
'wgNavigableTOCCollapseEnable',
'wgNavigableTOCResizable'
),
), ),
); );

View file

@ -446,7 +446,7 @@ fn: {
*/ */
function buildList( structure ) { function buildList( structure ) {
var list = $( '<ul />' ); var list = $( '<ul />' );
for ( i in structure ) { for ( var i = 0; i < structure.length; i++ ) {
var div = $( '<div />' ) var div = $( '<div />' )
.addClass( 'section-' + structure[i].index ) .addClass( 'section-' + structure[i].index )
.data( 'index', structure[i].index ) .data( 'index', structure[i].index )
@ -641,7 +641,7 @@ fn: {
} }
context.modules.toc.$toc.html( buildList( structure ) ); context.modules.toc.$toc.html( buildList( structure ) );
if ( wgNavigableTOCResizable && !context.$ui.data( 'resizableDone' ) ) { if ( !context.$ui.data( 'resizableDone' ) ) {
buildResizeControls(); buildResizeControls();
buildCollapseControls(); buildCollapseControls();
} }

View file

@ -5,7 +5,7 @@
$( document ).ready( function() { $( document ).ready( function() {
// Add table of contents module // Add table of contents module
$( '#wpTextbox1' ) $( '#wpTextbox1' )
.wikiEditor( 'addModule', 'toc' ) .wikiEditor( 'addModule', 'toc' );
// FIXME - should move the ready handler code to the create function so this isn't necissary // FIXME - should move the ready handler code to the create function so this isn't necissary
.data( 'wikiEditor-context' ).fn.trigger( 'ready' ); //.data( 'wikiEditor-context' ).fn.trigger( 'ready' );
} ); } );