diff --git a/zk-Timeplot-1.0_2/timeplotz/src/archive/web/js/timeplotz/timeplot.js b/zk-Timeplot-1.0_2/timeplotz/src/archive/web/js/timeplotz/timeplot.js index 8b589559e..a470125ee 100755 --- a/zk-Timeplot-1.0_2/timeplotz/src/archive/web/js/timeplotz/timeplot.js +++ b/zk-Timeplot-1.0_2/timeplotz/src/archive/web/js/timeplotz/timeplot.js @@ -1,9 +1,9 @@ /*timeplot.js {{IS_NOTE Purpose: - + Description: - + History: Wed Jan 17 13:19:47 2008, Created by Gu WeiXing }}IS_NOTE @@ -14,12 +14,10710 @@ Copyright (C) Gu WeiXing. All Rights Reserved. }}IS_RIGHT */ +var DependencyChecker = {}; +DependencyChecker.onAvailable = function(depedencyCheck, callback, retriesLeft) { + if (retriesLeft === undefined) { + retriesLeft = 6 * 200; + } + if (retriesLeft === 0) { + alert("the dependency check " + depedencyCheck + " always fails"); + return; + } + try { + var result = depedencyCheck(); + } catch (e) { + setTimeout(function() { + DependencyChecker.onAvailable(depedencyCheck, callback, retriesLeft - 1); + }, 50); + return; + } + callback(); +}; /////////////////load timeplot js library//////////////////////////////// -zk.load("ext.timeline.api.zkTimeline-api"); //zk.load("ext.timeline.api.zkTimeline-api-bundle"); -zk.load("ext.timeplot.api.simile-ajax-api"); -zk.load("ext.timeplot.api.zkTimeplot-api"); +//zk.load("ext.timeline.api.zkTimeline-api"); + +//zkTimeline-api.js + +var Timeline = new Object(); +Timeline.Platform = new Object(); + /* + HACK: We need these 2 things here because we cannot simply append + a + * + *================================================== + */ + +if (typeof SimileAjax == "undefined") { + var SimileAjax = { + loaded: false, + loadingScriptsCount: 0, + error: null, + params: { bundle:"true" } + }; + + SimileAjax.Platform = new Object(); + /* + HACK: We need these 2 things here because we cannot simply append + a "); + return; + } catch (e) { + // fall through + } + } + + var script = doc.createElement("script"); + if (onerror) { + try { script.innerHTML = onerror; } catch(e) {} + script.setAttribute("onerror", onerror); + } + if (charset) { + script.setAttribute("charset", charset); + } + script.type = "text/javascript"; + script.language = "JavaScript"; + script.src = url; + return getHead(doc).appendChild(script); + }; + SimileAjax.includeJavascriptFiles = function(doc, urlPrefix, filenames) { + for (var i = 0; i < filenames.length; i++) { + SimileAjax.includeJavascriptFile(doc, urlPrefix + filenames[i]); + } + SimileAjax.loadingScriptsCount += filenames.length; + //SimileAjax.includeJavascriptFile(doc, SimileAjax.urlPrefix + "scripts/signal.js?" + filenames.length); + }; + SimileAjax.includeCssFile = function(doc, url) { + if (doc.body == null) { + try { + doc.write(""); + return; + } catch (e) { + // fall through + } + } + + var link = doc.createElement("link"); + link.setAttribute("rel", "stylesheet"); + link.setAttribute("type", "text/css"); + link.setAttribute("href", url); + getHead(doc).appendChild(link); + }; + SimileAjax.includeCssFiles = function(doc, urlPrefix, filenames) { + for (var i = 0; i < filenames.length; i++) { + SimileAjax.includeCssFile(doc, urlPrefix + filenames[i]); + } + }; + + /** + * Append into urls each string in suffixes after prefixing it with urlPrefix. + * @param {Array} urls + * @param {String} urlPrefix + * @param {Array} suffixes + */ + SimileAjax.prefixURLs = function(urls, urlPrefix, suffixes) { + for (var i = 0; i < suffixes.length; i++) { + urls.push(urlPrefix + suffixes[i]); + } + }; + + /** + * Parse out the query parameters from a URL + * @param {String} url the url to parse, or location.href if undefined + * @param {Object} to optional object to extend with the parameters + * @param {Object} types optional object mapping keys to value types + * (String, Number, Boolean or Array, String by default) + * @return a key/value Object whose keys are the query parameter names + * @type Object + */ + SimileAjax.parseURLParameters = function(url, to, types) { + to = to || {}; + types = types || {}; + + if (typeof url == "undefined") { + url = location.href; + } + var q = url.indexOf("?"); + if (q < 0) { + return to; + } + url = (url+"#").slice(q+1, url.indexOf("#")); // toss the URL fragment + + var params = url.split("&"), param, parsed = {}; + var decode = window.decodeURIComponent || unescape; + for (var i = 0; param = params[i]; i++) { + var eq = param.indexOf("="); + var name = decode(param.slice(0,eq)); + var old = parsed[name]; + if (typeof old == "undefined") { + old = []; + } else if (!(old instanceof Array)) { + old = [old]; + } + parsed[name] = old.concat(decode(param.slice(eq+1))); + } + for (var i in parsed) { + if (!parsed.hasOwnProperty(i)) continue; + var type = types[i] || String; + var data = parsed[i]; + if (!(data instanceof Array)) { + data = [data]; + } + if (type === Boolean && data[0] == "false") { + to[i] = false; // because Boolean("false") === true + } else { + to[i] = type.apply(this, data); + } + } + return to; + }; + + (function() { + var javascriptFiles = [ + "jquery-1.1.3.1.js", + "platform.js", + "debug.js", + "xmlhttp.js", + "json.js", + "dom.js", + "graphics.js", + "date-time.js", + "string.js", + "html.js", + "data-structure.js", + "units.js", + + "ajax.js", + "history.js", + "window-manager.js" + ]; + var cssFiles = [ + ]; + +// if (typeof SimileAjax_urlPrefix == "string") { +// SimileAjax.urlPrefix = SimileAjax_urlPrefix; +// } else { +// var url = SimileAjax.findScript(document, "simile-ajax-api.js"); +// if (url == null) { +// SimileAjax.error = new Error("Failed to derive URL prefix for Simile Ajax API code files"); +// return; +// } +// +// SimileAjax.urlPrefix = url.substr(0, url.indexOf("simile-ajax-api.js")); +// } +// +// SimileAjax.parseURLParameters(url, SimileAjax.params, {bundle:Boolean}); +// if (SimileAjax.params.bundle) { +// SimileAjax.includeJavascriptFiles(document, SimileAjax.urlPrefix, [ "simile-ajax-bundle.js" ]); +// } else { +// SimileAjax.includeJavascriptFiles(document, SimileAjax.urlPrefix + "scripts/", javascriptFiles); +// } + SimileAjax.includeCssFiles(document, SimileAjax.urlPrefix + "styles/", cssFiles); + + SimileAjax.loaded = true; + })(); +} + +// end of simile-ajax-api.js + +// zkTimeplot-api.js + +/*================================================== + * Timeplot API + * + * This file will load all the Javascript files + * necessary to make the standard timeplot work. + * It also detects the default locale. + * + * Include this file in your HTML file as follows: + * + * + * + *================================================== + */ + +var Timeplot = new Object(); +Timeplot = { + loaded: false, + params: { bundle: true, autoCreate: true }, + namespace: "http://simile.mit.edu/2007/06/timeplot#", + importers: {} + }; +Timeplot.Platform = new Object(); + /* + HACK: We need these 2 things here because we cannot simply append + a + * + *================================================== + */ + +var Timeplot = new Object(); +Timeplot = { + loaded: false, + params: { bundle: true, autoCreate: true }, + namespace: "http://simile.mit.edu/2007/06/timeplot#", + importers: {} + }; +Timeplot.Platform = new Object(); + /* + HACK: We need these 2 things here because we cannot simply append + a