From 1c64eaeaa3295062b0a4e9b20b772274cd86ca42 Mon Sep 17 00:00:00 2001 From: Adrian Lang Date: Wed, 2 Dec 2009 13:24:34 +0100 Subject: Fix section edit highlighting for tables darcs-hash:20091202122434-e4919-d7be5b868af742e2408091b48f0152153ff1acb1.gz --- lib/scripts/script.js | 41 +++++++++++++++++++++++++++++------------ 1 file changed, 29 insertions(+), 12 deletions(-) (limited to 'lib/scripts/script.js') diff --git a/lib/scripts/script.js b/lib/scripts/script.js index ccba82144..b611f980a 100644 --- a/lib/scripts/script.js +++ b/lib/scripts/script.js @@ -538,24 +538,41 @@ addInitEvent(function(){ var break_classes = new RegExp('secedit|toc|page'); var btns = getElementsByClass('btn_secedit',document,'form'); for(var i=0; i Date: Thu, 4 Feb 2010 14:50:10 +0100 Subject: Rewrite section edit handling according to #1860 --- lib/scripts/script.js | 42 ++++++++++++++---------------------------- 1 file changed, 14 insertions(+), 28 deletions(-) (limited to 'lib/scripts/script.js') diff --git a/lib/scripts/script.js b/lib/scripts/script.js index b611f980a..ef4ae95a2 100644 --- a/lib/scripts/script.js +++ b/lib/scripts/script.js @@ -535,38 +535,24 @@ addInitEvent(function(){ * @author Andreas Gohr */ addInitEvent(function(){ - var break_classes = new RegExp('secedit|toc|page'); var btns = getElementsByClass('btn_secedit',document,'form'); for(var i=0; i Date: Tue, 2 Mar 2010 21:07:57 +0100 Subject: removed cursor:hand CSS property FS#1911 --- 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 ef4ae95a2..bf6f41ce5 100644 --- a/lib/scripts/script.js +++ b/lib/scripts/script.js @@ -215,10 +215,7 @@ function addTocToggle() { prependChild(header,obj); obj.parentNode.onclick = toggleToc; - try { - obj.parentNode.style.cursor = 'pointer'; - obj.parentNode.style.cursor = 'hand'; - }catch(e){} + obj.parentNode.style.cursor = 'pointer'; } /** -- cgit v1.2.3 From fda42deb082e4bdb560818a9c23b96f9312176d5 Mon Sep 17 00:00:00 2001 From: Adrian Lang Date: Mon, 15 Mar 2010 16:57:38 +0100 Subject: Various JavaScript fixes * Syntax error fixed * lock refresh event is now attached to the whole edit form since it bubbles up and we cannot be sure that the wikitext input exists on all edit forms * Updated findPos(X|Y) * Easier and less error-prone way of getting the section edit button in the highlight mouseover event handler --- lib/scripts/script.js | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) (limited to 'lib/scripts/script.js') diff --git a/lib/scripts/script.js b/lib/scripts/script.js index bf6f41ce5..27d088584 100644 --- a/lib/scripts/script.js +++ b/lib/scripts/script.js @@ -78,16 +78,15 @@ function getElementsByClass(searchClass,node,tag) { /** * Get the X offset of the top left corner of the given object * - * @link http://www.quirksmode.org/index.html?/js/findpos.html + * @link http://www.quirksmode.org/js/findpos.html */ function findPosX(object){ var curleft = 0; var obj = $(object); if (obj.offsetParent){ - while (obj.offsetParent){ + do { curleft += obj.offsetLeft; - obj = obj.offsetParent; - } + } while (obj = obj.offsetParent); } else if (obj.x){ curleft += obj.x; @@ -98,16 +97,15 @@ function findPosX(object){ /** * Get the Y offset of the top left corner of the given object * - * @link http://www.quirksmode.org/index.html?/js/findpos.html + * @link http://www.quirksmode.org/js/findpos.html */ function findPosY(object){ var curtop = 0; var obj = $(object); if (obj.offsetParent){ - while (obj.offsetParent){ + do { curtop += obj.offsetTop; - obj = obj.offsetParent; - } + } while (obj = obj.offsetParent); } else if (obj.y){ curtop += obj.y; @@ -535,7 +533,7 @@ addInitEvent(function(){ var btns = getElementsByClass('btn_secedit',document,'form'); for(var i=0; i Date: Mon, 22 Mar 2010 17:00:02 +0100 Subject: Really remove edit highlighting on mouseout --- 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 27d088584..25b10205c 100644 --- a/lib/scripts/script.js +++ b/lib/scripts/script.js @@ -552,7 +552,7 @@ addInitEvent(function(){ addEvent(btns[i],'mouseout',function(e){ var secs = getElementsByClass('section_highlight'); for(var j=0; j Date: Mon, 22 Mar 2010 20:30:44 +0100 Subject: fixed Safari browser detection --- 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 25b10205c..205d3f706 100644 --- a/lib/scripts/script.js +++ b/lib/scripts/script.js @@ -9,7 +9,7 @@ var clientPC = navigator.userAgent.toLowerCase(); // Get client info var is_macos = navigator.appVersion.indexOf('Mac') != -1; var is_gecko = ((clientPC.indexOf('gecko')!=-1) && (clientPC.indexOf('spoofer')==-1) && (clientPC.indexOf('khtml') == -1) && (clientPC.indexOf('netscape/7.0')==-1)); -var is_safari = ((clientPC.indexOf('AppleWebKit')!=-1) && (clientPC.indexOf('spoofer')==-1)); +var is_safari = ((clientPC.indexOf('applewebkit')!=-1) && (clientPC.indexOf('spoofer')==-1)); var is_khtml = (navigator.vendor == 'KDE' || ( document.childNodes && !document.all && !navigator.taintEnabled )); if (clientPC.indexOf('opera')!=-1) { var is_opera = true; -- cgit v1.2.3 From ea6dfbca91f6afe89ff631ac28eae023bcc52853 Mon Sep 17 00:00:00 2001 From: Adrian Lang Date: Fri, 26 Mar 2010 15:17:26 +0100 Subject: Rewrite footnote popup MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Popup now shows up relative to the link, not the mouse position * Easier handling of mouseout’s bubbling * Factor out popup creation to allow plugins to use it --- lib/scripts/script.js | 82 +++++++++++++++++++-------------------------------- 1 file changed, 31 insertions(+), 51 deletions(-) (limited to 'lib/scripts/script.js') diff --git a/lib/scripts/script.js b/lib/scripts/script.js index 205d3f706..99dade692 100644 --- a/lib/scripts/script.js +++ b/lib/scripts/script.js @@ -234,57 +234,51 @@ function toggleToc() { } /** - * Display an insitu footnote popup - * - * @author Andreas Gohr - * @author Chris Smith + * Create JavaScript mouseover popup */ -function footnote(e){ - var obj = e.target; - var id = obj.id.substr(5); +function insitu_popup(target, popup_id) { - // get or create the footnote popup div - var fndiv = $('insitu__fn'); + // get or create the popup div + var fndiv = $(popup_id); if(!fndiv){ fndiv = document.createElement('div'); - fndiv.id = 'insitu__fn'; + fndiv.id = popup_id; fndiv.className = 'insitu-footnote JSpopup dokuwiki'; // autoclose on mouseout - ignoring bubbled up events addEvent(fndiv,'mouseout',function(e){ - if(e.target != fndiv){ - e.stopPropagation(); - return; + var p = e.relatedTarget || e.toElement; + while (p && p !== this) { + p = p.parentNode; } - // check if the element was really left - if(e.pageX){ // Mozilla - var bx1 = findPosX(fndiv); - var bx2 = bx1 + fndiv.offsetWidth; - var by1 = findPosY(fndiv); - var by2 = by1 + fndiv.offsetHeight; - var x = e.pageX; - var y = e.pageY; - if(x > bx1 && x < bx2 && y > by1 && y < by2){ - // we're still inside boundaries - e.stopPropagation(); - return; - } - }else{ // IE - if(e.offsetX > 0 && e.offsetX < fndiv.offsetWidth-1 && - e.offsetY > 0 && e.offsetY < fndiv.offsetHeight-1){ - // we're still inside boundaries - e.stopPropagation(); - return; - } + if (p === this) { + return; } // okay, hide it - fndiv.style.display='none'; + this.style.display='none'; }); - document.body.appendChild(fndiv); + getElementsByClass('dokuwiki', document.body, 'div')[0].appendChild(fndiv); } + // position the div and make it visible + fndiv.style.position = 'absolute'; + fndiv.style.left = findPosX(target)+'px'; + fndiv.style.top = (findPosY(target)+target.scrollHeight * 1.5) + '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__"+id ); + var a = $("fn__" + e.target.id.substr(5)); if (!a){ return; } // anchor parent is the footnote container, get its innerHTML @@ -295,24 +289,10 @@ function footnote(e){ content = content.replace(/^\s+(,\s+)+/,''); // prefix ids on any elements with "insitu__" to ensure they remain unique - content = content.replace(/\bid=\"(.*?)\"/gi,'id="insitu__$1'); + content = content.replace(/\bid=(['"])([^"']+)\1/gi,'id="insitu__$2'); // now put the content into the wrapper fndiv.innerHTML = content; - - // position the div and make it visible - var x; var y; - if(e.pageX){ // Mozilla - x = e.pageX; - y = e.pageY; - }else{ // IE - x = e.offsetX; - y = e.offsetY; - } - fndiv.style.position = 'absolute'; - fndiv.style.left = (x+2)+'px'; - fndiv.style.top = (y+2)+'px'; - fndiv.style.display = ''; } /** -- cgit v1.2.3 From 2a98590b375e0acfd24fb0da343eb09a3ff76ff3 Mon Sep 17 00:00:00 2001 From: Adrian Lang Date: Mon, 29 Mar 2010 16:58:14 +0200 Subject: Better footnote popup positioning --- 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 99dade692..d8205b876 100644 --- a/lib/scripts/script.js +++ b/lib/scripts/script.js @@ -263,7 +263,7 @@ function insitu_popup(target, popup_id) { // position the div and make it visible fndiv.style.position = 'absolute'; fndiv.style.left = findPosX(target)+'px'; - fndiv.style.top = (findPosY(target)+target.scrollHeight * 1.5) + 'px'; + fndiv.style.top = (findPosY(target)+target.offsetHeight * 1.5) + 'px'; fndiv.style.display = ''; return fndiv; } -- cgit v1.2.3 From dc62d03d27d24a66840b83c5333221f5123ad203 Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Fri, 30 Apr 2010 06:20:41 +0200 Subject: optimized SMB link warning thingy --- lib/scripts/script.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'lib/scripts/script.js') diff --git a/lib/scripts/script.js b/lib/scripts/script.js index d8205b876..57917aeb5 100644 --- a/lib/scripts/script.js +++ b/lib/scripts/script.js @@ -482,14 +482,14 @@ addInitEvent(function(){ */ 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