-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathoptions.html
48 lines (42 loc) · 1.52 KB
/
options.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
<!DOCTYPE html>
<!--
* Copyright (c) 2010 The Chromium Authors. All rights reserved. Use of this
* source code is governed by a BSD-style license that can be found in the
* LICENSE file.
*
-->
<html>
<head>
<title>Options</title>
<script type="text/javascript" src="js/jquery-1.4.1.min.js"></script>
</head>
<body onload="initUI();">
<p><button id="revoke" onclick="logout();">Revoke your Rdio OAuth token</button></p>
<p>Refresh rate (minutes): <input id="refresh_rate" value="60"></p>
<p>Refresh rate maximum (minutes): <input disabled="true" value="240 mins. or 4 hours"></p>
<script type="text/javascript">
var bgPage = chrome.extension.getBackgroundPage();
$('#refresh_rate').change(function() {
localStorage.refreshRate = $(this).val();
//convert it to seconds.
localStorage.refreshRate = localStorage.refreshRate * 60 ;
bgPage.refreshRate = localStorage.refreshRate;
bgPage.pollIntervalMin = bgPage.refreshRate * 1000;
});
function logout() {
bgPage.logout();
$('#revoke').get(0).disabled = true;
}
function initUI() {
if (!bgPage.oauth.hasToken()) {
$('#revoke').get(0).disabled = true;
}
if (localStorage.refreshRate) {
$('#refresh_rate').val(localStorage.refreshRate/60);
} else {
$('#refresh_rate').val(bgPage.refreshRate/60);
}
}
</script>
</body>
</html>