From 933b445ed60324158ed5f126e906c99c94bb36f5 Mon Sep 17 00:00:00 2001 From: Daniel Triendl Date: Tue, 30 Nov 2021 14:34:29 +0100 Subject: [PATCH] Fix tapi search --- src/index.js | 2 +- src/search.ts | 15 +++++++++------ 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/index.js b/src/index.js index 6af313b..77ba41a 100644 --- a/src/index.js +++ b/src/index.js @@ -9,7 +9,7 @@ console.log('script start') const search = new Search() // eslint-disable-next-line no-undef -waitForKeyElements('div.nav-search', (element) => { search.createSearchWindow(element) }, true) +waitForKeyElements('ongoing-call-button', (element) => { search.createSearchWindow(element) }, true) const callNotification = new CallNotification() // eslint-disable-next-line no-undef diff --git a/src/search.ts b/src/search.ts index d8c3653..6672155 100644 --- a/src/search.ts +++ b/src/search.ts @@ -61,7 +61,7 @@ export class Search { icon.style.color = 'grey' searchWrapper.appendChild(icon) - element.appendChild(form) + element.parentElement.insertBefore(form, element) } private removeSearchResults () { @@ -170,12 +170,15 @@ export class Search { } private dial (number: string) { - var searchInput = document.getElementsByName('searchByNumberInput') - if (searchInput.length > 0) { - (searchInput[0]).value = number - searchInput[0].focus() + console.log('TAPI Search dialing', number); + var searchInput = document.getElementById('dialpad-input'); + (searchInput).value = number; + (searchInput).focus; + fireChangeEvents(searchInput); - fireChangeEvents(searchInput[0]) + var toaster = document.querySelector('toaster-container'); + if (window.getComputedStyle(toaster, null).display == 'none') { + document.getElementById('menuDialer').click(); } } }