1/** 2 * tilescroller.js 3 * ÁèÌæð·ë[é³¹æ[¸Ì½ßÌjs 4 * XN[ÉêØjqueryðgíÈ¢©çá±¢©à©à 5 * î{IÉbase62GR[hųkïÇ»µ½tilescroller.min.jsðg¤ 6 * XVµÄijk&ïÇ»·éêÉÍ 7 * http://dean.edwards.name/packer/ 8 * (¦»Ýñ³k\[XðgpB³k·éÆV^bNXG[ÆÈÁĵܤ½ß) 9 * Ås¤B 10 * @date 2013/01/21 11 * @author o.yabuta 12 * @version 0.0.1 13 * 14 */ 15 16var f = function(){}; 17 18tileScroller = new f(); 19tileScroller._show_area_width = null; 20tileScroller._show_area_height = null; 21tileScroller._tile_width = null; 22tileScroller._tile_height = null; 23tileScroller._scroll_count = null; 24tileScroller._map_dom = null; 25tileScroller._map_dom_id = null; 26tileScroller._tile_group_dom = null; 27tileScroller._tile_group_dom_id = null; 28tileScroller._tiles = null; 29tileScroller._left_scroll_event_target = null; 30tileScroller._right_scroll_event_target = null; 31tileScroller._intervalID = null; 32tileScroller._start_time = null; 33tileScroller._date = null; 34tileScroller._duration = null; 35tileScroller._begin = null; 36tileScroller._change = null; 37tileScroller._interval = null; 38tileScroller._tick_count = null; 39tileScroller._cur = null; 40tileScroller._time = null; 41tileScroller._now = 0; 42tileScroller._scroll_min = 0; 43tileScroller._scroll_max = 0; 44tileScroller._easingFunc = null; 45tileScroller._processing = null; 46tileScroller._tile_class = null; 47tileScroller._left_trigger_dom = null; 48tileScroller._right_trigger_dom = null; 49tileScroller.setOptions = function(options) { 50 with(this) { 51 _show_area_width = options.show_area_width, 52 _show_area_height = options.show_area_height, 53 _tile_width = options.tile_width, 54 _tile_height = options.tile_height, 55 _scroll_count = options.scroll_count, 56 _map_dom = $('#' + options.map_dom), 57 _map_dom_id = options.map_dom, 58 _tile_group_dom = $('#' + options.tile_group_dom), 59 _tile_group_dom_id = options.tile_group_dom, 60 _tiles = new Array(), 61 _left_scroll_event_target = (typeof options.left_scroll_event_target != 'undefined') ? $('#' + options.left_scroll_event_target) : null, 62 _right_scroll_event_target = (typeof options.right_scroll_event_target != 'undefined') ? $('#' + options.right_scroll_event_target) : null, 63 _intervalID = null, 64 _start_time = 0, 65 _date = new Date(), 66 _duration = 400, 67 _begin = 0, 68 _change = 0, 69 _interval = 13, 70 _tick_count = 0, 71 _cur = 0, 72 _time = null, 73 _now = 0, 74 _scroll_min = 0, 75 _scroll_max = 0, 76 _easingFunc = typeof options.easingFunc == 'undefined' ? this._ease : this[options.easingFunc], 77 _processing = false, 78 _tile_class = options.tile_dom, 79 _left_trigger_dom = options.left_trigger_dom , 80 _right_trigger_dom = options.right_trigger_dom; 81 initialize(); 82 } 83 84 return this; 85}; 86 87tileScroller.initialize = function() { 88 with(this) { 89 //_map_dom.css('overflow' , 'hidden').css('height' , _tile_height); 90 document.getElementById(_map_dom_id).style.overflow = 'hidden'; 91 document.getElementById(_map_dom_id).style.height = _tile_height + 'px'; 92 //_tile_group_dom.css('position' , 'relative').css('top' , '0px').css('left' , '0px'); 93 document.getElementById(_tile_group_dom_id).style.position = 'relative'; 94 document.getElementById(_tile_group_dom_id).style.top = '0px'; 95 document.getElementById(_tile_group_dom_id).style.left = '0px'; 96 document.getElementById(_tile_group_dom_id).style.zIndex = 9999; 97 98 var divs = document.getElementsByTagName('div'); 99 for (var i = 0; i < divs.length; i++) { 100 if (divs[i].className == _tile_class) { 101 //_tiles.push($(divs[i]).css('float' , 'left').css('position' , 'relative').children('img').attr('width' , _tile_width)); 102 divs[i].style.float = 'left'; 103 divs[i].style.position = 'relative'; 104 divs[i].style.width = _tile_width + 'px'; 105 _tiles.push(divs[i]); 106 } 107 } 108 109 var total_concat_width = (_tile_width * _tiles.length); 110 // _tile_group_dom.css('width' , total_concat_width); 111 document.getElementById(_tile_group_dom_id).style.width = (total_concat_width + 100) + 'px';
112 _scroll_max = (-1 * ( Math.ceil(total_concat_width / _show_area_width) - 1) ) * _show_area_width; 113 } 114}; 115 116 117tileScroller.bind = function(){ 118 this.bindLeftScrollEvent(); 119 this.bindRightScrollEvent(); 120 this.bindMouseWheelEvent(); 121}; 122 123tileScroller.bindLeftScrollEvent = function() { 124 if (!this._left_scroll_event_target) this._left_scroll_event_target = $('#' + this._left_trigger_dom); 125 ref = this; 126 this._left_scroll_event_target.bind('click' , {ref:ref}, function(e) { 127 e.data.ref._prepareScrollTileEvent('l'); 128 }); 129}; 130 131tileScroller.bindRightScrollEvent = function() { 132 if (!this._right_scroll_event_target) this._right_scroll_event_target = $('#' + this._right_trigger_dom); 133 ref = this; 134 this._right_scroll_event_target.bind('click' , {ref:ref} , function(e) { 135 e.data.ref._prepareScrollTileEvent('r'); 136 }); 137}; 138 139tileScroller.bindMouseWheelEvent = function() { 140 $('.' + this._tile_class).bind('mouseover' , {ref:this} , function(e) { 141 e.data.ref._bindMouseWheelEvent(e.data.ref); 142 }).bind('mouseout' , {ref : this} , function(e) { 143 $(document).unbind('mousewheel'); 144 }); 145 146 $('.' + this._tile_class).children('img span div').bind('mouseover' , {ref:this} , function(e) { 147 e.data.ref._bindMouseWheelEvent(e.data.ref); 148 }).bind('mouseout' , {ref:this} , function(e) { 149 $(document).unbind('mousewheel'); 150 }); 151}; 152 153tileScroller._bindMouseWheelEvent = function(ref) { 154 $(document).bind('mousewheel' , {ref:ref} , function(e, delta, deltaX, deltaY) { 155 e.preventDefault(); 156 var t_duration = e.data.ref._duration; 157 e.data.ref._duration = 100; 158 if (delta < 0) { 159 e.data.ref._prepareScrollTileEvent('l' , 'w'); 160 } 161 else { 162 e.data.ref._prepareScrollTileEvent('r' , 'w'); 163 } 164 e.data.ref._duration = t_duration; 165 }); 166} 167 168tileScroller._prepareScrollTileEvent = function(v , t) { 169 with(this) { 170 //stop scrolling forced 171 if (v == 'r') { 172 if (_scroll_min <= parseInt(document.getElementById(_tile_group_dom_id).style.left)) return false; 173 } 174 else if (v == 'l') { 175 if (_scroll_max >= parseInt(document.getElementById(_tile_group_dom_id).style.left)) return false; 176 } 177 178 //if scrolling is processing , pass scrolling logic. 179 if (_processing == false) 180 { 181 _processing = true, _start_time = (new Date()).getTime(),_begin = parseInt(document.getElementById(_tile_group_dom_id).style.left), 182 _change = this._getChange(v , t), 183 _finish = _begin + _change, 184 _intervalID = setInterval(function() { _scrollTile(); } , _interval); 185 } 186 } 187}; 188 189tileScroller._getChange = function(v , t) { 190 with(this) { 191 return ((v == 'l') ? -1 : 1) * ((t == 'w') ? _tile_width * 5 : _show_area_width); 192 } 193}; 194 195tileScroller._scrollTile = function() { 196 with(this) { 197 _now = (new Date()).getTime(), _time = _now - _start_time, _cur = Math.floor(_easingFunc(_time , _begin , _change , _duration)), 198 _updatePosition(); 199 } 200}; 201 202tileScroller._updatePosition = function() { 203 with(this) 204 { 205 var remaining = Math.max(0 , _start_time + _duration - _now), temp = remaining / _duration || 0, 206 percent = 1 - temp; 207 if (percent >= 1 || this._isMinOver() == true || this._isMaxOver() == true) { 208 _finish = this._isMinOver() == true ? _scroll_min : (this._isMaxOver() == true ? _scroll_max : _finish); 209 document.getElementById(_tile_group_dom_id).style.left = _finish + 'px', _processing = false, 210 clearInterval(_intervalID); 211 return; 212 } 213 document.getElementById(_tile_group_dom_id).style.left = _cur + 'px'; 214 } 215}; 216 217tileScroller._isMinOver = function() { 218 if (parseInt(document.getElementById(this._tile_group_dom_id).style.left) > this._scroll_min) { 219 return true; 220 } 221 return false; 222}; 223 224tileScroller._isMaxOver = function() { 225 if (parseInt(document.getElementById(this._tile_group_dom_id).style.left) < this._scroll_max) { 226 return true; 227 } 228 return false;
229}; 230 231tileScroller._ease = function (t, b, c, d) { 232 return c*(t/=d)*t + b; 233}; 234 235tileScroller._ease2 = function(t , b ,c ,d){ 236 if ((t/=d) < (1/2.75)) { 237 return c*(7.5625*t*t) + b; 238 } else if (t < (2/2.75)) { 239 return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b; 240 } else if (t < (2.5/2.75)) { 241 return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b; 242 } else { 243 return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b; 244 } 245};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.