From 87b6f1b0d70adbe5be08b2c5b3ac2838d039549d Mon Sep 17 00:00:00 2001 From: William Daniau Date: Fri, 18 Oct 2019 12:29:17 +0200 Subject: [PATCH] =?UTF-8?q?Utilisation=20de=20H5=20sp=C3=A9ciaux=20plut?= =?UTF-8?q?=C3=B4t=20que=20de=20zim-tags?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- templates/html/common/wizefunc.js | 63 +++++++++++++++++++++++++++++---------- 1 file changed, 48 insertions(+), 15 deletions(-) diff --git a/templates/html/common/wizefunc.js b/templates/html/common/wizefunc.js index afde500..ec1303b 100644 --- a/templates/html/common/wizefunc.js +++ b/templates/html/common/wizefunc.js @@ -45,20 +45,31 @@ /* Convert the two first tags into info */ /* use tags for image/table/object attributes */ function tagToInfo() { - var tags = document.getElementsByClassName('zim-tag'); + /* All H5 tags */ + var atags = document.getElementsByTagName('H5'); + /* extract configuration tags */ + tags=[]; + for (var i=0; i 2) { /* Image tags */ for (var i=1; i <= tags.length - 2; i++) { var ctag = tags[i+1]; + ctag.setAttribute("style","display:none;"); var s = ctag.innerHTML; - s = s.replace('@',''); /* find next img/table/zim-object */ ctag = findNextObject(ctag); @@ -92,7 +103,7 @@ function findNextObject(tag) { /* try to found in current */ - var objectsTagClassArray=['IMG','','TABLE','','DIV','zim-object']; + var objectsTagClassArray=['IMG','','TABLE','','DIV','zim-object','UL','','OL','']; ob = findTagInSiblings(tag,objectsTagClassArray); if (ob == null) { ob = findTagInSiblings(tag.parentElement,objectsTagClassArray); @@ -103,24 +114,46 @@ function findTagInSiblings(tag,tagsToFind) { var notFound = true; var ctag = tag; + var cctag; while (notFound) { ctag = ctag.nextElementSibling if (ctag == null) { notFound = false; break; - } - for (var i=0 ; i < tagsToFind.length/2 ; i++) { - if (ctag.tagName == tagsToFind[i*2]) { - /* we(ve got the tag */ - if (tagsToFind[i*2+1]=='') { - notFound = false; - break; - } else if (ctag.className == tagsToFind[i*2+1]) { + } + if (isTagInList(ctag,tagsToFind)) { + notFound = false; + break; + } + /* now search into children */ + if (ctag.childElementCount != 0) { + for (var i=0;i