r53848 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r53847‎ | r53848 | r53849 >
Date:00:25, 28 July 2009
Author:tparscal
Status:deferred
Tags:
Comment:
Added dummy jQuery extensions where good code needs to live.
Modified paths:
  • /trunk/extensions/UsabilityInitiative/NavigableTOC/NavigableTOC.js (modified) (history)

Diff [purge]

Index: trunk/extensions/UsabilityInitiative/NavigableTOC/NavigableTOC.js
@@ -1,5 +1,26 @@
22 /* JavaScript for NavigableTOC extension */
33
 4+/*
 5+ * This function should be called on the text area to map out the section
 6+ * character positions by scanning for headings, and the resulting data will
 7+ * be stored as $(this).data( 'sections', { ... } )
 8+ */
 9+jQuery.fn.mapSections = function() {
 10+ return this.each( function() {
 11+ // WRITE CODE HERE :)
 12+ } );
 13+};
 14+/*
 15+ * This function should be called on the text area with a selected UL element
 16+ * to perform the list update on, where it will match the current cursor
 17+ * position to an item on the outline and classify that li as 'current'
 18+ */
 19+jQuery.fn.updateSectionsList = function( list ) {
 20+ return this.each( function( list ) {
 21+ // WRITE CODE HERE :)
 22+ } );
 23+};
 24+
425 $( document ).ready( function() {
526 if ( $.section == '' ) {
627 // Full page edit
@@ -18,17 +39,16 @@
1940 }
2041 // Unlink all section links that didn't get an offset
2142 $( '.toc:last * li' ).each( function() {
22 - link = $(this).children( 'a' );
23 - if ( typeof link.data( 'offset') == 'undefined' &&
24 - link.is( ':visible' ) ) {
 43+ link = $(this).children( 'a:visible' );
 44+ if ( typeof link.data( 'offset') == 'undefined' ) {
2545 link.hide();
2646 $(this).prepend( link.html() );
2747 }
2848 });
2949
3050 $( '.toc:last * li a' ).click( function(e) {
31 - if( typeof jQuery(this).data( 'offset' ) != 'undefined' )
32 - jQuery( '#wpTextbox1' ).scrollToPosition( jQuery(this).data( 'offset' ) );
 51+ if( typeof $(this).data( 'offset' ) != 'undefined' )
 52+ $( '#wpTextbox1' ).scrollToPosition( $(this).data( 'offset' ) );
3353 e.preventDefault();
3454 });
3555
@@ -54,5 +74,4 @@
5575 // This is ugly as hell
5676 setTimeout(styleCurrentSection, 0);
5777 });
58 -
5978 });

Status & tagging log