Last active 1440820904

Speedrun.tv Twitch panels script

stv_panels.js Raw
1// Copying this into the browser console (when you have a chat tab selected) will open the Twitch panels in a new window.
2$.getJSON("http://www.corsproxy.com/api.twitch.tv/api/channels/"+$('.selected')[0].textContent+"/panels",
3 function(result){
4 var out = [];
5 $.each(result,
6 function(i, field){
7 var outp = "";
8 if (field["data"]["link"]) {
9 outp += "<a href=\"" + field["data"]["link"] + "\">";
10 }
11 if (field["data"]["image"]) {
12 outp += "<img src=\"" + field["data"]["image"] + "\">";
13 }
14 if (field["data"]["link"]) {
15 outp += "</a>";
16 }
17 outp += field["html_description"];
18 out.push(outp);
19 });
20 window.open("data:text/html;charset=utf-8," +
21 encodeURIComponent("<style>\
22 body{\
23 background: none repeat scroll 0% 0% #E0E0E0;\
24 text-rendering: optimizelegibility;\
25 color: #3B3B3B;\
26 font-family: Helvetica,Arial,sans-serif;\
27 font-size: 12px;\
28 } p {\
29 margin-bottom: 15px;\
30 line-height: 18px;\
31 }\
32 </style>") +
33 encodeURIComponent( out.join("") ),
34 "panels",
35 "height=600,width=380,status=no,menubar=no,status=no,toolbar=no,scrollbars=yes"
36 );
37 });