Index: trunk/extensions/Storyboard/jquery/jquery.ajaxscroll.js |
— | — | @@ -26,8 +26,7 @@ |
27 | 27 | scrollDelay: 600, // The interval for checking if the user scrolled, in ms. |
28 | 28 | endDelay: 100, |
29 | 29 | updateBatch: null, |
30 | | - updateEnd: null, |
31 | | - busy: false |
| 30 | + updateEnd: null |
32 | 31 | }, |
33 | 32 | opt |
34 | 33 | ); |
— | — | @@ -69,6 +68,7 @@ |
70 | 69 | |
71 | 70 | setTimeout( monEnd, opt.endDelay ); |
72 | 71 | |
| 72 | + // Initiate the scroll handling. |
73 | 73 | if( typeof opt.updateBatch == 'function' ){ |
74 | 74 | setTimeout( handleScrolling, opt.scrollDelay ); |
75 | 75 | } |
— | — | @@ -79,12 +79,12 @@ |
80 | 80 | var rp = opt.batchNum; |
81 | 81 | |
82 | 82 | while( rp-- ) { |
83 | | - $b=jQuery( opt.batchTemplate ) |
| 83 | + $b = jQuery( opt.batchTemplate ) |
84 | 84 | .attr({ |
85 | 85 | offset: offset, |
86 | | - len: opt.batchSiz, |
87 | | - storymodified: 0, |
88 | | - storyid: 0 |
| 86 | + storymodified: window.storyModified, |
| 87 | + storyid: window.storyId, |
| 88 | + len: opt.batchSize |
89 | 89 | }) |
90 | 90 | .addClass( opt.batchClass + " " + opt.emptyBatchClass ); |
91 | 91 | |
— | — | @@ -108,7 +108,7 @@ |
109 | 109 | function handleScrolling() { |
110 | 110 | var so = $me.scrollTop(); |
111 | 111 | |
112 | | - if( lsp != so) { |
| 112 | + if( !window.storyboardBusy && lsp != so ) { |
113 | 113 | lsp = so; |
114 | 114 | var co = $me.offset().top; |
115 | 115 | |
— | — | @@ -120,7 +120,8 @@ |
121 | 121 | return; |
122 | 122 | } |
123 | 123 | |
124 | | - opt.updateBatch( $b.removeClass( opt.emptyBatchClass ), opt ); |
| 124 | + window.storyboardBusy = true; |
| 125 | + opt.updateBatch( $b.removeClass( opt.emptyBatchClass ) ); |
125 | 126 | }); |
126 | 127 | } |
127 | 128 | |
Index: trunk/extensions/Storyboard/tags/Storyboard/storyboard.js |
— | — | @@ -11,7 +11,7 @@ |
12 | 12 | updateBatch: updateStoryboard, |
13 | 13 | maxOffset: 500, |
14 | 14 | batchSize: 8, |
15 | | - batchNum: 2, |
| 15 | + batchNum: 2, // TODO: change to 1. Some issue in the ajaxscroll plugin makesit break when this is the case though. |
16 | 16 | batchClass: "batch", |
17 | 17 | boxClass: "storyboard-box", |
18 | 18 | emptyBatchClass: "storyboard-empty", |
— | — | @@ -19,19 +19,27 @@ |
20 | 20 | } ); |
21 | 21 | } ); |
22 | 22 | |
23 | | - function updateStoryboard( $storyboard, ajaxScrollObj ) { |
| 23 | + function updateStoryboard( $storyboard ) { |
| 24 | + requestArgs = { |
| 25 | + 'action': 'query', |
| 26 | + 'list': 'stories', |
| 27 | + 'format': 'json', |
| 28 | + 'stlimit': 8, |
| 29 | + 'stlanguage': window.storyboardLanguage |
| 30 | + }; |
| 31 | + |
| 32 | + if ( $storyboard.attr( 'storymodified' ) ) { |
| 33 | + requestArgs.stcontinue = $storyboard.attr( 'storymodified' ); |
| 34 | + |
| 35 | + requestArgs.stcontinue += '-' + |
| 36 | + ( $storyboard.attr( 'storyid' ) ? $storyboard.attr( 'storyid' ) : '0' ); |
| 37 | + } |
| 38 | + |
24 | 39 | $.getJSON( wgScriptPath + '/api.php', |
25 | | - { |
26 | | - 'action': 'query', |
27 | | - 'list': 'stories', |
28 | | - 'format': 'json', |
29 | | - 'stcontinue': $storyboard.attr( 'storymodified' ) + '-' + $storyboard.attr( 'storyid' ), |
30 | | - 'stlimit': 8, |
31 | | - 'stlanguage': window.storyboardLanguage |
32 | | - }, |
| 40 | + requestArgs, |
33 | 41 | function( data ) { |
34 | 42 | if ( data.query ) { |
35 | | - addStories( $storyboard, data.query, ajaxScrollObj ); |
| 43 | + addStories( $storyboard, data.query ); |
36 | 44 | } else { |
37 | 45 | alert( 'An error occured:\n' + data.error.info ); // TODO: i18n |
38 | 46 | } |
— | — | @@ -39,7 +47,7 @@ |
40 | 48 | ); |
41 | 49 | } |
42 | 50 | |
43 | | - function addStories( $storyboard, query, ajaxScrollObj ) { |
| 51 | + function addStories( $storyboard, query ) { |
44 | 52 | // Remove the empty boxes. |
45 | 53 | $storyboard.html(''); |
46 | 54 | |
— | — | @@ -116,7 +124,11 @@ |
117 | 125 | $storyboard.append( $storyBody ); |
118 | 126 | } |
119 | 127 | |
120 | | - ajaxScrollObj.busy = false; |
| 128 | + var story = query.stories[query.stories.length - 1]; |
| 129 | + window.storyModified = story.modified; |
| 130 | + window.storyId = story.id; |
| 131 | + |
| 132 | + window.storyboardBusy = false; |
121 | 133 | } |
122 | 134 | |
123 | 135 | })(jQuery); |
\ No newline at end of file |
Index: trunk/extensions/Storyboard/api/ApiQueryStories.php |
— | — | @@ -101,7 +101,10 @@ |
102 | 102 | 'id' => $story->story_id, |
103 | 103 | 'author' => $story->story_author_name, |
104 | 104 | 'title' => $story->story_title, |
105 | | - 'created' => wfTimestamp( TS_ISO_8601, $story->story_created ), |
| 105 | + //'created' => wfTimestamp( TS_ISO_8601, $story->story_created ), |
| 106 | + //'modified' => wfTimestamp( TS_ISO_8601, $story->story_modified ), |
| 107 | + 'created' => $story->story_created, |
| 108 | + 'modified' => $story->story_modified, |
106 | 109 | 'imageurl' => $story->story_author_image, |
107 | 110 | 'permalink' => SpecialPage::getTitleFor( 'story', $story->story_title )->getFullURL() |
108 | 111 | ); |