4 Commits

Author SHA1 Message Date
29fc426161 Medium anzeigen 2020-11-09 08:53:39 +01:00
231d24b26a Search result submit selected first 2020-11-05 08:58:51 +01:00
f3693162ab Time Manager Link title 2020-11-05 08:58:20 +01:00
c09bdd856b Fix readme 2020-11-04 23:36:32 +01:00
7 changed files with 21 additions and 13 deletions

View File

@ -1,7 +1,7 @@
// ==UserScript== // ==UserScript==
// @name 3CX TAPI // @name 3CX TAPI
// @namespace http://cp-solutions.at // @namespace http://cp-solutions.at
// @version 7.0.0 // @version 7.0.2
// @author Daniel Triendl <d.triendl@cp-solutions.at> // @author Daniel Triendl <d.triendl@cp-solutions.at>
// @copyright Copyright 2020 CP Solutions GmbH // @copyright Copyright 2020 CP Solutions GmbH
// @source http://scootaloo.cp-austria.at/gitlist/3cx_tapi.git // @source http://scootaloo.cp-austria.at/gitlist/3cx_tapi.git
@ -3571,8 +3571,9 @@ class call_history_CallHistory {
parsedDate.getMinutes().toString().padStart(2, '0'); parsedDate.getMinutes().toString().padStart(2, '0');
var length = (parsedDuration.getHours() * 60 + parsedDuration.getMinutes()).toString(); var length = (parsedDuration.getHours() * 60 + parsedDuration.getMinutes()).toString();
var toolbar = call.querySelector('.wcToolbarTiles'); var toolbar = call.querySelector('.wcToolbarTiles');
var a = document.createElement('a');
var href = 'domizil://PM/Zeitbuchung?KontaktId=' + callerId.tD_ID + '&connect=' + connect + '&length=' + length; 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.dataset.domizilLink = href;
a.onclick = () => { a.onclick = () => {
window.open(href); window.open(href);
@ -3645,7 +3646,7 @@ class call_notification_CallNotification {
if (response.status === 200) { if (response.status === 200) {
var callerId = response.data; var callerId = response.data;
if (callerId) { 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 // eslint-disable-next-line no-undef
@ -3723,7 +3724,7 @@ class search_Search {
line1.appendChild(document.createTextNode(contact.tD_NAME)); line1.appendChild(document.createTextNode(contact.tD_NAME));
resultText.appendChild(line1); resultText.appendChild(line1);
var line2 = document.createElement('div'); 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); resultText.appendChild(line2);
resultList.appendChild(li); resultList.appendChild(li);
}); });
@ -3736,7 +3737,10 @@ class search_Search {
form.style.float = 'right'; form.style.float = 'right';
form.style.marginRight = '20px'; form.style.marginRight = '20px';
form.onsubmit = () => { 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) { if (items.length > 0) {
this.dial(items[0].dataset.tapiNumber); this.dial(items[0].dataset.tapiNumber);
} }

View File

@ -1,7 +1,7 @@
{ {
"name": "3cp-tapi", "name": "3cp-tapi",
"description": "Build your UserScript with webpack", "description": "Build your UserScript with webpack",
"version": "7.0.1", "version": "7.0.2",
"author": { "author": {
"name": "Daniel Triendl", "name": "Daniel Triendl",
"email": "d.triendl@cp-solutions.at" "email": "d.triendl@cp-solutions.at"
@ -29,8 +29,7 @@
"dependencies": { "dependencies": {
"axios": "0.20.0", "axios": "0.20.0",
"axios-userscript-adapter": "0.0.7", "axios-userscript-adapter": "0.0.7",
"chrono-node": "2.1.9", "chrono-node": "2.1.9"
"jquery": "3.5.1"
}, },
"devDependencies": { "devDependencies": {
"@typescript-eslint/eslint-plugin": "4.3.0", "@typescript-eslint/eslint-plugin": "4.3.0",

View File

@ -50,4 +50,4 @@ And commit 3CX_TAPI.user.js
## see also ## see also
Based on [webpack-userscript-template](https://github.com/Trim21/webpack-userscript-template/. Based on [webpack-userscript-template](https://github.com/Trim21/webpack-userscript-template/)

View File

@ -56,8 +56,9 @@ export class CallHistory {
var length = (parsedDuration.getHours() * 60 + parsedDuration.getMinutes()).toString() var length = (parsedDuration.getHours() * 60 + parsedDuration.getMinutes()).toString()
var toolbar = call.querySelector('.wcToolbarTiles') var toolbar = call.querySelector('.wcToolbarTiles')
var a = document.createElement('a')
var href = 'domizil://PM/Zeitbuchung?KontaktId=' + callerId.tD_ID + '&connect=' + connect + '&length=' + length 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.dataset.domizilLink = href
a.onclick = () => { a.onclick = () => {
window.open(href) window.open(href)

View File

@ -21,7 +21,7 @@ export class CallNotification {
if (response.status === 200) { if (response.status === 200) {
var callerId = response.data var callerId = response.data
if (callerId) { if (callerId) {
notification.text = callerId.tD_NAME + '\r\n' + number notification.text = callerId.tD_NAME + '\r\n' + number + ' (' + callerId.tD_MEDIUM + ')'
} }
} }

View File

@ -13,7 +13,10 @@ export class Search {
form.style.float = 'right' form.style.float = 'right'
form.style.marginRight = '20px' form.style.marginRight = '20px'
form.onsubmit = () => { 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) { if (items.length > 0) {
this.dial((<HTMLElement>items[0]).dataset.tapiNumber) this.dial((<HTMLElement>items[0]).dataset.tapiNumber)
} }
@ -148,7 +151,7 @@ export class Search {
resultText.appendChild(line1) resultText.appendChild(line1)
var line2 = document.createElement('div') 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) resultText.appendChild(line2)
resultList.appendChild(li) resultList.appendChild(li)

View File

@ -4,4 +4,5 @@ export interface TapiContact {
tD_NAME: string; tD_NAME: string;
tD_NUMBER?: string; tD_NUMBER?: string;
tD_NUMBER_TAPI?: string; tD_NUMBER_TAPI?: string;
tD_MEDIUM?: string;
} }