Skip to content

Commit 9a87fed

Browse files
committed
kor. pri prezento de gesto-bildoj
1 parent 1b2fcc5 commit 9a87fed

File tree

2 files changed

+19
-3
lines changed

2 files changed

+19
-3
lines changed

jsc/a/artikolo.ts

+6-3
Original file line numberDiff line numberDiff line change
@@ -476,7 +476,8 @@ export namespace artikolo {
476476
}
477477

478478
/**
479-
* Antataŭigas la aski-kodon de signolingvo (Suttons Sigwn Writing) per SVG-bildetoj montranta la signon de la gesto.
479+
* Tradukas la aski-kodon de signolingvo (Suttons Sigwn Writing) el atributo data-kod
480+
* al SVG-bildetoj montranta la signon de la gesto.
480481
*/
481482
function preparu_gestojn() {
482483
// @ts-ignore
@@ -496,9 +497,11 @@ export namespace artikolo {
496497

497498
function desegnu_gestojn(tk: Element) {
498499
if (tk instanceof HTMLElement
499-
&& !tk.closest("dd").classList.contains("kasxita")) { // dum kaŝita ni ankoraŭ ne transformas
500+
&& !tk.closest("dd").classList.contains("kasxita") // dum kaŝita ni ankoraŭ ne transformas
501+
&& !tk.querySelector("svg")) // SVG jam enestas, evitu duoble kalkuli ĝin
502+
{
500503
// povas esti pluraj apartigitaj per komo aŭ almenaŭ spaco
501-
const sgn = tk.innerText;
504+
const sgn = u.textcontent(tk); //tk.innerText;
502505
tk.textContent = '';
503506
const sgn_kod = tk.getAttribute("data-kod");
504507
if (sgn_kod[0] == 'M') {

jsc/u/ht_util.ts

+13
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,19 @@ export function HTTPRequest(method: string, url: string, params: Parametroj,
169169
onStart, onFinish, onError);
170170
}
171171

172+
/**
173+
* Redonas la tekstan enhavon de HTML-elemento inkl. de span-elementoj,
174+
* sed (alie ol la norma textContent) sen la teksta enhavo de aliaj ido-elementoj
175+
* @param element
176+
*/
177+
export function textcontent(element: HTMLElement) {
178+
const ch = Array.from(element.childNodes);
179+
return ch.reduce(
180+
(tc, n) => tc + (n.nodeType == Node.TEXT_NODE || n.nodeName == "SPAN")? n.textContent : "",
181+
""
182+
);
183+
}
184+
172185
/**
173186
* Utilfunkcio por forigi elementon, kondiĉe ke gi ekzistas.
174187
* Se ĝi ne ekzistas okazas nenio (do neniu escepto!)

0 commit comments

Comments
 (0)