From 645bba0402bea0d2561f2a2dc3a21a4645e7fe3c Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Thu, 6 Apr 2023 01:00:23 +0200 Subject: [PATCH] docs: fix opening url with anchors to widget properties --- resources/docs/extra/scripts.js | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/resources/docs/extra/scripts.js b/resources/docs/extra/scripts.js index c31449b7..f75c16a1 100644 --- a/resources/docs/extra/scripts.js +++ b/resources/docs/extra/scripts.js @@ -3,9 +3,19 @@ document.addEventListener('DOMContentLoaded', ()=>{ if (window.location.hash && window.location.href.includes('properties-reference')) { // show target in tabs/details document.querySelectorAll('[id='+window.location.hash.split("#")[1]+']').forEach(function(item){ - var tab = item.closest('.tabbed-content'), - details = item.closest('details') - if (tab) tab.previousSibling.click() + var tab = item.closest('.tabbed-block'), + container= item.closest('.tabbed-set'), + details = item.closest('details'), + index = 0 + while (tab.previousElementSibling) { + index++ + tab = tab.previousElementSibling + } + console.log(index) + container.querySelectorAll('.tabbed-labels label:nth-child('+(index+1)+')').forEach(function(item,i){ + item.click() + }) + if (item) { item.scrollIntoView() document.documentElement.scrollTop -= 70