Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Mueller <thomas.mueller@tmit.eu>2013-02-14 15:16:51 +0400
committerThomas Mueller <thomas.mueller@tmit.eu>2013-02-14 15:20:04 +0400
commit8877087b5716fde078bab4d303240498f02dd48b (patch)
treeec897d2aae2804e41929cd342452959b6ba28255
parenta03d70209fabbb3d2ae7137a6edde1f0712cd9e1 (diff)
adding a compatibility.js as a single source to define all fallback function declarations
-rw-r--r--core/js/compatibility.js25
-rw-r--r--lib/base.php1
2 files changed, 26 insertions, 0 deletions
diff --git a/core/js/compatibility.js b/core/js/compatibility.js
new file mode 100644
index 00000000000..3e9178f3200
--- /dev/null
+++ b/core/js/compatibility.js
@@ -0,0 +1,25 @@
+
+//https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Function/bind
+if (!Function.prototype.bind) {
+ Function.prototype.bind = function (oThis) {
+ if (typeof this !== "function") {
+ // closest thing possible to the ECMAScript 5 internal IsCallable function
+ throw new TypeError("Function.prototype.bind - what is trying to be bound is not callable");
+ }
+
+ var aArgs = Array.prototype.slice.call(arguments, 1),
+ fToBind = this,
+ fNOP = function () {},
+ fBound = function () {
+ return fToBind.apply(this instanceof fNOP && oThis
+ ? this
+ : oThis,
+ aArgs.concat(Array.prototype.slice.call(arguments)));
+ };
+
+ fNOP.prototype = this.prototype;
+ fBound.prototype = new fNOP();
+
+ return fBound;
+ };
+}
diff --git a/lib/base.php b/lib/base.php
index c60a97100f4..fd9a1d41121 100644
--- a/lib/base.php
+++ b/lib/base.php
@@ -278,6 +278,7 @@ class OC {
OC_Util::addScript("jquery-showpassword");
OC_Util::addScript("jquery.infieldlabel");
OC_Util::addScript("jquery-tipsy");
+ OC_Util::addScript("compatibility");
OC_Util::addScript("oc-dialogs");
OC_Util::addScript("js");
OC_Util::addScript("eventsource");