_attachEvent: function() { this.onTouchMove = snippet.bind(this._onTouchMove, this); this.onTouchEnd = snippet.bind(this._onTouchEnd, this); this.onTouchStart = snippet.bind(this._onTouchStart, this); this.element.addEventListener('touchstart', this.onTouchStart); },
_moveTo: function(pos, isBackward) { var way = isBackward ? 'backward' : 'forward'; var origin = this.startPos[this._config.way]; var moved = this._getMoved(); var start = origin + moved; var direction = way === 'forward' ? 1 : -1; var horizontal = this.flow === 'horizontal'; var config = this._config; var self = this; var originValue; pos.way = way; if (this.mover) { this.mover.cancel(); } this.mover = animation.anim({ from: horizontal ? start : [0, start], to: horizontal ? start + pos.dist : [0, start + pos.dist], duration: this.duration, easing: this.effect, frame: function(left, top) { originValue = (horizontal ? left : top) - start; self.wrapper.style[config.way] = (originValue * direction) + start + 'px'; }, complete: snippet.bind(this._complete, this, pos, pos.cover) }); this.mover.run(); },
TimeGrid.prototype.attachEvent = function() { clearInterval(this.intervalID); clearTimeout(this.timerID); this.intervalID = this.timerID = null; this.timerID = setTimeout(util.bind(this.onTick, this), (SIXTY_SECONDS - new TZDate().getSeconds()) * 1000); };
startTab: function(pos) { this.isLongtabed = false; this.longTabPos = pos; this.tabTimer = window.setTimeout(snippet.bind(function() { this.isLongtabed = true; }, this), this.longTabTerm); },
TimeGrid.prototype.onTick = function() { if (this.timerID) { clearTimeout(this.timerID); this.timerID = null; } if (!this.intervalID) { this.intervalID = setInterval(util.bind(this.onTick, this), HOURMARKER_REFRESH_INTERVAL); } this.refreshHourmarker(); };
AutoScroll.prototype._onMouseDown = function(mouseDownEvent) { // only primary button can start drag. if (domevent.getMouseButton(mouseDownEvent) !== 0) { return; } // deactivate autoscroll feature when mouse is on the scrollbar. (IE) if (util.browser.msie && this.isOnScrollbar(this.container, mouseDownEvent)) { return; } window.clearInterval(this._intervalID); this._intervalID = window.setInterval(util.bind(this._onTick, this), SCROLL_INTERVAL); domevent.on(global, { 'mousemove': this._onMouseMove, 'mouseup': this._onMouseUp }, this); };
init: function(tree, options) { options = snippet.extend({}, options); /** * Tree * @type {Tree} */ this.tree = tree; /** * Option for each request command * @type {Object} */ this.command = options.command; /** * Callback for parsing the response data * @type {?Function} */ this.parseData = options.parseData || null; /** * Classname of loader element * @type {string} */ this.loaderClassName = options.loaderClassName || LOADER_CLASSNAME; /** * State of loading root data or not * @type {boolean} */ this.isLoadRoot = !snippet.isUndefined(options.isLoadRoot) ? options.isLoadRoot : true; /** * Loader element * @type {HTMLElement} */ this.loader = null; this._createLoader(); tree.on('initFeature', snippet.bind(this._onInitFeature, this)); },