forked from GoogleChrome/chrome-extensions-samples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
options.html
44 lines (40 loc) · 1.3 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
<!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.
*
* Author: Eric Bidelman <[email protected]>
-->
<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 OAuth token</button></p>
<p>Refresh rate (seconds): <input id="refresh_rate" value="300"></p>
<script type="text/javascript">
var bgPage = chrome.extension.getBackgroundPage();
$('#refresh_rate').change(function() {
localStorage.refreshRate = $(this).val();
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);
} else {
$('#refresh_rate').val(bgPage.refreshRate);
}
}
</script>
</body>
</html>