Index: trunk/extensions/Storyboard/tags/Storyboard/Storyboard_body.php |
— | — | @@ -20,7 +20,7 @@ |
21 | 21 | |
22 | 22 | $wgOut->addStyle($egStoryboardScriptPath . '/tags/Storyboard/storyboard.css'); |
23 | 23 | $wgOut->includeJQuery(); |
24 | | - $wgOut->addScriptFile($egStoryboardScriptPath . '/tags/Storyboard/jquery.ajaxscroll.min.js'); |
| 24 | + $wgOut->addScriptFile($egStoryboardScriptPath . '/tags/Storyboard/jquery.ajaxscroll.js'); |
25 | 25 | |
26 | 26 | $output = <<<EOT |
27 | 27 | <div class="ajaxscroll" id="storyboard"> |
Index: trunk/extensions/Storyboard/tags/Storyboard/jquery.ajaxscroll.js |
— | — | @@ -0,0 +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+"'> </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);
|