This repository has been archived by the owner on Dec 13, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
poe.alert.mod.user.js
70 lines (60 loc) · 2.25 KB
/
poe.alert.mod.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
// ==UserScript==
// @name PoE.Trade Alert Mod
// @namespace https://github.com/crimsonfalconer/poe.alert.mod
// @include http://poe.trade/*/live
// @version 6
// @grant GM_getValue
// @grant GM_setValue
// @grant GM_log
// @updateURL https://github.com/crimsonfalconer/poe.alert.mod/raw/master/poe.alert.mod.user.js
// @downloadURL https://github.com/crimsonfalconer/poe.alert.mod/raw/master/poe.alert.mod.user.js
// @updateVersion 6
// @homepageURL https://github.com/crimsonfalconer/poe.alert.mod
// @supportURL https://github.com/crimsonfalconer/poe.alert.mod/issues
// ==/UserScript==
this.GM_getValue=function (key,def) {
return localStorage[key] || def;
};
this.GM_setValue=function (key,value) {
return localStorage[key]=value;
};
this.GM_deleteValue=function (key) {
return delete localStorage[key];
};
function UpdateLiveAlertSound()
{
var alertURL = GM_getValue("poeTradeAlertSound", 'https://raw.githubusercontent.com/crimsonfalconer/poe.alert.mod/master/alert.mp3');
var inputURL = document.getElementById('alert-sound-url');
if (typeof inputURL != 'undefined')
{
if(inputURL.value != alertURL)
{
GM_log("Updating URL to: " + inputURL.value);
GM_setValue('poeTradeAlertSound', inputURL.value);
alertURL = inputURL.value;
}
}
var audioObj = document.getElementById('live-audio');
var sourceObj = audioObj.getElementsByTagName('source');
if (sourceObj.length > 0)
{
sourceObj[0].setAttribute('src', alertURL);
audioObj.load();
}
}
var alertURL = GM_getValue("poeTradeAlertSound", 'https://raw.githubusercontent.com/crimsonfalconer/poe.alert.mod/master/alert.mp3');
var panel = document.getElementById('live-notification-settings');
panel.appendChild(document.createElement('br'));
panel.appendChild(document.createElement('br'));
var link = document.createElement('input');
link.style = "width:500px";
link.id = 'alert-sound-url';
link.type = 'textbox';
link.value = alertURL;
panel.appendChild(link);
var save = document.createElement('input');
save.type = 'button';
save.value = 'Update Sound';
save.onclick = UpdateLiveAlertSound;
panel.appendChild(save);
UpdateLiveAlertSound();