From 29fc4261611db41674536697111ffa61ccd3836d Mon Sep 17 00:00:00 2001 From: Daniel Triendl Date: Mon, 9 Nov 2020 08:53:39 +0100 Subject: [PATCH] Medium anzeigen --- 3CX_TAPI.user.js | 14 +++++++++----- package.json | 5 ++--- src/js/call-notification.ts | 2 +- src/js/search.ts | 2 +- src/js/tapi-contact.ts | 1 + 5 files changed, 14 insertions(+), 10 deletions(-) diff --git a/3CX_TAPI.user.js b/3CX_TAPI.user.js index b4eb5f9..5aa4841 100644 --- a/3CX_TAPI.user.js +++ b/3CX_TAPI.user.js @@ -1,7 +1,7 @@ // ==UserScript== // @name 3CX TAPI // @namespace http://cp-solutions.at -// @version 7.0.0 +// @version 7.0.2 // @author Daniel Triendl // @copyright Copyright 2020 CP Solutions GmbH // @source http://scootaloo.cp-austria.at/gitlist/3cx_tapi.git @@ -3571,8 +3571,9 @@ class call_history_CallHistory { parsedDate.getMinutes().toString().padStart(2, '0'); var length = (parsedDuration.getHours() * 60 + parsedDuration.getMinutes()).toString(); var toolbar = call.querySelector('.wcToolbarTiles'); - var a = document.createElement('a'); var href = 'domizil://PM/Zeitbuchung?KontaktId=' + callerId.tD_ID + '&connect=' + connect + '&length=' + length; + var a = document.createElement('a'); + a.title = 'PM Zeitbuchung'; a.dataset.domizilLink = href; a.onclick = () => { window.open(href); @@ -3645,7 +3646,7 @@ class call_notification_CallNotification { if (response.status === 200) { var callerId = response.data; if (callerId) { - notification.text = callerId.tD_NAME + '\r\n' + number; + notification.text = callerId.tD_NAME + '\r\n' + number + ' (' + callerId.tD_MEDIUM + ')'; } } // eslint-disable-next-line no-undef @@ -3723,7 +3724,7 @@ class search_Search { line1.appendChild(document.createTextNode(contact.tD_NAME)); resultText.appendChild(line1); var line2 = document.createElement('div'); - line2.appendChild(document.createTextNode(contact.tD_NUMBER_TAPI)); + line2.appendChild(document.createTextNode(contact.tD_MEDIUM + ': ' + contact.tD_NUMBER_TAPI)); resultText.appendChild(line2); resultList.appendChild(li); }); @@ -3736,7 +3737,10 @@ class search_Search { form.style.float = 'right'; form.style.marginRight = '20px'; form.onsubmit = () => { - var items = document.getElementsByClassName('tapi-search-result'); + var items = document.getElementsByClassName('tapi-search-result-selected'); + if (items.length === 0) { + items = document.getElementsByClassName('tapi-search-result'); + } if (items.length > 0) { this.dial(items[0].dataset.tapiNumber); } diff --git a/package.json b/package.json index a23be65..09bb2c2 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "3cp-tapi", "description": "Build your UserScript with webpack", - "version": "7.0.1", + "version": "7.0.2", "author": { "name": "Daniel Triendl", "email": "d.triendl@cp-solutions.at" @@ -29,8 +29,7 @@ "dependencies": { "axios": "0.20.0", "axios-userscript-adapter": "0.0.7", - "chrono-node": "2.1.9", - "jquery": "3.5.1" + "chrono-node": "2.1.9" }, "devDependencies": { "@typescript-eslint/eslint-plugin": "4.3.0", diff --git a/src/js/call-notification.ts b/src/js/call-notification.ts index 59cc7b3..69ba96c 100644 --- a/src/js/call-notification.ts +++ b/src/js/call-notification.ts @@ -21,7 +21,7 @@ export class CallNotification { if (response.status === 200) { var callerId = response.data if (callerId) { - notification.text = callerId.tD_NAME + '\r\n' + number + notification.text = callerId.tD_NAME + '\r\n' + number + ' (' + callerId.tD_MEDIUM + ')' } } diff --git a/src/js/search.ts b/src/js/search.ts index 7acd0c8..44007e6 100644 --- a/src/js/search.ts +++ b/src/js/search.ts @@ -151,7 +151,7 @@ export class Search { resultText.appendChild(line1) var line2 = document.createElement('div') - line2.appendChild(document.createTextNode(contact.tD_NUMBER_TAPI)) + line2.appendChild(document.createTextNode(contact.tD_MEDIUM + ': ' + contact.tD_NUMBER_TAPI)) resultText.appendChild(line2) resultList.appendChild(li) diff --git a/src/js/tapi-contact.ts b/src/js/tapi-contact.ts index 633b5bb..8f25104 100644 --- a/src/js/tapi-contact.ts +++ b/src/js/tapi-contact.ts @@ -4,4 +4,5 @@ export interface TapiContact { tD_NAME: string; tD_NUMBER?: string; tD_NUMBER_TAPI?: string; + tD_MEDIUM?: string; }