r65767 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r65766‎ | r65767 | r65768 >
Date:22:12, 1 May 2010
Author:jeroendedauw
Status:deferred
Tags:
Comment:
Stylized js a bit
Modified paths:
  • /trunk/extensions/Storyboard/api/ApiQueryStories.php (modified) (history)
  • /trunk/extensions/Storyboard/jquery/jquery.ajaxscroll.js (modified) (history)
  • /trunk/extensions/Storyboard/tags/Storyboard/storyboard.js (modified) (history)

Diff [purge]

Index: trunk/extensions/Storyboard/jquery/jquery.ajaxscroll.js
@@ -30,29 +30,33 @@
3131 },
3232 opt
3333 );
34 - return this.each(function(){
35 - var ele=this;
36 - var $me=jQuery(this);
 34+ return this.each( function() {
 35+ var ele = this;
 36+ var $me = jQuery( this );
3737 var $sp;
3838 var fnEnd,fnScroll;
39 - var offset=0;
40 - var lsp=-1;_css();
 39+ var offset= 0 ;
 40+ var lsp = -1;
4141
42 - opt.boxTemplate=(opt.boxTemplate||"<span class='"+opt.boxClass+"'>&nbsp</span>");
 42+ _css();
4343
44 - opt.batchTemplate=(opt.batchTemplate||"<span></span>");
45 - $sp=jQuery("<div></div>").addClass(opt.scrollPaneClass);
46 - $me.append($sp);
47 - offset=batch($sp,offset,opt);
 44+ opt.boxTemplate = ( opt.boxTemplate || "<span class='" + opt.boxClass + "'>&nbsp</span>" );
 45+ opt.batchTemplate = ( opt.batchTemplate || "<span></span>" );
 46+
 47+ $sp = jQuery( "<div></div>" ).addClass( opt.scrollPaneClass );
 48+ $me.append( $sp );
 49+ offset = batch( $sp, offset, opt );
4850 $me.scrollTop(0).scrollLeft(0);
 51+
4952 _ab();
50 - fnEnd=vEnd;
51 - fnScroll=vScroll;
5253
53 - setTimeout(monEnd,opt.endDelay);
 54+ fnEnd = vEnd;
 55+ fnScroll = vScroll;
5456
55 - if(typeof opt.updateBatch=='function'){
56 - setTimeout(monScroll,opt.scrollDelay);
 57+ setTimeout( monEnd, opt.endDelay );
 58+
 59+ if( typeof opt.updateBatch == 'function' ){
 60+ setTimeout( monScroll, opt.scrollDelay );
5761 }
5862
5963 function _css(){
@@ -78,29 +82,39 @@
7983 }
8084 }
8185
82 - function batch($s,o,opt){
83 - var $b,i,rp=opt.batchNum;
 86+ function batch($s, offset ,opt){
 87+ var $b;
 88+ var i;
 89+ var rp = opt.batchNum;
8490
85 - while(rp--){
86 - $b=jQuery(opt.batchTemplate).attr({offset:o,len:opt.batchSize}).addClass(opt.batchClass+" "+opt.emptyBatchClass);
87 - i=opt.batchSize;
88 - while(i--&&opt.maxOffset>o++){
89 - $b.append(opt.boxTemplate);
 91+ while( rp-- ) {
 92+ $b=jQuery(opt.batchTemplate)
 93+ .attr({
 94+ offset:offset,
 95+ len:opt.batchSiz
 96+ })
 97+ .addClass( opt.batchClass + " " + opt.emptyBatchClass );
 98+
 99+ i = opt.batchSize;
 100+
 101+ while( i-- && opt.maxOffset > offset++ ){
 102+ $b.append( opt.boxTemplate );
90103 }
 104+
91105 $s.append($b);
92106 }
93107
94 - return o;
 108+ return offset;
95109 };
96110
97111 function vScroll(){
98 - var so=$me.scrollTop();
 112+ var so = $me.scrollTop();
99113
100 - if(lsp!=so){
101 - lsp=so;
102 - var co=$me.offset().top;
 114+ if( lsp != so){
 115+ lsp = so;
 116+ var co = $me.offset().top;
103117
104 - $sp.find('> .'+opt.emptyBatchClass).each(function(i,obj){
 118+ $sp.find( '> .' + opt.emptyBatchClass ).each(function( i, obj ){
105119 var $b=jQuery(obj);
106120 var p=$b.position().top-co;
107121 if(opt.lBound>p||p>opt.uBound){return;}
Index: trunk/extensions/Storyboard/tags/Storyboard/storyboard.js
@@ -11,7 +11,7 @@
1212 updateBatch: updateStoryboard,
1313 maxOffset: 500,
1414 batchSize: 8,
15 - batchNum: 1,
 15+ batchNum: 2,
1616 batchClass: "batch",
1717 boxClass: "storyboard-box",
1818 emptyBatchClass: "storyboard-empty",
Index: trunk/extensions/Storyboard/api/ApiQueryStories.php
@@ -85,7 +85,6 @@
8686 "(story_modified = $storyId AND story_id <= $storyModified)"
8787 );
8888 */
89 -
9089 }
9190
9291 $stories = $this->select( __METHOD__ );

Follow-up revisions

RevisionCommit summaryAuthorDate
r65768Follow up to r65767jeroendedauw22:22, 1 May 2010

Status & tagging log