summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/exe/js.php1
-rw-r--r--lib/scripts/compatibility.js15
-rw-r--r--lib/scripts/events.js50
-rw-r--r--lib/scripts/helpers.js29
4 files changed, 44 insertions, 51 deletions
diff --git a/lib/exe/js.php b/lib/exe/js.php
index 44ab2d5ca..4355cbfd7 100644
--- a/lib/exe/js.php
+++ b/lib/exe/js.php
@@ -44,7 +44,6 @@ function js_out(){
DOKU_INC.'lib/scripts/jquery/jquery.cookie.js',
DOKU_INC."lib/scripts/jquery/jquery-ui$min.js",
DOKU_INC.'lib/scripts/helpers.js',
- DOKU_INC.'lib/scripts/events.js',
DOKU_INC.'lib/scripts/delay.js',
DOKU_INC.'lib/scripts/cookie.js',
DOKU_INC.'lib/scripts/script.js',
diff --git a/lib/scripts/compatibility.js b/lib/scripts/compatibility.js
index 13b088582..a5cc87e58 100644
--- a/lib/scripts/compatibility.js
+++ b/lib/scripts/compatibility.js
@@ -108,3 +108,18 @@ function prependChild(parent,element) {
jQuery(parent).prepend(element);
}
+function addEvent(element, type, handler) {
+ DEPRECATED('Use jQuery.bind() instead.');
+ jQuery(element).bind(type,{},handler);
+}
+
+function removeEvent(element, type, handler) {
+ DEPRECATED('Use jQuery.unbind() instead.');
+ jQuery(element).unbind(type,handler);
+}
+
+function addInitEvent(func) {
+ DEPRECATED('Use jQuery(<function>) instead');
+ jQuery(func);
+}
+
diff --git a/lib/scripts/events.js b/lib/scripts/events.js
deleted file mode 100644
index 796d3cc4c..000000000
--- a/lib/scripts/events.js
+++ /dev/null
@@ -1,50 +0,0 @@
-/**
- * The event functions are no longer in use and a mere wrapper around
- * jQuery's event handlers.
- *
- * @deprecated
- */
-function addEvent(element, type, handler) {
- DEPRECATED('Use jQuery.bind() instead.');
- jQuery(element).bind(type,{},handler);
-}
-
-function removeEvent(element, type, handler) {
- DEPRECATED('Use jQuery.unbind() instead.');
- jQuery(element).unbind(type,handler);
-}
-
-function addInitEvent(func) {
- DEPRECATED('Use jQuery(<function>) instead');
- jQuery(func);
-}
-
-/**
- * Bind variables to a function call creating a closure
- *
- * Use this to circumvent variable scope problems when creating closures
- * inside a loop
- *
- * @author Adrian Lang <lang@cosmocode.de>
- * @fixme Is there a jQuery equivalent? Otherwise move to somewhere else
- * @link http://www.cosmocode.de/en/blog/gohr/2009-10/15-javascript-fixing-the-closure-scope-in-loops
- * @param functionref fnc - the function to be called
- * @param mixed - any arguments to be passed to the function
- * @returns functionref
- */
-function bind(fnc/*, ... */) {
- var Aps = Array.prototype.slice;
- // Store passed arguments in this scope.
- // Since arguments is no Array nor has an own slice method,
- // we have to apply the slice method from the Array.prototype
- var static_args = Aps.call(arguments, 1);
-
- // Return a function evaluating the passed function with the
- // given args and optional arguments passed on invocation.
- return function (/* ... */) {
- // Same here, but we use Array.prototype.slice solely for
- // converting arguments to an Array.
- return fnc.apply(this,
- static_args.concat(Aps.call(arguments, 0)));
- };
-}
diff --git a/lib/scripts/helpers.js b/lib/scripts/helpers.js
index 77e7ffc4a..b286965cf 100644
--- a/lib/scripts/helpers.js
+++ b/lib/scripts/helpers.js
@@ -163,3 +163,32 @@ function substr_replace(str, replace, start, length) {
b1 = (length < 0 ? str.length : a2) + length;
return str.substring(0, a2) + replace + str.substring(b1);
}
+
+/**
+ * Bind variables to a function call creating a closure
+ *
+ * Use this to circumvent variable scope problems when creating closures
+ * inside a loop
+ *
+ * @author Adrian Lang <lang@cosmocode.de>
+ * @link http://www.cosmocode.de/en/blog/gohr/2009-10/15-javascript-fixing-the-closure-scope-in-loops
+ * @param functionref fnc - the function to be called
+ * @param mixed - any arguments to be passed to the function
+ * @returns functionref
+ */
+function bind(fnc/*, ... */) {
+ var Aps = Array.prototype.slice;
+ // Store passed arguments in this scope.
+ // Since arguments is no Array nor has an own slice method,
+ // we have to apply the slice method from the Array.prototype
+ var static_args = Aps.call(arguments, 1);
+
+ // Return a function evaluating the passed function with the
+ // given args and optional arguments passed on invocation.
+ return function (/* ... */) {
+ // Same here, but we use Array.prototype.slice solely for
+ // converting arguments to an Array.
+ return fnc.apply(this,
+ static_args.concat(Aps.call(arguments, 0)));
+ };
+}