mirror of
				https://github.com/Theodor-Springmann-Stiftung/hamann-ausgabe-core.git
				synced 2025-10-31 02:05:33 +00:00 
			
		
		
		
	Bugfixes (Resize observer)
This commit is contained in:
		| @@ -1,21 +1,26 @@ | ||||
| // // Code specifically for the letter view | ||||
| let activetab = null; | ||||
| let activetabbtn = null; | ||||
| let activetabbtn2 = null; | ||||
| let tabbtnlist = document.querySelectorAll(".ha-tabbtn"); | ||||
| let tablist = document.querySelectorAll(".ha-tab"); | ||||
|  | ||||
| for (let i = 0; i < tabbtnlist.length; i++) { | ||||
|     tablist[i].classList.add("hidden"); | ||||
|     tablist[i % tablist.length].classList.add("hidden"); | ||||
|     tabbtnlist[i].addEventListener("click", () => { | ||||
|         if (activetab != null)  | ||||
|             activetab.classList.add("hidden"); | ||||
|         if (activetabbtn != null) | ||||
|         if (activetabbtn != null)  | ||||
|             activetabbtn.classList.remove("active"); | ||||
|         if (activetabbtn2 != null) | ||||
|             activetabbtn2.classList.remove("active"); | ||||
|  | ||||
|         tablist[i].classList.remove("hidden"); | ||||
|         tablist[i % tablist.length].classList.remove("hidden"); | ||||
|         tabbtnlist[i].classList.add("active"); | ||||
|         activetab = tablist[i]; | ||||
|         tabbtnlist[(i + tablist.length) % tabbtnlist.length].classList.add("active"); | ||||
|         activetab = tablist[i % tablist.length]; | ||||
|         activetabbtn = tabbtnlist[i]; | ||||
|         activetabbtn2 = tabbtnlist[(i + tablist.length) % tabbtnlist.length]; | ||||
|     }); | ||||
| } | ||||
|  | ||||
|   | ||||
| @@ -115,14 +115,14 @@ const overlappingcollapsebox = function (selector, hoverfunction) { | ||||
|                             let lines = Math.floor(eh / lineheight); | ||||
|                             let cutoff = Math.floor((h - newlength) / lineheight); | ||||
|                             m.style.cssText += "-webkit-line-clamp: " + (lines - cutoff) + ";"; | ||||
|                             m.style.cssText += "line-clamp: " + (lines - cutoff) + ";"; | ||||
|                         } | ||||
|                     } | ||||
|                 } | ||||
|  | ||||
|                  | ||||
|                 requestAnimationFrame(() => { | ||||
|                     collapsedboxes.push(element); | ||||
|                     collapsebox(element, newlength, lineheight); | ||||
|                 }); | ||||
|                 requestAnimationFrame(() => { | ||||
|                     addbuttoncaollapsebox(element, newlength, hoverfunction); | ||||
|                 }); | ||||
|             } | ||||
| @@ -155,11 +155,36 @@ const collapseboxes = function () { | ||||
|     overlappingcollapsebox(".ha-text .ha-marginalbox", true); | ||||
| }; | ||||
|  | ||||
| var collapsedboxes = []; | ||||
|  | ||||
| const clearcollapsedboxes = function () { | ||||
|     var elements = document.querySelectorAll(".ha-text .ha-marginalbox"); | ||||
|     elements.forEach(element => { | ||||
|         element.removeAttribute("style"); | ||||
|     }); | ||||
|     collapsedboxes.forEach(element => { | ||||
|         element.classList.remove("ha-expanded-box"); | ||||
|         element.classList.remove("ha-collapsed-box"); | ||||
|         element.outerHTML = element.outerHTML; | ||||
|     }); | ||||
|     collapsedboxes = []; | ||||
|     var elements = document.querySelectorAll(".ha-btn-collapsed-box"); | ||||
|     elements.forEach(element => { | ||||
|         element.remove(); | ||||
|     }); | ||||
| } | ||||
|  | ||||
| const resetall = function() { | ||||
|     clearcollapsedboxes(); | ||||
|     marginalboxwidthset(); | ||||
|     collapseboxes(); | ||||
| } | ||||
|  | ||||
| marginalboxwidthset(); | ||||
| collapseboxes(); | ||||
| // var doit; | ||||
| // this.window.addEventListener("resize", function () { | ||||
| //     this.clearTimeout(doit); | ||||
| //     marginalboxwidthset(); | ||||
| //     doit = this.setTimeout(collapseboxes, 250); | ||||
| // }); | ||||
|  | ||||
| var doit; | ||||
| this.window.addEventListener("resize", function () { | ||||
|     this.clearTimeout(doit); | ||||
|     doit = this.setTimeout(resetall, 250); | ||||
| }); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Simon Martens
					Simon Martens