Added: struts/sandbox/trunk/overdrive/PhoneBook2/projects/www/website/gwt.js URL: http://svn.apache.org/viewvc/struts/sandbox/trunk/overdrive/PhoneBook2/projects/www/website/gwt.js?view=auto&rev=489200 ============================================================================== --- struts/sandbox/trunk/overdrive/PhoneBook2/projects/www/website/gwt.js (added) +++ struts/sandbox/trunk/overdrive/PhoneBook2/projects/www/website/gwt.js Wed Dec 20 13:10:10 2006 @@ -0,0 +1,578 @@ +// Copyright 2006 Google Inc. All Rights Reserved. +// This startup script should be included in host pages either just after +// <body> or inside the <head> after module <meta> tags. +// + +////////////////////////////////////////////////////////////////////////////// +// DynamicResources +// + +function DynamicResources() { + this.pendingElemsBySrc_ = {}; + this.pendingScriptElems_ = new Array(); +} +DynamicResources.prototype = {}; + +// The array is set up such that, pairwise, the entries are (src, readyFnStr). +// Called once for each module that is attached to the host page. +// It is theoretically possible that addScripts() could be called reentrantly +// if the browser event loop is pumped during this function and an iframe loads; +// we may want to enhance this method in the future to support that case. +DynamicResources.prototype.addScripts = function(scriptArray, insertBeforeElem) { + var wasEmpty = (this.pendingScriptElems_.length == 0); + var anyAdded = false; + for (var i = 0, n = scriptArray.length; i < n; i += 2) { + var src = scriptArray[i]; + if (this.pendingElemsBySrc_[src]) { + // Don't load the same script twice. + continue; + } + // Set up the element but don't add it to the DOM until its turn. + anyAdded = true; + var e = document.createElement("script"); + this.pendingElemsBySrc_[src] = e; + var readyFn; + eval("readyFn = " + scriptArray[i+1]); + e.__readyFn = readyFn; + e.type = "text/javascript"; + e.src = src; + e.__insertBeforeElem = insertBeforeElem; + this.pendingScriptElems_ = this.pendingScriptElems_.concat(e); + } + + if (wasEmpty && anyAdded) { + // Kickstart. + this.injectScript(this.pendingScriptElems_[0]); + } +} + +DynamicResources.prototype.injectScript = function(scriptElem) { + var parentElem = scriptElem.__insertBeforeElem.parentNode; + parentElem.insertBefore(scriptElem, scriptElem.__insertBeforeElem); +} + +DynamicResources.prototype.addStyles = function(styleSrcArray, insertBeforeElem) { + var parent = insertBeforeElem.parentNode; + for (var i = 0, n = styleSrcArray.length; i < n; ++i) { + var src = styleSrcArray[i]; + if (this.pendingElemsBySrc_[src]) + continue; + var e = document.createElement("link"); + this.pendingElemsBySrc_[src] = e; + e.type = "text/css"; + e.rel = "stylesheet"; + e.href = src; + parent.insertBefore(e, insertBeforeElem); + } +} + +DynamicResources.prototype.isReady = function() { + var elems = this.pendingScriptElems_; + if (elems.length > 0) { + var e = elems[0]; + if (!e.__readyFn()) { + // The pending script isn't ready yet. + return false; + } + + // The pending script has now finished loading. Enqueue the next, if any. + e.__readyFn = null; + elems.shift(); + if (elems.length > 0) { + // There is another script. + this.injectScript(elems[0]); + return false; + } + } + + // There are no more pending scripts. + return true; +} + +////////////////////////////////////////////////////////////////////////////// +// ModuleControlBlock +// +function ModuleControlBlock(metaElem, rawName) { + var parts = ["", rawName]; + var i = rawName.lastIndexOf("="); + if (i != -1) { + parts[0] = rawName.substring(0, i) + '/'; + parts[1] = rawName.substring(i+1); + } + + this.metaElem_ = metaElem; + this.baseUrl_ = parts[0]; + this.name_ = parts[1]; + this.compilationLoaded_ = false; + this.frameWnd_ = null; +} +ModuleControlBlock.prototype = {}; + +/** + * Determines whether this module is fully loaded and ready to run. + */ +ModuleControlBlock.prototype.isReady = function() { + return this.compilationLoaded_; +}; + +/** + * Called when the compilation for this module is loaded. + */ +ModuleControlBlock.prototype.compilationLoaded = function(frameWnd) { + this.frameWnd_ = frameWnd; + this.compilationLoaded_ = true; +} + +/** + * Gets the logical module name, not including a base url prefix if one was + * specified. + */ +ModuleControlBlock.prototype.getName = function() { + return this.name_; +} + +/** + * Gets the base URL of the module, guaranteed to end with a slash. + */ +ModuleControlBlock.prototype.getBaseURL = function() { + return this.baseUrl_; +} + +/** + * Gets the window of the module's frame. + */ +ModuleControlBlock.prototype.getModuleFrameWindow = function() { + return this.frameWnd_; +} + +/** + * Injects a set of dynamic scripts. + * The array is set up such that, pairwise, the entries are (src, readyFnStr). + */ +ModuleControlBlock.prototype.addScripts = function(scriptSrcArray) { + return ModuleControlBlocks.dynamicResources_.addScripts(scriptSrcArray, this.metaElem_); +} + +/** + * Injects a set of dynamic styles. + */ +ModuleControlBlock.prototype.addStyles = function(styleSrcArray) { + return ModuleControlBlocks.dynamicResources_.addStyles(styleSrcArray, this.metaElem_); +} + +////////////////////////////////////////////////////////////////////////////// +// ModuleControlBlocks +// +function ModuleControlBlocks() { + this.blocks_ = []; +} +ModuleControlBlocks.dynamicResources_ = new DynamicResources(); // "static" +ModuleControlBlocks.prototype = {}; + +/** + * Adds a module control control block for the named module. + * @param metaElem the meta element that caused the module to be added + * @param name the name of the module being added, optionally preceded by + * an alternate base url of the form "_path_=_module_". + */ +ModuleControlBlocks.prototype.add = function(metaElem, name) { + var mcb = new ModuleControlBlock(metaElem, name); + this.blocks_ = this.blocks_.concat(mcb); +}; + +/** + * Determines whether all the modules are loaded and ready to run. + */ +ModuleControlBlocks.prototype.isReady = function() { + for (var i = 0, n = this.blocks_.length; i < n; ++i) { + var mcb = this.blocks_[i]; + if (!mcb.isReady()) { + return false; + } + } + + // Are there any pending dynamic resources (e.g. styles, scripts)? + if (!ModuleControlBlocks.dynamicResources_.isReady()) { + // No, we're still waiting on one or more dynamic resources. + return false; + } + + return true; +} + +/** + * Determines whether there are any module control blocks. + */ +ModuleControlBlocks.prototype.isEmpty = function() { + return this.blocks_.length == 0; +} + +/** + * Gets the module control block at the specified index. + */ +ModuleControlBlocks.prototype.get = function(index) { + return this.blocks_[index]; +} + +/** + * Injects an iframe for each module. + */ +ModuleControlBlocks.prototype.injectFrames = function() { + for (var i = 0, n = this.blocks_.length; i < n; ++i) { + var mcb = this.blocks_[i]; + + // Insert an iframe for the module + var iframe = document.createElement("iframe"); + var selectorUrl = mcb.getBaseURL() + mcb.getName() + ".nocache.html"; + selectorUrl += "?" + (__gwt_isHosted() ? "h&" : "" ) + i; + var unique = new Date().getTime(); + selectorUrl += "&" + unique; + iframe.style.border = '0px'; + iframe.style.width = '0px'; + iframe.style.height = '0px'; + + // Fragile browser-specific ordering issues below + +/[EMAIL PROTECTED] + // prevent extra clicky noises on IE + iframe.src = selectorUrl; [EMAIL PROTECTED]/ + + if (document.body.firstChild) { + document.body.insertBefore(iframe, document.body.firstChild); + } else { + document.body.appendChild(iframe); + } + +/[EMAIL PROTECTED] + // prevent extra clicky noises on IE + return; [EMAIL PROTECTED]/ + + if (iframe.contentWindow) { + // Older Mozilla has a caching bug for the iframe and won't reload the nocache. + iframe.contentWindow.location.replace(selectorUrl); + } else { + // Older Safari doesn't have a contentWindow. + iframe.src = selectorUrl; + } + } +} + +/** + * Runs the entry point for each module. + */ +ModuleControlBlocks.prototype.run = function() { + for (var i = 0, n = this.blocks_.length; i < n; ++i) { + var mcb = this.blocks_[i]; + var name = mcb.getName(); + var frameWnd = mcb.getModuleFrameWindow(); + if (__gwt_isHosted()) { + if (!window.external.gwtOnLoad(frameWnd, name)) { + // Module failed to load. + if (__gwt_onLoadError) { + __gwt_onLoadError(name); + } else { + window.alert("Failed to load module '" + name + + "'.\nPlease see the log in the development shell for details."); + } + } + } else { + // The compilation itself handles calling the error function. + frameWnd.gwtOnLoad(__gwt_onLoadError, name); + } + } +} + +////////////////////////////////////////////////////////////////////////////// +// Globals +// + +var __gwt_retryWaitMillis = 10; +var __gwt_isHostPageLoaded = false; +var __gwt_metaProps = {}; +var __gwt_onPropertyError = null; +var __gwt_onLoadError = null; +var __gwt_moduleControlBlocks = new ModuleControlBlocks(); + +////////////////////////////////////////////////////////////////////////////// +// Common +// + +/** + * Determines whether or not the page is being loaded in the GWT hosted browser. + */ +function __gwt_isHosted() { + if (window.external && window.external.gwtOnLoad) { + // gwt.hybrid makes the hosted browser pretend not to be + if (document.location.href.indexOf("gwt.hybrid") == -1) { + return true; + } + } + return false; +} + +/** + * Tries to get a module control block based on a query string passed in from + * the caller. Used by iframes to get references back to their mcbs. + * @param queryString the entire query string as returned by location.search, + * which notably includes the leading '?' if one is specified + * @return the relevant module control block, or <code>null</code> if it cannot + * be derived based on <code>queryString</code> + */ +function __gwt_tryGetModuleControlBlock(queryString) { + if (queryString.length > 0) { + // The pattern is ?[h&]<index>[&<unique>] + var queryString = queryString.substring(1); + if (queryString.indexOf("h&") == 0) { + // Ignore the hosted mode flag here; only GWTShellServlet cares about it. + queryString = queryString.substring(2); + } + var pos = queryString.indexOf("&"); + if (pos >= 0) { + queryString = queryString.substring(0, pos); + } + var mcbIndex = parseInt(queryString); + if (!isNaN(mcbIndex)) { + var mcb = __gwt_moduleControlBlocks.get(mcbIndex); + return mcb; + } + // Ignore the unique number that remains on the query string. + } + return null; +} + +/** + * Parses meta tags from the host html. + * + * <meta name="gwt:module" content="_module-name_"> + * causes the specified module to be loaded + * + * <meta name="gwt:property" content="_name_=_value_"> + * statically defines a deferred binding client property + * + * <meta name="gwt:onPropertyErrorFn" content="_fnName_"> + * specifies the name of a function to call if a client property is set to + * an invalid value (meaning that no matching compilation will be found) + * + * <meta name="gwt:onLoadErrorFn" content="_fnName_"> + * specifies the name of a function to call if an exception happens during + * bootstrapping or if a module throws an exception out of onModuleLoad(); + * the function should take a message parameter + */ +function __gwt_processMetas() { + var metas = document.getElementsByTagName("meta"); + for (var i = 0, n = metas.length; i < n; ++i) { + var meta = metas[i]; + var name = meta.getAttribute("name"); + if (name) { + if (name == "gwt:module") { + var moduleName = meta.getAttribute("content"); + if (moduleName) { + __gwt_moduleControlBlocks.add(meta, moduleName); + } + } else if (name == "gwt:property") { + var content = meta.getAttribute("content"); + if (content) { + var name = content, value = ""; + var eq = content.indexOf("="); + if (eq != -1) { + name = content.substring(0, eq); + value = content.substring(eq+1); + } + __gwt_metaProps[name] = value; + } + } else if (name == "gwt:onPropertyErrorFn") { + var content = meta.getAttribute("content"); + if (content) { + try { + __gwt_onPropertyError = eval(content); + } catch (e) { + window.alert("Bad handler \"" + content + + "\" for \"gwt:onPropertyErrorFn\""); + } + } + } else if (name == "gwt:onLoadErrorFn") { + var content = meta.getAttribute("content"); + if (content) { + try { + __gwt_onLoadError = eval(content); + } catch (e) { + window.alert("Bad handler \"" + content + + "\" for \"gwt:onLoadErrorFn\""); + } + } + } + } + } +} + +/** + * Determines the value of a deferred binding client property specified + * statically in host html. + */ +function __gwt_getMetaProperty(name) { + var value = __gwt_metaProps[name]; + if (value) { + return value; + } else { + return null; + } +} + +/** + * Determines whether or not a particular property value is allowed. + * @param wnd the caller's window object (not $wnd!) + * @param propName the name of the property being checked + * @param propValue the property value being tested + */ +function __gwt_isKnownPropertyValue(wnd, propName, propValue) { + return propValue in wnd["values$" + propName]; +} + +/** + * Called by the selection script when a property has a bad value or is missing. + * 'allowedValues' is an array of strings. Can be hooked in the host page using + * gwt:onPropertyErrorFn. + */ +function __gwt_onBadProperty(moduleName, propName, allowedValues, badValue) { + if (__gwt_onPropertyError) { + __gwt_onPropertyError(moduleName, propName, allowedValues, badValue); + return; + } else { + var msg = "While attempting to load module \"" + moduleName + "\", "; + if (badValue != null) { + msg += "property \"" + propName + "\" was set to the unexpected value \"" + + badValue + "\""; + } else { + msg += "property \"" + propName + "\" was not specified"; + } + + msg += "\n\nAllowed values: " + allowedValues; + + window.alert(msg); + } +} + +/** + * Called directly from compiled code. + */ +function __gwt_initHandlers(resize, beforeunload, unload) { + var oldOnResize = window.onresize; + window.onresize = function() { + resize(); + if (oldOnResize) + oldOnResize(); + }; + + var oldOnBeforeUnload = window.onbeforeunload; + window.onbeforeunload = function() { + var ret = beforeunload(); + + var oldRet; + if (oldOnBeforeUnload) + oldRet = oldOnBeforeUnload(); + + if (ret !== null) + return ret; + return oldRet; + }; + + var oldOnUnload = window.onunload; + window.onunload = function() { + unload(); + if (oldOnUnload) + oldOnUnload(); + }; +} + +////////////////////////////////////////////////////////////////////////////// +// Hosted Mode +// +function __gwt_onUnloadHostedMode() { + window.external.gwtOnLoad(null, null); + if (__gwt_onUnloadHostedMode.oldUnloadHandler) { + __gwt_onUnloadHostedMode.oldUnloadHandler(); + } +} + +////////////////////////////////////////////////////////////////////////////// +// Bootstrap +// + +/** + * Waits until all startup preconditions are satisfied, then launches the + * user-defined startup code for each module. + */ +function __gwt_latchAndLaunch() { + var ready = true; + + // Are there any compilations still pending? + if (ready && !__gwt_moduleControlBlocks.isReady()) { + // Yes, we're still waiting on one or more compilations. + ready = false; + } + + // Has the host html onload event fired? + if (ready && !__gwt_isHostPageLoaded) { + // No, the host html page hasn't fully loaded. + ready = false; + } + + // Are we ready to run user code? + if (ready) { + // Yes: run entry points. + __gwt_moduleControlBlocks.run(); + } else { + // No: try again soon. + window.setTimeout(__gwt_latchAndLaunch, __gwt_retryWaitMillis); + } +} + +/** + * Starts the module-loading sequence after meta tags have been processed and + * the body element exists. + */ +function __gwt_loadModules() { + // Make sure the body element exists before starting. + if (!document.body) { + // Try again soon. + window.setTimeout(__gwt_loadModules, __gwt_retryWaitMillis); + return; + } + + // Inject a frame for each module. + __gwt_moduleControlBlocks.injectFrames(); + + // Try to launch module entry points once everything is ready. + __gwt_latchAndLaunch(); +} + +/** + * The very first thing to run, and it runs exactly once unconditionally. + */ +function __gwt_bootstrap() { + // Hook onunload for hosted mode. + if (__gwt_isHosted()) { + __gwt_onUnloadHostedMode.oldUnloadHandler = window.onunload; + window.onunload = __gwt_onUnloadHostedMode; + } + + // Hook the current window onload handler. + var oldHandler = window.onload; + window.onload = function() { + __gwt_isHostPageLoaded = true; + if (oldHandler) { + oldHandler(); + } + }; + + // Parse meta tags from host html. + __gwt_processMetas(); + + // Load any modules. + __gwt_loadModules(); +} + +// Go. +__gwt_bootstrap();
Added: struts/sandbox/trunk/overdrive/PhoneBook2/projects/www/website/history.html URL: http://svn.apache.org/viewvc/struts/sandbox/trunk/overdrive/PhoneBook2/projects/www/website/history.html?view=auto&rev=489200 ============================================================================== --- struts/sandbox/trunk/overdrive/PhoneBook2/projects/www/website/history.html (added) +++ struts/sandbox/trunk/overdrive/PhoneBook2/projects/www/website/history.html Wed Dec 20 13:10:10 2006 @@ -0,0 +1,20 @@ +<html> +<head> +<script> +function hst() { + var search = location.search; + var historyToken = ''; + if (location.search.length > 0) + historyToken = decodeURIComponent(location.search.substring(1)); + + document.getElementById('__historyToken').value = historyToken; + if (parent.__onHistoryChanged) + parent.__onHistoryChanged(historyToken); +} +</script></head> +<body onload='hst()'> + +<input type='text' id='__historyToken'> + +</body> +</html> Added: struts/sandbox/trunk/overdrive/PhoneBook2/projects/www/website/json.js URL: http://svn.apache.org/viewvc/struts/sandbox/trunk/overdrive/PhoneBook2/projects/www/website/json.js?view=auto&rev=489200 ============================================================================== --- struts/sandbox/trunk/overdrive/PhoneBook2/projects/www/website/json.js (added) +++ struts/sandbox/trunk/overdrive/PhoneBook2/projects/www/website/json.js Wed Dec 20 13:10:10 2006 @@ -0,0 +1,378 @@ +/* +Copyright (c) 2005 JSON.org + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The Software shall be used for Good, not Evil. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*/ + +/* + The global object JSON contains two methods. + + JSON.stringify(value) takes a JavaScript value and produces a JSON text. + The value must not be cyclical. + + JSON.parse(text) takes a JSON text and produces a JavaScript value. It will + return false if there is an error. +*/ +var JSON = function () { + var m = { + '\b': '\\b', + '\t': '\\t', + '\n': '\\n', + '\f': '\\f', + '\r': '\\r', + '"' : '\\"', + '\\': '\\\\' + }, + s = { + 'boolean': function (x) { + return String(x); + }, + number: function (x) { + return isFinite(x) ? String(x) : 'null'; + }, + string: function (x) { + if (/["\\\x00-\x1f]/.test(x)) { + x = x.replace(/([\x00-\x1f\\"])/g, function(a, b) { + var c = m[b]; + if (c) { + return c; + } + c = b.charCodeAt(); + return '\\u00' + + Math.floor(c / 16).toString(16) + + (c % 16).toString(16); + }); + } + return '"' + x + '"'; + }, + object: function (x) { + if (x) { + var a = [], b, f, i, l, v; + if (x instanceof Array) { + a[0] = '['; + l = x.length; + for (i = 0; i < l; i += 1) { + v = x[i]; + f = s[typeof v]; + if (f) { + v = f(v); + if (typeof v == 'string') { + if (b) { + a[a.length] = ','; + } + a[a.length] = v; + b = true; + } + } + } + a[a.length] = ']'; + } else if (x instanceof Object) { + a[0] = '{'; + for (i in x) { + v = x[i]; + f = s[typeof v]; + if (f) { + v = f(v); + if (typeof v == 'string') { + if (b) { + a[a.length] = ','; + } + a.push(s.string(i), ':', v); + b = true; + } + } + } + a[a.length] = '}'; + } else { + return; + } + return a.join(''); + } + return 'null'; + } + }; + return { + copyright: '(c)2005 JSON.org', + license: 'http://www.crockford.com/JSON/license.html', +/* + Stringify a JavaScript value, producing a JSON text. +*/ + stringify: function (v) { + var f = s[typeof v]; + if (f) { + v = f(v); + if (typeof v == 'string') { + return v; + } + } + return null; + }, +/* + Parse a JSON text, producing a JavaScript value. + It returns false if there is a syntax error. +*/ + eval: function (text) { + try { + if (/^("(\\.|[^"\\\n\r])*?"|[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t])+?$/.test(text)) { + return eval('(' + text + ')'); + } + } catch (e) { + } + throw new SyntaxError("eval"); + }, + + parse: function (text) { + var at = 0; + var ch = ' '; + + function error(m) { + throw { + name: 'JSONError', + message: m, + at: at - 1, + text: text + }; + } + + function next() { + ch = text.charAt(at); + at += 1; + return ch; + } + + function white() { + while (ch) { + if (ch <= ' ') { + next(); + } else if (ch == '/') { + switch (next()) { + case '/': + while (next() && ch != '\n' && ch != '\r') {} + break; + case '*': + next(); + for (;;) { + if (ch) { + if (ch == '*') { + if (next() == '/') { + next(); + break; + } + } else { + next(); + } + } else { + error("Unterminated comment"); + } + } + break; + default: + error("Syntax error"); + } + } else { + break; + } + } + } + + function string() { + var i, s = '', t, u; + + if (ch == '"') { + outer: while (next()) { + if (ch == '"') { + next(); + return s; + } else if (ch == '\\') { + switch (next()) { + case 'b': + s += '\b'; + break; + case 'f': + s += '\f'; + break; + case 'n': + s += '\n'; + break; + case 'r': + s += '\r'; + break; + case 't': + s += '\t'; + break; + case 'u': + u = 0; + for (i = 0; i < 4; i += 1) { + t = parseInt(next(), 16); + if (!isFinite(t)) { + break outer; + } + u = u * 16 + t; + } + s += String.fromCharCode(u); + break; + default: + s += ch; + } + } else { + s += ch; + } + } + } + error("Bad string"); + } + + function array() { + var a = []; + + if (ch == '[') { + next(); + white(); + if (ch == ']') { + next(); + return a; + } + while (ch) { + a.push(value()); + white(); + if (ch == ']') { + next(); + return a; + } else if (ch != ',') { + break; + } + next(); + white(); + } + } + error("Bad array"); + } + + function object() { + var k, o = {}; + + if (ch == '{') { + next(); + white(); + if (ch == '}') { + next(); + return o; + } + while (ch) { + k = string(); + white(); + if (ch != ':') { + break; + } + next(); + o[k] = value(); + white(); + if (ch == '}') { + next(); + return o; + } else if (ch != ',') { + break; + } + next(); + white(); + } + } + error("Bad object"); + } + + function number() { + var n = '', v; + if (ch == '-') { + n = '-'; + next(); + } + while (ch >= '0' && ch <= '9') { + n += ch; + next(); + } + if (ch == '.') { + n += '.'; + while (next() && ch >= '0' && ch <= '9') { + n += ch; + } + } + if (ch == 'e' || ch == 'E') { + n += 'e'; + next(); + if (ch == '-' || ch == '+') { + n += ch; + next(); + } + while (ch >= '0' && ch <= '9') { + n += ch; + next(); + } + } + v = +n; + if (!isFinite(v)) { + ////error("Bad number"); + } else { + return v; + } + } + + function word() { + switch (ch) { + case 't': + if (next() == 'r' && next() == 'u' && next() == 'e') { + next(); + return true; + } + break; + case 'f': + if (next() == 'a' && next() == 'l' && next() == 's' && + next() == 'e') { + next(); + return false; + } + break; + case 'n': + if (next() == 'u' && next() == 'l' && next() == 'l') { + next(); + return null; + } + break; + } + error("Syntax error"); + } + + function value() { + white(); + switch (ch) { + case '{': + return object(); + case '[': + return array(); + case '"': + return string(); + case '-': + return number(); + default: + return ch >= '0' && ch <= '9' ? number() : word(); + } + } + + return value(); + } + }; +}(); \ No newline at end of file Added: struts/sandbox/trunk/overdrive/PhoneBook2/projects/www/website/tree_closed.gif URL: http://svn.apache.org/viewvc/struts/sandbox/trunk/overdrive/PhoneBook2/projects/www/website/tree_closed.gif?view=auto&rev=489200 ============================================================================== Binary file - no diff available. Propchange: struts/sandbox/trunk/overdrive/PhoneBook2/projects/www/website/tree_closed.gif ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream Added: struts/sandbox/trunk/overdrive/PhoneBook2/projects/www/website/tree_open.gif URL: http://svn.apache.org/viewvc/struts/sandbox/trunk/overdrive/PhoneBook2/projects/www/website/tree_open.gif?view=auto&rev=489200 ============================================================================== Binary file - no diff available. Propchange: struts/sandbox/trunk/overdrive/PhoneBook2/projects/www/website/tree_open.gif ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream Added: struts/sandbox/trunk/overdrive/PhoneBook2/projects/www/website/tree_white.gif URL: http://svn.apache.org/viewvc/struts/sandbox/trunk/overdrive/PhoneBook2/projects/www/website/tree_white.gif?view=auto&rev=489200 ============================================================================== Binary file - no diff available. Propchange: struts/sandbox/trunk/overdrive/PhoneBook2/projects/www/website/tree_white.gif ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream Added: struts/sandbox/trunk/overdrive/PhoneBook2/projects/www/website/website.html URL: http://svn.apache.org/viewvc/struts/sandbox/trunk/overdrive/PhoneBook2/projects/www/website/website.html?view=auto&rev=489200 ============================================================================== --- struts/sandbox/trunk/overdrive/PhoneBook2/projects/www/website/website.html (added) +++ struts/sandbox/trunk/overdrive/PhoneBook2/projects/www/website/website.html Wed Dec 20 13:10:10 2006 @@ -0,0 +1,60 @@ +<html> + <head> + + <!-- --> + <!-- Any title is fine --> + <!-- --> + <title>Wrapper HTML for website</title> + + <!-- --> + <!-- Use normal html, such as style --> + <!-- --> + <style> + body,td,a,div,.p{font-family:arial,sans-serif} + div,td{color:#000000} + a:link,.w,.w a:link{color:#0000cc} + a:visited{color:#551a8b} + a:active{color:#ff0000} + </style> + + <!-- --> + <!-- The module reference below is the link --> + <!-- between html and your Web Toolkit module --> + <!-- --> + <meta name='gwt:module' content='website'> + + </head> + + <!-- --> + <!-- The body can have arbitrary html, or --> + <!-- you can leave the body empty if you want --> + <!-- to create a completely dynamic ui --> + <!-- --> + <body> + + <!-- --> + <!-- This script is required bootstrap stuff. --> + <!-- You can put it in the HEAD, but startup --> + <!-- is slightly faster if you include it here. --> + <!-- --> + <script language="javascript" src="gwt.js"></script> + + <!-- OPTIONAL: include this if you want history support --> + <iframe id="__gwt_historyFrame" style="width:0;height:0;border:0"></iframe> + + <h1>website</h1> + + <p> + This is an example of a host page for the website application. + You can attach a Web Toolkit module to any HTML page you like, + making it easy to add bits of AJAX functionality to existing pages + without starting from scratch. + </p> + + <table align=center> + <tr> + <td id="slot1"></td><td id="slot2"></td> + </tr> + </table> + </body> +</html> Added: struts/sandbox/trunk/overdrive/PhoneBook2/projects/www/website/website.nocache.html URL: http://svn.apache.org/viewvc/struts/sandbox/trunk/overdrive/PhoneBook2/projects/www/website/website.nocache.html?view=auto&rev=489200 ============================================================================== --- struts/sandbox/trunk/overdrive/PhoneBook2/projects/www/website/website.nocache.html (added) +++ struts/sandbox/trunk/overdrive/PhoneBook2/projects/www/website/website.nocache.html Wed Dec 20 13:10:10 2006 @@ -0,0 +1,105 @@ +<html> +<head><script> +var $wnd = parent; +var $doc = $wnd.document; +var $moduleName = null; + + +window["provider$user.agent"] = function() { + var ua = navigator.userAgent.toLowerCase(); + if (ua.indexOf('opera') != -1) { + return 'opera'; + } + else if (ua.indexOf('webkit') != -1) { + return 'safari'; + } + else if (ua.indexOf('msie 6.0') != -1 || ua.indexOf('msie 7.0') != -1) { + return 'ie6'; + } + else if (ua.indexOf('gecko') != -1) { + var result = /rv:([0-9]+)\.([0-9]+)/.exec(ua); + if (result && result.length == 3) { + var version = parseInt(result[1]) * 10 + parseInt(result[2]); + if (version >= 18) + return 'gecko1_8'; + } + return 'gecko'; + } + return 'unknown'; +} +; + +window["values$user.agent"] = { +"gecko": 0, +"gecko1_8": 1, +"ie6": 2, +"opera": 3, +"safari": 4 +}; + +window["prop$user.agent"] = function() { + var v = window["provider$user.agent"](); + var ok = window["values$user.agent"]; + if (v in ok) + return v; + var a = new Array(5); + for (var k in ok) + a[ok[k]] = k; + $wnd.__gwt_onBadProperty("website", "user.agent", a, v); + if (arguments.length > 0) throw null; else return null; +}; + +function O(a,v) { + var answer = O.answers; + var i = -1; + var n = a.length - 1; + while (++i < n) { + if (!(a[i] in answer)) { + answer[a[i]] = []; + } + answer = answer[a[i]]; + } + answer[a[n]] = v; +} +O.answers = []; + + +function selectScript() { + try { + var F; + var I = ["true", (F=window["prop$user.agent"],F(1))]; + + O(["true","opera"],"164EFC80C3677ACFDEDEF6A4AF66FE04"); + O(["true","safari"],"174B37857C972F54B63152687D8A7FFC"); + O(["true","gecko1_8"],"72204518A52416D9AEE1E670AA59DC83"); + O(["true","gecko"],"72204518A52416D9AEE1E670AA59DC83"); + O(["true","ie6"],"CD79F874819AA339F6BB2786D042E43F"); + + var strongName = O.answers[I[0]][I[1]]; + var query = location.search; + query = query.substring(0, query.indexOf('&')); + var newUrl = strongName + '.cache.html' + query; + location.replace(newUrl); + } catch (e) { + // intentionally silent on property failure + } +} + +function onLoad() { + if (!$wnd.__gwt_isHosted) return; + if (!$wnd.__gwt_isHosted()) { + selectScript(); + } + else { + var mcb = $wnd.__gwt_tryGetModuleControlBlock(location.search); + if (mcb) { + $moduleName = mcb.getName(); + mcb.compilationLoaded(window); + } + } +} +</script></head> +<body onload='onLoad()'> +<font face='arial' size='-1'>This script is part of module</font> <code>website</code> +</body> +</html>