Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 <html> | 1 <html> |
| 2 <head> | 2 <head> |
| 3 <title>Subscribe to feed</title> | 3 <title>Subscribe to feed</title> |
| 4 | 4 |
| 5 <script type="text/javascript"> | 5 <script type="text/javascript"> |
| 6 var queryString = location.search.substring(1).split("&"); | |
| 7 | |
| 6 // Grab the URL from the querystring, removing question mark at the front. | 8 // Grab the URL from the querystring, removing question mark at the front. |
|
Finnur
2009/09/03 23:04:22
nit: The question mark comment now applies to the
| |
| 7 var feedUrl = document.location.search.substring(1); | 9 var feedUrl = decodeURIComponent(queryString[0]); |
| 8 | 10 |
| 11 // We allow synchronous requests for testing. | |
| 12 var synchronousRequest = queryString[1] == "synchronous"; | |
| 13 | |
| 9 // The XMLHttpRequest object that tries to load and parse the feed. | 14 // The XMLHttpRequest object that tries to load and parse the feed. |
| 10 var req; | 15 var req; |
| 11 | 16 |
| 12 // What to show when we cannot parse the feed name. | 17 // What to show when we cannot parse the feed name. |
| 13 var unknownName = "Unknown feed name"; | 18 var unknownName = "Unknown feed name"; |
| 14 | 19 |
| 15 // The maximum number of feed items to show in the preview. | 20 // The maximum number of feed items to show in the preview. |
| 16 var maxFeedItems = 10; | 21 var maxFeedItems = 10; |
| 17 | 22 |
| 18 // The maximum number of characters to show in the feed item title. | 23 // The maximum number of characters to show in the feed item title. |
| 19 var maxTitleCount = 64; | 24 var maxTitleCount = 64; |
| 20 | 25 |
| 21 // The maximum number of characters to show for the feed item description. | 26 // The maximum number of characters to show for the feed item description. |
| 22 var maxDescCount = 1024; | 27 var maxDescCount = 1024; |
| 23 | 28 |
| 24 // Navigates to the reader of the user's choice (for subscribing to the feed). | 29 // Navigates to the reader of the user's choice (for subscribing to the feed). |
| 25 function navigate() { | 30 function navigate() { |
| 26 var select = document.getElementById('readers'); | 31 var select = document.getElementById('readers'); |
| 27 var url = select.options[select.selectedIndex].value + feedUrl; | 32 var url = select.options[select.selectedIndex].value + feedUrl; |
| 28 document.location = url; | 33 document.location = url; |
| 29 } | 34 } |
| 30 | 35 |
| 31 // Parses the feed specified. We will either end up in handleResponse or | 36 // Parses the feed specified. We will either end up in handleResponse or |
| 32 // handleError from here. | 37 // handleError from here. |
| 33 function loadFeed() { | 38 function loadFeed() { |
| 34 feedUrl = decodeURIComponent(feedUrl); | 39 feedUrl = decodeURIComponent(feedUrl); |
| 35 req = new XMLHttpRequest(); | 40 req = new XMLHttpRequest(); |
| 36 req.onload = handleResponse; | 41 req.onload = handleResponse; |
| 37 req.onerror = handleError; | 42 req.onerror = handleError; |
| 38 req.open("GET", feedUrl, false); | 43 req.open("GET", feedUrl, !synchronousRequest); |
| 39 req.send(null); | 44 req.send(null); |
| 40 } | 45 } |
| 41 | 46 |
| 42 // Sets the title for the feed. | 47 // Sets the title for the feed. |
| 43 function setFeedTitle(title) { | 48 function setFeedTitle(title) { |
| 44 var titleTag = document.getElementById('title'); | 49 var titleTag = document.getElementById('title'); |
| 45 titleTag.textContent = "Feed for '" + title + "'"; | 50 titleTag.textContent = "Feed for '" + title + "'"; |
| 46 } | 51 } |
| 47 | 52 |
| 48 // Handles errors during the XMLHttpRequest. | 53 // Handles errors during the XMLHttpRequest. |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 223 <button onclick="navigate();">Subscribe Now</button> | 228 <button onclick="navigate();">Subscribe Now</button> |
| 224 </td> | 229 </td> |
| 225 </tr> | 230 </tr> |
| 226 </table> | 231 </table> |
| 227 | 232 |
| 228 <div> </div> | 233 <div> </div> |
| 229 <div class="splitter"><b>Feed preview</b></div><br> | 234 <div class="splitter"><b>Feed preview</b></div><br> |
| 230 <div id="items"></div> | 235 <div id="items"></div> |
| 231 </body> | 236 </body> |
| 232 </html> | 237 </html> |
| OLD | NEW |