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

📄 zapatec.js

📁 zapatec suite 最新版 20070204,非常棒的ajax widgets 工具包
💻 JS
📖 第 1 页 / 共 5 页
字号:
return null;}if(Zapatec.is_opera){var pairs = style.split(";");for(var ii =0; ii < pairs.length; ii++){var kv = pairs[ii].split(":");if (!kv[1]){continue;}var value = kv[1].replace(/^\s*/, '').replace(/\s*$/, '');var key = "";for(var jj = 0; jj < kv[0].length; jj++){if(kv[0].charAt(jj) == "-"){jj++;if(jj < kv[0].length){key += kv[0].charAt(jj).toUpperCase();}continue;}key += kv[0].charAt(jj);}switch(key){case "float":key = "cssFloat";break;}try{elRef.style[key] = value;}catch(e){}}}else{elRef.style.cssText = style;}return true;}Zapatec.Utils.getStyleProperty = function(objElement, strProperty){if (document.defaultView && document.defaultView.getComputedStyle){strProperty = strProperty.replace(/([A-Z])/g, '-$1').toLowerCase();return document.defaultView.getComputedStyle(objElement, '').getPropertyValue(strProperty);}else if (objElement.currentStyle){return objElement.currentStyle[strProperty];}return objElement.style[strProperty];};Zapatec.Utils.getPrecision = function(fFloat){return (fFloat + '').replace(/^\d*\.*/, '').length;};Zapatec.Utils.setPrecision = function(fFloat, iPrecision){var iPow = Math.pow(10, iPrecision);return parseInt(fFloat * iPow, 10) / iPow;};/* * zpeventdriven.js */if (typeof Zapatec == 'undefined'){Zapatec ={};}Zapatec.EventDriven = function(){};Zapatec.EventDriven.prototype.init = function(){this.events ={};};Zapatec.EventDriven.prototype.addEventListener = function(strEvent, funcListener, first){if (typeof funcListener != "function"){return false;}if (!this.events[strEvent]){this.events[strEvent] ={listeners: []};}if (!first){this.events[strEvent].listeners.push(funcListener);}else{this.events[strEvent].listeners.unshift(funcListener);}};Zapatec.EventDriven.prototype.removeEventListener = function(strEvent, funcListener){if (!this.events[strEvent]){return;}var arrListeners = this.events[strEvent].listeners;for (var iListener = 0; iListener < arrListeners.length; iListener++){if (arrListeners[iListener] == funcListener){arrListeners.splice(iListener, 1);return;}}};Zapatec.EventDriven.prototype.isEvent = function(strEvent){if (this.events[strEvent]){return true;}return false;};Zapatec.EventDriven.prototype.removeEvent = function(strEvent){if (this.events[strEvent]){var undef;this.events[strEvent] = undef;}};Zapatec.EventDriven.prototype.fireEvent = function(strEvent){if (!this.events[strEvent]){return;}var arrListeners = this.events[strEvent].listeners;for (var iListener = 0; iListener < arrListeners.length; iListener++){var arrArgs = [].slice.call(arguments, 1);arrListeners[iListener].apply(this, arrArgs);}};Zapatec.EventDriven.events ={};Zapatec.EventDriven.addEventListener = function(strEvent, funcListener){if (typeof funcListener != "function"){return false;}if (!Zapatec.EventDriven.events[strEvent]){Zapatec.EventDriven.events[strEvent] ={listeners: []};}Zapatec.EventDriven.events[strEvent].listeners.push(funcListener);};Zapatec.EventDriven.removeEventListener = function(strEvent, funcListener){if (!Zapatec.EventDriven.events[strEvent]){return;}var arrListeners = Zapatec.EventDriven.events[strEvent].listeners;for (var iListener = 0; iListener < arrListeners.length; iListener++){if (arrListeners[iListener] == funcListener){arrListeners.splice(iListener, 1);return;}}};Zapatec.EventDriven.isEvent = function(strEvent){if (Zapatec.EventDriven.events[strEvent]){return true;}return false;};Zapatec.EventDriven.removeEvent = function(strEvent){if (Zapatec.EventDriven.events[strEvent]){var undef;Zapatec.EventDriven.events[strEvent] = undef;}};Zapatec.EventDriven.fireEvent = function(strEvent){if (!Zapatec.EventDriven.events[strEvent]){return;}var arrListeners = Zapatec.EventDriven.events[strEvent].listeners;for (var iListener = 0; iListener < arrListeners.length; iListener++){var arrArgs = [].slice.call(arguments, 1);arrListeners[iListener].apply(arrListeners[iListener], arrArgs);}};/* * transport.js */if (typeof Zapatec == 'undefined'){Zapatec = function(){};}Zapatec.Transport = function(){};if (typeof ActiveXObject != 'undefined'){Zapatec.Transport.XMLDOM = null;Zapatec.Transport.XMLHTTP = null;Zapatec.Transport.pickActiveXVersion = function(arrVersions){for (var iVn = 0; iVn < arrVersions.length; iVn++){try{var objDocument = new ActiveXObject(arrVersions[iVn]);return arrVersions[iVn];}catch (objException){};}return null;};Zapatec.Transport.XMLDOM = Zapatec.Transport.pickActiveXVersion(['Msxml2.DOMDocument.4.0','Msxml2.DOMDocument.3.0','MSXML2.DOMDocument','MSXML.DOMDocument','Microsoft.XMLDOM']);Zapatec.Transport.XMLHTTP = Zapatec.Transport.pickActiveXVersion(['Msxml2.XMLHTTP.4.0','MSXML2.XMLHTTP.3.0','MSXML2.XMLHTTP','Microsoft.XMLHTTP']);Zapatec.Transport.pickActiveXVersion = null;}Zapatec.Transport.createXmlHttpRequest = function(){if (typeof XMLHttpRequest != 'undefined'){return new XMLHttpRequest();}if (typeof ActiveXObject != 'undefined'){try{return new ActiveXObject(Zapatec.Transport.XMLHTTP);}catch (objException){};}return null;};Zapatec.Transport.isBusy = function(objArgs){var objContainer = objArgs.busyContainer;if (typeof objContainer == 'string'){objContainer = document.getElementById(objContainer);}if (!objContainer){return;}var strImage = objArgs.busyImage;if (typeof strImage != 'string'){strImage = '';}strImage = strImage.split('/').pop();if (!strImage.length){strImage = 'zpbusy.gif';}var objFC = objContainer.firstChild;if (objFC){objFC = objFC.firstChild;if (objFC){objFC = objFC.firstChild;if (objFC && objFC.tagName && objFC.tagName.toLowerCase() == 'img'){var strSrc = objFC.getAttribute('src');if (typeof strSrc == 'string' && strSrc.length){strSrc = strSrc.split('/').pop();if (strSrc == strImage){return true;}}}}}return false;};Zapatec.Transport.showBusy = function(objArgs){if (Zapatec.Transport.isBusy(objArgs)){return;}var objContainer = objArgs.busyContainer;if (typeof objContainer == 'string'){objContainer = document.getElementById(objContainer);}if (!objContainer){return;}var strImage = objArgs.busyImage;var strImageWidth = objArgs.busyImageWidth;var strImageHeight = objArgs.busyImageHeight;if (typeof strImage != 'string' || !strImage.length){strImage = 'zpbusy.gif';}else{if (typeof strImageWidth == 'number' ||(typeof strImageWidth == 'string' && /\d$/.test(strImageWidth))){strImageWidth += 'px';}if (typeof strImageHeight == 'number' ||(typeof strImageHeight == 'string' && /\d$/.test(strImageHeight))){strImageHeight += 'px';}}if (!strImageWidth){strImageWidth = '65px';}if (!strImageHeight){strImageHeight = '35px';}var strPath = '';if (strImage.indexOf('/') < 0){strPath = Zapatec.Transport.getPath('transport.js');}var arrImgTag = [];arrImgTag.push('<img src="');arrImgTag.push(strPath);arrImgTag.push(strImage);arrImgTag.push('"');if (strImageWidth || strImageHeight){arrImgTag.push(' style="');if (strImageWidth){arrImgTag.push('width:');arrImgTag.push(strImageWidth);arrImgTag.push(';');}if (strImageHeight){arrImgTag.push('height:');arrImgTag.push(strImageHeight);}arrImgTag.push('"');}arrImgTag.push(' />');strImgTag = arrImgTag.join('');var iContainerWidth = objContainer.offsetWidth;var iContainerHeight = objContainer.offsetHeight;var objBusyContainer = Zapatec.Utils.createElement('div');objBusyContainer.style.position = 'relative';objBusyContainer.style.zIndex = 2147483583;var objBusy = Zapatec.Utils.createElement('div', objBusyContainer);objBusy.style.position = 'absolute';objBusy.innerHTML = strImgTag;if (objContainer.firstChild){objContainer.insertBefore(objBusyContainer, objContainer.firstChild);}else{objContainer.appendChild(objBusyContainer);}var iBusyWidth = objBusy.offsetWidth;var iBusyHeight = objBusy.offsetHeight;if (iContainerWidth > iBusyWidth){objBusy.style.left = objContainer.scrollLeft +(iContainerWidth - iBusyWidth) / 2 + 'px';}if (iContainerHeight > iBusyHeight){objBusy.style.top = objContainer.scrollTop +(iContainerHeight - iBusyHeight) / 2 + 'px';}};Zapatec.Transport.removeBusy = function(objArgs){var objContainer = objArgs.busyContainer;if (typeof objContainer == 'string'){objContainer = document.getElementById(objContainer);}if (!objContainer){return;}if (Zapatec.Transport.isBusy(objArgs)){objContainer.removeChild(objContainer.firstChild);}};Zapatec.Transport.fetch = function(objArgs){if (objArgs == null || typeof objArgs != 'object'){return null;}if (!objArgs.url){return null;}if (!objArgs.method){objArgs.method = 'GET';}if (typeof objArgs.async == 'undefined'){objArgs.async = true;}if (!objArgs.contentType && objArgs.method.toUpperCase() == 'POST'){objArgs.contentType = 'application/x-www-form-urlencoded';}if (!objArgs.content){objArgs.content = null;}if (!objArgs.onLoad){objArgs.onLoad = null;}if (!objArgs.onError){objArgs.onError = null;}var objRequest = Zapatec.Transport.createXmlHttpRequest();if (objRequest == null){return null;}Zapatec.Transport.showBusy(objArgs);var boolErrorDisplayed = false;var funcOnReady = function (){Zapatec.Transport.removeBusy(objArgs);try{if (objRequest.status == 200 || objRequest.status == 304 ||(location.protocol == 'file:' && !objRequest.status)){if (typeof objArgs.onLoad == 'function'){objArgs.onLoad(objRequest);}}else if (!boolErrorDisplayed){boolErrorDisplayed = true;Zapatec.Transport.displayError(objRequest.status,"Error: Can't fetch " + objArgs.url + '.\n' +(objRequest.statusText || ''),objArgs.onError);}}catch (objException){if (!boolErrorDisplayed){boolErrorDisplayed = true;if (objException.name &&objException.name == 'NS_ERROR_NOT_AVAILABLE'){Zapatec.Transport.displayError(0,"Error: Can't fetch " + objArgs.url + '.\nFile not found.',objArgs.onError);}else{Zapatec.Transport.displayError(0,"Error: Can't fetch " + objArgs.url + '.\n' +(objException.message || ''),objArgs.onError);}}};};try{if (typeof objArgs.username != 'undefined' &&typeof objArgs.password != 'undefined'){objRequest.open(objArgs.method, objArgs.url, objArgs.async,objArgs.username, objArgs.password);}else{objRequest.open(objArgs.method, objArgs.url, objArgs.async);}if (objArgs.async){objRequest.onreadystatechange = function (){if (objRequest.readyState == 4){funcOnReady();objRequest.onreadystatechange ={};}};}if (objArgs.contentType){objRequest.setRequestHeader('Content-Type', objArgs.contentType);}objRequest.send(objArgs.content);if (!objArgs.async){funcOnReady();return objRequest;}}catch (objException){Zapatec.Transport.removeBusy(objArgs);if (!boolErrorDisplayed){boolErrorDisplayed = true;if (objException.name &&objException.name == 'NS_ERROR_FILE_NOT_FOUND'){Zapatec.Transport.displayError(0,"Error: Can't fetch " + objArgs.url + '.\nFile not found.',objArgs.onError);}else{Zapatec.Transport.displayError(0,"Error: Can't fetch " + objArgs.url + '.\n' +(objException.message || ''),objArgs.onError);}}};return null;};Zapatec.Transport.parseHtml = function(strHtml){strHtml += '';strHtml = strHtml.replace(/^\s+/g, '');var objTempContainer = null;if (document.createElementNS){objTempContainer =document.createElementNS('http://www.w3.org/1999/xhtml', 'div');}else{objTempContainer = document.createElement('div');}objTempContainer.innerHTML = strHtml;return objTempContainer;};Zapatec.Transport.evalGlobalScope = function(strScript){if (typeof strScript != 'string' || !strScript.match(/\S/)){return;}if (window.execScript){window.execScript(strScript, 'javascript');}else if (window.eval){window.eval(strScript);}};Zapatec.Transport.setInnerHtml = function(objArgs){if (!objArgs || typeof objArgs.html != 'string'){return;}var strHtml = objArgs.html;var objContainer = null;if (typeof objArgs.container == 'string'){objContainer = document.getElementById(objArgs.container);}else if (typeof objArgs.container == 'object'){objContainer = objArgs.container;}var arrScripts = [];if (strHtml.match(/<\s*\/\s*script\s*>/i)){var arrTokens = strHtml.split(/<\s*\/\s*script\s*>/i);var arrHtml = [];for (var iToken = arrTokens.length - 1; iToken >= 0; iToken--){var strToken = arrTokens[iToken];if (strToken.match(/\S/)){var arrMatch = strToken.match(/<\s*script([^>]*)>/i);if (arrMatch){var arrCouple = strToken.split(/<\s*script[^>]*>/i);while (arrCouple.length < 2){if (strToken.match(/^<\s*script[^>]*>/i)){arrCouple.unshift('');}else{arrCouple.push('');}}arrHtml.unshift(arrCouple[0]);var strAttrs = arrMatch[1];var srtScript = arrCouple[1];if (strAttrs.match(/\s+src\s*=/i)){srtScript = '';}else{srtScript = srtScript.replace(/function\s+([^(]+)/g, '$1=function');}arrScripts.push([strAttrs, srtScript]);}else if (iToken < arrTokens.length - 1){arrTokens[iToken - 1] += '</script>' + strToken;}else{arrHtml.unshift(strToken);}}else{arrHtml.unshift(strToken);}}strHtml = arrHtml.join('');}if (objContainer){if (window.opera){objContainer.innerHTML = '<form></form>';}objContainer.innerHTML = strHtml;}for (var iScript = 0; iScript < arrScripts.length; iScript++){

⌨️ 快捷键说明

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