()
| 51 | } |
| 52 | |
| 53 | async function tooltipCreate() { |
| 54 | localeData.hint = document.createElement('div'); |
| 55 | localeData.hint.className = 'tooltip'; |
| 56 | localeData.hint.id = 'tooltip-container'; |
| 57 | localeData.hint.innerText = 'this is a hint'; |
| 58 | gradioApp().appendChild(localeData.hint); |
| 59 | localeData.btn = gradioApp().getElementById('locale-container'); |
| 60 | if (!localeData.btn) { |
| 61 | localeData.btn = document.createElement('div'); |
| 62 | localeData.btn.className = 'locale'; |
| 63 | localeData.btn.id = 'locale-container'; |
| 64 | gradioApp().appendChild(localeData.btn); |
| 65 | } |
| 66 | localeData.btn.innerText = localeData.locale; |
| 67 | localeData.btn.ondblclick = resetLocale; |
| 68 | localeData.btn.onclick = cycleLocale; |
| 69 | if (window.opts.tooltips === 'None') localeData.type = 0; |
| 70 | if (window.opts.tooltips === 'Browser default') localeData.type = 1; |
| 71 | if (window.opts.tooltips === 'UI tooltips') localeData.type = 2; |
| 72 | |
| 73 | if (localeData.type === 2) { // setup event delegation for tooltips instead of individual listeners |
| 74 | if (isTouchDevice) { |
| 75 | gradioApp().addEventListener('touchstart', tooltipShowDelegated); |
| 76 | gradioApp().addEventListener('touchend', tooltipHideDelegated); |
| 77 | } |
| 78 | gradioApp().addEventListener('pointerover', tooltipShowDelegated); |
| 79 | gradioApp().addEventListener('pointerout', tooltipHideDelegated); |
| 80 | } |
| 81 | if (!hintsObserver) initializeDOMObserver(); |
| 82 | } |
| 83 | |
| 84 | async function expandTooltip(element, longHint) { |
| 85 | if (localeData.currentElement === element && localeData.hint.classList.contains('tooltip-show')) { |
no test coverage detected