forked from eve-val/market-site
-
Notifications
You must be signed in to change notification settings - Fork 0
/
poller.html
61 lines (54 loc) · 2.4 KB
/
poller.html
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
<html>
<title>Market Poller</title>
<head>
<script type="text/javascript" src="id_list.js"></script>
<script type="text/javascript">
// Returns a random integer in [min, max)
function getRandomInt(min, max) {
return Math.floor(Math.random() * (max - min) + min);
}
(function() {
var polling = false;
var item_ids_to_poll;
window.poll_the_next_item = function(looping) {
// Protect against clicking the button more than once
if(polling !== looping) return;
if(!polling) {
var start = getRandomInt(0, item_ids.length);
var front = item_ids.slice(start, item_ids.length);
var back = item_ids.slice(0, start);
item_ids_to_poll = front.concat(back);
document.getElementById('start-button').innerHTML = 'Polling:';
polling = true;
}
var current_item = document.getElementById('current-item');
var items_remaining = document.getElementById('items-remaining');
items_remaining.value = item_ids_to_poll.length.toString();
if(item_ids_to_poll.length == 0) {
current_item.value = 'Done!';
return;
}
var item_id = item_ids_to_poll.shift();
current_item.value = item_id.toString();
CCPEVE.showMarketDetails(item_id);
setTimeout(function() { poll_the_next_item(true) }, 4500);
};
})();
</script>
</head>
<body>
<ul>
<li>Run this in the in-game browser. It only works there!
<li>Also run EVEMon, or some other program that automatically uploads to eve-central.
<li>Hit the "Poll items" button.
<li>Feel good about yourself for helping out. Try not to be
annoyed by the market window popping itself to the front every
few seconds.
<li>Running this for just a few minutes helps out, since it
starts off at a random position in the items list. (Of
course, running it to completion is even better.)
</ul>
<button id="start-button" onclick="javascript:poll_the_next_item(false);">Poll items</button>
<input id="current-item" disabled="true" value="" /> (<input id="items-remaining" disabled="true" value="0" /> items remaining)
</body>
</hml>