aboutsummaryrefslogtreecommitdiff
path: root/includes/js/dojox/io/proxy/xip_client.html
diff options
context:
space:
mode:
authormensonge <mensonge@b3834d28-1941-0410-a4f8-b48e95affb8f>2008-11-13 09:49:11 +0000
committermensonge <mensonge@b3834d28-1941-0410-a4f8-b48e95affb8f>2008-11-13 09:49:11 +0000
commite44a7e37b6c7b5961adaffc62b9042b8d442938e (patch)
tree95b67c356e93163467db2451f2b8cce84ed5d582 /includes/js/dojox/io/proxy/xip_client.html
parenta62b9742ee5e28bcec6872d88f50f25b820914f6 (diff)
downloadsemanticscuttle-e44a7e37b6c7b5961adaffc62b9042b8d442938e.tar.gz
semanticscuttle-e44a7e37b6c7b5961adaffc62b9042b8d442938e.tar.bz2
New feature: basic Ajax suggestion for tags and implementation of Dojo toolkit
git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@151 b3834d28-1941-0410-a4f8-b48e95affb8f
Diffstat (limited to 'includes/js/dojox/io/proxy/xip_client.html')
-rw-r--r--includes/js/dojox/io/proxy/xip_client.html102
1 files changed, 102 insertions, 0 deletions
diff --git a/includes/js/dojox/io/proxy/xip_client.html b/includes/js/dojox/io/proxy/xip_client.html
new file mode 100644
index 0000000..c51a839
--- /dev/null
+++ b/includes/js/dojox/io/proxy/xip_client.html
@@ -0,0 +1,102 @@
+<!--
+ /*
+ Copyright (c) 2004-2008, The Dojo Foundation
+ All Rights Reserved.
+
+ Licensed under the Academic Free License version 2.1 or above OR the
+ modified BSD license. For more information on Dojo licensing, see:
+
+ http://dojotoolkit.org/community/licensing.shtml
+ */
+-->
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+ <title></title>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8"></meta>
+ <!-- Security protection: uncomment the start and end script tags to enable. -->
+ <!-- script type="text/javascript" -->
+ // <!--
+
+ function pollHash(){
+ //Can't use location.hash because at least Firefox does a decodeURIComponent on it.
+ var urlParts = window.location.href.split("#");
+ if(urlParts.length == 2){
+ var newHash = urlParts[1];
+ if(newHash != xipCurrentHash){
+ try{
+ callMaster(xipStateId, newHash);
+ }catch(e){
+ //Make sure to not keep processing the error hash value.
+ xipCurrentHash = newHash;
+ throw e;
+ }
+ xipCurrentHash = newHash;
+ }
+ }
+ }
+
+ function unpackMessage(encodedMessage){
+ var parts = encodedMessage.split(":");
+ var command = parts[1];
+ encodedMessage = parts[2] || "";
+
+ var config = null;
+ if(command == "init"){
+ var configParts = encodedMessage.split("&");
+ config = {};
+ for(var i = 0; i < configParts.length; i++){
+ var nameValue = configParts[i].split("=");
+ config[decodeURIComponent(nameValue[0])] = decodeURIComponent(nameValue[1]);
+ }
+ }
+ return {command: command, message: encodedMessage, config: config};
+ }
+
+ //************** Init **************************
+ xipCurrentHash = "";
+
+ //Decode the init params
+ var fragId = window.location.href.split("#")[1];
+ var config = unpackMessage(fragId).config;
+
+ xipStateId = config.id;
+ xipMasterFrame = parent.parent;
+
+ //Set up an HTML5 messaging publisher if postMessage exists.
+ //As of this writing, this is only useful to get Opera 9.25+ to work.
+ if(typeof document.postMessage != "undefined"){
+ callMaster = function(stateId, message){
+ xipMasterFrame.document.postMessage(stateId + "#" + message);
+ }
+ }else{
+ var parts = config.callback.split(".");
+ xipCallbackObject = xipMasterFrame;
+ for(var i = 0; i < parts.length - 1; i++){
+ xipCallbackObject = xipCallbackObject[parts[i]];
+ }
+ xipCallback = parts[parts.length - 1];
+
+ callMaster = function(stateId, message){
+ xipCallbackObject[xipCallback](stateId + "#" + message);
+ }
+ }
+
+ //Call the master frame to let it know it is OK to start sending.
+ callMaster(xipStateId, "0:loaded");
+
+ //Start counter to inspect hash value.
+ setInterval(pollHash, 10);
+
+ // -->
+ <!-- </script> -->
+</head>
+<body>
+ <h4>The Dojo Toolkit -- xip_client.html</h4>
+
+ <p>This file is used for Dojo's XMLHttpRequest Iframe Proxy. This is the "client" file used
+ internally by dojox.io.proxy.xip.</p>
+</body>
+</html>