Created
May 23, 2014 05:04
-
-
Save blha303/4effab6f2fe2760eccd2 to your computer and use it in GitHub Desktop.
Speedrun.tv Twitch panels script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Copying this into the browser console (when you have a chat tab selected) will open the Twitch panels in a new window. | |
$.getJSON("http://www.corsproxy.com/api.twitch.tv/api/channels/"+$('.selected')[0].textContent+"/panels", | |
function(result){ | |
var out = []; | |
$.each(result, | |
function(i, field){ | |
var outp = ""; | |
if (field["data"]["link"]) { | |
outp += "<a href=\"" + field["data"]["link"] + "\">"; | |
} | |
if (field["data"]["image"]) { | |
outp += "<img src=\"" + field["data"]["image"] + "\">"; | |
} | |
if (field["data"]["link"]) { | |
outp += "</a>"; | |
} | |
outp += field["html_description"]; | |
out.push(outp); | |
}); | |
window.open("data:text/html;charset=utf-8," + | |
encodeURIComponent("<style>\ | |
body{\ | |
background: none repeat scroll 0% 0% #E0E0E0;\ | |
text-rendering: optimizelegibility;\ | |
color: #3B3B3B;\ | |
font-family: Helvetica,Arial,sans-serif;\ | |
font-size: 12px;\ | |
} p {\ | |
margin-bottom: 15px;\ | |
line-height: 18px;\ | |
}\ | |
</style>") + | |
encodeURIComponent( out.join("") ), | |
"panels", | |
"height=600,width=380,status=no,menubar=no,status=no,toolbar=no,scrollbars=yes" | |
); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment