Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 134 lines (123 sloc) 6.556 kb
d4a6f715 »
2011-07-06 + added files
1 <html>
2 <head>
3 <script type="text/javascript" src="jquery.min.js"></script>
4 <script type="text/javascript" charset="utf-8">
e96ba350 »
2011-07-06 + changed urls
5 var url='http://www.audienciazero.org/xda/tv/webcam.jpg';
d4a6f715 »
2011-07-06 + added files
6 function timer(){
5572e7bb »
2011-07-06 + added spinner
7 var image=document.getElementById("image");
8 if(image)
e96ba350 »
2011-07-06 + changed urls
9 image.src="http://www.audienciazero.org/xda/tv/webcam.jpg?fuckyoucache="+Math.floor(Math.random()*99999);
5572e7bb »
2011-07-06 + added spinner
10 var t=setTimeout("timer()",30*1000);
d4a6f715 »
2011-07-06 + added files
11 }
12 </script>
13 </head>
e96ba350 »
2011-07-06 + changed urls
14 <body onLoad=''>
d4a6f715 »
2011-07-06 + added files
15 <style>
16 body { min-width:357px; overflow-x:hidden; font-family: "Helvetica Neue", "Helvetica", "Lucida Grande", "Arial", Verdana, sans-serif; line-height:11pt;}
17 a:visited,a:link{ color: #FFF;}
5572e7bb »
2011-07-06 + added spinner
18 a#xdalink:hover{
19 text-shadow: #959865 0px 1px 0px;
20 }
d4a6f715 »
2011-07-06 + added files
21 span.fixedlink{ background-color: #FCFFA8; border: 1px solid #FCFFA8; border-radius: 3px; padding: 5px 10px; cursor:pointer;}
22 span.link{padding:4px;border: 1px solid #DDD; cursor: pointer;padding: 5px 10px;}
23 span.link:hover{ background-color: #FCFFA8; border: 1px solid #FCFFA8; border-radius: 3px; padding: 5px 10px;}
24 #image-container a:link{text-decoration: none;}
25 #image-container{
5572e7bb »
2011-07-06 + added spinner
26 text-align: center; background-color: #808080; width:320px; min-height:240px;
d4a6f715 »
2011-07-06 + added files
27 margin: 0 auto; padding:20px; border: 1px solid #FFF; border-radius: 7px;
28 }
29 #image-container span{
30 font: 200% "Helvetica Neue", "Helvetica", "Lucida Grande", "Arial", Verdana, sans-serif;
31 color: #FFF; text-shadow: #333 0px 1px 0px;
32 }
33 #rss-container{display:none; width:320px;margin: 0 auto; background-color: #DDD; padding-bottom: 2px;}
34 #rss-container a{ color:#333;}
35 #rss-container a:visited{ text-decoration: underline; }
5572e7bb »
2011-07-06 + added spinner
36 img#image{ border: 5px solid #91C27B; margin-bottom:15px;border-radius: 10px;}
37
38 #image-container.loading {
39 background: url(spinner.gif) no-repeat center center;
40 }
d4a6f715 »
2011-07-06 + added files
41 </style>
5572e7bb »
2011-07-06 + added spinner
42
43 <div id="image-container" class="loading">
44 <span><a id="xdalink" href="http://xdatelier.org/">xDA atelier</a></span>
d4a6f715 »
2011-07-06 + added files
45 </div>
46 <div id="rss-container">
47 <p><span class="fixedlink" id="newslink">&larr;</span></p>
48 </div>
49
50 <script>
51 function showUrl(anchor) { var urlLocation = '' + anchor.href; chrome.tabs.create({url:urlLocation}); }
52 var req = new XMLHttpRequest();
53 req.open("GET","http://xdatelier.org/feed/", true);
54 req.onload = showPhoto;
55 req.send(null);
56 function showPhoto() {
5572e7bb »
2011-07-06 + added spinner
57
d4a6f715 »
2011-07-06 + added files
58 if(req.readyState==4)
59 {
60 var items = req.responseXML.getElementsByTagName("item");
61 for (var i = 0, item; item = items[i]; i++) {
62 var title="none!",link="none!";
63 for (var j=0; j < item.childNodes.length-1; j++){
64 if(item.childNodes[j].nodeName.toLowerCase()=="title" )
65 {
66 if(item.childNodes[j].firstChild.nodeValue.length>35)
67 title=item.childNodes[j].firstChild.nodeValue.substring(0,35)+"...";
68 else title=item.childNodes[j].firstChild.nodeValue;
69 }
70 if(item.childNodes[j].nodeName.toLowerCase()=="link" ) link=item.childNodes[j].firstChild.nodeValue;
71 };
72 var p = document.createElement("p");
73 var anchor = document.createElement("a");
74 var span = document.createElement("span");
75 span.setAttribute('class', 'link');
76 span.innerText = title;
77 anchor.setAttribute('href',link);
78 anchor.setAttribute('onClick', 'showUrl(this)');
79 anchor.appendChild(span);
80 p.appendChild(anchor);
81 document.getElementById("rss-container").appendChild(p);
82 };
83 }
84 else
85 {
86 var p = document.createElement("p");
87 p.innerHTML = "<h2>Error retrieving news feed</h2>";
88 document.getElementById("rss-container").appendChild(p);
89 }
90 }
91
5572e7bb »
2011-07-06 + added spinner
92
d4a6f715 »
2011-07-06 + added files
93 $(document).ready(function() {
5572e7bb »
2011-07-06 + added spinner
94
95 $(function () {
96 var img = new Image();
97 img.id="image";
98 img.width=320;
99 img.height=240;
100 // wrap our new image in jQuery, then:
101 $(img)// once the image has loaded, execute this code
102 .load(function () {
103 $(this).hide();// set the image hidden by default
104 $('#image-container')// with the holding div #loader, apply:
105 .removeClass('loading')// remove the loading class (so no background spinner),
106 .prepend(this);// then insert our image
107 $(this).fadeIn(400);// fade our image in to create a nice effect
108 })
109 .error(function () {
110 // notify the user that the image could not be loaded
111 $('#image-container').append($('<h2>Error retrieving stream</h2>'));
112 })
113
114 // *finally*, set the src attribute of the new image to our image
e96ba350 »
2011-07-06 + changed urls
115 .attr('src', 'http://www.audienciazero.org/xda/tv/webcam.jpg');
5572e7bb »
2011-07-06 + added spinner
116 });
117
e96ba350 »
2011-07-06 + changed urls
118 timer();
119
5572e7bb »
2011-07-06 + added spinner
120 $("#xdalink").click(function(event) {
d4a6f715 »
2011-07-06 + added files
121 event.preventDefault();
122 $("#image-container").hide()
123 $("#rss-container").show();
124 })
125 $("#newslink").click(function(event) {
126 event.preventDefault();
127 $("#rss-container").hide()
128 $("#image-container").show();
129 })
130 });
131 </script>
132
133 </body>
134 </html>
Something went wrong with that request. Please try again.