From 2d6262c1145c5937afa14d66b5203c84393df679 Mon Sep 17 00:00:00 2001 From: Pierre Spring Date: Fri, 17 Sep 2010 15:13:37 +0200 Subject: loading jQuery and putting it into noConflict mode --- lib/scripts/script.js | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'lib/scripts/script.js') diff --git a/lib/scripts/script.js b/lib/scripts/script.js index c79c9b683..1badf63a5 100644 --- a/lib/scripts/script.js +++ b/lib/scripts/script.js @@ -1,3 +1,8 @@ +// if jQuery was loaded, let's make it noConflict here. +if ('function' === typeof jQuery && 'function' === typeof jQuery.noConflict) { + jQuery.noConflict(); +} + /** * Some of these scripts were taken from wikipedia.org and were modified for DokuWiki */ -- cgit v1.2.3 From fdfb9c6a2877dcbadeab697aad779bea76780965 Mon Sep 17 00:00:00 2001 From: Michal Rezler Date: Sat, 26 Mar 2011 15:42:22 +0100 Subject: cookie.js is jQueryfied, added jQuery-cookie-plugin --- lib/scripts/script.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'lib/scripts/script.js') diff --git a/lib/scripts/script.js b/lib/scripts/script.js index a99735c99..09e61d88d 100644 --- a/lib/scripts/script.js +++ b/lib/scripts/script.js @@ -358,14 +358,14 @@ function initSizeCtl(ctlid,edid){ var textarea = $(edid); if(!ctl || !textarea) return; - var hgt = DokuCookie.getValue('sizeCtl'); + var hgt = getDokuCookie('sizeCtl'); if(hgt){ textarea.style.height = hgt; }else{ textarea.style.height = '300px'; } - var wrp = DokuCookie.getValue('wrapCtl'); + var wrp = getDokuCookie('wrapCtl'); if(wrp){ setWrap(textarea, wrp); } // else use default value @@ -393,7 +393,7 @@ function sizeCtl(edid,val){ height += val; textarea.style.height = height+'px'; - DokuCookie.setValue('sizeCtl',textarea.style.height); + setDokuCookie('sizeCtl',textarea.style.height); } /** @@ -408,7 +408,7 @@ function toggleWrap(edid){ setWrap(textarea, 'off'); } - DokuCookie.setValue('wrapCtl',textarea.getAttribute('wrap')); + setDokuCookie('wrapCtl',textarea.getAttribute('wrap')); } /** -- cgit v1.2.3 From 2ed49e2ac1bc9ed8a9d514d3ea9515e455768152 Mon Sep 17 00:00:00 2001 From: Michal Rezler Date: Mon, 28 Mar 2011 23:09:13 +0200 Subject: JS API is corrected to the original state --- lib/scripts/script.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'lib/scripts/script.js') diff --git a/lib/scripts/script.js b/lib/scripts/script.js index 09e61d88d..a99735c99 100644 --- a/lib/scripts/script.js +++ b/lib/scripts/script.js @@ -358,14 +358,14 @@ function initSizeCtl(ctlid,edid){ var textarea = $(edid); if(!ctl || !textarea) return; - var hgt = getDokuCookie('sizeCtl'); + var hgt = DokuCookie.getValue('sizeCtl'); if(hgt){ textarea.style.height = hgt; }else{ textarea.style.height = '300px'; } - var wrp = getDokuCookie('wrapCtl'); + var wrp = DokuCookie.getValue('wrapCtl'); if(wrp){ setWrap(textarea, wrp); } // else use default value @@ -393,7 +393,7 @@ function sizeCtl(edid,val){ height += val; textarea.style.height = height+'px'; - setDokuCookie('sizeCtl',textarea.style.height); + DokuCookie.setValue('sizeCtl',textarea.style.height); } /** @@ -408,7 +408,7 @@ function toggleWrap(edid){ setWrap(textarea, 'off'); } - setDokuCookie('wrapCtl',textarea.getAttribute('wrap')); + DokuCookie.setValue('wrapCtl',textarea.getAttribute('wrap')); } /** -- cgit v1.2.3 From d4be3f966cd03ceb295f319346c185ccf58da10a Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Fri, 3 Jun 2011 13:56:30 +0200 Subject: Deprecation marker for JavaScript functions This adds a DEPRECATED() JavaScript function. This function will print a warning to the Browser's debug console if available (Chrome and Firefox with Firebug extension) when ever it is called. The DEPRECATED() function was also added to the $() function which should no longer be used and be replaced with JQuery calls. Other deprecated functions need to be identified and marked. --- lib/scripts/script.js | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'lib/scripts/script.js') diff --git a/lib/scripts/script.js b/lib/scripts/script.js index a99735c99..20e475190 100644 --- a/lib/scripts/script.js +++ b/lib/scripts/script.js @@ -3,6 +3,32 @@ if ('function' === typeof jQuery && 'function' === typeof jQuery.noConflict) { jQuery.noConflict(); } +/** + * 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(!console) return; + if(!arguments.callee) return; + + var func = arguments.callee.caller.name; + var line = 'DEPRECATED function call '+func+'(). '+msg; + + if(console.warn){ + console.warn(line); + }else{ + console.log(line); + } + + if(console.trace) console.trace(); +} + + /** * Some of these scripts were taken from wikipedia.org and were modified for DokuWiki */ @@ -30,6 +56,8 @@ if (clientPC.indexOf('opera')!=-1) { * @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++) { -- cgit v1.2.3