-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcontent-script.js
More file actions
36 lines (32 loc) · 1.07 KB
/
Copy pathcontent-script.js
File metadata and controls
36 lines (32 loc) · 1.07 KB
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
/**
* Created by sean.j.greene on 2/27/2017.
* content-script.js
*/
var listingsElement;
var listingsFound = true;
var sound = new Audio(browser.extension.getURL("audio/notif_general.mp3"));
try {
// check if there are no results, but suggested results (not a true result found)
document.getElementsByClassName("sm-md")[0].innerHTML;
listingsFound = false;
} catch(error1) {
try {
// check for alternate result element found
listingsElement = window.document.getElementsByClassName("listingscnt")[0].innerHTML;
} catch(error2) {
//listingscnt tag was not found. Continue checking for rcnt tag instead
try {
// check for primary result element found
listingsElement = window.document.getElementsByClassName("rcnt")[0].innerHTML;
} catch(error3) {
// didn't find any listings tag at all. Do nothing.
listingsFound = false;
}
}
}
if(listingsFound) {
if(listingsElement !== "0" && listingsElement !== "") {
// do the stuff to play the sound and flip the tab
sound.play();
}
}