diff options
author | Ola Bini <ola.bini@gmail.com> | 2014-07-31 19:29:33 -0300 |
---|---|---|
committer | Ola Bini <ola.bini@gmail.com> | 2014-07-31 19:29:33 -0300 |
commit | 04cf441c5ae18400c6b4865b0b37a71718dc9d46 (patch) | |
tree | dd0b0d049ec00389e2d4561b226c46eb1682b997 /web-ui/app/js/monkey_patching | |
parent | 639a663a4c37020003586438fdcd7ac529a00f10 (diff) |
Add web-ui based on previous code
Diffstat (limited to 'web-ui/app/js/monkey_patching')
-rw-r--r-- | web-ui/app/js/monkey_patching/all.js | 1 | ||||
-rw-r--r-- | web-ui/app/js/monkey_patching/array.js | 11 | ||||
-rw-r--r-- | web-ui/app/js/monkey_patching/post_message.js | 16 |
3 files changed, 28 insertions, 0 deletions
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); + } + }; + +}()); |