r63203 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r63202‎ | r63203 | r63204 >
Date:15:03, 3 March 2010
Author:catrope
Status:ok
Tags:
Comment:
Storyboard: Redo r63200 in a cleaner way, using a class instead of consecutively numbered IDs
Modified paths:
  • /trunk/extensions/Storyboard/tags/Storyboard/Storyboard_body.php (modified) (history)
  • /trunk/extensions/Storyboard/tags/Storyboard/storyboard.js (modified) (history)

Diff [purge]

Index: trunk/extensions/Storyboard/tags/Storyboard/storyboard.js
@@ -2,6 +2,14 @@
33 * JavaScript added for <storyboard> tags
44 */
55
 6+$j( document ).ready( function(){
 7+ $j( '.storyboard' ).ajaxScroll( {
 8+ updateBatch: updateStoryboard,
 9+ batchSize: 5,
 10+ batchNum: 1
 11+ } );
 12+});
 13+
614 function updateStoryboard( $storyboard ){
715 $j.getJSON( wgScriptPath + '/api.php',
816 {
Index: trunk/extensions/Storyboard/tags/Storyboard/Storyboard_body.php
@@ -7,7 +7,7 @@
88 * @ingroup Storyboard
99 *
1010 * @author Jeroen De Dauw
11 - * @author Roan Kattouw
 11+ * @author Roan Kattouw
1212 */
1313
1414 if ( !defined( 'MEDIAWIKI' ) ) {
@@ -17,33 +17,23 @@
1818 class TagStoryboard {
1919
2020 public static function render( $input, $args, $parser, $frame ) {
21 - global $wgOut, $wgJsMimeType, $wgScriptPath, $egStoryboardScriptPath, $egStoryboardWidth, $egStoryboardHeight, $egStoryboardsOnPage;
 21+ global $wgOut, $wgJsMimeType, $wgScriptPath, $egStoryboardScriptPath, $egStoryboardWidth, $egStoryboardHeight;
2222
23 - if (empty($egStoryboardsOnPage)) {
24 - $egStoryboardsOnPage = 0;
25 - $wgOut->addStyle( $egStoryboardScriptPath . '/tags/Storyboard/storyboard.css' );
26 - $wgOut->includeJQuery();
27 - // TODO: Combine+minfiy JS files, add switch to use combined+minified version
28 - $wgOut->addScriptFile( $egStoryboardScriptPath . '/tags/Storyboard/jquery.ajaxscroll.js' );
29 - $wgOut->addScriptFile( $egStoryboardScriptPath . '/tags/Storyboard/storyboard.js' );
30 - }
 23+ $wgOut->addStyle( $egStoryboardScriptPath . '/tags/Storyboard/storyboard.css' );
 24+ $wgOut->includeJQuery();
 25+ // TODO: Combine+minfiy JS files, add switch to use combined+minified version
 26+ $wgOut->addScriptFile( $egStoryboardScriptPath . '/tags/Storyboard/jquery.ajaxscroll.js' );
 27+ $wgOut->addScriptFile( $egStoryboardScriptPath . '/tags/Storyboard/storyboard.js' );
3128
3229 $width = self::getDimension( $args, 'width', $egStoryboardWidth );
3330 $height = self::getDimension( $args, 'height', $egStoryboardHeight );
3431
35 - $egStoryboardsOnPage++;
36 -
3732 $output = Html::element( 'div', array(
3833 'class' => 'ajaxscroll',
39 - 'id' => "storyboard-$egStoryboardsOnPage",
 34+ 'class' => 'storyboard',
4035 'style' => "height: $height; width: $width;"
4136 )
4237 );
43 -
44 - $output .= <<<EOT
45 -<script type="$wgJsMimeType"> /*<![CDATA[*/ jQuery( document ).ready( function(){ jQuery( '#storyboard-$egStoryboardsOnPage' ).ajaxScroll( {updateBatch: updateStoryboard,batchSize: 5,batchNum: 1} ); });/*]]>*/ </script>
46 -EOT;
47 -
4838 return array( $output, 'noparse' => 'true', 'isHTML' => 'true' );
4939 }
5040

Follow-up revisions

RevisionCommit summaryAuthorDate
r63207Fixed style error from r63203jeroendedauw15:21, 3 March 2010

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r63200Fixed issue with multiple storyboards on one page.jeroendedauw14:39, 3 March 2010

Status & tagging log