Merge sidebar and wrapper js

This commit is contained in:
shortcutme 2018-02-21 03:15:04 +01:00
parent bee8aac0cc
commit 40693471e9
No known key found for this signature in database
GPG key ID: 5B63BAE6CB9613AE
2 changed files with 210 additions and 112 deletions

View file

@ -269,7 +269,7 @@ window.initScrollable = function () {
(function() {
var Sidebar,
var Sidebar, wrapper,
bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
hasProp = {}.hasOwnProperty,
@ -278,7 +278,8 @@ window.initScrollable = function () {
Sidebar = (function(superClass) {
extend(Sidebar, superClass);
function Sidebar() {
function Sidebar(wrapper1) {
this.wrapper = wrapper1;
this.unloadGlobe = bind(this.unloadGlobe, this);
this.displayGlobe = bind(this.displayGlobe, this);
this.loadGlobe = bind(this.loadGlobe, this);
@ -300,7 +301,7 @@ window.initScrollable = function () {
this.dragStarted = 0;
this.globe = null;
this.preload_html = null;
this.original_set_site_info = wrapper.setSiteInfo;
this.original_set_site_info = this.wrapper.setSiteInfo;
if (false) {
this.startDrag();
this.moved();
@ -310,15 +311,6 @@ window.initScrollable = function () {
}
Sidebar.prototype.initFixbutton = function() {
/*
@fixbutton.on "mousedown touchstart", (e) =>
if not @opened
@logStart("Preloading")
wrapper.ws.cmd "sidebarGetHtmlTag", {}, (res) =>
@logEnd("Preloading")
@preload_html = res
*/
this.fixbutton.on("mousedown touchstart", (function(_this) {
return function(e) {
if (e.button > 0) {
@ -413,10 +405,10 @@ window.initScrollable = function () {
};
})(this));
$(window).trigger("resize");
wrapper.setSiteInfo = (function(_this) {
this.wrapper.setSiteInfo = (function(_this) {
return function(site_info) {
_this.setSiteInfo(site_info);
return _this.original_set_site_info.apply(wrapper, arguments);
return _this.original_set_site_info.apply(_this.wrapper, arguments);
};
})(this);
img = new Image();
@ -452,7 +444,7 @@ window.initScrollable = function () {
this.setHtmlTag(this.preload_html);
return this.preload_html = null;
} else {
return wrapper.ws.cmd("sidebarGetHtmlTag", {}, this.setHtmlTag);
return this.wrapper.ws.cmd("sidebarGetHtmlTag", {}, this.setHtmlTag);
}
};
@ -527,7 +519,9 @@ window.initScrollable = function () {
this.opened = false;
} else {
targetx = this.width;
if (!this.opened) {
if (this.opened) {
onOpened();
} else {
this.when_loaded.done((function(_this) {
return function() {
return _this.onOpened();
@ -570,9 +564,9 @@ window.initScrollable = function () {
})(this));
this.tag.find("#button-sitelimit").off("click touchend").on("click touchend", (function(_this) {
return function() {
wrapper.ws.cmd("siteSetLimit", $("#input-sitelimit").val(), function(res) {
_this.wrapper.ws.cmd("siteSetLimit", $("#input-sitelimit").val(), function(res) {
if (res === "ok") {
wrapper.notifications.add("done-sitelimit", "done", "Site storage limit modified!", 5000);
_this.wrapper.notifications.add("done-sitelimit", "done", "Site storage limit modified!", 5000);
}
return _this.updateHtmlTag();
});
@ -581,8 +575,8 @@ window.initScrollable = function () {
})(this));
this.tag.find("#button-dbreload").off("click touchend").on("click touchend", (function(_this) {
return function() {
wrapper.ws.cmd("dbReload", [], function() {
wrapper.notifications.add("done-dbreload", "done", "Database schema reloaded!", 5000);
_this.wrapper.ws.cmd("dbReload", [], function() {
_this.wrapper.notifications.add("done-dbreload", "done", "Database schema reloaded!", 5000);
return _this.updateHtmlTag();
});
return false;
@ -590,9 +584,9 @@ window.initScrollable = function () {
})(this));
this.tag.find("#button-dbrebuild").off("click touchend").on("click touchend", (function(_this) {
return function() {
wrapper.notifications.add("done-dbrebuild", "info", "Database rebuilding....");
wrapper.ws.cmd("dbRebuild", [], function() {
wrapper.notifications.add("done-dbrebuild", "done", "Database rebuilt!", 5000);
_this.wrapper.notifications.add("done-dbrebuild", "info", "Database rebuilding....");
_this.wrapper.ws.cmd("dbRebuild", [], function() {
_this.wrapper.notifications.add("done-dbrebuild", "done", "Database rebuilt!", 5000);
return _this.updateHtmlTag();
});
return false;
@ -601,8 +595,8 @@ window.initScrollable = function () {
this.tag.find("#button-update").off("click touchend").on("click touchend", (function(_this) {
return function() {
_this.tag.find("#button-update").addClass("loading");
wrapper.ws.cmd("siteUpdate", wrapper.site_info.address, function() {
wrapper.notifications.add("done-updated", "done", "Site updated!", 5000);
_this.wrapper.ws.cmd("siteUpdate", _this.wrapper.site_info.address, function() {
_this.wrapper.notifications.add("done-updated", "done", "Site updated!", 5000);
return _this.tag.find("#button-update").removeClass("loading");
});
return false;
@ -611,30 +605,30 @@ window.initScrollable = function () {
this.tag.find("#button-pause").off("click touchend").on("click touchend", (function(_this) {
return function() {
_this.tag.find("#button-pause").addClass("hidden");
wrapper.ws.cmd("sitePause", wrapper.site_info.address);
_this.wrapper.ws.cmd("sitePause", _this.wrapper.site_info.address);
return false;
};
})(this));
this.tag.find("#button-resume").off("click touchend").on("click touchend", (function(_this) {
return function() {
_this.tag.find("#button-resume").addClass("hidden");
wrapper.ws.cmd("siteResume", wrapper.site_info.address);
_this.wrapper.ws.cmd("siteResume", _this.wrapper.site_info.address);
return false;
};
})(this));
this.tag.find("#button-delete").off("click touchend").on("click touchend", (function(_this) {
return function() {
wrapper.displayConfirm("Are you sure?", ["Delete this site", "Blacklist"], function(confirmed) {
_this.wrapper.displayConfirm("Are you sure?", ["Delete this site", "Blacklist"], function(confirmed) {
if (confirmed === 1) {
_this.tag.find("#button-delete").addClass("loading");
return wrapper.ws.cmd("siteDelete", wrapper.site_info.address, function() {
return _this.wrapper.ws.cmd("siteDelete", _this.wrapper.site_info.address, function() {
return document.location = $(".fixbutton-bg").attr("href");
});
} else if (confirmed === 2) {
return wrapper.displayPrompt("Blacklist this site", "text", "Delete and Blacklist", "Reason", function(reason) {
return _this.wrapper.displayPrompt("Blacklist this site", "text", "Delete and Blacklist", "Reason", function(reason) {
_this.tag.find("#button-delete").addClass("loading");
wrapper.ws.cmd("blacklistAdd", [wrapper.site_info.address, reason]);
return wrapper.ws.cmd("siteDelete", wrapper.site_info.address, function() {
_this.wrapper.ws.cmd("blacklistAdd", [_this.wrapper.site_info.address, reason]);
return _this.wrapper.ws.cmd("siteDelete", _this.wrapper.site_info.address, function() {
return document.location = $(".fixbutton-bg").attr("href");
});
});
@ -645,40 +639,40 @@ window.initScrollable = function () {
})(this));
this.tag.find("#checkbox-owned").off("click touchend").on("click touchend", (function(_this) {
return function() {
return wrapper.ws.cmd("siteSetOwned", [_this.tag.find("#checkbox-owned").is(":checked")]);
return _this.wrapper.ws.cmd("siteSetOwned", [_this.tag.find("#checkbox-owned").is(":checked")]);
};
})(this));
this.tag.find("#checkbox-autodownloadoptional").off("click touchend").on("click touchend", (function(_this) {
return function() {
return wrapper.ws.cmd("siteSetAutodownloadoptional", [_this.tag.find("#checkbox-autodownloadoptional").is(":checked")]);
return _this.wrapper.ws.cmd("siteSetAutodownloadoptional", [_this.tag.find("#checkbox-autodownloadoptional").is(":checked")]);
};
})(this));
this.tag.find("#button-identity").off("click touchend").on("click touchend", (function(_this) {
return function() {
wrapper.ws.cmd("certSelect");
_this.wrapper.ws.cmd("certSelect");
return false;
};
})(this));
this.tag.find("#checkbox-owned").off("click touchend").on("click touchend", (function(_this) {
return function() {
return wrapper.ws.cmd("siteSetOwned", [_this.tag.find("#checkbox-owned").is(":checked")]);
return _this.wrapper.ws.cmd("siteSetOwned", [_this.tag.find("#checkbox-owned").is(":checked")]);
};
})(this));
this.tag.find("#button-settings").off("click touchend").on("click touchend", (function(_this) {
return function() {
wrapper.ws.cmd("fileGet", "content.json", function(res) {
_this.wrapper.ws.cmd("fileGet", "content.json", function(res) {
var data, json_raw;
data = JSON.parse(res);
data["title"] = $("#settings-title").val();
data["description"] = $("#settings-description").val();
json_raw = unescape(encodeURIComponent(JSON.stringify(data, void 0, '\t')));
return wrapper.ws.cmd("fileWrite", ["content.json", btoa(json_raw), true], function(res) {
return _this.wrapper.ws.cmd("fileWrite", ["content.json", btoa(json_raw), true], function(res) {
if (res !== "ok") {
return wrapper.notifications.add("file-write", "error", "File write error: " + res);
return _this.wrapper.notifications.add("file-write", "error", "File write error: " + res);
} else {
wrapper.notifications.add("file-write", "done", "Site settings saved!", 5000);
if (wrapper.site_info.privatekey) {
wrapper.ws.cmd("siteSign", {
_this.wrapper.notifications.add("file-write", "done", "Site settings saved!", 5000);
if (_this.wrapper.site_info.privatekey) {
_this.wrapper.ws.cmd("siteSign", {
privatekey: "stored",
inner_path: "content.json",
update_changed_files: true
@ -703,29 +697,29 @@ window.initScrollable = function () {
return function() {
var inner_path;
inner_path = _this.tag.find("#input-contents").val();
wrapper.ws.cmd("fileRules", {
_this.wrapper.ws.cmd("fileRules", {
inner_path: inner_path
}, function(res) {
var ref;
if (wrapper.site_info.privatekey || (ref = wrapper.site_info.auth_address, indexOf.call(res.signers, ref) >= 0)) {
return wrapper.ws.cmd("siteSign", {
if (_this.wrapper.site_info.privatekey || (ref = _this.wrapper.site_info.auth_address, indexOf.call(res.signers, ref) >= 0)) {
return _this.wrapper.ws.cmd("siteSign", {
privatekey: "stored",
inner_path: inner_path,
update_changed_files: true
}, function(res) {
if (res === "ok") {
return wrapper.notifications.add("sign", "done", inner_path + " Signed!", 5000);
return _this.wrapper.notifications.add("sign", "done", inner_path + " Signed!", 5000);
}
});
} else {
return wrapper.displayPrompt("Enter your private key:", "password", "Sign", "", function(privatekey) {
return wrapper.ws.cmd("siteSign", {
return _this.wrapper.displayPrompt("Enter your private key:", "password", "Sign", "", function(privatekey) {
return _this.wrapper.ws.cmd("siteSign", {
privatekey: privatekey,
inner_path: inner_path,
update_changed_files: true
}, function(res) {
if (res === "ok") {
return wrapper.notifications.add("sign", "done", inner_path + " Signed!", 5000);
return _this.wrapper.notifications.add("sign", "done", inner_path + " Signed!", 5000);
}
});
});
@ -739,7 +733,7 @@ window.initScrollable = function () {
return function() {
var inner_path;
inner_path = _this.tag.find("#input-contents").val();
wrapper.ws.cmd("sitePublish", {
_this.wrapper.ws.cmd("sitePublish", {
"inner_path": inner_path,
"sign": false
});
@ -762,36 +756,38 @@ window.initScrollable = function () {
})(this));
$("body").on("click", (function(_this) {
return function() {
if (_this.tag) {
return _this.tag.find(".contents + .flex").removeClass("active");
}
};
})(this));
this.tag.find("#button-sign-publish").off("click touchend").on("click touchend", (function(_this) {
return function() {
var inner_path;
inner_path = _this.tag.find("#input-contents").val();
wrapper.ws.cmd("fileRules", {
_this.wrapper.ws.cmd("fileRules", {
inner_path: inner_path
}, function(res) {
var ref;
if (wrapper.site_info.privatekey || (ref = wrapper.site_info.auth_address, indexOf.call(res.signers, ref) >= 0)) {
return wrapper.ws.cmd("sitePublish", {
if (_this.wrapper.site_info.privatekey || (ref = _this.wrapper.site_info.auth_address, indexOf.call(res.signers, ref) >= 0)) {
return _this.wrapper.ws.cmd("sitePublish", {
privatekey: "stored",
inner_path: inner_path,
sign: true
}, function(res) {
if (res === "ok") {
return wrapper.notifications.add("sign", "done", inner_path + " Signed and published!", 5000);
return _this.wrapper.notifications.add("sign", "done", inner_path + " Signed and published!", 5000);
}
});
} else {
return wrapper.displayPrompt("Enter your private key:", "password", "Sign", "", function(privatekey) {
return wrapper.ws.cmd("sitePublish", {
return _this.wrapper.displayPrompt("Enter your private key:", "password", "Sign", "", function(privatekey) {
return _this.wrapper.ws.cmd("sitePublish", {
privatekey: privatekey,
inner_path: inner_path,
sign: true
}, function(res) {
if (res === "ok") {
return wrapper.notifications.add("sign", "done", inner_path + " Signed and published!", 5000);
return _this.wrapper.notifications.add("sign", "done", inner_path + " Signed and published!", 5000);
}
});
});
@ -821,7 +817,7 @@ window.initScrollable = function () {
}
};
})(this));
return wrapper.setSiteInfo = this.original_set_site_info;
return this.wrapper.setSiteInfo = this.original_set_site_info;
};
Sidebar.prototype.loadGlobe = function() {
@ -845,7 +841,7 @@ window.initScrollable = function () {
img.src = "/uimedia/globe/world.jpg";
return img.onload = (function(_this) {
return function() {
return wrapper.ws.cmd("sidebarGetPeers", [], function(globe_data) {
return _this.wrapper.ws.cmd("sidebarGetPeers", [], function(globe_data) {
var e, ref, ref1;
if (_this.globe) {
_this.globe.scene.remove(_this.globe.points);
@ -892,8 +888,10 @@ window.initScrollable = function () {
})(Class);
wrapper = window.wrapper;
setTimeout((function() {
return window.sidebar = new Sidebar();
return window.sidebar = new Sidebar(wrapper);
}), 500);
window.transitionEnd = 'transitionend webkitTransitionEnd oTransitionEnd otransitionend';

View file

@ -44,17 +44,18 @@
(function() {
var ZeroWebsocket,
__bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
__slice = [].slice;
bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
slice = [].slice;
ZeroWebsocket = (function() {
function ZeroWebsocket(url) {
this.onCloseWebsocket = __bind(this.onCloseWebsocket, this);
this.onErrorWebsocket = __bind(this.onErrorWebsocket, this);
this.onOpenWebsocket = __bind(this.onOpenWebsocket, this);
this.log = __bind(this.log, this);
this.route = __bind(this.route, this);
this.onMessage = __bind(this.onMessage, this);
this.onCloseWebsocket = bind(this.onCloseWebsocket, this);
this.onErrorWebsocket = bind(this.onErrorWebsocket, this);
this.onOpenWebsocket = bind(this.onOpenWebsocket, this);
this.log = bind(this.log, this);
this.response = bind(this.response, this);
this.route = bind(this.route, this);
this.onMessage = bind(this.onMessage, this);
this.url = url;
this.next_message_id = 1;
this.waiting_cb = {};
@ -138,17 +139,17 @@
ZeroWebsocket.prototype.log = function() {
var args;
args = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
return console.log.apply(console, ["[ZeroWebsocket]"].concat(__slice.call(args)));
args = 1 <= arguments.length ? slice.call(arguments, 0) : [];
return console.log.apply(console, ["[ZeroWebsocket]"].concat(slice.call(args)));
};
ZeroWebsocket.prototype.onOpenWebsocket = function(e) {
var message, _i, _len, _ref;
var i, len, message, ref;
this.log("Open");
this.connected = true;
_ref = this.message_queue;
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
message = _ref[_i];
ref = this.message_queue;
for (i = 0, len = ref.length; i < len; i++) {
message = ref[i];
this.ws.send(JSON.stringify(message));
}
this.message_queue = [];
@ -818,13 +819,16 @@ jQuery.extend( jQuery.easing,
Wrapper = (function() {
function Wrapper(ws_url) {
this.gotoSite = bind(this.gotoSite, this);
this.setSizeLimit = bind(this.setSizeLimit, this);
this.onLoad = bind(this.onLoad, this);
this.onWrapperLoad = bind(this.onWrapperLoad, this);
this.onPageLoad = bind(this.onPageLoad, this);
this.onCloseWebsocket = bind(this.onCloseWebsocket, this);
this.onOpenWebsocket = bind(this.onOpenWebsocket, this);
this.handleMessage = bind(this.handleMessage, this);
this.cmd = bind(this.cmd, this);
this.onMessageInner = bind(this.onMessageInner, this);
this.onMessageWebsocket = bind(this.onMessageWebsocket, this);
this.verifyEvent = bind(this.verifyEvent, this);
this.log("Created!");
this.loading = new Loading();
this.notifications = new Notifications($(".notifications"));
@ -838,6 +842,7 @@ jQuery.extend( jQuery.easing,
this.ws.onMessage = this.onMessageWebsocket;
this.ws.connect();
this.ws_error = null;
this.next_cmd_message_id = -1;
this.site_info = null;
this.event_site_info = $.Deferred();
this.inner_loaded = false;
@ -846,7 +851,8 @@ jQuery.extend( jQuery.easing,
this.site_error = null;
this.address = null;
this.opener_tested = false;
window.onload = this.onLoad;
this.allowed_event_constructors = [MouseEvent, KeyboardEvent];
window.onload = this.onPageLoad;
window.onhashchange = (function(_this) {
return function(e) {
var src;
@ -871,6 +877,19 @@ jQuery.extend( jQuery.easing,
$("#inner-iframe").focus();
}
Wrapper.prototype.verifyEvent = function(allowed_target, e) {
var ref;
if (!e.originalEvent.isTrusted) {
throw "Event not trusted";
}
if (ref = e.originalEvent.constructor, indexOf.call(this.allowed_event_constructors, ref) < 0) {
throw "Invalid event constructor: " + e.constructor + " != " + allowed_event_constructor;
}
if (e.originalEvent.currentTarget !== allowed_target[0]) {
throw "Invalid event target: " + e.originalEvent.currentTarget + " != " + allowed_target[0];
}
};
Wrapper.prototype.onMessageWebsocket = function(e) {
var cmd, id, message, ref, type;
message = JSON.parse(e.data);
@ -914,7 +933,6 @@ jQuery.extend( jQuery.easing,
this.ws.ws.close();
return this.ws.onCloseWebsocket(null, 4000);
} else if (cmd === "injectHtml") {
console.log("inject", message);
return $("body").append(message.params);
} else {
return this.sendInner(message);
@ -922,7 +940,7 @@ jQuery.extend( jQuery.easing,
};
Wrapper.prototype.onMessageInner = function(e) {
var cmd, message, query;
var message;
if (!window.postmessage_nonce_security && this.opener_tested === false) {
if (window.opener && window.opener !== window) {
this.log("Opener present", window.opener);
@ -941,6 +959,30 @@ jQuery.extend( jQuery.easing,
this.log("Message nonce error:", message.wrapper_nonce, '!=', window.wrapper_nonce);
return;
}
return this.handleMessage(message);
};
Wrapper.prototype.cmd = function(cmd, params, cb) {
var message;
if (params == null) {
params = {};
}
if (cb == null) {
cb = null;
}
message = {};
message.cmd = cmd;
message.params = params;
message.id = this.next_cmd_message_id;
if (cb) {
this.ws.waiting_cb[message.id] = cb;
}
this.next_cmd_message_id -= 1;
return this.handleMessage(message);
};
Wrapper.prototype.handleMessage = function(message) {
var cmd, query;
cmd = message.cmd;
if (cmd === "innerReady") {
this.inner_ready = true;
@ -1079,14 +1121,19 @@ jQuery.extend( jQuery.easing,
Wrapper.prototype.actionPermissionAdd = function(message) {
var permission;
permission = message.params;
return this.ws.cmd("permissionDetails", permission, (function(_this) {
return function(permission_details) {
return $.when(this.event_site_info).done((function(_this) {
return function() {
if (indexOf.call(_this.site_info.settings.permissions, permission) >= 0) {
return false;
}
return _this.ws.cmd("permissionDetails", permission, function(permission_details) {
return _this.displayConfirm("This site requests permission:" + (" <b>" + (_this.toHtmlSafe(permission)) + "</b>") + ("<br><small style='color: #4F4F4F'>" + permission_details + "</small>"), "Grant", function() {
return _this.ws.cmd("permissionAdd", permission, function() {
return _this.ws.cmd("permissionAdd", permission, function(res) {
return _this.sendInner({
"cmd": "response",
"to": message.id,
"result": "Granted"
"result": res
});
});
});
});
@ -1102,21 +1149,25 @@ jQuery.extend( jQuery.easing,
};
Wrapper.prototype.displayConfirm = function(message, captions, cb) {
var body, button, buttons, caption, i, j, len;
var body, button, buttons, caption, fn, i, j, len;
body = $("<span class='message-outer'><span class='message'>" + message + "</span></span>");
buttons = $("<span class='buttons'></span>");
if (!(captions instanceof Array)) {
captions = [captions];
}
fn = (function(_this) {
return function(button) {
return button.on("click", function(e) {
_this.verifyEvent(button, e);
cb(parseInt(e.currentTarget.dataset.value));
return false;
});
};
})(this);
for (i = j = 0, len = captions.length; j < len; i = ++j) {
caption = captions[i];
button = $("<a href='#" + caption + "' class='button button-confirm button-" + caption + " button-" + (i + 1) + "' data-value='" + (i + 1) + "'>" + caption + "</a>");
button.on("click", (function(_this) {
return function(e) {
cb(parseInt(e.currentTarget.dataset.value));
return false;
};
})(this));
fn(button);
buttons.append(button);
}
body.append(buttons);
@ -1157,15 +1208,17 @@ jQuery.extend( jQuery.easing,
input = $("<input type='" + type + "' class='input button-" + type + "' placeholder='" + placeholder + "'/>");
input.on("keyup", (function(_this) {
return function(e) {
_this.verifyEvent(input, e);
if (e.keyCode === 13) {
return button.trigger("click");
return cb(input.val());
}
};
})(this));
body.append(input);
button = $("<a href='#" + caption + "' class='button button-" + caption + "'>" + caption + "</a>");
button.on("click", (function(_this) {
return function() {
return function(e) {
_this.verifyEvent(button, e);
cb(input.val());
return false;
};
@ -1270,7 +1323,7 @@ jQuery.extend( jQuery.easing,
};
Wrapper.prototype.actionReload = function(message) {
return this.reload();
return this.reload(message.params[0]);
};
Wrapper.prototype.reload = function(url_post) {
@ -1367,7 +1420,7 @@ jQuery.extend( jQuery.easing,
})(this)), 1000);
};
Wrapper.prototype.onLoad = function(e) {
Wrapper.prototype.onPageLoad = function(e) {
var ref;
this.inner_loaded = true;
if (!this.inner_ready) {
@ -1383,6 +1436,12 @@ jQuery.extend( jQuery.easing,
}
};
Wrapper.prototype.onWrapperLoad = function() {
delete window.wrapper;
delete window.wrapper_key;
return $("#script_init").remove();
};
Wrapper.prototype.sendInner = function(message) {
return this.inner.postMessage(message, '*');
};
@ -1499,7 +1558,7 @@ jQuery.extend( jQuery.easing,
value = this.toHtmlSafe(value);
} else {
value = String(value).replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;');
value = value.replace(/&lt;([\/]{0,1}(br|b|u|i))&gt;/g, "<$1>");
value = value.replace(/&lt;([\/]{0,1}(br|b|u|i|small))&gt;/g, "<$1>");
}
values[i] = value;
}
@ -1528,18 +1587,6 @@ jQuery.extend( jQuery.easing,
return false;
};
Wrapper.prototype.isProxyRequest = function() {
return window.location.pathname === "/";
};
Wrapper.prototype.gotoSite = function(elem) {
var href;
href = $(elem).attr("href");
if (this.isProxyRequest()) {
return $(elem).attr("href", "http://zero" + href);
}
};
Wrapper.prototype.log = function() {
var args;
args = 1 <= arguments.length ? slice.call(arguments, 0) : [];
@ -1569,3 +1616,56 @@ jQuery.extend( jQuery.easing,
window.wrapper = new Wrapper(ws_url);
}).call(this);
/* ---- src/Ui/media/WrapperZeroFrame.coffee ---- */
(function() {
var WrapperZeroFrame,
bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };
WrapperZeroFrame = (function() {
function WrapperZeroFrame(wrapper) {
this.certSelectGotoSite = bind(this.certSelectGotoSite, this);
this.response = bind(this.response, this);
this.cmd = bind(this.cmd, this);
this.wrapperCmd = wrapper.cmd;
this.wrapperResponse = wrapper.ws.response;
console.log("WrapperZeroFrame", wrapper);
}
WrapperZeroFrame.prototype.cmd = function(cmd, params, cb) {
if (params == null) {
params = {};
}
if (cb == null) {
cb = null;
}
return this.wrapperCmd(cmd, params, cb);
};
WrapperZeroFrame.prototype.response = function(to, result) {
return this.wrapperResponse(to, result);
};
WrapperZeroFrame.prototype.isProxyRequest = function() {
return window.location.pathname === "/";
};
WrapperZeroFrame.prototype.certSelectGotoSite = function(elem) {
var href;
href = $(elem).attr("href");
if (this.isProxyRequest()) {
return $(elem).attr("href", "http://zero" + href);
}
};
return WrapperZeroFrame;
})();
window.zeroframe = new WrapperZeroFrame(window.wrapper);
}).call(this);