Index: trunk/extensions/Storyboard/tags/Storyboard/storyboard.js |
— | — | @@ -2,6 +2,14 @@ |
3 | 3 | * JavaScript added for <storyboard> tags |
4 | 4 | */ |
5 | 5 | |
| 6 | +$j( document ).ready( function(){ |
| 7 | + $j( '.storyboard' ).ajaxScroll( { |
| 8 | + updateBatch: updateStoryboard, |
| 9 | + batchSize: 5, |
| 10 | + batchNum: 1 |
| 11 | + } ); |
| 12 | +}); |
| 13 | + |
6 | 14 | function updateStoryboard( $storyboard ){ |
7 | 15 | $j.getJSON( wgScriptPath + '/api.php', |
8 | 16 | { |
Index: trunk/extensions/Storyboard/tags/Storyboard/Storyboard_body.php |
— | — | @@ -7,7 +7,7 @@ |
8 | 8 | * @ingroup Storyboard |
9 | 9 | * |
10 | 10 | * @author Jeroen De Dauw |
11 | | - * @author Roan Kattouw |
| 11 | + * @author Roan Kattouw |
12 | 12 | */ |
13 | 13 | |
14 | 14 | if ( !defined( 'MEDIAWIKI' ) ) { |
— | — | @@ -17,33 +17,23 @@ |
18 | 18 | class TagStoryboard { |
19 | 19 | |
20 | 20 | 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; |
22 | 22 | |
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' ); |
31 | 28 | |
32 | 29 | $width = self::getDimension( $args, 'width', $egStoryboardWidth ); |
33 | 30 | $height = self::getDimension( $args, 'height', $egStoryboardHeight ); |
34 | 31 | |
35 | | - $egStoryboardsOnPage++; |
36 | | - |
37 | 32 | $output = Html::element( 'div', array( |
38 | 33 | 'class' => 'ajaxscroll', |
39 | | - 'id' => "storyboard-$egStoryboardsOnPage", |
| 34 | + 'class' => 'storyboard', |
40 | 35 | 'style' => "height: $height; width: $width;" |
41 | 36 | ) |
42 | 37 | ); |
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 | | - |
48 | 38 | return array( $output, 'noparse' => 'true', 'isHTML' => 'true' ); |
49 | 39 | } |
50 | 40 | |