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 From 17e2e2545f2fd3607a14238ecee25eb7a605ce84 Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Fri, 10 Jun 2011 20:26:04 +0200 Subject: Moved behavioural functions into it's own object and file JavaScript functions adding behaviours based on IDs or class names where moved to their own object into behaviour.js and where jQueryized. --- lib/scripts/script.js | 82 --------------------------------------------------- 1 file changed, 82 deletions(-) (limited to 'lib/scripts/script.js') diff --git a/lib/scripts/script.js b/lib/scripts/script.js index 20e475190..9b9ca600c 100644 --- a/lib/scripts/script.js +++ b/lib/scripts/script.js @@ -471,34 +471,6 @@ function closePopups(){ } } -/** - * Looks for an element with the ID scroll__here at scrolls to it - */ -function scrollToMarker(){ - var obj = $('scroll__here'); - if(obj) obj.scrollIntoView(); -} - -/** - * Looks for an element with the ID focus__this at sets focus to it - */ -function focusMarker(){ - var obj = $('focus__this'); - if(obj) obj.focus(); -} - -/** - * Remove messages - */ -function cleanMsgArea(){ - var elems = getElementsByClass('(success|info|error)',document,'div'); - if(elems){ - for(var i=0; i tag has the class "quickselect", this script will - * automatically submit its parent form when the select value changes. - * It also hides the submit button of the form. - * - * @author Andreas Gohr - */ -addInitEvent(function(){ - var selects = getElementsByClass('quickselect',document,'select'); - for(var i=0; i - */ -function checkWindowsShares() { - if(!LANG['nosmblinks']) return true; - if(document.all != null) return true; - - var elems = getElementsByClass('windows',document,'a'); - if(elems){ - for(var i=0; i - */ -addInitEvent(function(){ - checkWindowsShares(); -}); /** * Highlight the section when hovering over the appropriate section edit button -- cgit v1.2.3 From d7ead0093374b7233de1dc1df47aa10ac39facfb Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Thu, 16 Jun 2011 18:43:49 +0200 Subject: fix console check in Internet Explorer --- lib/scripts/script.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/scripts/script.js') diff --git a/lib/scripts/script.js b/lib/scripts/script.js index 9b9ca600c..a673cdc02 100644 --- a/lib/scripts/script.js +++ b/lib/scripts/script.js @@ -13,7 +13,7 @@ if ('function' === typeof jQuery && 'function' === typeof jQuery.noConflict) { * @param msg optional message to print */ function DEPRECATED(msg){ - if(!console) return; + if(!window.console) return; if(!arguments.callee) return; var func = arguments.callee.caller.name; -- 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/script.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'lib/scripts/script.js') diff --git a/lib/scripts/script.js b/lib/scripts/script.js index a673cdc02..8adba829c 100644 --- a/lib/scripts/script.js +++ b/lib/scripts/script.js @@ -28,6 +28,21 @@ function DEPRECATED(msg){ 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); + } +} /** * Some of these scripts were taken from wikipedia.org and were modified for DokuWiki -- 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/script.js | 39 --------------------------------------- 1 file changed, 39 deletions(-) (limited to 'lib/scripts/script.js') diff --git a/lib/scripts/script.js b/lib/scripts/script.js index 8adba829c..68687c14e 100644 --- a/lib/scripts/script.js +++ b/lib/scripts/script.js @@ -123,45 +123,6 @@ function getElementsByClass(searchClass,node,tag) { return classElements; } -/** - * Get the X offset of the top left corner of the given object - * - * @link http://www.quirksmode.org/js/findpos.html - */ -function findPosX(object){ - var curleft = 0; - var obj = $(object); - if (obj.offsetParent){ - do { - curleft += obj.offsetLeft; - } while (obj = obj.offsetParent); - } - else if (obj.x){ - curleft += obj.x; - } - return curleft; -} //end findPosX function - -/** - * Get the Y offset of the top left corner of the given object - * - * @link http://www.quirksmode.org/js/findpos.html - */ -function findPosY(object){ - var curtop = 0; - var obj = $(object); - if (obj.offsetParent){ - do { - curtop += obj.offsetTop; - } while (obj = obj.offsetParent); - } - else if (obj.y){ - curtop += obj.y; - } - return curtop; -} //end findPosY function - -/** * Get the computed style of a node. * * @link https://acidmartin.wordpress.com/2008/08/26/style-get-any-css-property-value-of-an-object/ -- 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/script.js | 23 ----------------------- 1 file changed, 23 deletions(-) (limited to 'lib/scripts/script.js') diff --git a/lib/scripts/script.js b/lib/scripts/script.js index 68687c14e..fc8cb6096 100644 --- a/lib/scripts/script.js +++ b/lib/scripts/script.js @@ -100,29 +100,6 @@ function isset(varname){ } /** - * Select elements by their class name - * - * @author Dustin Diaz - * @link http://www.dustindiaz.com/getelementsbyclass/ - */ -function getElementsByClass(searchClass,node,tag) { - var classElements = new Array(); - if ( node == null ) - node = document; - if ( tag == null ) - tag = '*'; - var els = node.getElementsByTagName(tag); - var elsLen = els.length; - var pattern = new RegExp("(^|\\s)"+searchClass+"(\\s|$)"); - for (var i = 0, j = 0; i < elsLen; i++) { - if ( pattern.test(els[i].className) ) { - classElements[j] = els[i]; - j++; - } - } - return classElements; -} - * Get the computed style of a node. * * @link https://acidmartin.wordpress.com/2008/08/26/style-get-any-css-property-value-of-an-object/ -- cgit v1.2.3 From ee94499951d43d07fa5822b968f594c1f5932613 Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Fri, 8 Jul 2011 11:37:01 +0200 Subject: more robust deprecation messages --- lib/scripts/script.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'lib/scripts/script.js') diff --git a/lib/scripts/script.js b/lib/scripts/script.js index fc8cb6096..24473c2e6 100644 --- a/lib/scripts/script.js +++ b/lib/scripts/script.js @@ -14,10 +14,12 @@ if ('function' === typeof jQuery && 'function' === typeof jQuery.noConflict) { */ function DEPRECATED(msg){ if(!window.console) return; - if(!arguments.callee) return; + if(!msg) msg = ''; - var func = arguments.callee.caller.name; - var line = 'DEPRECATED function call '+func+'(). '+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); -- 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/script.js | 80 --------------------------------------------------- 1 file changed, 80 deletions(-) (limited to 'lib/scripts/script.js') diff --git a/lib/scripts/script.js b/lib/scripts/script.js index 24473c2e6..a6951c4ce 100644 --- a/lib/scripts/script.js +++ b/lib/scripts/script.js @@ -331,86 +331,6 @@ addInitEvent(function(){ } }); -/** - * Add the edit window size controls - */ -function initSizeCtl(ctlid,edid){ - if(!document.getElementById){ return; } - - var ctl = $(ctlid); - var textarea = $(edid); - if(!ctl || !textarea) return; - - var hgt = DokuCookie.getValue('sizeCtl'); - if(hgt){ - textarea.style.height = hgt; - }else{ - textarea.style.height = '300px'; - } - - var wrp = DokuCookie.getValue('wrapCtl'); - if(wrp){ - setWrap(textarea, wrp); - } // else use default value - - var l = document.createElement('img'); - var s = document.createElement('img'); - var w = document.createElement('img'); - l.src = DOKU_BASE+'lib/images/larger.gif'; - s.src = DOKU_BASE+'lib/images/smaller.gif'; - w.src = DOKU_BASE+'lib/images/wrap.gif'; - addEvent(l,'click',function(){sizeCtl(edid,100);}); - addEvent(s,'click',function(){sizeCtl(edid,-100);}); - addEvent(w,'click',function(){toggleWrap(edid);}); - ctl.appendChild(l); - ctl.appendChild(s); - ctl.appendChild(w); -} - -/** - * This sets the vertical size of the editbox - */ -function sizeCtl(edid,val){ - var textarea = $(edid); - var height = parseInt(textarea.style.height.substr(0,textarea.style.height.length-2)); - height += val; - textarea.style.height = height+'px'; - - DokuCookie.setValue('sizeCtl',textarea.style.height); -} - -/** - * Toggle the wrapping mode of a textarea - */ -function toggleWrap(edid){ - var textarea = $(edid); - var wrap = textarea.getAttribute('wrap'); - if(wrap && wrap.toLowerCase() == 'off'){ - setWrap(textarea, 'soft'); - }else{ - setWrap(textarea, 'off'); - } - - DokuCookie.setValue('wrapCtl',textarea.getAttribute('wrap')); -} - -/** - * Set the wrapping mode of a textarea - * - * @author Fluffy Convict - * @author - * @link http://news.hping.org/comp.lang.javascript.archive/12265.html - * @link https://bugzilla.mozilla.org/show_bug.cgi?id=41464 - */ -function setWrap(textarea, wrapAttrValue){ - textarea.setAttribute('wrap', wrapAttrValue); - - // Fix display for mozilla - var parNod = textarea.parentNode; - var nxtSib = textarea.nextSibling; - parNod.removeChild(textarea); - parNod.insertBefore(textarea, nxtSib); -} /** * Handler to close all open Popups -- cgit v1.2.3 From 08db444152e81531736df0ac9bd055bfeb38dda8 Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Fri, 8 Jul 2011 12:25:16 +0200 Subject: jQueryized closePopups() --- lib/scripts/script.js | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) (limited to 'lib/scripts/script.js') diff --git a/lib/scripts/script.js b/lib/scripts/script.js index a6951c4ce..f5d76d27c 100644 --- a/lib/scripts/script.js +++ b/lib/scripts/script.js @@ -336,14 +336,7 @@ addInitEvent(function(){ * Handler to close all open Popups */ function closePopups(){ - if(!document.getElementById){ return; } - - var divs = document.getElementsByTagName('div'); - for(var i=0; i < divs.length; i++){ - if(divs[i].className.indexOf('JSpopup') != -1){ - divs[i].style.display = 'none'; - } - } + jQuery('div.JSpopup').hide(); } /** -- cgit v1.2.3 From 32cb905a0339607a7acfef6488bec0015bae6b8b Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Fri, 8 Jul 2011 13:04:59 +0200 Subject: moved the TOC toggling to dw_behaviour --- lib/scripts/script.js | 41 ----------------------------------------- 1 file changed, 41 deletions(-) (limited to 'lib/scripts/script.js') diff --git a/lib/scripts/script.js b/lib/scripts/script.js index f5d76d27c..e3216177c 100644 --- a/lib/scripts/script.js +++ b/lib/scripts/script.js @@ -193,47 +193,6 @@ function hideLoadBar(id){ if(obj) obj.style.display="none"; } -/** - * Adds the toggle switch to the TOC - */ -function addTocToggle() { - if(!document.getElementById) return; - var header = $('toc__header'); - if(!header) return; - var toc = $('toc__inside'); - - var obj = document.createElement('span'); - obj.id = 'toc__toggle'; - obj.style.cursor = 'pointer'; - if (toc && toc.style.display == 'none') { - obj.innerHTML = '+'; - obj.className = 'toc_open'; - } else { - obj.innerHTML = ''; - obj.className = 'toc_close'; - } - - prependChild(header,obj); - obj.parentNode.onclick = toggleToc; - obj.parentNode.style.cursor = 'pointer'; -} - -/** - * This toggles the visibility of the Table of Contents - */ -function toggleToc() { - var toc = $('toc__inside'); - var obj = $('toc__toggle'); - if(toc.style.display == 'none') { - toc.style.display = ''; - obj.innerHTML = ''; - obj.className = 'toc_close'; - } else { - toc.style.display = 'none'; - obj.innerHTML = '+'; - obj.className = 'toc_open'; - } -} /** * Create JavaScript mouseover popup -- 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/script.js | 13 ------------- 1 file changed, 13 deletions(-) (limited to 'lib/scripts/script.js') diff --git a/lib/scripts/script.js b/lib/scripts/script.js index e3216177c..b44d95d6f 100644 --- a/lib/scripts/script.js +++ b/lib/scripts/script.js @@ -146,19 +146,6 @@ function escapeQuotes(text) { return text; } -/** - * Adds a node as the first childenode to the given parent - * - * @see appendChild() - */ -function prependChild(parent,element) { - if(!parent.firstChild){ - parent.appendChild(element); - }else{ - parent.insertBefore(element,parent.firstChild); - } -} - /** * Prints a animated gif to show the search is performed * -- cgit v1.2.3 From fbedf1265a6551391cbb7442ec5f9360328ff508 Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Thu, 18 Aug 2011 15:17:54 +0200 Subject: moved footnotes and section highlighting to ne file jquerized --- lib/scripts/script.js | 133 -------------------------------------------------- 1 file changed, 133 deletions(-) (limited to 'lib/scripts/script.js') diff --git a/lib/scripts/script.js b/lib/scripts/script.js index b44d95d6f..3e2ec4f89 100644 --- a/lib/scripts/script.js +++ b/lib/scripts/script.js @@ -180,104 +180,6 @@ function hideLoadBar(id){ if(obj) obj.style.display="none"; } - -/** - * Create JavaScript mouseover popup - */ -function insitu_popup(target, popup_id) { - - // get or create the popup div - var fndiv = $(popup_id); - if(!fndiv){ - fndiv = document.createElement('div'); - fndiv.id = popup_id; - fndiv.className = 'insitu-footnote JSpopup dokuwiki'; - - // autoclose on mouseout - ignoring bubbled up events - addEvent(fndiv,'mouseout',function(e){ - var p = e.relatedTarget || e.toElement; - while (p && p !== this) { - p = p.parentNode; - } - if (p === this) { - return; - } - // okay, hide it - this.style.display='none'; - }); - getElementsByClass('dokuwiki', document.body, 'div')[0].appendChild(fndiv); - } - - var non_static_parent = fndiv.parentNode; - while (non_static_parent != document && gcs(non_static_parent)['position'] == 'static') { - non_static_parent = non_static_parent.parentNode; - } - - var fixed_target_parent = target; - while (fixed_target_parent != document && gcs(fixed_target_parent)['position'] != 'fixed') { - fixed_target_parent = fixed_target_parent.parentNode; - } - - // position the div and make it visible - if (fixed_target_parent != document) { - // the target has position fixed, that means the footnote needs to be fixed, too - fndiv.style.position = 'fixed'; - } else { - fndiv.style.position = 'absolute'; - } - - if (fixed_target_parent != document || non_static_parent == document) { - fndiv.style.left = findPosX(target)+'px'; - fndiv.style.top = (findPosY(target)+target.offsetHeight * 1.5) + 'px'; - } else { - fndiv.style.left = (findPosX(target) - findPosX(non_static_parent)) +'px'; - fndiv.style.top = (findPosY(target)+target.offsetHeight * 1.5 - findPosY(non_static_parent)) + 'px'; - } - - fndiv.style.display = ''; - return fndiv; -} - -/** - * Display an insitu footnote popup - * - * @author Andreas Gohr - * @author Chris Smith - */ -function footnote(e){ - var fndiv = insitu_popup(e.target, 'insitu__fn'); - - // locate the footnote anchor element - var a = $("fn__" + e.target.id.substr(5)); - if (!a){ return; } - - // anchor parent is the footnote container, get its innerHTML - var content = new String (a.parentNode.parentNode.innerHTML); - - // strip the leading content anchors and their comma separators - content = content.replace(/.*<\/sup>/gi, ''); - content = content.replace(/^\s+(,\s+)+/,''); - - // prefix ids on any elements with "insitu__" to ensure they remain unique - content = content.replace(/\bid=(['"])([^"']+)\1/gi,'id="insitu__$2'); - - // now put the content into the wrapper - fndiv.innerHTML = content; -} - -/** - * Add the event handlers to footnotes - * - * @author Andreas Gohr - */ -addInitEvent(function(){ - var elems = getElementsByClass('fn_top',null,'a'); - for(var i=0; i - */ -addInitEvent(function(){ - var btns = getElementsByClass('btn_secedit',document,'form'); - for(var i=0; i Date: Fri, 19 Aug 2011 13:06:25 +0200 Subject: jqueryized diff checkbox script --- lib/scripts/script.js | 28 ---------------------------- 1 file changed, 28 deletions(-) (limited to 'lib/scripts/script.js') diff --git a/lib/scripts/script.js b/lib/scripts/script.js index 3e2ec4f89..caa2a107c 100644 --- a/lib/scripts/script.js +++ b/lib/scripts/script.js @@ -187,32 +187,4 @@ function closePopups(){ jQuery('div.JSpopup').hide(); } -/** - * disable multiple revisions checkboxes if two are checked - * - * @author Anika Henke - */ -addInitEvent(function(){ - var revForm = $('page__revisions'); - if (!revForm) return; - var elems = revForm.elements; - var countTicks = 0; - for (var i=0; i= 2) input2.disabled = (input2.type=='checkbox' && !input2.checked); - else input2.disabled = (input2.type!='checkbox'); - } - }); - input1.checked = false; // chrome reselects on back button which messes up the logic - } else if(input1.type=='submit'){ - input1.disabled = true; - } - } -}); -- 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/script.js | 128 -------------------------------------------------- 1 file changed, 128 deletions(-) (limited to 'lib/scripts/script.js') diff --git a/lib/scripts/script.js b/lib/scripts/script.js index caa2a107c..8db223d61 100644 --- a/lib/scripts/script.js +++ b/lib/scripts/script.js @@ -3,53 +3,6 @@ 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(!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); - } -} - -/** - * Some of these scripts were taken from wikipedia.org and were modified for DokuWiki - */ - /** * Some browser detection */ @@ -65,87 +18,6 @@ if (clientPC.indexOf('opera')!=-1) { var is_opera_seven = (window.opera && document.childNodes); } -/** - * 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; -} - -/** - * 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){ - return(typeof(window[varname])!='undefined'); -} - -/** - * 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){ - if(node.currentStyle){ - return node.currentStyle; - }else{ - return node.ownerDocument.defaultView.getComputedStyle(node, null); - } -} - -/** - * Escape special chars in JavaScript - * - * @author Andreas Gohr - */ -function jsEscape(text){ - 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; -} - -/** - * This function escapes some special chars - * @deprecated by above function - */ -function escapeQuotes(text) { - var 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; -} - /** * Prints a animated gif to show the search is performed * -- 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/script.js | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'lib/scripts/script.js') diff --git a/lib/scripts/script.js b/lib/scripts/script.js index 8db223d61..709e7705a 100644 --- a/lib/scripts/script.js +++ b/lib/scripts/script.js @@ -48,8 +48,7 @@ function showLoadBar(){ * @author Andreas Gohr */ function hideLoadBar(id){ - obj = $(id); - if(obj) obj.style.display="none"; + jQuery('#' + id).hide(); } /** @@ -58,5 +57,3 @@ function hideLoadBar(id){ function closePopups(){ jQuery('div.JSpopup').hide(); } - - -- 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/script.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'lib/scripts/script.js') diff --git a/lib/scripts/script.js b/lib/scripts/script.js index 709e7705a..8db223d61 100644 --- a/lib/scripts/script.js +++ b/lib/scripts/script.js @@ -48,7 +48,8 @@ function showLoadBar(){ * @author Andreas Gohr */ function hideLoadBar(id){ - jQuery('#' + id).hide(); + obj = $(id); + if(obj) obj.style.display="none"; } /** @@ -57,3 +58,5 @@ function hideLoadBar(id){ function closePopups(){ jQuery('div.JSpopup').hide(); } + + -- 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/script.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'lib/scripts/script.js') diff --git a/lib/scripts/script.js b/lib/scripts/script.js index 8db223d61..5fddb0431 100644 --- a/lib/scripts/script.js +++ b/lib/scripts/script.js @@ -48,8 +48,7 @@ function showLoadBar(){ * @author Andreas Gohr */ function hideLoadBar(id){ - obj = $(id); - if(obj) obj.style.display="none"; + jQuery('#' + id).hide(); } /** @@ -59,4 +58,6 @@ function closePopups(){ jQuery('div.JSpopup').hide(); } - +jQuery(function () { + jQuery(document).click(closePopups); +}); -- cgit v1.2.3