From cd06d16faa924afeb14f864b058e01ce8867057c Mon Sep 17 00:00:00 2001 From: Adrian Lang Date: Tue, 21 Jun 2011 13:30:18 +0200 Subject: Fix index Javascript, introduce compatibility.js * Removed "use strict" statement, since it does not work with our script file joining (the statement has to be the first in a file or function) * Make index a global object again to allow overriding and enhancing * Use prefix dw_ for index object * Reintroduce index.treeattach * Support deprecated index.toggle calling convention * Add $ prefix for jQuery variables * Use slide animation for freshly loaded sublists as well * Fix various errors --- lib/scripts/compatibility.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 lib/scripts/compatibility.js (limited to 'lib/scripts/compatibility.js') diff --git a/lib/scripts/compatibility.js b/lib/scripts/compatibility.js new file mode 100644 index 000000000..559cc359a --- /dev/null +++ b/lib/scripts/compatibility.js @@ -0,0 +1,16 @@ +/*jslint sloppy: true */ +/*global dw_index, DEPRECATED */ + +var index = { + throbber_delay: dw_index.throbber_delay, + + toggle: function () { + DEPRECATED(); + dw_index.toggle.apply(dw_index, arguments); + }, + + treeattach: function () { + DEPRECATED(); + dw_index.treeattach.apply(dw_index, arguments); + } +}; -- cgit v1.2.3 From c949174a2e8c324e3e463a9d10e9e6dc07b0ba9e Mon Sep 17 00:00:00 2001 From: Adrian Lang Date: Wed, 22 Jun 2011 21:05:17 +0200 Subject: Fix and refactor ajax.js * Move file to qsearch.js * Rename object to dw_qsearch * Remove unnecessary usage of Delay * Use $ prefix for jQuery objects * Fix result list hiding on click * Fix namespace shorting --- lib/scripts/compatibility.js | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) (limited to 'lib/scripts/compatibility.js') diff --git a/lib/scripts/compatibility.js b/lib/scripts/compatibility.js index 559cc359a..54eb07632 100644 --- a/lib/scripts/compatibility.js +++ b/lib/scripts/compatibility.js @@ -1,16 +1,14 @@ /*jslint sloppy: true */ -/*global dw_index, DEPRECATED */ +/*global dw_index, dw_qsearch, DEPRECATED_WRAP */ var index = { throbber_delay: dw_index.throbber_delay, + toggle: DEPRECATED_WRAP(dw_index.toggle, dw_index), + treeattach: DEPRECATED_WRAP(dw_index.treeattach, dw_index) +}; - toggle: function () { - DEPRECATED(); - dw_index.toggle.apply(dw_index, arguments); - }, - - treeattach: function () { - DEPRECATED(); - dw_index.treeattach.apply(dw_index, arguments); - } +var ajax_quicksearch = { + init: DEPRECATED_WRAP(dw_qsearch.init, dw_qsearch), + clear_results: DEPRECATED_WRAP(dw_qsearch.clear_results, dw_qsearch), + onCompletion: DEPRECATED_WRAP(dw_qsearch.onCompletion, dw_qsearch) }; -- cgit v1.2.3 From 0589eb71f959c92226f31a408aefc1ca4306b54d Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Mon, 4 Jul 2011 22:55:11 +0200 Subject: deprecated findPosX and findPosY --- lib/scripts/compatibility.js | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'lib/scripts/compatibility.js') diff --git a/lib/scripts/compatibility.js b/lib/scripts/compatibility.js index 54eb07632..bd5403f0d 100644 --- a/lib/scripts/compatibility.js +++ b/lib/scripts/compatibility.js @@ -12,3 +12,14 @@ var ajax_quicksearch = { clear_results: DEPRECATED_WRAP(dw_qsearch.clear_results, dw_qsearch), onCompletion: DEPRECATED_WRAP(dw_qsearch.onCompletion, dw_qsearch) }; + +function findPosX(object){ + DEPRECATED('Use jQuery.position() instead'); + return jQuery(object).position().left; +} + +function findPosY(object){ + DEPRECATED('Use jQuery.position() instead'); + return jQuery(object).position().top; +} + -- cgit v1.2.3 From 5566338d2cd5117586de2c881cffe4bc00f61a5a Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Mon, 4 Jul 2011 22:55:51 +0200 Subject: deprecated getElementsByClass --- lib/scripts/compatibility.js | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'lib/scripts/compatibility.js') diff --git a/lib/scripts/compatibility.js b/lib/scripts/compatibility.js index bd5403f0d..58efc03b9 100644 --- a/lib/scripts/compatibility.js +++ b/lib/scripts/compatibility.js @@ -23,3 +23,8 @@ function findPosY(object){ return jQuery(object).position().top; } +function getElementsByClass(searchClass,node,tag){ + DEPRECATED('Use jQuery() instead'); + if(node == null) node = document; + return jQuery(node).find(tag+'.'+searchClass).toArray(); +} -- cgit v1.2.3 From d57b00771430e5ae76d25920e2a49d8a0adda651 Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Fri, 8 Jul 2011 11:39:45 +0200 Subject: renamed linkwiz object --- lib/scripts/compatibility.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'lib/scripts/compatibility.js') diff --git a/lib/scripts/compatibility.js b/lib/scripts/compatibility.js index 58efc03b9..6c851d5e2 100644 --- a/lib/scripts/compatibility.js +++ b/lib/scripts/compatibility.js @@ -13,6 +13,24 @@ var ajax_quicksearch = { onCompletion: DEPRECATED_WRAP(dw_qsearch.onCompletion, dw_qsearch) }; +var linkwiz = { + init: DEPRECATED_WRAP(dw_linkwiz.init, dw_linkwiz), + onEntry: DEPRECATED_WRAP(dw_linkwiz.onEntry, dw_linkwiz), + getResult: DEPRECATED_WRAP(dw_linkwiz.getResult, dw_linkwiz), + select: DEPRECATED_WRAP(dw_linkwiz.select, dw_linkwiz), + deselect: DEPRECATED_WRAP(dw_linkwiz.deselect, dw_linkwiz), + onResultClick: DEPRECATED_WRAP(dw_linkwiz.onResultClick, dw_linkwiz), + resultClick: DEPRECATED_WRAP(dw_linkwiz.resultClick, dw_linkwiz), + insertLink: DEPRECATED_WRAP(dw_linkwiz.insertLink, dw_linkwiz), + autocomplete: DEPRECATED_WRAP(dw_linkwiz.autocomplete, dw_linkwiz), + autocomplete_exec: DEPRECATED_WRAP(dw_linkwiz.autocomplete_exec, dw_linkwiz), + clear: DEPRECATED_WRAP(dw_linkwiz.clear, dw_linkwiz), + show: DEPRECATED_WRAP(dw_linkwiz.show, dw_linkwiz), + hide: DEPRECATED_WRAP(dw_linkwiz.hide, dw_linkwiz), + toggle: DEPRECATED_WRAP(dw_linkwiz.toggle, dw_linkwiz) +}; + + function findPosX(object){ DEPRECATED('Use jQuery.position() instead'); return jQuery(object).position().left; -- cgit v1.2.3 From 05685ca5e3f5f2616b1c73148cef8b1fb5fe331d Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Fri, 8 Jul 2011 12:01:05 +0200 Subject: linkwiz: clear doesn't exist anymore --- lib/scripts/compatibility.js | 1 - 1 file changed, 1 deletion(-) (limited to 'lib/scripts/compatibility.js') diff --git a/lib/scripts/compatibility.js b/lib/scripts/compatibility.js index 6c851d5e2..ac17a4427 100644 --- a/lib/scripts/compatibility.js +++ b/lib/scripts/compatibility.js @@ -24,7 +24,6 @@ var linkwiz = { insertLink: DEPRECATED_WRAP(dw_linkwiz.insertLink, dw_linkwiz), autocomplete: DEPRECATED_WRAP(dw_linkwiz.autocomplete, dw_linkwiz), autocomplete_exec: DEPRECATED_WRAP(dw_linkwiz.autocomplete_exec, dw_linkwiz), - clear: DEPRECATED_WRAP(dw_linkwiz.clear, dw_linkwiz), show: DEPRECATED_WRAP(dw_linkwiz.show, dw_linkwiz), hide: DEPRECATED_WRAP(dw_linkwiz.hide, dw_linkwiz), toggle: DEPRECATED_WRAP(dw_linkwiz.toggle, dw_linkwiz) -- cgit v1.2.3 From ddf8a04fe3281e871c5311235b08185a5ceab797 Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Fri, 8 Jul 2011 12:20:02 +0200 Subject: moved some editor functions to a new dw_editor object There are probably more functions that should go in here --- lib/scripts/compatibility.js | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'lib/scripts/compatibility.js') diff --git a/lib/scripts/compatibility.js b/lib/scripts/compatibility.js index ac17a4427..1ab7d02ad 100644 --- a/lib/scripts/compatibility.js +++ b/lib/scripts/compatibility.js @@ -29,6 +29,10 @@ var linkwiz = { toggle: DEPRECATED_WRAP(dw_linkwiz.toggle, dw_linkwiz) }; +initSizeCtl = DEPRECATED_WRAP(dw_editor.initSizeCtl); +sizeCtl = DEPRECATED_WRAP(dw_editor.sizeCtl); +toggleWrap = DEPRECATED_WRAP(dw_editor.toggleWrap); +setWrap = DEPRECATED_WRAP(dw_editor.setWrap); function findPosX(object){ DEPRECATED('Use jQuery.position() instead'); -- cgit v1.2.3 From ff9f537503912e41605048e604fb938256468001 Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Fri, 8 Jul 2011 13:12:06 +0200 Subject: deprecated prependChild() --- lib/scripts/compatibility.js | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'lib/scripts/compatibility.js') diff --git a/lib/scripts/compatibility.js b/lib/scripts/compatibility.js index 1ab7d02ad..e9d845625 100644 --- a/lib/scripts/compatibility.js +++ b/lib/scripts/compatibility.js @@ -49,3 +49,9 @@ function getElementsByClass(searchClass,node,tag){ if(node == null) node = document; return jQuery(node).find(tag+'.'+searchClass).toArray(); } + +function prependChild(parent,element) { + DEPRECATED('Use jQuery.prepend() instead'); + jQuery(parent).prepend(element); +} + -- cgit v1.2.3 From d10c9a7424d1ef0aace2fd34e1008196d111a88c Mon Sep 17 00:00:00 2001 From: Adrian Lang Date: Thu, 7 Jul 2011 16:08:05 +0200 Subject: Rewrite mediamanager JavaScript Make it faster, prettier, less wrong, add UI effects, use jQuery UI Dialog, Abstract tree view stuff away into jQuery.dw_tree --- lib/scripts/compatibility.js | 52 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) (limited to 'lib/scripts/compatibility.js') diff --git a/lib/scripts/compatibility.js b/lib/scripts/compatibility.js index e9d845625..27347972a 100644 --- a/lib/scripts/compatibility.js +++ b/lib/scripts/compatibility.js @@ -29,6 +29,58 @@ var linkwiz = { toggle: DEPRECATED_WRAP(dw_linkwiz.toggle, dw_linkwiz) }; +var media_manager = { + // treeattach, selectorattach, confirmattach are munched together into + // dw_mediamanager.init + attachoptions: DEPRECATED_WRAP(dw_mediamanager.attachoptions, dw_mediamanager), + togglekeepopen: function (event, cb) { + DEPRECATED('Use dw_mediamanager.toggleOption instead'); + return dw_mediamanager.toggleOption.call(cb, 'keepopen'); + }, + togglehide: function (event, cb) { + DEPRECATED('Use dw_mediamanager.toggleOption instead'); + return dw_mediamanager.toggleOption.call(cb, 'hide'); + }, + updatehide: DEPRECATED_WRAP(dw_mediamanager.updatehide, dw_mediamanager), + select: function (event, link) { + DEPRECATED('Use dw_mediamanager.select instead'); + return dw_mediamanager.select.call(link, event); + }, + initpopup: DEPRECATED_WRAP(dw_mediamanager.initpopup, dw_mediamanager), + insert: DEPRECATED_WRAP(dw_mediamanager.insert, dw_mediamanager), + list: function (event, link) { + DEPRECATED('Use dw_mediamanager.list instead'); + return dw_mediamanager.list.call(link, event); + }, + // toggle is handled by dw_tree + suggest: DEPRECATED_WRAP(dw_mediamanager.suggest, dw_mediamanager), + initFlashUpload: DEPRECATED_WRAP(dw_mediamanager.initFlashUpload, dw_mediamanager), + closePopup: function () { + DEPRECATED(); + dw_mediamanager.$popup.dialog('close'); + }, + setalign: function (event, cb) { + DEPRECATED('Use dw_mediamanager.setOpt instead'); + return dw_mediamanager.setOpt.call(this, 'align', event); + }, + setlink: function (event, cb) { + DEPRECATED('Use dw_mediamanager.setOpt instead'); + return dw_mediamanager.setOpt.call(this, 'link', event); + }, + setsize: function (event, cb) { + DEPRECATED('Use dw_mediamanager.setOpt instead'); + return dw_mediamanager.setOpt.call(this, 'size', event); + }, + outSet: function (id) { + DEPRECATED(); + return jQuery(id).removeClass('selected'); + }, + inSet: function (id) { + DEPRECATED(); + return jQuery(id).addClass('selected'); + } +}; + initSizeCtl = DEPRECATED_WRAP(dw_editor.initSizeCtl); sizeCtl = DEPRECATED_WRAP(dw_editor.sizeCtl); toggleWrap = DEPRECATED_WRAP(dw_editor.toggleWrap); -- cgit v1.2.3 From bd6d984f1ebbd5da31b431960e408efd150825b7 Mon Sep 17 00:00:00 2001 From: Michael Hamann Date: Tue, 19 Jul 2011 16:49:11 +0200 Subject: Make getElementsByClass() work without given tag This fixes the hiding of the highlighting of the current section when the mouse leaves the edit section button. --- lib/scripts/compatibility.js | 1 + 1 file changed, 1 insertion(+) (limited to 'lib/scripts/compatibility.js') diff --git a/lib/scripts/compatibility.js b/lib/scripts/compatibility.js index 27347972a..13b088582 100644 --- a/lib/scripts/compatibility.js +++ b/lib/scripts/compatibility.js @@ -99,6 +99,7 @@ function findPosY(object){ function getElementsByClass(searchClass,node,tag){ DEPRECATED('Use jQuery() instead'); if(node == null) node = document; + if(typeof tag === 'undefined') tag = ''; return jQuery(node).find(tag+'.'+searchClass).toArray(); } -- cgit v1.2.3 From b2a330ca75f1ceec063a08029abb0204110e3601 Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Sat, 6 Aug 2011 13:56:57 +0200 Subject: removed events.js --- lib/scripts/compatibility.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'lib/scripts/compatibility.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() instead'); + jQuery(func); +} + -- cgit v1.2.3 From 26fc53c6a8fe022cd60b5df5474cfbe35afd34e4 Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Fri, 19 Aug 2011 15:40:58 +0200 Subject: moved more stuff out from script.js the file is nearly empty now --- lib/scripts/compatibility.js | 87 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 87 insertions(+) (limited to 'lib/scripts/compatibility.js') diff --git a/lib/scripts/compatibility.js b/lib/scripts/compatibility.js index a5cc87e58..ddc8823d3 100644 --- a/lib/scripts/compatibility.js +++ b/lib/scripts/compatibility.js @@ -1,6 +1,78 @@ /*jslint sloppy: true */ /*global dw_index, dw_qsearch, DEPRECATED_WRAP */ +/** + * Mark a JavaScript function as deprecated + * + * This will print a warning to the JavaScript console (if available) in + * Firebug and Chrome and a stack trace (if available) to easily locate the + * problematic function call. + * + * @param msg optional message to print + */ +function DEPRECATED(msg){ + if(!window.console) return; + if(!msg) msg = ''; + + var func; + if(arguments.callee) func = arguments.callee.caller.name; + if(func) func = ' '+func+'()'; + var line = 'DEPRECATED function call'+func+'. '+msg; + + if(console.warn){ + console.warn(line); + }else{ + console.log(line); + } + + if(console.trace) console.trace(); +} + +/** + * Construct a wrapper function for deprecated function names + * + * This function returns a wrapper function which just calls DEPRECATED + * and the new function. + * + * @param func The new function + * @param context Optional; The context (`this`) of the call + */ +function DEPRECATED_WRAP(func, context) { + return function () { + DEPRECATED(); + return func.apply(context || this, arguments); + } +} + +/** + * Handy shortcut to document.getElementById + * + * This function was taken from the prototype library + * + * @link http://prototype.conio.net/ + */ +function $() { + DEPRECATED('Please use the JQuery() function instead.'); + + var elements = new Array(); + + for (var i = 0; i < arguments.length; i++) { + var element = arguments[i]; + if (typeof element == 'string') + element = document.getElementById(element); + + if (arguments.length == 1) + return element; + + elements.push(element); + } + + return elements; +} + + + + var index = { throbber_delay: dw_index.throbber_delay, toggle: DEPRECATED_WRAP(dw_index.toggle, dw_index), @@ -123,3 +195,18 @@ function addInitEvent(func) { jQuery(func); } + +function jsEscape(text){ + DEPRECATED('Insert text through jQuery.text() instead of escaping on your own'); + var re=new RegExp("\\\\","g"); + text=text.replace(re,"\\\\"); + re=new RegExp("'","g"); + text=text.replace(re,"\\'"); + re=new RegExp('"',"g"); + text=text.replace(re,'"'); + re=new RegExp("\\\\\\\\n","g"); + text=text.replace(re,"\\n"); + return text; +} + + -- cgit v1.2.3 From cb42e5f1de77ce65441002c0b0b94d5855cab1f0 Mon Sep 17 00:00:00 2001 From: Adrian Lang Date: Mon, 22 Aug 2011 15:25:15 +0200 Subject: Deprecate several helper functions, JSLINT helpers.js --- lib/scripts/compatibility.js | 172 ++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 169 insertions(+), 3 deletions(-) (limited to 'lib/scripts/compatibility.js') diff --git a/lib/scripts/compatibility.js b/lib/scripts/compatibility.js index ddc8823d3..39f703c71 100644 --- a/lib/scripts/compatibility.js +++ b/lib/scripts/compatibility.js @@ -1,6 +1,3 @@ -/*jslint sloppy: true */ -/*global dw_index, dw_qsearch, DEPRECATED_WRAP */ - /** * Mark a JavaScript function as deprecated * @@ -209,4 +206,173 @@ function jsEscape(text){ return text; } +/** + * Simple function to check if a global var is defined + * + * @author Kae Verens + * @link http://verens.com/archives/2005/07/25/isset-for-javascript/#comment-2835 + */ +function isset(varname){ + DEPRECATED("Use `typeof var !== 'undefined'` instead"); + return(typeof(window[varname])!='undefined'); +} + +/** + * Checks if property is undefined + * + * @param {Object} prop value to check + * @return {Boolean} true if matched + * @scope public + * @author Ilya Lebedev + */ +function isUndefined (prop /* :Object */) /* :Boolean */ { + DEPRECATED("Use `typeof var === 'undefined'` instead"); + return (typeof prop == 'undefined'); +} + +/** + * Checks if property is function + * + * @param {Object} prop value to check + * @return {Boolean} true if matched + * @scope public + * @author Ilya Lebedev + */ +function isFunction (prop /* :Object */) /* :Boolean */ { + DEPRECATED("Use `typeof var === 'function'` instead"); + return (typeof prop == 'function'); +} +/** + * Checks if property is string + * + * @param {Object} prop value to check + * @return {Boolean} true if matched + * @scope public + * @author Ilya Lebedev + */ +function isString (prop /* :Object */) /* :Boolean */ { + DEPRECATED("Use `typeof var === 'string'` instead"); + return (typeof prop == 'string'); +} + +/** + * Checks if property is number + * + * @param {Object} prop value to check + * @return {Boolean} true if matched + * @scope public + * @author Ilya Lebedev + */ +function isNumber (prop /* :Object */) /* :Boolean */ { + DEPRECATED("Use `typeof var === 'number'` instead"); + return (typeof prop == 'number'); +} + +/** + * Checks if property is the calculable number + * + * @param {Object} prop value to check + * @return {Boolean} true if matched + * @scope public + * @author Ilya Lebedev + */ +function isNumeric (prop /* :Object */) /* :Boolean */ { + DEPRECATED("Use `typeof var === 'number' && !isNaN(var) && isFinite(var)` instead"); + return isNumber(prop)&&!isNaN(prop)&&isFinite(prop); +} + +/** + * Checks if property is array + * + * @param {Object} prop value to check + * @return {Boolean} true if matched + * @scope public + * @author Ilya Lebedev + */ +function isArray (prop /* :Object */) /* :Boolean */ { + DEPRECATED("Use `var instanceof Array` instead"); + return (prop instanceof Array); +} + +/** + * Checks if property is regexp + * + * @param {Object} prop value to check + * @return {Boolean} true if matched + * @scope public + * @author Ilya Lebedev + */ +function isRegExp (prop /* :Object */) /* :Boolean */ { + DEPRECATED("Use `var instanceof RegExp` instead"); + return (prop instanceof RegExp); +} + +/** + * Checks if property is a boolean value + * + * @param {Object} prop value to check + * @return {Boolean} true if matched + * @scope public + * @author Ilya Lebedev + */ +function isBoolean (prop /* :Object */) /* :Boolean */ { + DEPRECATED("Use `typeof var === 'boolean'` instead"); + return ('boolean' == typeof prop); +} + +/** + * Checks if property is a scalar value (value that could be used as the hash key) + * + * @param {Object} prop value to check + * @return {Boolean} true if matched + * @scope public + * @author Ilya Lebedev + */ +function isScalar (prop /* :Object */) /* :Boolean */ { + DEPRECATED("Use `typeof var === 'string' || (typeof var === 'number' &&" + + " !isNaN(var) && isFinite(var))` instead"); + return isNumeric(prop)||isString(prop); +} + +/** + * Checks if property is empty + * + * @param {Object} prop value to check + * @return {Boolean} true if matched + * @scope public + * @author Ilya Lebedev + */ +function isEmpty (prop /* :Object */) /* :Boolean */ { + DEPRECATED(); + var i; + if (isBoolean(prop)) { + return false; + } else if (isRegExp(prop) && new RegExp("").toString() == prop.toString()) { + return true; + } else if (isString(prop) || isNumber(prop)) { + return !prop; + } else if (Boolean(prop) && false != prop) { + for (i in prop) { + if(prop.hasOwnProperty(i)) { + return false; + } + } + } + return true; +} + +/** + * Get the computed style of a node. + * + * @link https://acidmartin.wordpress.com/2008/08/26/style-get-any-css-property-value-of-an-object/ + * @link http://svn.dojotoolkit.org/src/dojo/trunk/_base/html.js + */ +function gcs(node){ + DEPRECATED('Use jQuery(node).style() instead'); + if(node.currentStyle){ + return node.currentStyle; + }else{ + return node.ownerDocument.defaultView.getComputedStyle(node, null); + } +} -- cgit v1.2.3 From ba6c070edd92ca0fc8a6ee85d51769d64a19ee7c Mon Sep 17 00:00:00 2001 From: Adrian Lang Date: Sun, 4 Sep 2011 13:52:43 +0200 Subject: tmp --- lib/scripts/compatibility.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/scripts/compatibility.js') diff --git a/lib/scripts/compatibility.js b/lib/scripts/compatibility.js index 39f703c71..3b027f016 100644 --- a/lib/scripts/compatibility.js +++ b/lib/scripts/compatibility.js @@ -38,7 +38,7 @@ function DEPRECATED_WRAP(func, context) { return function () { DEPRECATED(); return func.apply(context || this, arguments); - } + }; } /** -- cgit v1.2.3 From 1ffc211ddb46bfabe649bbacd1e36bc8e035afa3 Mon Sep 17 00:00:00 2001 From: Adrian Lang Date: Sun, 4 Sep 2011 15:32:41 +0200 Subject: Revert tmp commits This reverts commit ba6c070edd92ca0fc8a6ee85d51769d64a19ee7c. This reverts commit 923510088dda99cb2790b15308593e47369d4f01. --- lib/scripts/compatibility.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/scripts/compatibility.js') diff --git a/lib/scripts/compatibility.js b/lib/scripts/compatibility.js index 3b027f016..39f703c71 100644 --- a/lib/scripts/compatibility.js +++ b/lib/scripts/compatibility.js @@ -38,7 +38,7 @@ function DEPRECATED_WRAP(func, context) { return function () { DEPRECATED(); return func.apply(context || this, arguments); - }; + } } /** -- cgit v1.2.3 From 5e7a292691951a0fa0a18f06c8b9bcfb509a032d Mon Sep 17 00:00:00 2001 From: Adrian Lang Date: Fri, 9 Sep 2011 22:26:16 +0200 Subject: Various JavaScript improvements, JSLint, jQuery --- lib/scripts/compatibility.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/scripts/compatibility.js') diff --git a/lib/scripts/compatibility.js b/lib/scripts/compatibility.js index 39f703c71..3b027f016 100644 --- a/lib/scripts/compatibility.js +++ b/lib/scripts/compatibility.js @@ -38,7 +38,7 @@ function DEPRECATED_WRAP(func, context) { return function () { DEPRECATED(); return func.apply(context || this, arguments); - } + }; } /** -- cgit v1.2.3 From 5409251a942c68bcf0c3778d0ffd658b1bd315d9 Mon Sep 17 00:00:00 2001 From: Adrian Lang Date: Tue, 13 Sep 2011 13:00:20 +0200 Subject: Readd variable declaration for plugin:sortablejs --- lib/scripts/compatibility.js | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'lib/scripts/compatibility.js') diff --git a/lib/scripts/compatibility.js b/lib/scripts/compatibility.js index 3b027f016..5cc8b3011 100644 --- a/lib/scripts/compatibility.js +++ b/lib/scripts/compatibility.js @@ -376,3 +376,9 @@ function gcs(node){ } } +/** + * Until 2011-05-25 "Rincewind", a code intended to fix some Safari issue + * always declared the global _timer. plugin:sortablejs relies on _timer + * being declared. + */ +var _timer; -- cgit v1.2.3 From 7827dd2afcb37599610894016f2e1e6150e561b7 Mon Sep 17 00:00:00 2001 From: Adrian Lang Date: Fri, 16 Sep 2011 12:27:43 +0200 Subject: Increase locktimer compatibility --- lib/scripts/compatibility.js | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'lib/scripts/compatibility.js') diff --git a/lib/scripts/compatibility.js b/lib/scripts/compatibility.js index 5cc8b3011..46cb6ccc2 100644 --- a/lib/scripts/compatibility.js +++ b/lib/scripts/compatibility.js @@ -98,6 +98,15 @@ var linkwiz = { toggle: DEPRECATED_WRAP(dw_linkwiz.toggle, dw_linkwiz) }; +var locktimer = { + init: DEPRECATED_WRAP(dw_locktimer.init, dw_locktimer), + reset: DEPRECATED_WRAP(dw_locktimer.reset, dw_locktimer), + warning: DEPRECATED_WRAP(dw_locktimer.warning, dw_locktimer), + clear: DEPRECATED_WRAP(dw_locktimer.clear, dw_locktimer), + refresh: DEPRECATED_WRAP(dw_locktimer.refresh, dw_locktimer), + refreshed: DEPRECATED_WRAP(dw_locktimer.refreshed, dw_locktimer) +}; + var media_manager = { // treeattach, selectorattach, confirmattach are munched together into // dw_mediamanager.init -- cgit v1.2.3 From 1c04390c3b7c331cf85c4fa21c8c52212c15d903 Mon Sep 17 00:00:00 2001 From: Adrian Lang Date: Fri, 16 Sep 2011 14:20:47 +0200 Subject: Increase compatibility in addEvent --- lib/scripts/compatibility.js | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) (limited to 'lib/scripts/compatibility.js') diff --git a/lib/scripts/compatibility.js b/lib/scripts/compatibility.js index 46cb6ccc2..ea52153c5 100644 --- a/lib/scripts/compatibility.js +++ b/lib/scripts/compatibility.js @@ -187,8 +187,29 @@ function prependChild(parent,element) { } function addEvent(element, type, handler) { - DEPRECATED('Use jQuery.bind() instead.'); - jQuery(element).bind(type,{},handler); + DEPRECATED('Use jQuery.bind() instead. Note that jQuery’s behaviour' + + ' when a handler returns false differs from addEvent’s'); + jQuery(element).bind(type,{},function (e) { + // returning false in an addEvent event handler did not prevent + // bubbling but just canceled handlers on this node and prevented + // default behavior, so wrap the handler call and mimic that behavior. + // + // Refer to jQuery.event.handle(). + var ret = handler.apply(this, Array.prototype.slice.call(arguments, 0)); + if (typeof ret !== 'undefined') { + if ( ret !== false ) { + return ret; + } + // What jQuery does. + e.result = ret; + e.preventDefault(); + // Not what jQuery does. This would be: event.stopPropagation(); + // Hack it so that immediate propagation (other event handlers on + // this element) appears stopped without stopping the actual + // propagation (bubbling) + e.isImmediatePropagationStopped = function () { return true; }; + } + }); } function removeEvent(element, type, handler) { -- cgit v1.2.3