Bump version to 9.0.0
This commit is contained in:
parent
933b445ed6
commit
f578bd2fe1
220
3CX_TAPI.user.js
220
3CX_TAPI.user.js
@ -1,7 +1,7 @@
|
|||||||
// ==UserScript==
|
// ==UserScript==
|
||||||
// @name 3CX TAPI
|
// @name 3CX TAPI
|
||||||
// @namespace http://cp-solutions.at
|
// @namespace http://cp-solutions.at
|
||||||
// @version 8.0.1
|
// @version 9.0.0
|
||||||
// @author Daniel Triendl <d.triendl@cp-solutions.at>
|
// @author Daniel Triendl <d.triendl@cp-solutions.at>
|
||||||
// @copyright Copyright 2021 CP Solutions GmbH
|
// @copyright Copyright 2021 CP Solutions GmbH
|
||||||
// @source https://source.cp-austria.at/git/CPATRD/3cx_tapi.git
|
// @source https://source.cp-austria.at/git/CPATRD/3cx_tapi.git
|
||||||
@ -8013,17 +8013,11 @@ class CallHistory {
|
|||||||
this.callerIds = {};
|
this.callerIds = {};
|
||||||
}
|
}
|
||||||
updateCallHistoryEntry(call, callerId) {
|
updateCallHistoryEntry(call, callerId) {
|
||||||
var span = call.querySelector('span');
|
var span = call.querySelector(':scope > span');
|
||||||
this.showTimeManager(call, span.nextSibling.textContent.trim(), callerId);
|
this.showTimeManager(call, call.querySelector('.date').textContent, callerId);
|
||||||
if (callerId && callerId.tD_NAME !== '') {
|
if (callerId && callerId.tD_NAME !== '') {
|
||||||
var text = span.textContent;
|
var text = span.textContent;
|
||||||
span.textContent = callerId.tD_NAME;
|
span.textContent = callerId.tD_NAME + ' ' + callerId.tD_NUMBER;
|
||||||
var br = document.createElement('br');
|
|
||||||
var span2 = document.createElement('span');
|
|
||||||
span2.style.fontSize = 'small';
|
|
||||||
span2.textContent = text;
|
|
||||||
span.parentNode.insertBefore(br, span.nextSibling);
|
|
||||||
span.parentNode.insertBefore(span2, span.nextSibling);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
showTimeManager(call, date, callerId) {
|
showTimeManager(call, date, callerId) {
|
||||||
@ -8050,7 +8044,7 @@ class CallHistory {
|
|||||||
parsedDate.getHours().toString().padStart(2, '0') +
|
parsedDate.getHours().toString().padStart(2, '0') +
|
||||||
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('call-history-options');
|
||||||
var href = 'domizil://PM/Zeitbuchung?';
|
var href = 'domizil://PM/Zeitbuchung?';
|
||||||
if (callerId && callerId.tD_ID) {
|
if (callerId && callerId.tD_ID) {
|
||||||
href += 'KontaktId=' + callerId.tD_ID + '&';
|
href += 'KontaktId=' + callerId.tD_ID + '&';
|
||||||
@ -8062,7 +8056,7 @@ class CallHistory {
|
|||||||
a.onclick = () => {
|
a.onclick = () => {
|
||||||
window.open(href);
|
window.open(href);
|
||||||
};
|
};
|
||||||
a.innerHTML = '<svg version="1.1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 559.98 559.98" width="20" height="20">' +
|
a.innerHTML = '<svg version="1.1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 559.98 559.98">' +
|
||||||
'<g>' +
|
'<g>' +
|
||||||
' <g>' +
|
' <g>' +
|
||||||
' <path d="M279.99,0C125.601,0,0,125.601,0,279.99c0,154.39,125.601,279.99,279.99,279.99c154.39,0,279.99-125.601,279.99-279.99' +
|
' <path d="M279.99,0C125.601,0,0,125.601,0,279.99c0,154.39,125.601,279.99,279.99,279.99c154.39,0,279.99-125.601,279.99-279.99' +
|
||||||
@ -8074,11 +8068,13 @@ class CallHistory {
|
|||||||
' </g>' +
|
' </g>' +
|
||||||
'</g>' +
|
'</g>' +
|
||||||
'</svg>';
|
'</svg>';
|
||||||
|
a.classList.add('btn');
|
||||||
|
a.classList.add('btn-plain');
|
||||||
toolbar.insertBefore(a, toolbar.firstChild);
|
toolbar.insertBefore(a, toolbar.firstChild);
|
||||||
}
|
}
|
||||||
showCallHistory(element) {
|
showCallHistory(element) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
var span = element.querySelector('span');
|
var span = element.querySelector(':scope > span');
|
||||||
var number = extractNumber(span.textContent);
|
var number = extractNumber(span.textContent);
|
||||||
if (!number) {
|
if (!number) {
|
||||||
this.updateCallHistoryEntry(element, undefined);
|
this.updateCallHistoryEntry(element, undefined);
|
||||||
@ -8115,7 +8111,7 @@ var call_notification_awaiter = (undefined && undefined.__awaiter) || function (
|
|||||||
class CallNotification {
|
class CallNotification {
|
||||||
showCallNotification(element) {
|
showCallNotification(element) {
|
||||||
return call_notification_awaiter(this, void 0, void 0, function* () {
|
return call_notification_awaiter(this, void 0, void 0, function* () {
|
||||||
var number = element.dataset.id;
|
var number = element.querySelector('.callNumber').textContent;
|
||||||
console.log('TAPI call notification', number);
|
console.log('TAPI call notification', number);
|
||||||
number = extractNumber(number);
|
number = extractNumber(number);
|
||||||
if (!number) {
|
if (!number) {
|
||||||
@ -8262,7 +8258,7 @@ class Search {
|
|||||||
icon.classList.add('form-control-feedback');
|
icon.classList.add('form-control-feedback');
|
||||||
icon.style.color = 'grey';
|
icon.style.color = 'grey';
|
||||||
searchWrapper.appendChild(icon);
|
searchWrapper.appendChild(icon);
|
||||||
element.appendChild(form);
|
element.parentElement.insertBefore(form, element);
|
||||||
}
|
}
|
||||||
removeSearchResults() {
|
removeSearchResults() {
|
||||||
var resultList = document.getElementById('tapiResults');
|
var resultList = document.getElementById('tapiResults');
|
||||||
@ -8318,11 +8314,14 @@ class Search {
|
|||||||
resultLi.classList.add('tapi-search-result-selected');
|
resultLi.classList.add('tapi-search-result-selected');
|
||||||
}
|
}
|
||||||
dial(number) {
|
dial(number) {
|
||||||
var searchInput = document.getElementsByName('searchByNumberInput');
|
console.log('TAPI Search dialing', number);
|
||||||
if (searchInput.length > 0) {
|
var searchInput = document.getElementById('dialpad-input');
|
||||||
searchInput[0].value = number;
|
searchInput.value = number;
|
||||||
searchInput[0].focus();
|
searchInput.focus;
|
||||||
fireChangeEvents(searchInput[0]);
|
fireChangeEvents(searchInput);
|
||||||
|
var toaster = document.querySelector('toaster-container');
|
||||||
|
if (window.getComputedStyle(toaster, null).display == 'none') {
|
||||||
|
document.getElementById('menuDialer').click();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -8372,83 +8371,8 @@ class Status {
|
|||||||
this._statusOn = yield GM.getValue('tapi-zc-on', 'menuAvailable');
|
this._statusOn = yield GM.getValue('tapi-zc-on', 'menuAvailable');
|
||||||
this._statusOff = yield GM.getValue('tapi-zc-off', 'menuAvailable');
|
this._statusOff = yield GM.getValue('tapi-zc-off', 'menuAvailable');
|
||||||
console.log('tapi-zc-user', this._user, 'tapi-zc-enabled', this._enabled, 'tapi-zc-on', this._statusOn, 'tapi-zc-off', this._statusOff);
|
console.log('tapi-zc-user', this._user, 'tapi-zc-enabled', this._enabled, 'tapi-zc-on', this._statusOn, 'tapi-zc-off', this._statusOff);
|
||||||
var div = document.createElement('div');
|
|
||||||
div.classList.add('tapi-dropdown');
|
|
||||||
var button = document.createElement('button');
|
|
||||||
button.id = 'tapi-zc-button';
|
|
||||||
button.classList.add('btn');
|
|
||||||
button.classList.add('btn-default');
|
|
||||||
button.innerText = 'ZeitConsens';
|
|
||||||
button.onclick = () => {
|
|
||||||
document.getElementById('tapi-zc-dropdown').classList.toggle('show');
|
|
||||||
};
|
|
||||||
div.appendChild(button);
|
|
||||||
var html = '<div class="form-group">' +
|
|
||||||
' <label for="tapi-zc-user">Username</label>' +
|
|
||||||
' <input type="text" class="form-control" name="tapi-zc-user" id="tapi-zc-user">' +
|
|
||||||
'</div>' +
|
|
||||||
'<div class="form-group">' +
|
|
||||||
' <label for="tapi-zc-on">Signed in</label>' +
|
|
||||||
' <select id="tapi-zc-on" class="form-control">' +
|
|
||||||
' <option value="menuAvailable">Available</option>' +
|
|
||||||
' <option value="menuOutofoffice">Do Not Disturb</option>' +
|
|
||||||
' <option value="menuCustom1">Verfügbar DW</option>' +
|
|
||||||
' </select>' +
|
|
||||||
'</div>' +
|
|
||||||
'<div class="form-group">' +
|
|
||||||
' <label for="tapi-zc-off">Signed out</label>' +
|
|
||||||
' <select id="tapi-zc-off" class="form-control">' +
|
|
||||||
' <option value="menuAway">Away</option>' +
|
|
||||||
' <option value="menuOutofoffice">Do Not Disturb</option>' +
|
|
||||||
' </select>' +
|
|
||||||
'</div>' +
|
|
||||||
'<div class="checkbox">' +
|
|
||||||
' <label class="i-checks" for="tapi-zc-enabled">' +
|
|
||||||
' <input type="checkbox" id="tapi-zc-enabled">' +
|
|
||||||
' <i></i><span>Enabled</span>' +
|
|
||||||
'</label>';
|
|
||||||
'</div>';
|
|
||||||
var dropdown = document.createElement('div');
|
|
||||||
dropdown.classList.add('tapi-dropdown-content');
|
|
||||||
dropdown.classList.add('panel-body');
|
|
||||||
dropdown.id = 'tapi-zc-dropdown';
|
|
||||||
dropdown.innerHTML = html;
|
|
||||||
div.appendChild(dropdown);
|
|
||||||
element.insertBefore(div, element.firstChild);
|
|
||||||
var zcUser = document.getElementById('tapi-zc-user');
|
|
||||||
zcUser.value = this._user;
|
|
||||||
zcUser.onchange = () => {
|
|
||||||
this._user = zcUser.value;
|
|
||||||
GM.setValue('tapi-zc-user', this._user);
|
|
||||||
console.log('tapi-zc-user', this._user);
|
|
||||||
this._currentStatus = undefined;
|
|
||||||
};
|
|
||||||
var zcEnabled = document.getElementById('tapi-zc-enabled');
|
|
||||||
zcEnabled.checked = this._enabled;
|
|
||||||
zcEnabled.onchange = () => {
|
|
||||||
this._enabled = zcEnabled.checked;
|
|
||||||
GM.setValue('tapi-zc-enabled', this._enabled);
|
|
||||||
console.log('tapi-zc-enabled', this._enabled);
|
|
||||||
this._currentStatus = undefined;
|
|
||||||
this.checkStatus();
|
|
||||||
};
|
|
||||||
var zcOn = document.getElementById('tapi-zc-on');
|
|
||||||
zcOn.value = this._statusOn;
|
|
||||||
zcOn.onchange = () => {
|
|
||||||
this._statusOn = zcOn.value;
|
|
||||||
GM.setValue('tapi-zc-on', this._statusOn);
|
|
||||||
console.log('tapi-zc-on', this._statusOn);
|
|
||||||
this._currentStatus = undefined;
|
|
||||||
};
|
|
||||||
var zcOff = document.getElementById('tapi-zc-off');
|
|
||||||
zcOff.value = this._statusOff;
|
|
||||||
zcOff.onchange = () => {
|
|
||||||
this._statusOff = zcOff.value;
|
|
||||||
GM.setValue('tapi-zc-off', this._statusOff);
|
|
||||||
console.log('tapi-zc-off', this._statusOff);
|
|
||||||
this._currentStatus = undefined;
|
|
||||||
};
|
|
||||||
this.checkStatus();
|
this.checkStatus();
|
||||||
|
waitForKeyElements("wc-account-menu > div > ul", (element) => { this.addZcStatusPopup(element); }, true);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
checkStatus() {
|
checkStatus() {
|
||||||
@ -8461,7 +8385,7 @@ class Status {
|
|||||||
if (this._currentStatus !== status.loggedIn) {
|
if (this._currentStatus !== status.loggedIn) {
|
||||||
this._currentStatus = status.loggedIn;
|
this._currentStatus = status.loggedIn;
|
||||||
console.log('New status, loggedIn', this._currentStatus);
|
console.log('New status, loggedIn', this._currentStatus);
|
||||||
document.getElementsByClassName("current-status")[0].click();
|
document.getElementsByTagName("wcavatar")[0].click();
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
var statusId = this._currentStatus ? this._statusOn : this._statusOff;
|
var statusId = this._currentStatus ? this._statusOn : this._statusOff;
|
||||||
document.getElementById(statusId).click();
|
document.getElementById(statusId).click();
|
||||||
@ -8476,6 +8400,104 @@ class Status {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
addZcStatusPopup(element) {
|
||||||
|
var divider = document.createElement('li');
|
||||||
|
divider.classList.add('divider');
|
||||||
|
divider.classList.add('dropdown-divider');
|
||||||
|
element.appendChild(divider);
|
||||||
|
var menu = document.createElement('li');
|
||||||
|
element.appendChild(menu);
|
||||||
|
var link = document.createElement('a');
|
||||||
|
link.id = 'tapi-zc-button';
|
||||||
|
link.innerText = 'ZeitConsens';
|
||||||
|
link.classList.add('dropdown-item');
|
||||||
|
link.classList.add('d-flex');
|
||||||
|
link.onclick = () => {
|
||||||
|
document.getElementById('zc-modal').classList.toggle('show');
|
||||||
|
};
|
||||||
|
menu.appendChild(link);
|
||||||
|
var html = '<div role="document" class="modal-dialog">' +
|
||||||
|
' <div class="modal-content">' +
|
||||||
|
' <div class="modal-header">' +
|
||||||
|
' <h4 class="modal-title float-left">ZeitConsens Status</h4><button id="zc-btnClose" type="button" aria-label="Close" class="close float-right"><span aria-hidden="true">×</span></button>' +
|
||||||
|
' </div>' +
|
||||||
|
' <div class="modal-body">' +
|
||||||
|
' <div class="form-group">' +
|
||||||
|
' <label for="tapi-zc-user">Username</label>' +
|
||||||
|
' <input type="text" class="form-control" name="tapi-zc-user" id="tapi-zc-user">' +
|
||||||
|
' </div>' +
|
||||||
|
' <div class="form-group">' +
|
||||||
|
' <label for="tapi-zc-on">Signed in</label>' +
|
||||||
|
' <select id="tapi-zc-on" class="form-control">' +
|
||||||
|
' <option value="menuAvailable">Available</option>' +
|
||||||
|
' <option value="menuOutofoffice">Do Not Disturb</option>' +
|
||||||
|
' <option value="menuCustom1">Verfügbar DW</option>' +
|
||||||
|
' </select>' +
|
||||||
|
' </div>' +
|
||||||
|
' <div class="form-group">' +
|
||||||
|
' <label for="tapi-zc-off">Signed out</label>' +
|
||||||
|
' <select id="tapi-zc-off" class="form-control">' +
|
||||||
|
' <option value="menuAway">Away</option>' +
|
||||||
|
' <option value="menuOutofoffice">Do Not Disturb</option>' +
|
||||||
|
' </select>' +
|
||||||
|
' </div>' +
|
||||||
|
' <div class="checkbox">' +
|
||||||
|
' <label class="i-checks" for="tapi-zc-enabled">' +
|
||||||
|
' <input type="checkbox" id="tapi-zc-enabled">' +
|
||||||
|
' <i></i><span>Enabled</span>' +
|
||||||
|
' </label>';
|
||||||
|
' </div>';
|
||||||
|
' </div>' +
|
||||||
|
' <div class="modal-footer">' +
|
||||||
|
' <button id="zc-btnOk" type="button" class="btn btn-primary">OK </button>' +
|
||||||
|
' <button id="zc-btnCancel" type="button" class="btn btn-light">Cancel </button>' +
|
||||||
|
' </div>' +
|
||||||
|
' </div>' +
|
||||||
|
'</div>';
|
||||||
|
var modal = document.createElement('modal-container');
|
||||||
|
modal.id = 'zc-modal';
|
||||||
|
modal.classList.add('modal');
|
||||||
|
modal.classList.add('fade');
|
||||||
|
modal.innerHTML = html;
|
||||||
|
var body = document.getElementsByTagName('body')[0].appendChild(modal);
|
||||||
|
var btnClose = document.getElementById('zc-btnClose');
|
||||||
|
btnClose.onclick = () => {
|
||||||
|
document.getElementById('zc-modal').classList.toggle('show');
|
||||||
|
};
|
||||||
|
var zcUser = document.getElementById('tapi-zc-user');
|
||||||
|
zcUser.value = this._user;
|
||||||
|
zcUser.onchange = () => {
|
||||||
|
this._user = zcUser.value;
|
||||||
|
GM.setValue('tapi-zc-user', this._user);
|
||||||
|
console.log('tapi-zc-user', this._user);
|
||||||
|
this._currentStatus = undefined;
|
||||||
|
};
|
||||||
|
var zcEnabled = document.getElementById('tapi-zc-enabled');
|
||||||
|
zcEnabled.checked = this._enabled;
|
||||||
|
zcEnabled.onchange = () => {
|
||||||
|
this._enabled = zcEnabled.checked;
|
||||||
|
GM.setValue('tapi-zc-enabled', this._enabled);
|
||||||
|
console.log('tapi-zc-enabled', this._enabled);
|
||||||
|
this._currentStatus = undefined;
|
||||||
|
this.checkStatus();
|
||||||
|
};
|
||||||
|
var zcOn = document.getElementById('tapi-zc-on');
|
||||||
|
zcOn.value = this._statusOn;
|
||||||
|
zcOn.onchange = () => {
|
||||||
|
this._statusOn = zcOn.value;
|
||||||
|
GM.setValue('tapi-zc-on', this._statusOn);
|
||||||
|
console.log('tapi-zc-on', this._statusOn);
|
||||||
|
this._currentStatus = undefined;
|
||||||
|
};
|
||||||
|
var zcOff = document.getElementById('tapi-zc-off');
|
||||||
|
zcOff.value = this._statusOff;
|
||||||
|
zcOff.onchange = () => {
|
||||||
|
this._statusOff = zcOff.value;
|
||||||
|
GM.setValue('tapi-zc-off', this._statusOff);
|
||||||
|
console.log('tapi-zc-off', this._statusOff);
|
||||||
|
this._currentStatus = undefined;
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
;// CONCATENATED MODULE: ./src/index.js
|
;// CONCATENATED MODULE: ./src/index.js
|
||||||
@ -8488,7 +8510,7 @@ class Status {
|
|||||||
console.log('script start');
|
console.log('script start');
|
||||||
const search = new Search(); // eslint-disable-next-line no-undef
|
const search = new Search(); // eslint-disable-next-line no-undef
|
||||||
|
|
||||||
waitForKeyElements('div.nav-search', element => {
|
waitForKeyElements('ongoing-call-button', element => {
|
||||||
search.createSearchWindow(element);
|
search.createSearchWindow(element);
|
||||||
}, true);
|
}, true);
|
||||||
const callNotification = new CallNotification(); // eslint-disable-next-line no-undef
|
const callNotification = new CallNotification(); // eslint-disable-next-line no-undef
|
||||||
@ -8503,7 +8525,7 @@ waitForKeyElements('.call-history-list call', element => {
|
|||||||
}, false);
|
}, false);
|
||||||
const src_status_0 = new Status(); // eslint-disable-next-line no-undef
|
const src_status_0 = new Status(); // eslint-disable-next-line no-undef
|
||||||
|
|
||||||
waitForKeyElements('#status-change', element => {
|
waitForKeyElements('wc-account-menu', element => {
|
||||||
src_status_0.showStatus(element);
|
src_status_0.showStatus(element);
|
||||||
}, false);
|
}, false);
|
||||||
}();
|
}();
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "3cp-tapi",
|
"name": "3cx-tapi",
|
||||||
"description": "Build your UserScript with webpack",
|
"description": "3CX CP Tapi and Projectmanager integration",
|
||||||
"version": "8.0.1",
|
"version": "9.0.0",
|
||||||
"author": {
|
"author": {
|
||||||
"name": "Daniel Triendl",
|
"name": "Daniel Triendl",
|
||||||
"email": "d.triendl@cp-solutions.at"
|
"email": "d.triendl@cp-solutions.at"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user