⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 zptime-states.js

📁 zapatec suite 最新版 20070204,非常棒的ajax widgets 工具包
💻 JS
字号:
// $Id: zptime-states.js 6651 2007-03-19 10:15:22Z slip $/** * * Copyright (c) 2004-2006 by Zapatec, Inc. * http://www.zapatec.com * 1700 MLK Way, Berkeley, California, * 94709, U.S.A. * All rights reserved. *//** * Checks if needed state was reached and tryes to fire function exactly when it needs. * @param state [string] - required state; * @param func [function] - function needed to be fired * @param first [boolean] - should it go first * @return true if the state was already reached */Zapatec.TimeSelect.prototype.fireOnState = function(state, func) {	var self = this;	//special way for BODY load	if (state == "body_loaded") {		//Object was destroyed!		if (!this.stateReached("created")) {			return false;		}		//not loaded? - let's try again in 50 msecs		if (!Zapatec.windowLoaded) {			setTimeout(function() {func.call(self);}, 50);			return false;		}				return true;	}	//was state reached?	if (!this.stateReached(state)) {		//Object was destroyed!		if (!this.stateReached("created")) {			return false;		}		//or lets just add listener to the state		this.addEventListener(state, func);		//returning false, as function can not be executed		//and was scheduled		return false;	} else {		//state was reached we can execute function		return true;	}};/** * Changes the state of the widget, firing all the events planned * @param state [string] - state to set. * @return true if succeeds, otherwise false */Zapatec.TimeSelect.prototype.changeState = function(state) {	this.widgetState = state;	this.fireEvent(state);	return true;};/** * This method tells you wether the state you need was reached or maybe already passed. * Right now we have following states: * 'destroyed' - the object was destroyed; * 'created' - the instance of the object was created; * 'inited' - the object was inited (this include initing all variables, calling parent *            init and starting loading structure); * 'loaded' - the structure is loaded and parsed; * 'ready' - object has all the parts ready for work; * 'hidden' - object is visually hidden; * 'shown' - object is visible; * @param state [string] - the name of the state you need to check; * @return - true if the state was reached or already passed, otherwise false */Zapatec.TimeSelect.prototype.stateReached = function(state) {	//getting current state priority.	//if there is no such in our priority array we give it the highest priority, 	//which means count of states avaliable in the array.	var currentState = this.priorities[this.widgetState] || (this.priorities[this.widgetState] !== 0 ? this.priorities.count : 0);	//getting passed state priority.	//if there is no such in our priority array we give it the highest priority, 	//which means count of states avaliable in the array.	state = this.priorities[state] || (this.priorities[state] !== 0 ? this.priorities.count : 0);	//and now compareing them	if (state > currentState) {return false;}	return true;};

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -