Fossil SCM
Generalize [6b31bcfc1b] and [9a49859504] to ignore more HTML elements responding to clicks themselves. So far there's an accordion section header containing a hyperlink on the /rchvdwnld UI page and a timeline entries with nested buttons on the /download page.
Commit
b09a9b621fd9f74944fa2a59e753b8665b11272ef8ab3f46d71c599b55c06a24
Parent
dedc4ab387df787…
2 files changed
+5
-3
+6
-4
+5
-3
| --- src/accordion.js | ||
| +++ src/accordion.js | ||
| @@ -42,13 +42,15 @@ | ||
| 42 | 42 | img = document.createElement("img"); |
| 43 | 43 | img.src = acc_svgdata[0]+acc_svgdata[3]+acc_svgdata[1]; |
| 44 | 44 | img.className = "accordion_btn accordion_btn_minus"; |
| 45 | 45 | a[i].insertBefore(img,a[i].firstChild); |
| 46 | 46 | a[i].addEventListener("click",function(evt){ |
| 47 | - /* Ignore clicks to hyperlinks and form controls inside ".accordion" buttons | |
| 48 | - ** (for which Fossil uses <DIV> elements that represent section headers). */ | |
| 49 | - if( evt.target.tagName in { 'INPUT':1, 'SELECT':1, 'A':1 } ) return; | |
| 47 | + /* Ignore clicks to hyperlinks and other "click-responsive" HTML elements in | |
| 48 | + ** ".accordion" headers (for which Fossil uses <DIV> elements that represent | |
| 49 | + ** section headers). */ | |
| 50 | + var xClickyHTML = /^(?:A|AREA|BUTTON|INPUT|LABEL|SELECT|TEXTAREA|DETAILS)$/; | |
| 51 | + if( xClickyHTML.test(evt.target.tagName) ) return; | |
| 50 | 52 | var x = this.nextElementSibling; |
| 51 | 53 | if( this.classList.contains("accordion_closed") ){ |
| 52 | 54 | x.style.maxHeight = x.scrollHeight + "px"; |
| 53 | 55 | setTimeout(function(){ |
| 54 | 56 | x.style.maxHeight = ""; |
| 55 | 57 |
| --- src/accordion.js | |
| +++ src/accordion.js | |
| @@ -42,13 +42,15 @@ | |
| 42 | img = document.createElement("img"); |
| 43 | img.src = acc_svgdata[0]+acc_svgdata[3]+acc_svgdata[1]; |
| 44 | img.className = "accordion_btn accordion_btn_minus"; |
| 45 | a[i].insertBefore(img,a[i].firstChild); |
| 46 | a[i].addEventListener("click",function(evt){ |
| 47 | /* Ignore clicks to hyperlinks and form controls inside ".accordion" buttons |
| 48 | ** (for which Fossil uses <DIV> elements that represent section headers). */ |
| 49 | if( evt.target.tagName in { 'INPUT':1, 'SELECT':1, 'A':1 } ) return; |
| 50 | var x = this.nextElementSibling; |
| 51 | if( this.classList.contains("accordion_closed") ){ |
| 52 | x.style.maxHeight = x.scrollHeight + "px"; |
| 53 | setTimeout(function(){ |
| 54 | x.style.maxHeight = ""; |
| 55 |
| --- src/accordion.js | |
| +++ src/accordion.js | |
| @@ -42,13 +42,15 @@ | |
| 42 | img = document.createElement("img"); |
| 43 | img.src = acc_svgdata[0]+acc_svgdata[3]+acc_svgdata[1]; |
| 44 | img.className = "accordion_btn accordion_btn_minus"; |
| 45 | a[i].insertBefore(img,a[i].firstChild); |
| 46 | a[i].addEventListener("click",function(evt){ |
| 47 | /* Ignore clicks to hyperlinks and other "click-responsive" HTML elements in |
| 48 | ** ".accordion" headers (for which Fossil uses <DIV> elements that represent |
| 49 | ** section headers). */ |
| 50 | var xClickyHTML = /^(?:A|AREA|BUTTON|INPUT|LABEL|SELECT|TEXTAREA|DETAILS)$/; |
| 51 | if( xClickyHTML.test(evt.target.tagName) ) return; |
| 52 | var x = this.nextElementSibling; |
| 53 | if( this.classList.contains("accordion_closed") ){ |
| 54 | x.style.maxHeight = x.scrollHeight + "px"; |
| 55 | setTimeout(function(){ |
| 56 | x.style.maxHeight = ""; |
| 57 |
+6
-4
| --- src/graph.js | ||
| +++ src/graph.js | ||
| @@ -722,14 +722,16 @@ | ||
| 722 | 722 | function changeDisplayById(id,value){ |
| 723 | 723 | var x = document.getElementById(id); |
| 724 | 724 | if(x) x.style.display=value; |
| 725 | 725 | } |
| 726 | 726 | function toggleDetail(evt){ |
| 727 | - /* Ignore clicks to hyperlinks in check-in comments. This click-handler is | |
| 728 | - ** attached to <SPAN> elements with the CSS class names "timelineEllipsis" | |
| 729 | - ** and "timelineCompactComment" (for the "Compact" and "Simple" views). */ | |
| 730 | - if( evt.target.tagName=='A' ) return; | |
| 727 | + /* Ignore clicks to hyperlinks and other "click-responsive" HTML elements. | |
| 728 | + ** This click-handler is set for <SPAN> elements with the CSS class names | |
| 729 | + ** "timelineEllipsis" and "timelineCompactComment", which are part of the | |
| 730 | + ** "Compact" and "Simple" views. */ | |
| 731 | + var xClickyHTML = /^(?:A|AREA|BUTTON|INPUT|LABEL|SELECT|TEXTAREA|DETAILS)$/; | |
| 732 | + if( xClickyHTML.test(evt.target.tagName) ) return; | |
| 731 | 733 | var id = parseInt(this.getAttribute('data-id')) |
| 732 | 734 | var x = document.getElementById("detail-"+id); |
| 733 | 735 | if( x.style.display=="inline" ){ |
| 734 | 736 | x.style.display="none"; |
| 735 | 737 | document.getElementById("ellipsis-"+id).textContent = "..."; |
| 736 | 738 |
| --- src/graph.js | |
| +++ src/graph.js | |
| @@ -722,14 +722,16 @@ | |
| 722 | function changeDisplayById(id,value){ |
| 723 | var x = document.getElementById(id); |
| 724 | if(x) x.style.display=value; |
| 725 | } |
| 726 | function toggleDetail(evt){ |
| 727 | /* Ignore clicks to hyperlinks in check-in comments. This click-handler is |
| 728 | ** attached to <SPAN> elements with the CSS class names "timelineEllipsis" |
| 729 | ** and "timelineCompactComment" (for the "Compact" and "Simple" views). */ |
| 730 | if( evt.target.tagName=='A' ) return; |
| 731 | var id = parseInt(this.getAttribute('data-id')) |
| 732 | var x = document.getElementById("detail-"+id); |
| 733 | if( x.style.display=="inline" ){ |
| 734 | x.style.display="none"; |
| 735 | document.getElementById("ellipsis-"+id).textContent = "..."; |
| 736 |
| --- src/graph.js | |
| +++ src/graph.js | |
| @@ -722,14 +722,16 @@ | |
| 722 | function changeDisplayById(id,value){ |
| 723 | var x = document.getElementById(id); |
| 724 | if(x) x.style.display=value; |
| 725 | } |
| 726 | function toggleDetail(evt){ |
| 727 | /* Ignore clicks to hyperlinks and other "click-responsive" HTML elements. |
| 728 | ** This click-handler is set for <SPAN> elements with the CSS class names |
| 729 | ** "timelineEllipsis" and "timelineCompactComment", which are part of the |
| 730 | ** "Compact" and "Simple" views. */ |
| 731 | var xClickyHTML = /^(?:A|AREA|BUTTON|INPUT|LABEL|SELECT|TEXTAREA|DETAILS)$/; |
| 732 | if( xClickyHTML.test(evt.target.tagName) ) return; |
| 733 | var id = parseInt(this.getAttribute('data-id')) |
| 734 | var x = document.getElementById("detail-"+id); |
| 735 | if( x.style.display=="inline" ){ |
| 736 | x.style.display="none"; |
| 737 | document.getElementById("ellipsis-"+id).textContent = "..."; |
| 738 |