aboutsummaryrefslogtreecommitdiffstats
path: root/trunk/infrastructure/net.appjet.ajstdlib/streaming-iframe.html
diff options
context:
space:
mode:
authorAlexander Sulfrian <alexander@sulfrian.net>2010-06-08 08:22:05 +0200
committerAlexander Sulfrian <alexander@sulfrian.net>2010-06-08 08:22:05 +0200
commitd7c5ad7d6263fd1baf9bfdbaa4c50b70ef2fbdb2 (patch)
treeae0b65da6432f4c26c8d5a7319efbda5d172846c /trunk/infrastructure/net.appjet.ajstdlib/streaming-iframe.html
parentfa61221dcd89fcd72cba2c97971626f456c86e5d (diff)
downloadetherpad-d7c5ad7d6263fd1baf9bfdbaa4c50b70ef2fbdb2.tar.gz
etherpad-d7c5ad7d6263fd1baf9bfdbaa4c50b70ef2fbdb2.tar.xz
etherpad-d7c5ad7d6263fd1baf9bfdbaa4c50b70ef2fbdb2.zip
reverted folder structure change for better mergeing with upstream
Diffstat (limited to 'trunk/infrastructure/net.appjet.ajstdlib/streaming-iframe.html')
-rw-r--r--trunk/infrastructure/net.appjet.ajstdlib/streaming-iframe.html76
1 files changed, 76 insertions, 0 deletions
diff --git a/trunk/infrastructure/net.appjet.ajstdlib/streaming-iframe.html b/trunk/infrastructure/net.appjet.ajstdlib/streaming-iframe.html
new file mode 100644
index 0000000..3bdb5c4
--- /dev/null
+++ b/trunk/infrastructure/net.appjet.ajstdlib/streaming-iframe.html
@@ -0,0 +1,76 @@
+<html>
+<head>
+<script>
+function createRequestObject() {
+ var xmlhttp=false;
+ /*@cc_on @*/
+ /*@if (@_jscript_version >= 5)
+ try {
+ xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
+ } catch (e) {
+ try {
+ xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
+ } catch (E) {
+ xmlhttp = false;
+ }
+ }
+ @end @*/
+ if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
+ try {
+ xmlhttp = new XMLHttpRequest();
+ } catch (e) {
+ xmlhttp=false;
+ }
+ }
+ if (!xmlhttp && window.createRequest) {
+ try {
+ xmlhttp = window.createRequest();
+ } catch (e) {
+ xmlhttp=false;
+ }
+ }
+ return xmlhttp
+}
+var host = window.location.host;
+var oldDomain = document.domain;
+var newDomain = oldDomain.substring(oldDomain.indexOf(".", oldDomain.indexOf(".")+1)+1);
+
+function doAction(method, uri, async, headers, body, cb) {
+ try {
+ document.domain = oldDomain;
+ } catch (e) { }
+ var req = createRequestObject();
+ req.open(method, '//'+host+uri, async);
+ for (var i in headers) {
+ req.setRequestHeader(i, headers[i]);
+ }
+ req.onreadystatechange = function() {
+ if (req.readyState == 4) {
+ try {
+ document.domain = newDomain;
+ cb(req.status, req.responseText);
+ } catch (e) {
+ // yikes. well, hopefully a timeout will notice this error.
+ }
+ }
+ }
+ req.send(body);
+}
+function doAbort(xhr) {
+ try {
+ document.domain = oldDomain;
+ } catch (e) { }
+ xhr.abort();
+}
+document.domain = newDomain;
+window.onload = function() {
+ var doneKey = 'done_'+oldDomain.split(".", 2)[0];
+ setTimeout(function() {
+ window.parent[doneKey]();
+ }, 0);
+}
+</script>
+</head>
+<body>
+</body>
+</html>