PageSourceSearch

https://lineascan.build/assets/js/custom/text-highlighter.js?v=26.9.3.0

js lineascan.build collected 2026-09-25 14:17:07 UTC 46,197 bytes, 786 lines download raw bytes

1var myFnGeneratedHLRandomIds = new Set();
2var myHLRandomIds = 0
3function myFnGenerateUniqueId() {
4    let id;
5    do {
6        //id = crypto.randomUUID();
7        id = myHLRandomIds
8        myHLRandomIds += 1;
9    } while (myFnGeneratedHLRandomIds.has(id));
10
11    myFnGeneratedHLRandomIds.add(id);
12    return id;
13}
14
15var TextHighlight = {
16    count: 0,
17    isHightlight: false,
18    classType: "",
19    nontable_defaultHighlightClasses: "bg-warning bg-opacity-15 rounded border-warning border-dashed border px-1 mx-n1",
20    contentMap: {},
21    wrapEL: {},
22    cacheEL: {},
23    addContent: function (content, element) {
24        if (!TextHighlight.contentMap[content]) {
25            TextHighlight.contentMap[content] = [];
26        }
27
28        TextHighlight.contentMap[content].push(element);
29    },
30    init: function (siteName, flag) {
31        function findFirstTextChild(el) {
32            if (el && el.classList.contains('hash-tag'))
33                return el;
34            for (const child of el.childNodes) {
35                if (child instanceof Text && child.nodeValue.trim() !== '') {
36                    return el;
37                }
38                if (child instanceof HTMLElement) {
39                    const result = findFirstTextChild(child);
40                    if (result)
41                        return result;
42                }
43            }
44            return null;
45        }
46        const wrapElements = (el) => {
47            //if (!el.dataset.uid) {
48            //    el.dataset.uid = myFnGenerateUniqueId();
49            //}
50            //var tmpId = el.dataset.uid
51
52            //if (this.wrapEL[tmpId]) {
53            //    return this.wrapEL[tmpId];
54            //}
55            if (el?.previousElementSibling && !el.previousElementSibling.parentNode.classList.contains("dom-texthighlight")) {
56                let isApplied = false;
57                let wrapper = null;
58                let prevSibling = el.previousElementSibling;
59                let prevSibling_2;
60                if (el.previousElementSibling.previousElementSibling?.tagName === 'IMG' || el.previousElementSibling.previousElementSibling?.tagName === 'I') {
61                    prevSibling_2 = el.previousElementSibling.previousElementSibling;
62                }
63                if (prevSibling) {
64                    wrapper = document.createElement('div');
65                    wrapper.classList.add('d-inline-flex', 'align-items-center', 'gap-1', 'dom-texthighlight');
66                    el.parentNode.insertBefore(wrapper, prevSibling);
67                    if (prevSibling_2) {
68                        wrapper.appendChild(prevSibling_2);
69                    }
70                    wrapper.appendChild(prevSibling);
71                    wrapper.appendChild(el);
72                    isApplied = true;
73                }
74                if (el?.previousElementSibling?.parentNode?.nextElementSibling?.classList.contains('text-muted')) {
75                    wrapper = document.createElement('div');
76                    wrapper.classList.add('d-inline-flex', 'align-items-center', 'gap-1', 'dom-texthighlight');
77                    el.parentNode.parentNode.insertBefore(wrapper, el.parentNode.parentNode.firstChild);
78                    wrapper.appendChild(el.parentNode.nextElementSibling);
79                    wrapper.prepend(el.parentNode);
80                    isApplied = true;
81                }
82                if (isApplied) {
83                    //this.wrapEL[tmpId] = wrapper;
84                    return wrapper;
85                }
86            } else if (el?.previousElementSibling) {
87                if (el?.previousElementSibling?.parentNode?.nextElementSibling?.classList.contains('text-muted')) {
88                    const wrapper = document.createElement('div');
89                    wrapper.classList.add('d-inline-flex', 'align-items-center', 'gap-1', 'dom-texthighlight');
90                    el.parentNode.parentNode.insertBefore(wrapper, el.parentNode.parentNode.firstChild);
91                    wrapper.appendChild(el.parentNode.nextElementSibling);
92                    wrapper.prepend(el.parentNode);
93                    //this.wrapEL[tmpId] = wrapper;
94                    return wrapper;
95                }
96                //this.wrapEL[tmpId] = el.previousElementSibling.parentNode;
97                return el.previousElementSibling.parentNode
98            }
99        }
100            ;
101        const wrapElementsNonTables = (el) => {
102            //if (!el.dataset.uid) {
103            //    el.dataset.uid = myFnGenerateUniqueId();
104            //}
105            //var tmpId = el.dataset.uid
106
107            //if (this.wrapEL[tmpId]) {
108            //    return this.wrapEL[tmpId];
109            //}
110            if (el?.previousElementSibling && !el.previousElementSibling.parentNode.classList.contains("dom-texthighlight")) {
111                let isApplied = false;
112                let wrapper = null;
113                const prevSibling = el.previousElementSibling;
114                if (prevSibling) {
115                    wrapper = document.createElement('div');
116                    wrapper.classList.add('border', 'border-white', 'dom-texthighlight-nontable', 'd-inline-block');
117                    wrapper.style.setProperty('--bs-border-opacity', '0');
118                    if (prevSibling.classList.contains('me-1')) {
119                        wrapper.classList.add('me-1', 'prev-me-1');
120                    } else if (el.classList.contains('ms-1')) {
121                        wrapper.classList.add('me-1', 'prev-me-1');
122                    }
123                    el.parentNode.insertBefore(wrapper, prevSibling);
124                    wrapper.appendChild(prevSibling);
125                    wrapper.appendChild(el);
126                    isApplied = true;
127                }
128                if (isApplied) {
129                    //this.wrapEL[tmpId] = wrapper;
130                    return wrapper;
131                }
132            }
133        };
134        const wrapTdElements = (el) => {
135            //if (!el.dataset.uid) {
136            //    el.dataset.uid = myFnGenerateUniqueId();
137            //}
138            //var tmpId = el.dataset.uid
139
140            //if (this.wrapEL[tmpId]) {
141            //    return this.wrapEL[tmpId];
142            //}
143            const wrapper = document.createElement('div');
144            wrapper.classList.add('d-inline-flex', 'align-items-center', 'dom-texthighlight2');
145            wrapper.innerHTML = el.innerHTML;
146            el.innerHTML = '';
147            el.appendChild(wrapper);
148            //this.wrapEL[tmpId] = wrapper;
149            return wrapper;
150        };
151        TextHighlight.contentMap = {};
152        const hasAllClasses = (el, classes) => {
153            try {
154                return classes.split(' ').every(cls => el.classList.contains(cls));
155            } catch (error) {
156                return false;
157            }
158        }
159        let defaultHighlightClasses = 'bg-warning bg-opacity-15 rounded border-warning border border-dashed px-1 mx-n1';
160        let defaultInitialClasses = 'border border-white px-1 mx-n1';
161        let privateNametagMarker = 'badge rounded-pill';
162        let privateNametagHighlightClasses = 'bg-warning bg-opacity-15 border-warning border-dashed';
163        let privateNametagInitialClasses = 'bg-light border-dark dark:border-white border-opacity-10';
164        let methodMarker = 'd-block badge border w-100 py-1.5';
165        let methodHighlightClasses = 'bg-warning bg-opacity-15 border-warning border-dashed';
166        let methodInitialClasses = 'bg-light border-dark dark:border-white';
167        function setupClassesForNonTables(el) {
168            if (el.closest('.d-flex.flex-wrap')) {
169                el = el.closest('.d-flex.flex-wrap');
170                if (el.closest('.d-flex.flex-column')) {
171                    el = el.closest('.d-flex.flex-column');
172                    if (el.tagName !== 'BODY')
173                        el.classList.add('px-1', 'mx-n1', 'py-1', 'my-n1');
174                }
175            }
176        }
177        function doHighlight() {
178            const tables = document.querySelectorAll('table');
179            TextHighlight.contentMap = {};
180            let highlightIndices_2 = Array.from(document.querySelectorAll(['[data-highlight-value]']));
181            highlightIndices_2.forEach((el, index) => {
182                if (el.closest('td'))
183                    return;
184
185                let content = el.textContent.trim().toLowerCase();
186                let defaultInlineClasses = 'border border-white px-1 mx-n1';
187                el.style.setProperty('--bs-border-radius', '0.375rem');
188                if (el.getAttribute('data-highlight-value')) {
189                    content = el.getAttribute('data-highlight-value').toLowerCase();
190                }
191                if (el.getAttribute('data-highlight-target')) {
192                    content = el.getAttribute('data-highlight-target').toLowerCase();
193                }
194                if (el.querySelector(['[data-highlight-target]'])) {
195                    content = el.querySelector(['[data-highlight-target]']).getAttribute('data-highlight-target').toLowerCase();
196                }
197                if (content) {
198                    if (!TextHighlight.contentMap[content]) {
199                        TextHighlight.contentMap[content] = [];
200                    }
201
202                    if (!el.dataset.uid) {
203                        var tmpId = myFnGenerateUniqueId();
204                        el.dataset.uid = tmpId
205
206                        if (el.previousElementSibling?.tagName === 'I') {
207                            defaultInlineClasses = defaultInlineClasses.replace(' mx-n1', '');
208                        }
209                        if (el.classList.contains('me-2')) {
210                            defaultInlineClasses = defaultInlineClasses.replace(' mx-n1', ' ms-n1');
211                        }
212                        if (el.classList.contains('me-1')) {
213                            defaultInlineClasses = defaultInlineClasses.replace(' mx-n1', ' ms-n1 prev-me-1');
214                            if (!el.classList.contains('ms-1') && !Array.from(el.parentElement.children).some(child => hasAllClasses(child, privateNametagMarker))) {
215                                el.classList.remove('me-1');
216                            }
217                            if (!el.previousElementSibling && el.parentElement?.classList.contains('d-inline-block')) {
218                                el.parentElement.classList.remove('d-inline-block');
219                                el.parentElement.classList.add('d-flex');
220                            }
221                        }
222                        if (el.classList.contains('address-to-idm')) {
223
224                            el.classList.add('d-flex', 'align-items-center');
225
226                        }
227                        if (el.childElementCount > 1) {
228                            if (el.querySelector('img') !== null && el.querySelector('a') !== null && !(el.parentElement?.nextElementSibling && hasAllClasses(el.parentElement?.nextElementSibling, privateNametagMarker))) {
229                                if (!el.parentElement?.nextElementSibling?.classList.contains('js-clipboard')) {
230                                    el.classList.add('text-nowrap');
231                                }
232                            }
233                        }
234                        if (el.parentNode?.classList.contains('font-monospace')) {
235                            defaultInlineClasses = defaultInlineClasses.replace(' ', '');
236                        }
237                        if (!hasAllClasses(el, privateNametagMarker)) {
238                            el.classList.add(...defaultInlineClasses.split(" "), 'd-inline-block');
239                            el.style.setProperty('--bs-border-opacity', '0');
240
241                            //Fix bug: lost space bug#3364 
242                            if (el.className == "text-break border border-white px-1 ms-n1 prev-me-1 d-inline-block mx-n1") {
243                                el.className = "text-break border border-white px-1 ms-n1 prev-me-1 d-inline-block";
244                            }
245                        }
246                        setupClassesForNonTables(el);
247                        if (el.firstElementChild && el.firstElementChild.classList && hasAllClasses(el.firstElementChild, privateNametagMarker)) {
248                            el = el.firstElementChild;
249                        } else if (el.previousElementSibling?.tagName === 'IMG' || el.previousElementSibling?.tagName === 'I') {
250
251                            let firstElmType = el.previousElementSibling?.tagName;
252                            var tmpType = "1"
253                            if (el.previousElementSibling?.tagName === 'I') {
254                                tmpType = "2"
255                            }
256                            el.classList.remove(...defaultInlineClasses.split(" "));
257                            if (hasAllClasses(el.firstElementChild, 'hash-tag text-truncate') && el.firstElementChild.style.maxWidth !== '') {
258                                el.classList.add('d-inline-flex');
259                            }
260                            if (el.classList.contains('me-1')) {
261                                el.classList.remove('me-1');
262                            }
263                            el = wrapElementsNonTables(el);
264                            if (el.classList.contains('me-1')) {
265                                el.classList.remove('me-1');
266                            }
267                            if (el.childElementCount > 1) {
268                                if (!el.children[1].classList.contains("ms-1")) {
269                                    el.firstElementChild.classList.add('me-1')
270                                }
271
272                                if (firstElmType != "IMG" && firstElmType != "img" && !el.previousElementSibling) { // for tx page with tx-action if first item is a domain, it not allow add nx-n1 class
273                                    el.classList.add('mx-n1');
274                                }
275                            }
276
277                            el.classList.add(...defaultInlineClasses.split(" "));
278                        } else if (el.parentNode?.previousElementSibling?.tagName === 'IMG' || (el.parentNode?.previousElementSibling?.tagName === 'I' && !el.parentNode?.previousElementSibling?.classList.contains('fa-caret-right'))) {
279                            el = wrapElementsNonTables(el.parentElement);
280                            if (el.childElementCount > 1) {
281                                el.firstElementChild.classList.add('me-1')
282                            }
283                        } else if (el.previousElementSibling?.tagName === 'SPAN' && el.previousElementSibling?.firstElementChild?.classList.contains('fa-file-alt')) {
284                            el.classList.add('d-inline-block', 'align-middle');
285                            el = wrapElementsNonTables(el);
286                        }
287
288                        el.addEventListener("mouseenter", doMouseEnter);
289                        el.addEventListener("mouseleave", doMouseLeave);
290
291                        el.dataset.uid = tmpId
292                        TextHighlight.cacheEL[tmpId] = el
293                    }
294                    TextHighlight.contentMap[content].push(TextHighlight.cacheEL[el.dataset.uid]);
295                }
296            }
297            );
298            let highlightIndices_3 = Array.from(document.querySelectorAll(['[data-highlight-pos-value]']));
299            highlightIndices_3.forEach((el, index) => {
300                let content = el.textContent.trim().toLowerCase();
301                let defaultInlineClasses = 'position-relative';
302                el.style.setProperty('--bs-border-radius', '0.375rem');
303                if (el.getAttribute('data-highlight-pos-value')) {
304                    content = el.getAttribute('data-highlight-pos-value').toLowerCase();
305                }
306                if (content) {
307                    if (!TextHighlight.contentMap[content]) {
308                        TextHighlight.contentMap[content] = [];
309                    }
310
311                    if (!el.dataset.uid) {
312                        var tmpId = myFnGenerateUniqueId();
313                        el.dataset.uid = tmpId
314
315                        el.classList.add(...defaultInlineClasses.split(" "));
316                        el.style.setProperty('--bs-border-opacity', '0');
317                        el.innerHTML += `<span class="js-highlight-span position-absolute bg-opacity-15 rounded border-white border-dashed border" style="top: -0.075rem; bottom: -0.075rem; left: -0.25rem; right: -0.25rem;"></span>`;
318                        setupClassesForNonTables(el);
319                        if (el.firstElementChild && el.firstElementChild.classList && hasAllClasses(el.firstElementChild, privateNametagMarker)) {
320                            el = el.firstElementChild;
321                        } else if (el.previousElementSibling?.tagName === 'IMG') {
322                            el = wrapElementsNonTables(el);
323                        }
324
325                        el.addEventListener("mouseenter", doMouseEnter);
326                        el.addEventListener("mouseleave", doMouseLeave);
327
328                        el.dataset.uid = tmpId
329                        TextHighlight.cacheEL[tmpId] = el
330                    }
331                    TextHighlight.contentMap[content].push(TextHighlight.cacheEL[el.dataset.uid]);
332                }
333            }
334            );
335            tables.forEach(function (table) {
336                let classes = '';
337                let initialClasses = '';
338                const highlightHeaders = Array.from(table.querySelectorAll('thead tr th:not([style*="display: none"]):not([style*="display: none"]'));
339                const highlightIndices = highlightHeaders.reduce((indices, header, index) => {
340                    if (header.hasAttribute('data-highlight')) {
341                        indices.push(index);
342                    }
343                    return indices;
344                }
345                    , []);
346                const rows = Array.from(table.querySelectorAll('tr:not([style*="display:none"]):not([style*="display: none"])'));
347                rows.forEach(row => {
348                    var cells = Array.from(row.querySelectorAll('td:not([style*="display:none"]):not([style*="display: none"])'));
349                    cells.forEach((cell, index) => {
350                        if (cell && cell.getAttribute('colspan')) {
351                            const colspanValue = cell.colSpan
352                            if (colspanValue > 1) {
353                                for (let i = 1; i < colspanValue; i++) {
354                                    cells.splice(index + i, 0, null);
355                                }
356                            }
357                        }
358                    }
359                    );
360                    highlightIndices.forEach(index => {
361                        const cell = cells[index];
362                        if (!cell)
363                            return;
364                        cell.style.setProperty('--bs-border-radius', '0.375rem');
365                        const nestedElement = cell.querySelector("*");
366                        let actualElement = nestedElement && nestedElement.textContent.trim() ? findFirstTextChild(nestedElement) : cell;
367                        if (!actualElement.dataset.uid) {
368                            var tmpId = myFnGenerateUniqueId();
369                            actualElement.dataset.uid = tmpId
370
371                            if (actualElement === cell) {
372                                actualElement = wrapTdElements(actualElement);
373                            } else if (actualElement.previousElementSibling) {
374                                actualElement = wrapElements(actualElement);
375                            } else if (actualElement.parentElement.previousElementSibling?.tagName === 'IMG' || actualElement.parentElement.previousElementSibling?.tagName === 'I') {
376                                actualElement = wrapElements(actualElement.parentElement);
377                            } else if (actualElement?.childNodes[0]?.nodeType === Node.TEXT_NODE && actualElement?.childNodes[0]?.nextSibling) {
378                                var textToReplace = actualElement?.childNodes[0].textContent;
379                                if (textToReplace.trim() && actualElement.innerHTML.includes(textToReplace)) {
380                                    actualElement.innerHTML = actualElement.innerHTML.replace(textToReplace, '<div>' + textToReplace + '</div>');
381                                    actualElement = actualElement.children[0]
382                                }
383                            } else if (actualElement?.childNodes[1]?.nodeType === Node.TEXT_NODE && actualElement?.childNodes[1]?.nextSibling && actualElement?.childNodes[1]?.previousSibling) {
384                                var textToReplace = actualElement?.childNodes[1].textContent;
385                                if (textToReplace.trim() && actualElement.innerHTML.includes(textToReplace)) {
386                                    actualElement.innerHTML = actualElement.innerHTML.replace(textToReplace, '<div>' + textToReplace + '</div>');
387                                    actualElement = wrapElements(actualElement.children[1])
388                                }
389                            }
390                            if (!hasAllClasses(actualElement, privateNametagMarker) && !hasAllClasses(actualElement, methodMarker)) {
391                                actualElement.classList.add('border', 'px-1', 'mx-n1', ...defaultInitialClasses.split(" "));
392                                actualElement.style.setProperty('--bs-border-opacity', '0');
393                            }
394                            if (actualElement.firstElementChild && actualElement.firstElementChild.classList && actualElement.firstElementChild.classList.contains('hash-tag') && actualElement.firstElementChild.classList.contains('text-truncate')) {
395                                let firstElemChild = actualElement.firstElementChild;
396                                if (firstElemChild.firstElementChild && firstElemChild.firstElementChild.classList && firstElemChild.firstElementChild.classList.contains('hash-tag') && firstElemChild.firstElementChild.classList.contains('text-truncate')) {
397                                    firstElemChild.classList.add('lh-sm', 'my-n1');
398                                    firstElemChild.firstElementChild.classList.add('lh-sm', 'my-n1');
399                                }
400                            }
401                            if (actualElement.parentElement.classList.contains('text-truncate')) {
402                                actualElement.classList.remove('mx-n1');
403                                actualElement.classList.add('me-n1');
404                                actualElement.parentElement.classList.add('ms-n1');
405                            }
406                            if (actualElement?.parentElement.classList.contains('gap-2')) {
407                                actualElement.classList.remove('px-1', 'mx-n1');
408                                actualElement.classList.add('ps-1', 'pe-2', 'ms-n1', 'me-n2');
409                            }
410                            if (actualElement?.parentElement?.parentElement.classList.contains('gap-2')) {
411                                actualElement.classList.remove('px-1', 'mx-n1');
412                                actualElement.classList.add('ps-1', 'pe-2', 'ms-n1', 'me-n2');
413                                if (actualElement.parentElement.classList.contains('me-1')) {
414                                    actualElement.parentElement.classList.remove('me-1');
415                                }
416                            }
417
418                            actualElement.dataset.uid = tmpId
419                        }
420
421                        let content = actualElement.textContent.trim().toLowerCase();
422                        if (content.includes('(')) {
423                            content = content.replace('(', ' (').replace(/\s\s+/g, ' ')
424                        }
425                        if (content.includes('\n')) {
426                            content = content.replace(/\s\s+/g, ' ')
427                        }
428                        if (actualElement.getAttribute('data-highlight-value')) {
429                            content = actualElement.getAttribute('data-highlight-value').toLowerCase();
430                        }
431                        if (actualElement.querySelector('[data-highlight-value]')) {
432                            content = actualElement.querySelector('[data-highlight-value]').getAttribute('data-highlight-value').toLowerCase();
433                        }
434                        if (actualElement.getAttribute('data-highlight-target')) {
435                            content = actualElement.getAttribute('data-highlight-target').toLowerCase();
436                        }
437                        else if (actualElement.parentNode.getAttribute('data-highlight-target')) {
438                            content = actualElement.parentNode.getAttribute('data-highlight-target').toLowerCase();
439                        }
440                        else if (actualElement.parentNode.parentNode.getAttribute('data-highlight-target')) {
441                            content = actualElement.parentNode.parentNode.getAttribute('data-highlight-target').toLowerCase();
442                        }
443                        else if (actualElement.parentNode.parentNode.parentNode.getAttribute("data-highlight-target")) {
444                            content = actualElement.parentNode.parentNode.parentNode.getAttribute("data-highlight-target").toLowerCase();
445                            if (actualElement.parentNode.parentNode.parentNode?.parentNode.tagName === "TD" && actualElement.parentNode.parentNode.parentNode.classList.contains('d-flex')) {
446                                actualElement.parentNode.parentNode.parentNode.classList.replace('d-flex', 'd-inline-flex')
447                            }
448                        } else if (actualElement.querySelector(['[data-highlight-target]'])) {
449                            content = actualElement.querySelector(['[data-highlight-target]']).getAttribute('data-highlight-target').toLowerCase();
450                        }
451
452                        if (content) {
453                            if (!TextHighlight.cacheEL.hasOwnProperty(actualElement.dataset.uid)) {
454                                TextHighlight.cacheEL[actualElement.dataset.uid] = actualElement
455                            }
456
457                            if (!TextHighlight.contentMap[content]) {
458                                TextHighlight.contentMap[content] = [];
459                            }
460
461                            TextHighlight.contentMap[content].push(TextHighlight.cacheEL[actualElement.dataset.uid]);
462                        }
463                    }
464                    );
465                }
466                );
467                rows.forEach(row => {
468                    var cells = Array.from(row.querySelectorAll('td:not([style*="display:none"]):not([style*="display: none"])'));
469                    cells.forEach((cell, index) => {
470                        if (cell && cell.getAttribute('colspan')) {
471                            const colspanValue = cell.colSpan
472                            if (colspanValue > 1) {
473                                for (let i = 1; i < colspanValue; i++) {
474                                    cells.splice(index + i, 0, null);
475                                }
476                            }
477                        }
478                    }
479                    );
480                    highlightIndices.forEach(index => {
481                        const cell = cells[index];
482                        if (!cell)
483                            return;
484                        cell.addEventListener("mouseenter", doMouseEnter);
485                        cell.addEventListener("mouseleave", doMouseLeave);
486                    }
487                    );
488                }
489                );
490            });
491        }
492        ; function doMouseEnter() {
493            const nestedElement = this.querySelector("*");
494            const actualElement = nestedElement && nestedElement.textContent.trim() ? nestedElement : this;
495            let content = actualElement.textContent.trim().toLowerCase();
496            if (content.includes('(')) {
497                content = content.replace('(', ' (').replace(/\s\s+/g, ' ')
498            }
499            if (content.includes('\n')) {
500                content = content.replace(/\s\s+/g, ' ');
501            }
502            let isDone = false
503            if (actualElement.parentNode.tagName === "TD") {
504                if (actualElement.attributes && actualElement.hasAttribute('data-highlight-target')) {
505                    content = actualElement.getAttribute('data-highlight-target').toLowerCase();
506                    isDone = true
507                }
508                if (isDone === false) {
509                    const firstMatch = this.querySelector('[data-highlight-target]');
510                    if (firstMatch) {
511                        content = firstMatch.getAttribute('data-highlight-target').toLowerCase();
512                        isDone = true
513                    }
514                }
515                if (isDone === false && actualElement.children && actualElement.children.length > 0) {
516                    for (const child of actualElement.children) {
517                        if (child.attributes && child.hasAttribute('data-highlight-target')) {
518                            content = child.getAttribute('data-highlight-target').toLowerCase();
519                            isDone = true
520                            break;
521                        }
522                    }
523                }
524                if (isDone === false && actualElement.firstElementChild && actualElement.firstElementChild.children && actualElement.firstElementChild.children.length > 0) {
525                    for (const child of actualElement.firstElementChild.children) {
526                        if (child.attributes && child.hasAttribute('data-highlight-target')) {
527                            content = child.getAttribute('data-highlight-target').toLowerCase();
528                            isDone = true
529                            break;
530                        }
531                        if (child.children.length > 0 && child.children[0].hasAttribute('data-highlight-target')) {
532                            content = child.children[0].getAttribute('data-highlight-target').toLowerCase();
533                            isDone = true
534                            break;
535                        }
536                    }
537                }
538                if (actualElement.querySelector('[data-highlight-value]')) {
539                    content = actualElement.querySelector('[data-highlight-value]').getAttribute('data-highlight-value').toLowerCase();
540                }
541            } else {
542                if (actualElement.hasAttribute('data-highlight-value')) {
543                    if (actualElement.getAttribute('data-highlight-value')) {
544                        content = actualElement.getAttribute('data-highlight-value').toLowerCase()
545                    }
546                }
547                if (actualElement.attributes && actualElement.hasAttribute('data-highlight-target')) {
548                    content = actualElement.getAttribute('data-highlight-target').toLowerCase();
549                } else if (actualElement.parentNode && actualElement.parentNode.attributes && actualElement.parentNode.hasAttribute('data-highlight-target')) {
550                    content = actualElement.parentNode.getAttribute('data-highlight-target').toLowerCase();
551                } else if (actualElement.querySelector('[data-highlight-target]')) {
552                    content = actualElement.querySelector('[data-highlight-target]').getAttribute('data-highlight-target').toLowerCase();
553                } else {
554                    for (const child of actualElement.children) {
555                        if (child.attributes && child.hasAttribute('data-highlight-target')) {
556                            content = child.getAttribute('data-highlight-target').toLowerCase();
557                            break;
558                        }
559                    }
560                }
561            }
562            if (!(content.startsWith("Create: ") || content.startsWith("Contract Creation"))) {
563                try {
564                    if (!TextHighlight.contentMap[content]) return;
565
566                    TextHighlight.contentMap[content].forEach(matchingElement => {
567                        if (matchingElement.parentNode.parentNode.parentNode.getAttribute("data-highlight-target")) {
568                            matchingElement = matchingElement.parentNode.parentNode.parentNode;
569                        }
570                        let privateNameTagInChild = matchingElement.querySelector(privateNametagMarker.split(' ').map(cls => `.${cls}`).join(''));
571                        if (privateNameTagInChild) {
572                            matchingElement = privateNameTagInChild;
573                        }
574                        initialClasses = defaultInitialClasses;
575                        classes = defaultHighlightClasses;
576                        matchingElement.style.setProperty('--bs-border-opacity', '1');
577                        if (matchingElement.hasAttribute('data-highlight-value')) {
578                            if (matchingElement.previousElementSibling?.tagName === 'I') {
579                                classes = classes.replace(' mx-n1', '');
580                            }
581                            if (matchingElement.classList.contains('me-2') || matchingElement.classList.contains('prev-me-1')) {
582                                classes = classes.replace('mx-n1', 'ms-n1');
583                            }
584                            if (matchingElement.parentNode?.classList.contains('font-monospace')) {
585                                classes = classes.replace(' mx-n1', '');
586                            }
587                            matchingElement.style.removeProperty('--bs-border-opacity');
588                        }
589                        if (hasAllClasses(matchingElement, privateNametagMarker)) {
590                            initialClasses = privateNametagInitialClasses;
591                            classes = privateNametagHighlightClasses;
592                            matchingElement.style.removeProperty('--bs-border-opacity');
593                        }
594                        if (hasAllClasses(matchingElement, methodMarker)) {
595                            initialClasses = methodInitialClasses;
596                            classes = methodHighlightClasses;
597                        }
598                        if (!matchingElement.hasAttribute('data-highlight-pos-value')) {
599                            if (matchingElement.classList.contains('prev-me-1')) {
600                                classes = classes.replace('mx-n1', 'ms-n1');
601                                matchingElement.classList.remove('me-1')
602                            }
603                            if (matchingElement.parentElement.classList.contains('text-truncate')) {
604                                initialClasses = initialClasses.replace('mx-n1', 'me-n1');
605                                classes = classes.replace('mx-n1', 'me-n1');
606                            }
607                            matchingElement.classList.remove(...initialClasses.split(" "));
608                            matchingElement.classList.add(...classes.split(" "));
609                        } else {
610                            matchingElement = matchingElement.querySelector('span.js-highlight-span');
611                            matchingElement.classList.remove('border-white');
612                            matchingElement.classList.add('border-warning', 'bg-warning');
613                        }
614                    }
615                    );
616                } catch (e) {
617                    console.error('Error:', e);
618                }
619            }
620        }
621        function doMouseLeave() {
622            const nestedElement = this.querySelector("*");
623            const actualElement = nestedElement && nestedElement.textContent.trim() ? nestedElement : this;
624            let content = actualElement.textContent.trim().toLowerCase();
625            if (content.includes('(')) {
626                content = content.replace('(', ' (').replace(/\s\s+/g, ' ')
627            }
628            if (content.includes('\n')) {
629                content = content.replace(/\s\s+/g, ' ')
630            }
631            let isDone = false
632            if (actualElement.parentNode.tagName === "TD") {
633                if (actualElement.attributes && actualElement.hasAttribute('data-highlight-target')) {
634                    content = actualElement.getAttribute('data-highlight-target').toLowerCase();
635                    isDone = true
636                }
637                if (isDone === false) {
638                    const firstMatch = this.querySelector('[data-highlight-target]');
639                    if (firstMatch) {
640                        content = firstMatch.getAttribute('data-highlight-target').toLowerCase();
641                        isDone = true
642                    }
643                }
644                if (isDone === false && actualElement.children.length > 0) {
645                    for (const child of actualElement.children) {
646                        if (child.attributes && child.hasAttribute('data-highlight-target')) {
647                            content = child.getAttribute('data-highlight-target').toLowerCase();
648                            isDone = true
649                            break;
650                        }
651                    }
652                }
653                if (isDone === false && actualElement.firstElementChild && actualElement.firstElementChild.children && actualElement.firstElementChild.children.length > 0) {
654                    for (const child of actualElement.firstElementChild.children) {
655                        if (child.attributes && child.hasAttribute('data-highlight-target')) {
656                            content = child.getAttribute('data-highlight-target').toLowerCase();
657                            isDone = true
658                            break;
659                        }
660                        if (child.children.length > 0 && child.children[0].hasAttribute('data-highlight-target')) {
661                            content = child.children[0].getAttribute('data-highlight-target').toLowerCase();
662                            isDone = true
663                            break;
664                        }
665                    }
666                }
667                if (actualElement.querySelector('[data-highlight-value]')) {
668                    content = actualElement.querySelector('[data-highlight-value]').getAttribute('data-highlight-value').toLowerCase();
669                }
670            } else {
671                if (actualElement.hasAttribute('data-highlight-value')) {
672                    if (actualElement.getAttribute('data-highlight-value')) {
673                        content = actualElement.getAttribute('data-highlight-value').toLowerCase()
674                    }
675                }
676                if (actualElement.attributes && actualElement.hasAttribute('data-highlight-target')) {
677                    content = actualElement.getAttribute('data-highlight-target').toLowerCase();
678                } else if (actualElement.parentNode && actualElement.parentNode.attributes && actualElement.parentNode.hasAttribute('data-highlight-target')) {
679                    content = actualElement.parentNode.getAttribute('data-highlight-target').toLowerCase();
680                } else if (actualElement.querySelector('[data-highlight-target]')) {
681                    content = actualElement.querySelector('[data-highlight-target]').getAttribute('data-highlight-target').toLowerCase();
682                } else {
683                    for (const child of actualElement.children) {
684                        if (child.attributes && child.hasAttribute('data-highlight-target')) {
685                            content = child.getAttribute('data-highlight-target').toLowerCase();
686                            break;
687                        }
688                    }
689                }
690            }
691            if (!(content.startsWith("Create: ") || content.startsWith("Contract Creation"))) {
692                try {
693                    if (!TextHighlight.contentMap[content]) return;
694
695                    TextHighlight.contentMap[content].forEach(matchingElement => {
696                        if (matchingElement.parentNode.parentNode.parentNode.getAttribute("data-highlight-target")) {
697                            matchingElement = matchingElement.parentNode.parentNode.parentNode;
698                        }
699                        let privateNameTagInChild = matchingElement.querySelector(privateNametagMarker.split(' ').map(cls => `.${cls}`).join(''));
700                        if (privateNameTagInChild) {
701                            matchingElement = privateNameTagInChild;
702                        }
703                        initialClasses = defaultInitialClasses;
704                        classes = defaultHighlightClasses;
705                        matchingElement.style.setProperty('--bs-border-opacity', '0');
706                        if (matchingElement.hasAttribute('data-highlight-value')) {
707                            classes = defaultHighlightClasses
708                            if (matchingElement.previousElementSibling?.tagName === 'I') {
709                                initialClasses = initialClasses.replace(' mx-n1', '');
710                            }
711                            if (matchingElement.classList.contains('me-2') || matchingElement.classList.contains('prev-me-1')) {
712                                initialClasses = initialClasses.replace('mx-n1', 'ms-n1');
713                            }
714                            if (matchingElement.parentNode?.classList.contains('font-monospace')) {
715                                initialClasses = initialClasses.replace(' mx-n1', '');
716                            }
717                            matchingElement.style.removeProperty('--bs-border-opacity');
718                        }
719                        if (hasAllClasses(matchingElement, privateNametagMarker)) {
720                            initialClasses = privateNametagInitialClasses;
721                            classes = privateNametagHighlightClasses;
722                            matchingElement.style.removeProperty('--bs-border-opacity');
723                        }
724                        if (hasAllClasses(matchingElement, methodMarker)) {
725                            initialClasses = methodInitialClasses;
726                            classes = methodHighlightClasses;
727                            matchingElement.style.removeProperty('--bs-border-opacity');
728                        }
729                        if (!matchingElement.hasAttribute('data-highlight-pos-value')) {
730                            if (matchingElement.classList.contains('prev-me-1')) {
731                                initialClasses = initialClasses.replace('px-1 mx-n1', 'me-1');
732                                matchingElement.classList.remove('ms-n1')
733                            }
734                            if (matchingElement.parentElement.classList.contains('text-truncate')) {
735                                initialClasses = initialClasses.replace('mx-n1', 'me-n1');
736                                classes = classes.replace('mx-n1', 'me-n1');
737                            }
738                            matchingElement.classList.remove(...classes.split(" "));
739                            matchingElement.classList.add(...initialClasses.split(" "));
740                        } else {
741                            matchingElement = matchingElement.querySelector('span.js-highlight-span');
742                            matchingElement.classList.remove('border-warning', 'bg-warning');
743                            matchingElement.classList.add('border-white');
744                        }
745                    }
746                    );
747                } catch (e) {
748                    console.error('Error:', e);
749                }
750            }
751        }
752        function getCookie(cname) {
753            var name = cname + "=";
754            var ca = document.cookie.split(';');
755            for (var i = 0; i < ca.length; i++) {
756                var c = ca[i];
757                while (c.charAt(0) === ' ') {
758                    c = c.substring(1);
759                }
760                if (c.indexOf(name) === 0) {
761                    return c.substring(name.length, c.length);
762                }
763            }
764            return "";
765        }
766        function deserializeSettings() {
767            const decodedCookie = getCookie(siteName + "_isHighlight");
768            if (decodedCookie === "false") {
769                return false;
770            } else {
771                return true;
772            }
773        }
774        if (this.count == 0) {
775            this.isHightlight = deserializeSettings()
776            this.count = 1
777        }
778        if (this.isHightlight) {
779            if (flag === "1") {
780                doHighlight();
781            } else {
782                document.addEventListener("DOMContentLoaded", doHighlight());
783            }
784        }
785    }
786};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.