diff options
author | Stefan Radomski <radomski@tk.informatik.tu-darmstadt.de> | 2014-04-22 14:02:03 (GMT) |
---|---|---|
committer | Stefan Radomski <radomski@tk.informatik.tu-darmstadt.de> | 2014-04-22 14:02:03 (GMT) |
commit | 1fb6bcf30f954e426f2d3002d14887574fb941dd (patch) | |
tree | 08cff7f2b879c50efe79e3c04d255075522af862 /test/samples/uscxml/templates/xhtml-invoker.html | |
parent | 71c334bf4e35559496feac3f3cf00b72ceb88812 (diff) | |
download | uscxml-1fb6bcf30f954e426f2d3002d14887574fb941dd.zip uscxml-1fb6bcf30f954e426f2d3002d14887574fb941dd.tar.gz uscxml-1fb6bcf30f954e426f2d3002d14887574fb941dd.tar.bz2 |
Major refactoring
- Moved tests
- Changes to promela datamodel
- Implemented Trie
Diffstat (limited to 'test/samples/uscxml/templates/xhtml-invoker.html')
-rw-r--r-- | test/samples/uscxml/templates/xhtml-invoker.html | 228 |
1 files changed, 0 insertions, 228 deletions
diff --git a/test/samples/uscxml/templates/xhtml-invoker.html b/test/samples/uscxml/templates/xhtml-invoker.html deleted file mode 100644 index 7773231..0000000 --- a/test/samples/uscxml/templates/xhtml-invoker.html +++ /dev/null @@ -1,228 +0,0 @@ -<html xmlns="http://www.w3.org/1999/xhtml"> - <head> - <meta http-equiv="Content-Type" content="text/html;charset=utf-8" /> - <script type="text/javascript"> - // see http://stackoverflow.com/questions/1206937/javascript-domready - var domLoaded = function(callback) { - /* Internet Explorer */ - /*@cc_on - @if (@_win32 || @_win64) - document.write('<script id="ieScriptLoad" defer src="//:"><\/script>'); - document.getElementById('ieScriptLoad').onreadystatechange = function() { - if (this.readyState == 'complete') { - var head= document.getElementsByTagName('head')[0]; - var script= document.createElement('script'); - script.type= 'text/javascript'; - script.src= 'http://wicked-good-xpath.googlecode.com/files/wgxpath.install.js'; - head.appendChild(script); - wgxpath.install(); - - // see http://stackoverflow.com/questions/1811116/ie-support-for-dom-importnode - document.importNode = function(node, allChildren) { - switch (node.nodeType) { - case document.ELEMENT_NODE: - var newNode = document.createElementNS(node.namespaceURI, node.nodeName); - if(node.attributes && node.attributes.length > 0) - for(var i = 0, il = node.attributes.length; i < il; i++) - newNode.setAttribute(node.attributes[i].nodeName, node.getAttribute(node.attributes[i].nodeName)); - if(allChildren && node.childNodes && node.childNodes.length > 0) - for(var i = 0, il = node.childNodes.length; i < il; i++) - newNode.appendChild(document.importNode(node.childNodes[i], allChildren)); - return newNode; - break; - case document.TEXT_NODE: - case document.CDATA_SECTION_NODE: - case document.COMMENT_NODE: - return document.createTextNode(node.nodeValue); - break; - } - } - - callback(); - } - }; - @end @*/ - /* Mozilla, Chrome, Opera */ - if (document.addEventListener) { - document.addEventListener('DOMContentLoaded', callback, false); - return; - } - /* Safari, iCab, Konqueror */ - if (/KHTML|WebKit|iCab/i.test(navigator.userAgent)) { - var DOMLoadTimer = setInterval(function () { - if (/loaded|complete/i.test(document.readyState)) { - callback(); - clearInterval(DOMLoadTimer); - } - }, 10); - return; - } - /* Other web browsers */ - window.onload = callback; - }; - - </script> - <script type="text/javascript"> - - function CometSession(options) { - /** - * Support for two-channel asynchronous http communication - */ - for (var key in options) { - if (options.hasOwnProperty(key)) { - this[key] = options[key]; - } - } - var self = this; - - this.xhr = (window.XMLHttpRequest ? new XMLHttpRequest() : new ActiveXObject("MSXML2.XMLHTTP.3.0")); - this.cometPoll = (window.XMLHttpRequest ? new XMLHttpRequest() : new ActiveXObject("MSXML2.XMLHTTP.3.0")); - - this.createUUID = function() { - // http://www.ietf.org/rfc/rfc4122.txt - var s = []; - var hexDigits = "0123456789abcdef"; - for (var i = 0; i < 36; i++) { - s[i] = hexDigits.substr(Math.floor(Math.random() * 0x10), 1); - } - s[14] = "4"; // bits 12-15 of the time_hi_and_version field to 0010 - s[19] = hexDigits.substr((s[19] & 0x3) | 0x8, 1); // bits 6-7 of the clock_seq_hi_and_reserved to 01 - s[8] = s[13] = s[18] = s[23] = "-"; - var uuid = s.join(""); - return uuid; - } - - this.longpoll = function() { - self.cometPoll.onreadystatechange = function() { - if (self.cometPoll.readyState === 4) { - if (self.cometPoll.status !== 200) { - self.longpoll(); - return; - } - self.onRcvd(self.cometPoll); - self.longpoll(); - } - }; - // use token until we have a context - self.cometPoll.open("GET", self.server + (self.query ? "?" + self.query : "")); - self.cometPoll.setRequestHeader('X-Requested-With', 'XMLHttpRequest'); - self.cometPoll.setRequestHeader("Connection", "close"); - self.cometPoll.send(null); - }; - - this.post = function(name, data) { - self.xhr.open("POST", self.server + (self.query ? "?" + self.query : "")); - self.xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest'); - self.xhr.setRequestHeader('X-SCXML-Name', name); - self.xhr.send(data); - } - - // serialize an object to be send - this.send = function(name, thing) { - var data; - // see also: https://raw.github.com/douglascrockford/JSON-js/master/cycle.js - // dispatch over thingy type here - if (typeof thing === "object") { - var seen = []; - // will not work on opera as thing is checked for cycles first - data = JSON.stringify(thing, function(key, val) { - if (isNode(val)) { - // return a selection of attributes - return { - id: val.id, - tagName: val.tagName, - localName: val.localName - }; - } - if (isWindow(val)) { - return; - } - if (typeof val === "object") { - if (seen.indexOf(val) >= 0) - return; - seen.push(val) - } - return val - }); - } else { - data = thing; - } - this.post(name, data); - } - - // helper function to determine whether something is a html node - var isNode = function(o){ - return ( - typeof Node === "object" ? o instanceof Node : - o && typeof o === "object" && typeof o.nodeType === "number" && typeof o.nodeName==="string" - ); - } - - // helper function to determine whether something is a window - var isWindow = function(o){ - return ( - typeof Window === "object" ? o instanceof Window : - o && typeof o === "object" && typeof o.menubar === "object" - ); - } - - } - - </script> - - <script type="text/javascript"> - domLoaded(function () { - scxml = new CometSession({ - element: document.getElementById("${scxml.invokeId}"), - server: "${scxml.server}", - onRcvd : function(data) { - if (data.responseXML) { - var type = data.getResponseHeader("X-SCXML-Type") || "replacechildren"; - var domTarget = data.getResponseHeader("X-SCXML-XPath") || "/html/body"; - var domAttr = data.getResponseHeader("X-SCXML-Attr"); - var result = document.evaluate(domTarget, document, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null); - - for (var i = 0, l = result.snapshotLength; i < l; i++) { - var item = result.snapshotItem(i); - var node = document.importNode(data.responseXML.firstChild, true); - switch (type) { - case "firstchild": - item.insertBefore(node, item.firstChild); - break; - case "lastchild": - item.appendChild(node); - break; - case "previoussibling": - item.parentNode.insertBefore(node, item); - break; - case "nextsibling": - item.parentNode.insertBefore(node, item.nextSibling); - break; - case "replace": - item.parentNode.replaceChild(node, item); - break; - case "delete": - item.parentNode.removeChild(item); - break; - case "addattribute": - item.setAttribute(domAttr, node); - break; - case "replacechildren": - while(item.hasChildNodes()) { - item.removeChild(item.firstChild); - } - item.appendChild(node); - default: - break; - } - } - } - } - }); - scxml.longpoll(); - }); - </script> - - </head> - <body></body> -</html> |