-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.js
More file actions
40 lines (34 loc) · 1.19 KB
/
main.js
File metadata and controls
40 lines (34 loc) · 1.19 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
37
38
39
40
if (geofs.userRecord.callsign in getContents()) {
var url = prompt("Your username isn't in the GeoFS Username addon system, please enter the URL you would like to be identified with");
update(url, geofs.userRecord.callsign);
}
console.log("GeoFSUsers running");
var d = document.getElementsByClassName("geofs-user-dialog")[0];
d.id = "test2";
var selected = "no_one_selected";
function linkGet() {
if (selected in users) {
return '//'+users[selected];
} else {
return '//google.com/search?q=GeoFS+user+'+selected;
}
}
var button = document.createElement('p');
button.innerHTML = "user";
button.classList = ["mdl-button mdl-button--raised"];
button.onclick = function() { console.log("click"); window.open(linkGet(),'_blank'); };
d.appendChild(button);
var targeter = document.querySelector("#test2").childNodes[1].childNodes[2];
var observer = new MutationObserver(function(mutations) {
mutations.forEach(function(mutation) {
console.log(targeter.innerHTML);
button.innerHTML = targeter.innerHTML;
selected = targeter.innerHTML;
});
});
var config = {
childList: true,
subtree: true,
characterData: true
};
observer.observe(targeter, config);