r63065 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r63064‎ | r63065 | r63066 >
Date:11:32, 28 February 2010
Author:catrope
Status:ok
Tags:
Comment:
Storyboard: svn:eol-style native on jquery.ajaxscroll.js, add Makefile to generate minified JS
Modified paths:
  • /trunk/extensions/Storyboard/Makefile (added) (history)
  • /trunk/extensions/Storyboard/tags/Storyboard/jquery.ajaxscroll.js (modified) (history)
  • /trunk/extensions/Storyboard/tags/Storyboard/jquery.ajaxscroll.min.js (modified) (history)

Diff [purge]

Index: trunk/extensions/Storyboard/Makefile
@@ -0,0 +1,26 @@
 2+#
 3+# Handy makefile to combine and minify css and javascript files
 4+#
 5+
 6+all: tags/Storyboard/jquery.ajaxscroll.min.js
 7+
 8+# JavaScript Minification
 9+
 10+tags/Storyboard/jquery.ajaxscroll.min.js: tags/Storyboard/jquery.ajaxscroll.js jsmin
 11+ if [ -e ./jsmin ]; then ./jsmin < tags/Storyboard/jquery.ajaxscroll.js > tags/Storyboard/jquery.ajaxscroll.min.js;\
 12+ else jsmin < tags/Storyboard/jquery.ajaxscroll.js > tags/Storyboard/jquery.ajaxscroll.min.js; fi
 13+
 14+# JSMin - For more info on JSMin, see: http://www.crockford.com/javascript/jsmin.html
 15+
 16+jsmin:
 17+ type -P jsmin &>/dev/null || ( wget http://www.crockford.com/javascript/jsmin.c; gcc jsmin.c -o jsmin )
 18+
 19+# Actions
 20+
 21+distclean: clean
 22+ rm -rf jsmin
 23+ rm -rf jsmin.c
 24+
 25+clean:
 26+ rm -f tags/Storyboard/jquery.ajaxscroll.min.js
 27+
Property changes on: trunk/extensions/Storyboard/Makefile
___________________________________________________________________
Name: svn:eol-style
128 + native
Index: trunk/extensions/Storyboard/tags/Storyboard/jquery.ajaxscroll.js
@@ -1,158 +1,158 @@
2 -/**
3 - * AjaxScroll v0.1 (jQuery Plugins)
4 - *
5 - * @author Timmy Tin (ycTIN)
6 - * @license GPL
7 - * @version 0.1
8 - * @copyright Timmy Tin (ycTIN)
9 - * @website http://project.yctin.com/ajaxscroll
10 - *
11 - */
12 -(function($) {
13 - $.fn.ajaxScroll=function(opt){
14 - opt=jQuery.extend(
15 - {
16 - batchNum:5,
17 - batchSize:30,
18 - horizontal:false,
19 - batchTemplate:null,
20 - boxTemplate:null,
21 - batchClass:"batch",
22 - boxClass:"box",
23 - emptyBatchClass:"empty",
24 - scrollPaneClass:"scrollpane",
25 - lBound:"auto",
26 - uBound:"auto",
27 - eBound:"auto",
28 - maxOffset:1000,
29 - scrollDelay:600,
30 - endDelay:100,
31 - updateBatch:null,
32 - updateEnd:null
33 - },
34 - opt
35 - );
36 - return this.each(function(){
37 - var ele=this;
38 - var $me=jQuery(this);
39 - var $sp;
40 - var fnEnd,fnScroll;
41 - var offset=0;
42 - var lsp=-1;_css();
43 - opt.boxTemplate=(opt.boxTemplate||"<span class='"+opt.boxClass+"'>&nbsp</span>");
44 - if(opt.horizontal){
45 - opt.batchTemplate=(opt.batchTemplate||"<td></td>");
46 - $sp=jQuery("<table><tr></tr></table>").addClass(opt.scrollPaneClass);
47 - $me.append($sp);
48 - offset=batch($sp.find("tr"),offset,opt);
49 - _bz();
50 - _ab();
51 - fnEnd=hEnd;
52 - fnScroll=hScroll;
53 - }else{
54 - opt.batchTemplate=(opt.batchTemplate||"<span></span>");
55 - $sp=jQuery("<div></div>").addClass(opt.scrollPaneClass);
56 - $me.append($sp);
57 - offset=batch($sp,offset,opt);
58 - _bz();
59 - _ab();
60 - fnEnd=vEnd;
61 - fnScroll=vScroll;
62 - }
63 - setTimeout(monEnd,opt.endDelay);
64 - if(typeof opt.updateBatch=='function'){
65 - setTimeout(monScroll,opt.scrollDelay);
66 - }
67 - function _css(){
68 - if(opt.horizontal){
69 - $me.css({"overflow-x":"auto","overflow-y":"hidden"});
70 - }else{
71 - $me.css({"overflow-x":"hidden","overflow-y":"auto"});
72 - }
73 - }
74 - function _ab(){
75 - var os,b;
76 - if(opt.horizontal){
77 - os=$me.find('.batch:first').next().offset().left;
78 - b=($me.width()/os+1)*os;
79 - }else{
80 - os=$me.find('.batch:first').next().offset().top;
81 - b=($me.height()/os+1)*os;
82 - }
83 - if("auto"==opt.uBound){
84 - opt.uBound=b;
85 - }
86 - if("auto"==opt.lBound){
87 - opt.lBound=-b;
88 - }
89 - if("auto"==opt.eBound){
90 - opt.eBound=b*2;
91 - }
92 - }
93 - function _bz(){
94 - $me.scrollTop(0).scrollLeft(0);
95 - };
96 - function batch($s,o,opt){
97 - var $b,i,rp=opt.batchNum;
98 - while(rp--){
99 - $b=jQuery(opt.batchTemplate).attr({offset:o,len:opt.batchSize}).addClass(opt.batchClass+" "+opt.emptyBatchClass);
100 - i=opt.batchSize;
101 - while(i--&&opt.maxOffset>o++){
102 - $b.append(opt.boxTemplate);
103 - }
104 - $s.append($b);
105 - }
106 - return o;
107 - };
108 - function vScroll(){
109 - var so=$me.scrollTop();
110 - if(lsp!=so){
111 - lsp=so;
112 - var co=$me.offset().top;
113 - $sp.find('> .'+opt.emptyBatchClass).each(function(i,obj){
114 - var $b=jQuery(obj);
115 - var p=$b.position().top-co;
116 - if(opt.lBound>p||p>opt.uBound){return;}
117 - opt.updateBatch($b.removeClass(opt.emptyBatchClass));
118 - });
119 - }
120 - };
121 - function hScroll(){
122 - var so=$me.scrollLeft();
123 - if(lsp!=so){
124 - lsp=so;
125 - var co=$me.offset().left;
126 - $sp.find('tr > .'+opt.emptyBatchClass).each(function(i,obj){
127 - var $b=jQuery(obj);
128 - var p=$b.position().left-co;
129 - if(opt.lBound>p||p>opt.uBound){return;}
130 - opt.updateBatch($b.removeClass(opt.emptyBatchClass));
131 - });
132 - }
133 - };
134 - function vEnd(){
135 - if(ele.scrollTop>0&&ele.scrollHeight-ele.scrollTop<opt.eBound){
136 - offset=batch($sp,offset,opt);
137 - return 1;
138 - }
139 - return opt.endDelay;
140 - };
141 - function hEnd(){
142 - if(ele.scrollLeft>0&&ele.scrollWidth-ele.scrollLeft<opt.eBound){
143 - offset=batch($sp.find("tr:first"),offset,opt);
144 - return 1;
145 - }
146 - return opt.endDelay;
147 - };
148 - function monScroll(){
149 - fnScroll();
150 - setTimeout(monScroll,opt.scrollDelay);
151 - };
152 - function monEnd(){
153 - if(offset<opt.maxOffset){
154 - setTimeout(monEnd,fnEnd());
155 - }
156 - }
157 - });
158 - };
159 -})(jQuery);
 2+/**
 3+ * AjaxScroll v0.1 (jQuery Plugins)
 4+ *
 5+ * @author Timmy Tin (ycTIN)
 6+ * @license GPL
 7+ * @version 0.1
 8+ * @copyright Timmy Tin (ycTIN)
 9+ * @website http://project.yctin.com/ajaxscroll
 10+ *
 11+ */
 12+(function($) {
 13+ $.fn.ajaxScroll=function(opt){
 14+ opt=jQuery.extend(
 15+ {
 16+ batchNum:5,
 17+ batchSize:30,
 18+ horizontal:false,
 19+ batchTemplate:null,
 20+ boxTemplate:null,
 21+ batchClass:"batch",
 22+ boxClass:"box",
 23+ emptyBatchClass:"empty",
 24+ scrollPaneClass:"scrollpane",
 25+ lBound:"auto",
 26+ uBound:"auto",
 27+ eBound:"auto",
 28+ maxOffset:1000,
 29+ scrollDelay:600,
 30+ endDelay:100,
 31+ updateBatch:null,
 32+ updateEnd:null
 33+ },
 34+ opt
 35+ );
 36+ return this.each(function(){
 37+ var ele=this;
 38+ var $me=jQuery(this);
 39+ var $sp;
 40+ var fnEnd,fnScroll;
 41+ var offset=0;
 42+ var lsp=-1;_css();
 43+ opt.boxTemplate=(opt.boxTemplate||"<span class='"+opt.boxClass+"'>&nbsp</span>");
 44+ if(opt.horizontal){
 45+ opt.batchTemplate=(opt.batchTemplate||"<td></td>");
 46+ $sp=jQuery("<table><tr></tr></table>").addClass(opt.scrollPaneClass);
 47+ $me.append($sp);
 48+ offset=batch($sp.find("tr"),offset,opt);
 49+ _bz();
 50+ _ab();
 51+ fnEnd=hEnd;
 52+ fnScroll=hScroll;
 53+ }else{
 54+ opt.batchTemplate=(opt.batchTemplate||"<span></span>");
 55+ $sp=jQuery("<div></div>").addClass(opt.scrollPaneClass);
 56+ $me.append($sp);
 57+ offset=batch($sp,offset,opt);
 58+ _bz();
 59+ _ab();
 60+ fnEnd=vEnd;
 61+ fnScroll=vScroll;
 62+ }
 63+ setTimeout(monEnd,opt.endDelay);
 64+ if(typeof opt.updateBatch=='function'){
 65+ setTimeout(monScroll,opt.scrollDelay);
 66+ }
 67+ function _css(){
 68+ if(opt.horizontal){
 69+ $me.css({"overflow-x":"auto","overflow-y":"hidden"});
 70+ }else{
 71+ $me.css({"overflow-x":"hidden","overflow-y":"auto"});
 72+ }
 73+ }
 74+ function _ab(){
 75+ var os,b;
 76+ if(opt.horizontal){
 77+ os=$me.find('.batch:first').next().offset().left;
 78+ b=($me.width()/os+1)*os;
 79+ }else{
 80+ os=$me.find('.batch:first').next().offset().top;
 81+ b=($me.height()/os+1)*os;
 82+ }
 83+ if("auto"==opt.uBound){
 84+ opt.uBound=b;
 85+ }
 86+ if("auto"==opt.lBound){
 87+ opt.lBound=-b;
 88+ }
 89+ if("auto"==opt.eBound){
 90+ opt.eBound=b*2;
 91+ }
 92+ }
 93+ function _bz(){
 94+ $me.scrollTop(0).scrollLeft(0);
 95+ };
 96+ function batch($s,o,opt){
 97+ var $b,i,rp=opt.batchNum;
 98+ while(rp--){
 99+ $b=jQuery(opt.batchTemplate).attr({offset:o,len:opt.batchSize}).addClass(opt.batchClass+" "+opt.emptyBatchClass);
 100+ i=opt.batchSize;
 101+ while(i--&&opt.maxOffset>o++){
 102+ $b.append(opt.boxTemplate);
 103+ }
 104+ $s.append($b);
 105+ }
 106+ return o;
 107+ };
 108+ function vScroll(){
 109+ var so=$me.scrollTop();
 110+ if(lsp!=so){
 111+ lsp=so;
 112+ var co=$me.offset().top;
 113+ $sp.find('> .'+opt.emptyBatchClass).each(function(i,obj){
 114+ var $b=jQuery(obj);
 115+ var p=$b.position().top-co;
 116+ if(opt.lBound>p||p>opt.uBound){return;}
 117+ opt.updateBatch($b.removeClass(opt.emptyBatchClass));
 118+ });
 119+ }
 120+ };
 121+ function hScroll(){
 122+ var so=$me.scrollLeft();
 123+ if(lsp!=so){
 124+ lsp=so;
 125+ var co=$me.offset().left;
 126+ $sp.find('tr > .'+opt.emptyBatchClass).each(function(i,obj){
 127+ var $b=jQuery(obj);
 128+ var p=$b.position().left-co;
 129+ if(opt.lBound>p||p>opt.uBound){return;}
 130+ opt.updateBatch($b.removeClass(opt.emptyBatchClass));
 131+ });
 132+ }
 133+ };
 134+ function vEnd(){
 135+ if(ele.scrollTop>0&&ele.scrollHeight-ele.scrollTop<opt.eBound){
 136+ offset=batch($sp,offset,opt);
 137+ return 1;
 138+ }
 139+ return opt.endDelay;
 140+ };
 141+ function hEnd(){
 142+ if(ele.scrollLeft>0&&ele.scrollWidth-ele.scrollLeft<opt.eBound){
 143+ offset=batch($sp.find("tr:first"),offset,opt);
 144+ return 1;
 145+ }
 146+ return opt.endDelay;
 147+ };
 148+ function monScroll(){
 149+ fnScroll();
 150+ setTimeout(monScroll,opt.scrollDelay);
 151+ };
 152+ function monEnd(){
 153+ if(offset<opt.maxOffset){
 154+ setTimeout(monEnd,fnEnd());
 155+ }
 156+ }
 157+ });
 158+ };
 159+})(jQuery);
Property changes on: trunk/extensions/Storyboard/tags/Storyboard/jquery.ajaxscroll.js
___________________________________________________________________
Name: svn:eol-style
160160 + native
Index: trunk/extensions/Storyboard/tags/Storyboard/jquery.ajaxscroll.min.js
@@ -1,13 +1,15 @@
2 -/**
3 - * AjaxScroll v0.1 (jQuery Plugins)
4 - *
5 - * @author Timmy Tin (ycTIN)
6 - * @license GPL
7 - * @version 0.1
8 - * @copyright Timmy Tin (ycTIN)
9 - * @website http://project.yctin.com/ajaxscroll
10 - *
11 - */
12 -(function($) {
13 - $.fn.ajaxScroll=function(opt){opt=jQuery.extend({batchNum:5,batchSize:30,horizontal:false,batchTemplate:null,boxTemplate:null,batchClass:"batch",boxClass:"box",emptyBatchClass:"empty",scrollPaneClass:"scrollpane",lBound:"auto",uBound:"auto",eBound:"auto",maxOffset:1000,scrollDelay:600,endDelay:100,updateBatch:null,updateEnd:null},opt);return this.each(function(){var ele=this;var $me=jQuery(this);var $sp;var fnEnd,fnScroll;var offset=0;var lsp=-1;_css();opt.boxTemplate=(opt.boxTemplate||"<span class='"+opt.boxClass+"'>&nbsp</span>");if(opt.horizontal){opt.batchTemplate=(opt.batchTemplate||"<td></td>");$sp=jQuery("<table><tr></tr></table>").addClass(opt.scrollPaneClass);$me.append($sp);offset=batch($sp.find("tr"),offset,opt);_bz();_ab();fnEnd=hEnd;fnScroll=hScroll;}else{opt.batchTemplate=(opt.batchTemplate||"<span></span>");$sp=jQuery("<div></div>").addClass(opt.scrollPaneClass);$me.append($sp);offset=batch($sp,offset,opt);_bz();_ab();fnEnd=vEnd;fnScroll=vScroll;}setTimeout(monEnd,opt.endDelay);if(typeof opt.updateBatch=='function'){setTimeout(monScroll,opt.scrollDelay);}function _css(){if(opt.horizontal){$me.css({"overflow-x":"auto","overflow-y":"hidden"});}else{$me.css({"overflow-x":"hidden","overflow-y":"auto"});}}function _ab(){var os,b;if(opt.horizontal){os=$me.find('.batch:first').next().offset().left;b=($me.width()/os+1)*os;}else{os=$me.find('.batch:first').next().offset().top;b=($me.height()/os+1)*os;}if("auto"==opt.uBound){opt.uBound=b;}if("auto"==opt.lBound){opt.lBound=-b;}if("auto"==opt.eBound){opt.eBound=b*2;}}function _bz(){$me.scrollTop(0).scrollLeft(0);};function batch($s,o,opt){var $b,i,rp=opt.batchNum;while(rp--){$b=jQuery(opt.batchTemplate).attr({offset:o,len:opt.batchSize}).addClass(opt.batchClass+" "+opt.emptyBatchClass);i=opt.batchSize;while(i--&&opt.maxOffset>o++){$b.append(opt.boxTemplate);}$s.append($b);}return o;};function vScroll(){var so=$me.scrollTop();if(lsp!=so){lsp=so;var co=$me.offset().top;$sp.find('> .'+opt.emptyBatchClass).each(function(i,obj){var $b=jQuery(obj);var p=$b.position().top-co;if(opt.lBound>p||p>opt.uBound){return;}opt.updateBatch($b.removeClass(opt.emptyBatchClass));});}};function hScroll(){var so=$me.scrollLeft();if(lsp!=so){lsp=so;var co=$me.offset().left;$sp.find('tr > .'+opt.emptyBatchClass).each(function(i,obj){var $b=jQuery(obj);var p=$b.position().left-co;if(opt.lBound>p||p>opt.uBound){return;}opt.updateBatch($b.removeClass(opt.emptyBatchClass));});}};function vEnd(){if(ele.scrollTop>0&&ele.scrollHeight-ele.scrollTop<opt.eBound){offset=batch($sp,offset,opt);return 1;}return opt.endDelay;};function hEnd(){if(ele.scrollLeft>0&&ele.scrollWidth-ele.scrollLeft<opt.eBound){offset=batch($sp.find("tr:first"),offset,opt);return 1;}return opt.endDelay;};function monScroll(){fnScroll();setTimeout(monScroll,opt.scrollDelay);};function monEnd(){if(offset<opt.maxOffset){setTimeout(monEnd,fnEnd());}}});};
14 -})(jQuery);
 2+
 3+(function($){$.fn.ajaxScroll=function(opt){opt=jQuery.extend({batchNum:5,batchSize:30,horizontal:false,batchTemplate:null,boxTemplate:null,batchClass:"batch",boxClass:"box",emptyBatchClass:"empty",scrollPaneClass:"scrollpane",lBound:"auto",uBound:"auto",eBound:"auto",maxOffset:1000,scrollDelay:600,endDelay:100,updateBatch:null,updateEnd:null},opt);return this.each(function(){var ele=this;var $me=jQuery(this);var $sp;var fnEnd,fnScroll;var offset=0;var lsp=-1;_css();opt.boxTemplate=(opt.boxTemplate||"<span class='"+opt.boxClass+"'>&nbsp</span>");if(opt.horizontal){opt.batchTemplate=(opt.batchTemplate||"<td></td>");$sp=jQuery("<table><tr></tr></table>").addClass(opt.scrollPaneClass);$me.append($sp);offset=batch($sp.find("tr"),offset,opt);_bz();_ab();fnEnd=hEnd;fnScroll=hScroll;}else{opt.batchTemplate=(opt.batchTemplate||"<span></span>");$sp=jQuery("<div></div>").addClass(opt.scrollPaneClass);$me.append($sp);offset=batch($sp,offset,opt);_bz();_ab();fnEnd=vEnd;fnScroll=vScroll;}
 4+setTimeout(monEnd,opt.endDelay);if(typeof opt.updateBatch=='function'){setTimeout(monScroll,opt.scrollDelay);}
 5+function _css(){if(opt.horizontal){$me.css({"overflow-x":"auto","overflow-y":"hidden"});}else{$me.css({"overflow-x":"hidden","overflow-y":"auto"});}}
 6+function _ab(){var os,b;if(opt.horizontal){os=$me.find('.batch:first').next().offset().left;b=($me.width()/os+1)*os;}else{os=$me.find('.batch:first').next().offset().top;b=($me.height()/os+1)*os;}
 7+if("auto"==opt.uBound){opt.uBound=b;}
 8+if("auto"==opt.lBound){opt.lBound=-b;}
 9+if("auto"==opt.eBound){opt.eBound=b*2;}}
 10+function _bz(){$me.scrollTop(0).scrollLeft(0);};function batch($s,o,opt){var $b,i,rp=opt.batchNum;while(rp--){$b=jQuery(opt.batchTemplate).attr({offset:o,len:opt.batchSize}).addClass(opt.batchClass+" "+opt.emptyBatchClass);i=opt.batchSize;while(i--&&opt.maxOffset>o++){$b.append(opt.boxTemplate);}
 11+$s.append($b);}
 12+return o;};function vScroll(){var so=$me.scrollTop();if(lsp!=so){lsp=so;var co=$me.offset().top;$sp.find('> .'+opt.emptyBatchClass).each(function(i,obj){var $b=jQuery(obj);var p=$b.position().top-co;if(opt.lBound>p||p>opt.uBound){return;}
 13+opt.updateBatch($b.removeClass(opt.emptyBatchClass));});}};function hScroll(){var so=$me.scrollLeft();if(lsp!=so){lsp=so;var co=$me.offset().left;$sp.find('tr > .'+opt.emptyBatchClass).each(function(i,obj){var $b=jQuery(obj);var p=$b.position().left-co;if(opt.lBound>p||p>opt.uBound){return;}
 14+opt.updateBatch($b.removeClass(opt.emptyBatchClass));});}};function vEnd(){if(ele.scrollTop>0&&ele.scrollHeight-ele.scrollTop<opt.eBound){offset=batch($sp,offset,opt);return 1;}
 15+return opt.endDelay;};function hEnd(){if(ele.scrollLeft>0&&ele.scrollWidth-ele.scrollLeft<opt.eBound){offset=batch($sp.find("tr:first"),offset,opt);return 1;}
 16+return opt.endDelay;};function monScroll(){fnScroll();setTimeout(monScroll,opt.scrollDelay);};function monEnd(){if(offset<opt.maxOffset){setTimeout(monEnd,fnEnd());}}});};})(jQuery);
\ No newline at end of file

Status & tagging log