Home | History | Annotate | Download | only in gdocs
      1 <!DOCTYPE html>
      2 <!--
      3  * Copyright (c) 2010 The Chromium Authors. All rights reserved.  Use of this
      4  * source code is governed by a BSD-style license that can be found in the
      5  * LICENSE file.
      6  *
      7  * Author: Eric Bidelman <ericbidelman (a] chromium.org>
      8 -->
      9 <html>
     10   <head>
     11     <title>Options</title>
     12     <script type="text/javascript" src="js/jquery-1.4.1.min.js"></script>
     13   </head>
     14   <body onload="initUI();">
     15     <p><button id="revoke" onclick="logout();">Revoke your OAuth token</button></p>
     16     <p>Refresh rate (seconds): <input id="refresh_rate" value="300"></p>
     17     <script type="text/javascript">
     18       var bgPage = chrome.extension.getBackgroundPage();
     19 
     20       $('#refresh_rate').change(function() {
     21         localStorage.refreshRate = $(this).val();
     22         bgPage.refreshRate = localStorage.refreshRate;
     23         bgPage.pollIntervalMin =  bgPage.refreshRate * 1000;
     24       });
     25 
     26       function logout() {
     27         bgPage.logout();
     28         $('#revoke').get(0).disabled = true;
     29       }
     30 
     31       function initUI() {
     32         if (!bgPage.oauth.hasToken()) {
     33           $('#revoke').get(0).disabled = true;
     34         }
     35 
     36         if (localStorage.refreshRate) {
     37           $('#refresh_rate').val(localStorage.refreshRate);
     38         } else {
     39            $('#refresh_rate').val(bgPage.refreshRate);
     40         }
     41       }
     42     </script>
     43   </body>
     44 </html>
     45