-
Notifications
You must be signed in to change notification settings - Fork 0
/
Available.user.js
86 lines (75 loc) · 3.43 KB
/
Available.user.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
// ==UserScript==
// @name Available
// @namespace http://tampermonkey.net/
// @version 1.0
// @description Available/Busy -> Available Manual
// @author Connor Kaiser
// @include https://osisoft--fullcopy.*
// @include https://osisoft--prodcopy.*
// @include https://osisoft.lightning.force.*
// @grant none
// ==/UserScript==
(function()
{
if (window.top === window.self)
{
var StatusCount = 0;
var CaseCount = 0;
var observer = new MutationObserver(function(mutations)
{
var Status = document.getElementsByClassName("onlineStatus truncatedText uiOutputText")
var CasesOpen = document.getElementsByClassName("flexipageRecordHomePinnedLeftRightSidebarsTemplateDesktop");
if (Status != null && (Status.length != StatusCount || CasesOpen.length != CaseCount))
{
StatusCount = Status.length
CaseCount = CasesOpen.length
}
else
{
return;
}
try
{
//Available
if (document.getElementsByClassName("onlineStatus truncatedText uiOutputText")[0].innerText == "Available Manual")
{
document.getElementsByClassName("slds-button slds-button_icon-container slds-button_icon-x-small")[document.getElementsByClassName("slds-button slds-button_icon-container slds-button_icon-x-small").length-1].click()
//document.getElementsByClassName("slds-dropdown__item onlineStatus")[1].children[0].click() //Available Manual
document.getElementsByClassName("slds-dropdown__item onlineStatus")[0].children[0].click() //Available
}
}
catch(er){}
try
{
//Busy
if (document.getElementsByClassName("awayStatus truncatedText uiOutputText")[0].innerText == "Busy")
{
document.getElementsByClassName("slds-button slds-button_icon-container slds-button_icon-x-small")[document.getElementsByClassName("slds-button slds-button_icon-container slds-button_icon-x-small").length-1].click()
//document.getElementsByClassName("slds-dropdown__item onlineStatus")[1].children[0].click() //Available Manual
document.getElementsByClassName("slds-dropdown__item onlineStatus")[0].children[0].click() //Available
}
}
catch (err){}
try
{
//Offline
if (document.getElementsByClassName("onlineStatus truncatedText uiOutputText")[0].innerText == "Offline")
{
document.getElementsByClassName("slds-button slds-button_icon-container slds-button_icon-x-small")[document.getElementsByClassName("slds-button slds-button_icon-container slds-button_icon-x-small").length-1].click()
//document.getElementsByClassName("slds-dropdown__item onlineStatus")[1].children[0].click() //Available Manual
document.getElementsByClassName("slds-dropdown__item onlineStatus")[0].children[0].click() //Available
}
}
catch(er){}
});
observer.observe(document, {
childList: true,
subtree: true
});
return;
}
else
{
return;
}
})();