OLD | NEW |
1 <!DOCTYPE html> | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 <html> | 2 // Use of this source code is governed by a BSD-style license that can be |
3 <head> | 3 // found in the LICENSE file. |
4 <style> | |
5 body { | |
6 font-family: helvetica, arial, sans-serif; | |
7 font-size: 12px; | |
8 overflow: hidden; | |
9 } | |
10 | 4 |
11 a { | 5 // Feed |
12 color:#0000CC; | |
13 text-decoration: underline; | |
14 cursor: pointer; | |
15 } | |
16 | |
17 .open_box { | |
18 display: block; | |
19 overflow: hidden; | |
20 margin-right: 4px; | |
21 margin-top: 2px; | |
22 height: 12px; | |
23 width: 12px; | |
24 float: left; | |
25 clear: left; | |
26 background-image: url(sprite_arrows.gif); | |
27 background-position: 0px -24px; | |
28 cursor: pointer; | |
29 } | |
30 | |
31 .opened .open_box { | |
32 background-position:-12px -24px; | |
33 } | |
34 | |
35 .item { | |
36 padding: 2px 0px; | |
37 } | |
38 | |
39 .item_title { | |
40 display: block; | |
41 min-width: 300px; | |
42 padding-left: 15px; | |
43 cursor: pointer; | |
44 } | |
45 | |
46 .item_desc { | |
47 min-width: 500px; | |
48 height: 0px; | |
49 display: block; | |
50 border: none; | |
51 padding: 0px; | |
52 margin: 0px; | |
53 -webkit-transition: height 0.2s ease-out; | |
54 } | |
55 | |
56 #title { | |
57 display: block; | |
58 margin-left: auto; | |
59 } | |
60 | |
61 .error { | |
62 white-space: nowrap; | |
63 color: red; | |
64 } | |
65 | |
66 .more { | |
67 display: block; | |
68 text-align: right; | |
69 padding-top: 20px; | |
70 padding-right: 10px; | |
71 color: #88C; | |
72 } | |
73 | |
74 </style> | |
75 <script id="iframe_script"> | |
76 function reportHeight() { | |
77 var msg = JSON.stringify({type:"size", size:document.body.offsetHeight}); | |
78 parent.postMessage(msg, "*"); | |
79 } | |
80 | |
81 function frameLoaded() { | |
82 var links = document.getElementsByTagName("A"); | |
83 for (i = 0; i < links.length; i++) { | |
84 var class = links[i].className; | |
85 if (class != "item_title" && class != "open_box") { | |
86 links[i].addEventListener("click", showStory); | |
87 } | |
88 } | |
89 window.addEventListener("message", messageHandler); | |
90 } | |
91 | |
92 function showStory(event) { | |
93 var href = event.currentTarget.href; | |
94 parent.postMessage(JSON.stringify({type:"show", url:href}), "*"); | |
95 event.preventDefault(); | |
96 } | |
97 | |
98 function messageHandler(event) { | |
99 reportHeight(); | |
100 } | |
101 | |
102 </script> | |
103 <script> | |
104 // Feed URL. | |
105 var feedUrl = 'http://news.google.com/?output=rss'; | 6 var feedUrl = 'http://news.google.com/?output=rss'; |
106 | 7 |
107 // The XMLHttpRequest object that tries to load and parse the feed. | 8 // The XMLHttpRequest object that tries to load and parse the feed. |
108 var req; | 9 var req; |
109 | 10 |
110 function main() { | 11 function main() { |
111 req = new XMLHttpRequest(); | 12 req = new XMLHttpRequest(); |
112 req.onload = handleResponse; | 13 req.onload = handleResponse; |
113 req.onerror = handleError; | 14 req.onerror = handleError; |
114 req.open("GET", feedUrl, true); | 15 req.open("GET", feedUrl, true); |
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
364 } | 265 } |
365 showUrl(url); | 266 showUrl(url); |
366 } | 267 } |
367 } | 268 } |
368 return; | 269 return; |
369 } | 270 } |
370 } | 271 } |
371 } | 272 } |
372 | 273 |
373 window.addEventListener("message", iframeMessageHandler); | 274 window.addEventListener("message", iframeMessageHandler); |
374 </script> | 275 document.addEventListener("DOMContentLoaded", main); |
375 </head> | |
376 <body onload="main();"> | |
377 <a id="title_a" tabIndex="0"><img id='title' alt="Google News logo"></a> | |
378 <div id="feed"></div> | |
379 </body> | |
380 </html> | |
381 | |
OLD | NEW |