-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathzendesk.js
48 lines (39 loc) · 1.28 KB
/
zendesk.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
function isZendeskTab() {
var metaTags = document.getElementsByTagName("meta");
for (var i = 0; i < metaTags.length; i++) {
var tag = metaTags[i];
if (tag.getAttribute('name') == 'author' && tag.getAttribute('content')) {
if (tag.getAttribute('content').toLowerCase().indexOf("zendesk") >= 0) {
return true;
}
}
}
return false;
}
function addTestFairyZendeskIFrame() {
var testfairyDescriptionBlock = document.querySelectorAll(".content .body a")
if (testfairyDescriptionBlock == null || testfairyDescriptionBlock.length == 0) {
return false;
}
var testFairyUrls = [];
for (let i = 0; i < testfairyDescriptionBlock.length; i++) {
let anchor = testfairyDescriptionBlock[i];
var url = anchor.getAttribute("href");
if (url.includes("projects") && url.includes("builds") && url.includes("sessions")) {
testFairyUrls.push(anchor);
}
}
if (testFairyUrls.length == 0) {
return false;
}
var testfairyLink = testFairyUrls[0];
var url = testfairyLink.getAttribute("href");
if (url.includes('#')) {
url = url.substring(0, url.indexOf('#'));
}
url = url + "?iframe";
var detailsModule = testfairyLink.closest(".comment");
var parent = createIFrame(url, getTestFairyCommonIFrameId(), 'TestFairy Information');
insertAfter(parent, detailsModule);
return true;
}