Created
April 24, 2014 08:08
-
-
Save anonymous/11245967 to your computer and use it in GitHub Desktop.
VLC Song Info for OBS CLR Browser in under 1k
This file contains 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
<!doctype html> | |
<script> | |
var get_info = function() { | |
var x = new XMLHttpRequest() | |
x.open("GET", "http://localhost:8080/requests/status.json", true); | |
x.onreadystatechange = function() { | |
if (x.readyState === 4) { | |
var tmp = JSON.parse(x.responseText), | |
L = {} | |
L.title = tmp.information.category.meta.title | |
L.artist = tmp.information.category.meta.artist | |
replace_text(L) | |
} | |
} | |
x.onerror = function() { | |
default_text() | |
} | |
x.send() | |
}, main = function() { | |
get_info() | |
}, replace_text = function(L) { | |
document.querySelector("#title").innerHTML = L.title | |
document.querySelector("#artist").innerHTML = L.artist | |
}, default_text = function() { | |
document.querySelector("#title").innerHTML = "No song is playing or I'm deaf." | |
document.querySelector("#artist").innerHTML = "" | |
}, fireForever = function() { | |
setInterval(main, 1000); | |
} | |
document.addEventListener("DOMContentLoaded", fireForever); | |
</script> | |
<style> | |
body { | |
font-family:"WeblySleek UI Light"; | |
color: #fff; | |
} | |
#artist { | |
color: #90c600; | |
font-family:"WeblySleek UI Semibold"; | |
} | |
</style> | |
<span id="artist"></span> | |
<span id="title">No song is playing or I'm deaf.</span> |
This file contains 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
<!doctype html> | |
<script>function d(){var a=new XMLHttpRequest;a.open("GET","http://localhost:8080/requests/status.json",!0);a.onreadystatechange=function(){if(4===a.readyState){var c,b=JSON.parse(a.responseText);c=b.information.category.meta.title;b=b.information.category.meta.artist;document.querySelector("#title").innerHTML=c;document.querySelector("#artist").innerHTML=b}};a.onerror=function(){document.querySelector("#title").innerHTML="No song is playing or I'm deaf.";document.querySelector("#artist").innerHTML=""};a.send()}function e(){d()}document.addEventListener("DOMContentLoaded",function(){setInterval(e,1E3)});</script> | |
<style>body {font-family:"WeblySleek UI Light",sans-serif;color: #fff;}#artist {color: #90c600;font-family:"WeblySleek UI Semibold",sans-serif;}</style> | |
<span id="artist"></span> <span id="title">No song is playing or I'm deaf.</span> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment