1<!-- 2 Copyright 2010 Google 3 4 Licensed under the Apache License, Version 2.0 (the "License"); you may not 5 use this file except in compliance with the License. You may obtain a copy of 6 the License at 7 8 http://www.apache.org/licenses/LICENSE-2.0 9 10 Unless required by applicable law or agreed to in writing, software 11 distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 License for the specific language governing permissions and limitations under 14 the License. 15 16 Brian Kennish <byoogle@google.com> 17--> 18<style> 19 body { 20 width: 400px; 21 font: small Arial, sans-serif; 22 color: initial 23 } 24 25 body > div { 26 border-bottom: 1px solid #edeff5; 27 padding: 3px 6px 28 } 29 30 .overflow { margin-right: 27px } 31 32 .digest, #logo, #authorization { cursor: pointer } 33 34 .digest { height: 64px } 35 36 .mouseover { background: #f4f6fc } 37 38 .title { font-weight: bold } 39 40 .snippet { color: #7f7f7f } 41 42 #authorization { 43 float: right; 44 margin-top: 14px; 45 text-decoration: underline; 46 color: #003ea8 47 } 48 49 #template { display: none } 50</style> 51<script> 52 const TABS = chrome.tabs; 53 const URL = 'https://wave.google.com/wave/'; 54 const BACKGROUND = chrome.extension.getBackgroundPage(); 55 const OAUTH = BACKGROUND.OAUTH; 56 const DIGESTS = 57 (BACKGROUND.parse(localStorage.digests) || []). 58 slice(0, localStorage.maxDigests); 59 const DIGEST_COUNT = DIGESTS.length; 60 var template; 61 var digest; 62 63 onload = function() { 64 document.getElementById('logo').onclick = function() { 65 TABS.create({url: URL}); 66 }; 67 68 const AUTHORIZATION = document.getElementById('authorization'); 69 AUTHORIZATION.textContent = 'Sign '; 70 71 if (OAUTH.hasToken()) { 72 AUTHORIZATION.textContent += 'out'; 73 74 AUTHORIZATION.onclick = function() { 75 BACKGROUND.clearInterval(BACKGROUND.id); 76 delete localStorage.digests; 77 OAUTH.clearTokens(); 78 BACKGROUND.initialize(); 79 BACKGROUND.BROWSER_ACTION.setIcon({path: 'unauthorized.png'}); 80 BACKGROUND.load(); 81 BACKGROUND.PRETTYLOAD.finish(BACKGROUND.UNKNOWN_COUNT); 82 close(); 83 }; 84 } else { 85 AUTHORIZATION.textContent += 'in'; 86 87 AUTHORIZATION.onclick = function() { BACKGROUND.authorize(); }; 88 } 89 90 const BODY = document.body; 91 92 for (var i = 0; i < DIGEST_COUNT; i++) { 93 template = 94 BODY.appendChild(document.getElementById('template').cloneNode(true)); 95 digest = DIGESTS[i]; 96 template.id = digest.waveId; 97 98 if (BACKGROUND.parse(localStorage.participantAnnotated)) { 99 template.title = digest.participants.join(', '); 100 } 101 102 template.getElementsByClassName('title')[0].textContent = digest.title; 103 template.getElementsByClassName('snippet')[0].textContent += 104 digest.snippet; 105 106 template.onmouseover = function() { this.className += ' mouseover'; }; 107 108 template.onmouseout = function() { 109 this.className = this.className.split(' ', 1); 110 }; 111 112 template.onclick = function() { 113 TABS.create({url: URL + '#restored:wave:' + this.id}); 114 }; 115 } 116 117 if (BODY.scrollHeight > 600) { BODY.className = 'overflow'; } 118 }; 119</script> 120<div> 121 <img id="logo" src="logo.png" alt="Google Wave"> 122 <div id="authorization"></div> 123</div> 124<div class="digest" id="template"> 125 <span class="title"></span> 126 <span class="snippet">– </span> 127</div> 128