r71823 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r71822‎ | r71823 | r71824 >
Date:23:20, 27 August 2010
Author:adam
Status:deferred
Tags:
Comment:
Delaying the load of the jquery ui dependent stars plugin. Thinking I'll be replacing that plugin soon since I dont think it really needs to be depedent on jquery ui...seems like pointless extra loading for that functionality
Modified paths:
  • /trunk/extensions/ArticleAssessmentPilot/ArticleAssessmentPilot.hooks.php (modified) (history)
  • /trunk/extensions/ArticleAssessmentPilot/js/ArticleAssessment.js (modified) (history)
  • /trunk/extensions/ArticleAssessmentPilot/test.html (modified) (history)

Diff [purge]

Index: trunk/extensions/ArticleAssessmentPilot/test.html
@@ -23,7 +23,7 @@
2424
2525 <body>
2626 <div class="article-assessment-wrapper">
27 - <div id="catLinks">
 27+ <div id="catlinks">
2828
2929 </div>
3030 </div>
Index: trunk/extensions/ArticleAssessmentPilot/ArticleAssessmentPilot.hooks.php
@@ -15,8 +15,6 @@
1616 array( 'src' => 'js/ArticleAssessment.js', 'version' => 1 ),
1717 array( 'src' => 'js/jquery.cookie.js', 'version' => 1 ),
1818 array( 'src' => 'js/jquery.tipsy.js', 'version' => 1 ),
19 - //array( 'src' => 'js/jquery.ui.stars.js', 'version' => 1 ),
20 - array( 'src' => 'js/jquery.ui.stars.min.js', 'version' => 1 ),
2119 );
2220
2321 /* Static Functions */
Index: trunk/extensions/ArticleAssessmentPilot/js/ArticleAssessment.js
@@ -72,7 +72,7 @@
7373 $output.find( '.article-assessment-rating-fields' )
7474 .append( $( settings.fieldHTML
7575 .replace( /\{LABEL\}/g, settings.fieldPrefix + settings.fieldMessages[field] )
76 - .replace( /\{NAME\}/g, settings.fieldMessages[field] )
 76+ .replace( /\{FIELD\}/g, settings.fieldMessages[field] )
7777 .replace( /\{HINT\}/g, settings.fieldPrefix + settings.fieldMessages[field] + settings.fieldHintSuffix ) ) );
7878 $output.find( '#article-assessment-ratings' )
7979 .append( $( settings.ratingHTML
@@ -81,10 +81,12 @@
8282 .replace( /\{COUNT\}/g, 'field-count' ) )
8383 );
8484 }
85 - $( '#catLinks' ).before( $output );
8685
 86+ $( '#catlinks' ).before( $output );
 87+
8788 // initialize the star plugin
8889 $( '.rating-field' ).each( function() {
 90+ console.log(this);
8991 $( this )
9092 .wrapAll( '<div class="rating-field"></div>' )
9193 .parent()
@@ -93,7 +95,7 @@
9496 callback: function( value, link ) {
9597 // remove any stale classes
9698 value.$stars.each( function() {
97 - $(this).removeClass( 'ui-stars-star-stale' );
 99+ $( this ).removeClass( 'ui-stars-star-stale' );
98100 } );
99101 }
100102 } );
@@ -138,6 +140,10 @@
139141 };
140142 // FIXME - this should be moved out of here
141143 $( document ).ready( function () {
142 - $.ArticleAssessment.fn.init( { 'endpoint': 'hello' } );
 144+ mw.usability.load( [ '$j.ui' ], function() {
 145+ $.getScript( wgScriptPath + '/extensions/ArticleAssessmentPilot/js/jquery.ui.stars.js', function() {
 146+ $.ArticleAssessment.fn.init( { 'endpoint': wgScriptPath + "/api.php" } );
 147+ } );
 148+ } );
143149 } ); //document ready
144150 } )( jQuery );
\ No newline at end of file

Status & tagging log