r63200 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r63199‎ | r63200 | r63201 >
Date:14:39, 3 March 2010
Author:jeroendedauw
Status:ok
Tags:
Comment:
Fixed issue with multiple storyboards on one page.
Modified paths:
  • /trunk/extensions/Storyboard/api/ApiQueryStories.php (modified) (history)
  • /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/api/ApiQueryStories.php
@@ -6,6 +6,7 @@
77 * @ingroup Storyboard
88 *
99 * @author Jeroen De Dauw
 10+ * @author Roan Kattouw
1011 *
1112 * This program is free software; you can redistribute it and/or modify
1213 * it under the terms of the GNU General Public License as published by
Index: trunk/extensions/Storyboard/tags/Storyboard/storyboard.js
@@ -2,14 +2,6 @@
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 -
146 function updateStoryboard( $storyboard ){
157 $j.getJSON( wgScriptPath + '/api.php',
168 {
Index: trunk/extensions/Storyboard/tags/Storyboard/Storyboard_body.php
@@ -7,6 +7,7 @@
88 * @ingroup Storyboard
99 *
1010 * @author Jeroen De Dauw
 11+ * @author Roan Kattouw
1112 */
1213
1314 if ( !defined( 'MEDIAWIKI' ) ) {
@@ -16,23 +17,33 @@
1718 class TagStoryboard {
1819
1920 public static function render( $input, $args, $parser, $frame ) {
20 - global $wgOut, $wgJsMimeType, $wgScriptPath, $egStoryboardScriptPath, $egStoryboardWidth, $egStoryboardHeight;
 21+ global $wgOut, $wgJsMimeType, $wgScriptPath, $egStoryboardScriptPath, $egStoryboardWidth, $egStoryboardHeight, $egStoryboardsOnPage;
2122
22 - $wgOut->addStyle( $egStoryboardScriptPath . '/tags/Storyboard/storyboard.css' );
23 - $wgOut->includeJQuery();
24 - // TODO: Combine+minfiy JS files, add switch to use combined+minified version
25 - $wgOut->addScriptFile( $egStoryboardScriptPath . '/tags/Storyboard/jquery.ajaxscroll.js' );
26 - $wgOut->addScriptFile( $egStoryboardScriptPath . '/tags/Storyboard/storyboard.js' );
 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+ }
2731
2832 $width = self::getDimension( $args, 'width', $egStoryboardWidth );
2933 $height = self::getDimension( $args, 'height', $egStoryboardHeight );
3034
 35+ $egStoryboardsOnPage++;
 36+
3137 $output = Html::element( 'div', array(
3238 'class' => 'ajaxscroll',
33 - 'id' => 'storyboard', // FIXME: Causes id conflicts for multiple <storyboard> tags
 39+ 'id' => "storyboard-$egStoryboardsOnPage",
3440 'style' => "height: $height; width: $width;"
3541 )
3642 );
 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+
3748 return array( $output, 'noparse' => 'true', 'isHTML' => 'true' );
3849 }
3950

Follow-up revisions

RevisionCommit summaryAuthorDate
r63203Storyboard: Redo r63200 in a cleaner way, using a class instead of consecutiv...catrope15:03, 3 March 2010

Status & tagging log