Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(305)

Side by Side Diff: chrome/test/data/extensions/samples/gmail/gmail_checker.html

Issue 99172: Part 1 of sample sprucing. (Closed)
Patch Set: Added buildbot.crx, since that seems like something people might want to install. Created 11 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 <html>
2 <head>
3 <link rel="stylesheet" type="text/css" href="extensions_toolstrip.css">
4 <link rel="stylesheet" type="text/css" href="styles.css">
5 <script>
6 gmail_atom_href = "http://mail.google.com/mail/feed/atom";
7 var poll_timeout = 2000;
8 var unreadCount;
9 var debug = true;
10
11 function gmailNSResolver(prefix) {
12 if(prefix == 'gmail') {
13 return 'http://purl.org/atom/ns#';
14 }
15 }
16
17 function startFlip() {
18 document.getElementById("unreadCount").className = 'mid-flip';
19 setTimeout("midFlip();", 500);
20 }
21
22 function midFlip() {
23 document.getElementById("unreadCount").className = 'post-flip';
24 document.getElementById("unreadCount").innerHTML = "(" + unreadCount + ")";
25 setTimeout("endFlip();", 500);
26 }
27
28 function endFlip() {
29 document.getElementById("unreadCount").className = 'base-flip';
30 }
31
32 function updateUnreadCount(count) {
33 if (unreadCount != count) {
34 unreadCount = count;
35 startFlip();
36 }
37 }
38
39 function requestUnreadFeed() {
40 var xhr = new XMLHttpRequest();
41 try {
42 console.log("request..");
43 xhr.onreadystatechange = function(){
44 console.log("readystate: " + xhr.readyState);
45 if (xhr.readyState == 4) {
46 console.log("response..");
47 var xmlDoc = xhr.responseXML;
48 var fullCountSet = xmlDoc.evaluate("/gmail:feed/gmail:fullcount",
49 xmlDoc, gmailNSResolver, XPathResult.ANY_TYPE, null);
50 var fullCountNode = fullCountSet.iterateNext();
51 if (fullCountNode) {
52 updateUnreadCount(fullCountNode.textContent);
53 } else {
54 console.log("fullcount not found!");
55 console.error("Error: feed retrieved, but no <fullcount> node found");
56 }
57
58 window.setTimeout(requestUnreadFeed, poll_timeout);
59 }
60 }
61
62 xhr.onerror = function(error) {
63 debugger;
64 console.log("error: " + error);
65 window.setTimeout(requestUnreadFeed, poll_timeout);
66 }
67
68 xhr.open("GET", gmail_atom_href);
69 xhr.send({});
70 } catch(e) {
71 console.log("ex: " + e);
72 console.error("exception: " + e);
73 window.setTimeout(requestUnreadFeed, poll_timeout);
74 }
75 }
76
77 function goToInbox() {
78 chromium.tabs.createTab({url:"http://www.gmail.com/"});
79 }
80
81 </script>
82 </head>
83 <body onload="requestUnreadFeed();" onclick="goToInbox()">
84 <div class="toolstrip-button">
85 <img src="gmail.png" style="width:auto; height:auto">
86 <span>Gmail - Inbox <span style="display: inline-block;" id="unreadCount" cl ass="base-flip" onclick="startFlip();"></span></span>
87 </div>
88 </body>
89 </html>
OLDNEW
« no previous file with comments | « chrome/test/data/extensions/samples/gmail/gmail.png ('k') | chrome/test/data/extensions/samples/gmail/manifest.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698