Commit 27aab967 authored by Sven Franck's avatar Sven Franck

removed event listeners from all files except renderjs

parent 4a44482d
...@@ -70,12 +70,6 @@ ...@@ -70,12 +70,6 @@
} else { } else {
$("body").text("No parameter found in url"); $("body").text("No parameter found in url");
} }
// if (window.addEventListener){
// window.addEventListener("message", handler, false)
// } else {
// window.attachEvent("onmessage", handler)
// }
}); });
}(document, jQuery)); }(document, jQuery));
...@@ -9,22 +9,19 @@ ...@@ -9,22 +9,19 @@
sessionStorage.setItem("schnick", "schnack"); sessionStorage.setItem("schnick", "schnack");
var setup = function () { var setup = function () {
// not an easy API...
// can this be done internally?
// TODO: // TODO: I don't like scope/target for passing too specific information
// "call" default API need not be passed, // like scope = which storage to use and target = which file to load in
// "self" can be added automatically // the next target
// "scope" (previous "storage") don't like... too gadget-specific? // TODO: Should be in window.location.href, not declared here
// "target" (previous "display") don't like, as above // TODO: how to pass multiple instances of _links? allow at all?
var instance1 = "data://application/hal+json;base64," + var instance1 = "data://application/hal+json;base64," +
window.btoa(JSON.stringify({ window.btoa(JSON.stringify({
_links: { _links: {
self: {href: ''}, self: {href: ''},
scope: {href: 'browser://browse/ls/'}, scope: {href: 'browser://browse/ls/'},
target: {href: 'preview_by_hash_change.html'}, target: {href: 'preview_by_hash_change.html'}
call: {href: ''}
}})); }}));
var instance2 = "data://application/hal+json;base64," + var instance2 = "data://application/hal+json;base64," +
...@@ -32,8 +29,7 @@ ...@@ -32,8 +29,7 @@
_links: { _links: {
self: {href: ''}, self: {href: ''},
scope: {href: 'browser://browse/ss/'}, scope: {href: 'browser://browse/ss/'},
target: {href: 'preview_by_postmessage.html'}, target: {href: 'preview_by_postmessage.html'}
call: {href: ''}
}})); }}));
$("body").addGadget({ $("body").addGadget({
......
...@@ -16,23 +16,6 @@ ...@@ -16,23 +16,6 @@
}); });
}; };
var handler = function (event) {
var type = event.data.type,
method = type ? type.split("/")[0] : undefined;
// prevent both renderJs and page events triggering on "run"
if (type === undefined || method !== "run") {
ajaxGet(event.data, function(value, status, jqXHR) {
ajaxGet(value._links.enclosure.href, function(value, status, jqXHR) {
if (value === "") {
window.document.body.innerHTML = "file not found";
} else {
window.document.body.innerHTML = value;
}
});
});
}
}
var getParameter = function(searchString, paramName) { var getParameter = function(searchString, paramName) {
var i, val, params = searchString.split("&"); var i, val, params = searchString.split("&");
...@@ -97,12 +80,6 @@ ...@@ -97,12 +80,6 @@
} else { } else {
$("body").text("No parameter found in url"); $("body").text("No parameter found in url");
} }
if (window.addEventListener){
window.addEventListener("message", handler, false)
} else {
window.attachEvent("onmessage", handler)
}
}); });
}(document, jQuery)); }(document, jQuery));
\ No newline at end of file
...@@ -16,23 +16,6 @@ ...@@ -16,23 +16,6 @@
}); });
}; };
var handler = function (event) {
var type = event.data.type,
method = type ? type.split("/")[0] : undefined;
// prevent both renderJs and page events triggering on "run"
if (type === undefined || method !== "run") {
ajaxGet(event.data, function(value, status, jqXHR) {
ajaxGet(value._links.enclosure.href, function(value, status, jqXHR) {
if (value === "") {
window.document.body.innerHTML = "file not found";
} else {
window.document.body.innerHTML = value;
}
});
});
}
}
var getParameter = function(searchString, paramName) { var getParameter = function(searchString, paramName) {
var i, val, params = searchString.split("&"); var i, val, params = searchString.split("&");
...@@ -103,12 +86,6 @@ ...@@ -103,12 +86,6 @@
} else { } else {
$("body").text("No parameter found in url"); $("body").text("No parameter found in url");
} }
if (window.addEventListener){
window.addEventListener("message", handler, false)
} else {
window.attachEvent("onmessage", handler)
}
}); });
}(document, jQuery)); }(document, jQuery));
\ No newline at end of file
...@@ -509,7 +509,6 @@ ...@@ -509,7 +509,6 @@
// => manages all interactions (listens to incoming postMessages) // => manages all interactions (listens to incoming postMessages)
priv.serviceHandler = function (event) { priv.serviceHandler = function (event) {
var type = event.data.type, route; var type = event.data.type, route;
if (type) { if (type) {
route = event.data.type.split("/"); route = event.data.type.split("/");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment