From 04cf441c5ae18400c6b4865b0b37a71718dc9d46 Mon Sep 17 00:00:00 2001 From: Ola Bini Date: Thu, 31 Jul 2014 19:29:33 -0300 Subject: Add web-ui based on previous code --- web-ui/app/js/monkey_patching/all.js | 1 + web-ui/app/js/monkey_patching/array.js | 11 +++++++++++ web-ui/app/js/monkey_patching/post_message.js | 16 ++++++++++++++++ 3 files changed, 28 insertions(+) create mode 100644 web-ui/app/js/monkey_patching/all.js create mode 100644 web-ui/app/js/monkey_patching/array.js create mode 100644 web-ui/app/js/monkey_patching/post_message.js (limited to 'web-ui/app/js/monkey_patching') diff --git a/web-ui/app/js/monkey_patching/all.js b/web-ui/app/js/monkey_patching/all.js new file mode 100644 index 00000000..e0f98823 --- /dev/null +++ b/web-ui/app/js/monkey_patching/all.js @@ -0,0 +1 @@ +require(['js/monkey_patching/array', 'js/monkey_patching/post_message'], function () {}); \ No newline at end of file diff --git a/web-ui/app/js/monkey_patching/array.js b/web-ui/app/js/monkey_patching/array.js new file mode 100644 index 00000000..cf0e71ed --- /dev/null +++ b/web-ui/app/js/monkey_patching/array.js @@ -0,0 +1,11 @@ +(function () { + 'use strict'; + + // Array Remove - By John Resig (MIT Licensed) + Array.prototype.remove = function (from, to) { + var rest = this.slice((to || from) + 1 || this.length); + this.length = from < 0 ? this.length + from : from; + return this.push.apply(this, rest); + }; + +}()); \ No newline at end of file diff --git a/web-ui/app/js/monkey_patching/post_message.js b/web-ui/app/js/monkey_patching/post_message.js new file mode 100644 index 00000000..87576900 --- /dev/null +++ b/web-ui/app/js/monkey_patching/post_message.js @@ -0,0 +1,16 @@ +/* + * origin window.postMessage fails with non serializable objects, so we fallback to console.log to do the job + */ +(function () { + 'use strict'; + + var originalPostMessage = window.postMessage; + window.postMessage = function(a, b) { + try { + originalPostMessage(a, b); + } catch (e) { + console.log(a, b); + } + }; + +}()); -- cgit v1.2.3