forked from tsholmes/canvas-rider-tracker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
page.js
33 lines (27 loc) · 886 Bytes
/
page.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
var track = 0;
function inject(script) {
var s = document.createElement("script");
s.src = chrome.extension.getURL(script);
s.onload = function() {
this.parentNode.removeChild(this);
};
(document.head||document.documentElement).appendChild(s);
}
$(document).ready(function(){
var span = document.createElement("span");
span.className = "status";
document.body.appendChild(span);
var href = $("span.green").next().attr("href");
track = parseInt(href.split("/")[1]);
TrackDB.getTrack(track,function(res){
if (res == 0) {
$("span.status").addClass("status_new").text("NEW");
} else if (res == 1) {
$("span.status").addClass("status_played").text("PLAYED");
} else {
$("span.status").addClass("status_completed").text("COMPLETED");
}
});
inject("trackdb.js");
inject("inject.js");
});