Timemanger immer anzeigen, TAPI Suche nur wenn mehr als 3 Ziffern bei Nummer
This commit is contained in:
parent
29fc426161
commit
fec9885a64
@ -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.2
|
// @version 7.0.3
|
||||||
// @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
|
||||||
@ -3502,7 +3502,7 @@ var external_axiosGmxhrAdapter_default = /*#__PURE__*/__webpack_require__.n(exte
|
|||||||
external_axios_default.a.defaults.adapter = external_axiosGmxhrAdapter_default.a;
|
external_axios_default.a.defaults.adapter = external_axiosGmxhrAdapter_default.a;
|
||||||
|
|
||||||
function extractNumber(s) {
|
function extractNumber(s) {
|
||||||
var match = /(\+?[0-9]+)/.exec(s);
|
var match = /(\+?[0-9]{4,})/.exec(s);
|
||||||
if (!match) {
|
if (!match) {
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
@ -3530,9 +3530,9 @@ class call_history_CallHistory {
|
|||||||
this.callerIds = {};
|
this.callerIds = {};
|
||||||
}
|
}
|
||||||
updateCallHistoryEntry(call, callerId) {
|
updateCallHistoryEntry(call, callerId) {
|
||||||
if (callerId.tD_NAME !== '') {
|
var span = call.querySelector('span');
|
||||||
var span = call.querySelector('span');
|
this.showTimeManager(call, span.nextSibling.textContent.trim(), callerId);
|
||||||
this.showTimeManager(call, span.nextSibling.textContent.trim(), callerId);
|
if (callerId && callerId.tD_NAME !== '') {
|
||||||
var text = span.textContent;
|
var text = span.textContent;
|
||||||
span.textContent = callerId.tD_NAME;
|
span.textContent = callerId.tD_NAME;
|
||||||
var br = document.createElement('br');
|
var br = document.createElement('br');
|
||||||
@ -3544,9 +3544,6 @@ class call_history_CallHistory {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
showTimeManager(call, date, callerId) {
|
showTimeManager(call, date, callerId) {
|
||||||
if (!callerId.tD_ID) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
var dateParts = date.match(/^(?<date>.*), (?<duration>[0-9]{2}:[0-9]{2}:[0-9]{2})$/);
|
var dateParts = date.match(/^(?<date>.*), (?<duration>[0-9]{2}:[0-9]{2}:[0-9]{2})$/);
|
||||||
var duration = '00:00:00';
|
var duration = '00:00:00';
|
||||||
if (dateParts) {
|
if (dateParts) {
|
||||||
@ -3571,7 +3568,11 @@ 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 href = 'domizil://PM/Zeitbuchung?KontaktId=' + callerId.tD_ID + '&connect=' + connect + '&length=' + length;
|
var href = 'domizil://PM/Zeitbuchung?';
|
||||||
|
if (callerId && callerId.tD_ID) {
|
||||||
|
href += 'KontaktId=' + callerId.tD_ID + '&';
|
||||||
|
}
|
||||||
|
href += 'connect=' + connect + '&length=' + length;
|
||||||
var a = document.createElement('a');
|
var a = document.createElement('a');
|
||||||
a.title = 'PM Zeitbuchung';
|
a.title = 'PM Zeitbuchung';
|
||||||
a.dataset.domizilLink = href;
|
a.dataset.domizilLink = href;
|
||||||
@ -3597,6 +3598,7 @@ class call_history_CallHistory {
|
|||||||
var span = element.querySelector('span');
|
var span = element.querySelector('span');
|
||||||
var number = extractNumber(span.textContent);
|
var number = extractNumber(span.textContent);
|
||||||
if (!number) {
|
if (!number) {
|
||||||
|
this.updateCallHistoryEntry(element, undefined);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (this.callerIds[number] !== undefined) {
|
if (this.callerIds[number] !== undefined) {
|
||||||
|
@ -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.2",
|
"version": "7.0.3",
|
||||||
"author": {
|
"author": {
|
||||||
"name": "Daniel Triendl",
|
"name": "Daniel Triendl",
|
||||||
"email": "d.triendl@cp-solutions.at"
|
"email": "d.triendl@cp-solutions.at"
|
||||||
|
@ -6,11 +6,10 @@ export class CallHistory {
|
|||||||
private callerIds: { [number: string]: TapiContact } = {}
|
private callerIds: { [number: string]: TapiContact } = {}
|
||||||
|
|
||||||
private updateCallHistoryEntry (call: HTMLElement, callerId: TapiContact) {
|
private updateCallHistoryEntry (call: HTMLElement, callerId: TapiContact) {
|
||||||
if (callerId.tD_NAME !== '') {
|
var span = call.querySelector('span')
|
||||||
var span = call.querySelector('span')
|
this.showTimeManager(call, span.nextSibling.textContent.trim(), callerId)
|
||||||
|
|
||||||
this.showTimeManager(call, span.nextSibling.textContent.trim(), callerId)
|
|
||||||
|
|
||||||
|
if (callerId && callerId.tD_NAME !== '') {
|
||||||
var text = span.textContent
|
var text = span.textContent
|
||||||
span.textContent = callerId.tD_NAME
|
span.textContent = callerId.tD_NAME
|
||||||
var br = document.createElement('br')
|
var br = document.createElement('br')
|
||||||
@ -23,10 +22,6 @@ export class CallHistory {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private showTimeManager (call: HTMLElement, date: string, callerId: TapiContact) {
|
private showTimeManager (call: HTMLElement, date: string, callerId: TapiContact) {
|
||||||
if (!callerId.tD_ID) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
var dateParts = date.match(/^(?<date>.*), (?<duration>[0-9]{2}:[0-9]{2}:[0-9]{2})$/)
|
var dateParts = date.match(/^(?<date>.*), (?<duration>[0-9]{2}:[0-9]{2}:[0-9]{2})$/)
|
||||||
var duration = '00:00:00'
|
var duration = '00:00:00'
|
||||||
if (dateParts) {
|
if (dateParts) {
|
||||||
@ -56,7 +51,11 @@ 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 href = 'domizil://PM/Zeitbuchung?KontaktId=' + callerId.tD_ID + '&connect=' + connect + '&length=' + length
|
var href = 'domizil://PM/Zeitbuchung?'
|
||||||
|
if (callerId && callerId.tD_ID) {
|
||||||
|
href += 'KontaktId=' + callerId.tD_ID + '&'
|
||||||
|
}
|
||||||
|
href += 'connect=' + connect + '&length=' + length
|
||||||
var a = document.createElement('a')
|
var a = document.createElement('a')
|
||||||
a.title = 'PM Zeitbuchung'
|
a.title = 'PM Zeitbuchung'
|
||||||
a.dataset.domizilLink = href
|
a.dataset.domizilLink = href
|
||||||
@ -82,6 +81,7 @@ export class CallHistory {
|
|||||||
var span = element.querySelector('span')
|
var span = element.querySelector('span')
|
||||||
var number = extractNumber(span.textContent)
|
var number = extractNumber(span.textContent)
|
||||||
if (!number) {
|
if (!number) {
|
||||||
|
this.updateCallHistoryEntry(element, undefined)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@ axios.defaults.adapter = adapter
|
|||||||
export { axios }
|
export { axios }
|
||||||
|
|
||||||
export function extractNumber (s: string) {
|
export function extractNumber (s: string) {
|
||||||
var match = /(\+?[0-9]+)/.exec(s)
|
var match = /(\+?[0-9]{4,})/.exec(s)
|
||||||
if (!match) {
|
if (!match) {
|
||||||
return undefined
|
return undefined
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user