Index: trunk/extensions/Storyboard/tags/Storyboard/storyboard.js |
— | — | @@ -10,7 +10,7 @@ |
11 | 11 | $( '.storyboard' ).ajaxScroll( { |
12 | 12 | updateBatch: updateStoryboard, |
13 | 13 | batchSize: 4, |
14 | | - batchNum: 1 |
| 14 | + batchNum: 2 |
15 | 15 | } ); |
16 | 16 | } ); |
17 | 17 | |
— | — | @@ -18,74 +18,84 @@ |
19 | 19 | $.getJSON( wgScriptPath + '/api.php', |
20 | 20 | { |
21 | 21 | 'action': 'query', |
22 | | - 'list': 'stories', |
23 | | - 'stcontinue': $storyboard.attr( 'offset' ), |
| 22 | + 'list': 'stories', |
| 23 | + //'stcontinue': $storyboard.attr( 'offset' ) + '|0', // TODO: get id of last story here to break ties correctly |
24 | 24 | 'stlimit': 4, |
25 | 25 | 'format': 'json' |
26 | 26 | }, |
27 | 27 | function( data ) { |
28 | | - var html = ''; |
29 | | - for ( var i in data.query.stories ) { |
30 | | - var story = data.query.stories[i]; |
31 | | - var $storyBody = $( "<div />" ).addClass( "storyboard-box" ); |
32 | | - |
33 | | - var $header = $( "<div />" ).addClass( "story-header" ).appendTo( $storyBody ); |
34 | | - $( "<div />" ).addClass( "story-title" ).text( story.title ).appendTo( $header ); |
35 | | - |
36 | | - // TODO: move social sharing to a pop-up that's triggered by a link above each storyboard-box |
37 | | - |
38 | | - $( "<div />" ) |
39 | | - .addClass( "story-sharing" ) |
40 | | - .append( |
41 | | - $( "<div />" ).addClass( "story-sharing-item" ).append( |
42 | | - $( "<a />" ).attr( { |
43 | | - "target": "_blank", |
44 | | - "href": "http://delicious.com/save?jump=yes&url=" + "" |
45 | | - } ) |
46 | | - .append( $( "<img />" ).attr( "src", |
47 | | - wgScriptPath + "/extensions/Storyboard/images/storyboard-delicious.png" |
48 | | - ) ) |
49 | | - ) |
50 | | - ) //TODO |
51 | | - .append( |
52 | | - $( "<div />" ).addClass( "story-sharing-item" ).append( |
53 | | - $( "<a />" ).attr( { |
54 | | - "target": "_blank", |
55 | | - "href": "http://www.facebook.com/sharer.php?u=" + "" + "&t=" + story.title |
56 | | - } ) |
57 | | - .append( $( "<img />" ).attr( "src", |
58 | | - wgScriptPath + "/extensions/Storyboard/images/storyboard-facebook.png" |
59 | | - ) ) |
60 | | - ) |
61 | | - ) //TODO |
62 | | - .append( |
63 | | - $( "<div />" ).addClass( "story-sharing-item" ).append( |
64 | | - $( "<a />" ).attr( { |
65 | | - "target": "_blank", |
66 | | - "href": "http://twitter.com/home?status=" + "" |
67 | | - } ) |
68 | | - .append( $( "<img />" ).attr( "src", |
69 | | - wgScriptPath + "/extensions/Storyboard/images/storyboard-twitter.png" |
70 | | - ) ) |
71 | | - ) |
72 | | - ) //TODO |
73 | | - .appendTo( $header ); |
74 | | - |
75 | | - $storyBody.append( $( "<div />" ).addClass( "story-text" ) |
76 | | - .text( story["*"] ) |
77 | | - .prepend( $( "<img />" ) |
78 | | - // TODO: replace by wgScriptPath + path/to/scropped/img |
79 | | - .attr( "src", "http://upload.wikimedia.org/wikipedia/mediawiki/9/99/SemanticMaps.png" ) |
80 | | - .addClass( "story-image" ) |
81 | | - ) |
82 | | - ); |
83 | | - |
84 | | - // TODO: add delete button that hides the story from the storyboard (=unpublish+hide?) |
85 | | - |
86 | | - html += $storyBody; |
87 | | - } |
88 | | - $storyboard.html( html ); |
| 28 | + if ( data.query ) { |
| 29 | + addStories( $storyboard, data.query ); |
| 30 | + } else { |
| 31 | + alert( 'An error occured:\n' + data.error.info ); // TODO: i18n |
| 32 | + } |
89 | 33 | } |
90 | 34 | ); |
91 | 35 | } |
| 36 | + |
| 37 | + function addStories( $storyboard, query ) { |
| 38 | + // Remove the empty boxes. |
| 39 | + $storyboard.html(''); |
| 40 | + |
| 41 | + for ( var i in query.stories ) { |
| 42 | + var story = query.stories[i]; |
| 43 | + var $storyBody = $( "<div />" ).addClass( "storyboard-box" ); |
| 44 | + |
| 45 | + var $header = $( "<div />" ).addClass( "story-header" ).appendTo( $storyBody ); |
| 46 | + $( "<div />" ).addClass( "story-title" ).text( story.title ).appendTo( $header ); |
| 47 | + |
| 48 | + // TODO: move social sharing to a pop-up that's triggered by a link above each storyboard-box |
| 49 | + |
| 50 | + $( "<div />" ) |
| 51 | + .addClass( "story-sharing" ) |
| 52 | + .append( |
| 53 | + $( "<div />" ).addClass( "story-sharing-item" ).append( |
| 54 | + $( "<a />" ).attr( { |
| 55 | + "target": "_blank", |
| 56 | + "href": "http://delicious.com/save?jump=yes&url=" + "" |
| 57 | + } ) |
| 58 | + .append( $( "<img />" ).attr( "src", |
| 59 | + wgScriptPath + "/extensions/Storyboard/images/storyboard-delicious.png" |
| 60 | + ) ) |
| 61 | + ) |
| 62 | + ) //TODO |
| 63 | + .append( |
| 64 | + $( "<div />" ).addClass( "story-sharing-item" ).append( |
| 65 | + $( "<a />" ).attr( { |
| 66 | + "target": "_blank", |
| 67 | + "href": "http://www.facebook.com/sharer.php?u=" + "" + "&t=" + story.title |
| 68 | + } ) |
| 69 | + .append( $( "<img />" ).attr( "src", |
| 70 | + wgScriptPath + "/extensions/Storyboard/images/storyboard-facebook.png" |
| 71 | + ) ) |
| 72 | + ) |
| 73 | + ) //TODO |
| 74 | + .append( |
| 75 | + $( "<div />" ).addClass( "story-sharing-item" ).append( |
| 76 | + $( "<a />" ).attr( { |
| 77 | + "target": "_blank", |
| 78 | + "href": "http://twitter.com/home?status=" + "" |
| 79 | + } ) |
| 80 | + .append( $( "<img />" ).attr( "src", |
| 81 | + wgScriptPath + "/extensions/Storyboard/images/storyboard-twitter.png" |
| 82 | + ) ) |
| 83 | + ) |
| 84 | + ) //TODO |
| 85 | + .appendTo( $header ); |
| 86 | + |
| 87 | + $storyBody.append( $( "<div />" ).addClass( "story-text" ) |
| 88 | + .text( story["*"] ) |
| 89 | + .prepend( $( "<img />" ) |
| 90 | + // TODO: replace by wgScriptPath + path/to/scropped/img |
| 91 | + .attr( "src", "http://upload.wikimedia.org/wikipedia/mediawiki/9/99/SemanticMaps.png" ) |
| 92 | + .addClass( "story-image" ) |
| 93 | + ) |
| 94 | + ); |
| 95 | + |
| 96 | + // TODO: add delete button that hides the story from the storyboard (=unpublish+hide?) |
| 97 | + |
| 98 | + $storyboard.append( $storyBody ); |
| 99 | + } |
| 100 | + } |
| 101 | + |
92 | 102 | })(jQuery); |
\ No newline at end of file |
Index: trunk/extensions/Storyboard/tags/Storyboard/Storyboard_body.php |
— | — | @@ -17,13 +17,17 @@ |
18 | 18 | class TagStoryboard { |
19 | 19 | |
20 | 20 | public static function render( $input, $args, $parser, $frame ) { |
21 | | - global $wgOut, $wgJsMimeType, $wgScriptPath, $egStoryboardScriptPath, $egStoryboardWidth, $egStoryboardHeight; |
| 21 | + global $wgOut, $wgJsMimeType, $wgScriptPath, $wgStylePath, $wgStyleVersion, $egStoryboardScriptPath, $egStoryboardWidth, $egStoryboardHeight; |
22 | 22 | |
23 | | - $wgOut->addStyle( $egStoryboardScriptPath . '/storyboard.css' ); |
24 | | - $wgOut->includeJQuery(); |
25 | 23 | // 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' ); |
| 24 | + $parser->getOutput()->addHeadItem( |
| 25 | + <<<EOT |
| 26 | + <link rel="stylesheet" href="$egStoryboardScriptPath/storyboard.css?$wgStyleVersion" /> |
| 27 | + <script type="$wgJsMimeType" src="$wgStylePath/common/jquery.min.js?$wgStyleVersion"></script> |
| 28 | + <script type="$wgJsMimeType" src="$egStoryboardScriptPath/tags/Storyboard/jquery.ajaxscroll.js?$wgStyleVersion"></script> |
| 29 | + <script type="$wgJsMimeType" src="$egStoryboardScriptPath/tags/Storyboard/storyboard.js?$wgStyleVersion"></script |
| 30 | +EOT |
| 31 | + ); |
28 | 32 | |
29 | 33 | $width = StoryboardUtils::getDimension( $args, 'width', $egStoryboardWidth ); |
30 | 34 | $height = StoryboardUtils::getDimension( $args, 'height', $egStoryboardHeight ); |