-
-
Save rornor/ecd94da2dea74fe61ced to your computer and use it in GitHub Desktop.
Tiny GrooveShark Client
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
<html> | |
<head> | |
<title>Tiny GrooveShark Client</title> | |
<HTA:APPLICATION | |
APPLICATIONNAME="Tiny GrooveShark Client" | |
ID="TinyGS" | |
VERSION="0.1" | |
BORDER="none" | |
INNERBORDER="no" | |
SELECTION="no" | |
CONTEXTMENU="yes" | |
SINGLEINSTANCE="yes" | |
NAVIGABLE="yes" | |
ICON="http://grooveshark.com/webincludes/images/favicon64.ico" /> | |
<script language="VBScript"> | |
<!-- | |
width = 280 | |
height = 160 | |
ResizeTo width, height | |
MoveTo (screen.AvailWidth-width)/2, (screen.AvailHeight-height)/2 | |
x = 0 : y = 0 : m = 0 | |
Function setPos() | |
move_me.style.color = "#000000" | |
move_me.style.backgroundColor = "#6AAEF5" | |
main.style.backgroundColor = "#6AAEF5" | |
close_button.style.backgroundColor = "#5B92D2" | |
main.style.borderColor = "#5B92D2" | |
window.event.srcElement.hideFocus = 1 | |
x = window.event.screenX | |
y = window.event.screenY | |
m = 1 | |
End Function | |
Function doMove() | |
If m = 1 Then | |
moveX = 0 : moveY = 0 | |
moveX = window.event.screenX - x | |
moveY = window.event.screenY - y | |
window.moveto(window.screenLeft + moveX), (window.screenTop + moveY) | |
setPos() | |
End if | |
End Function | |
Function stopMove() | |
move_me.style.color = "#444444" | |
move_me.style.backgroundColor = "#EBEBEB" | |
main.style.backgroundColor = "#EBEBEB" | |
close_button.style.backgroundColor = "#BABABA" | |
main.style.borderColor = "#C9C9C9" | |
m = 0 | |
End Function | |
//--> | |
</script> | |
<style type="text/css"> | |
body,form,input,object { | |
margin: 0; | |
border: 0; | |
padding: 0; | |
font-family: "Segoe UI","Trebuchet MS",Arial; | |
} | |
body { | |
padding: 28px 6px 6px 6px; | |
border: 1px solid #D7D7D7; | |
overflow: hidden; | |
} | |
form { | |
background-color: #FFFFFF; | |
padding: 0 0 10px 0; | |
} | |
#input_box { | |
color: silver; | |
font-size: 9pt; | |
width: 250px; | |
height: 26px; | |
padding: 0px 28px 0px 4px; | |
border: solid 1px #D8D8D8; | |
line-height: 24px; | |
} | |
#move_me,#close_button,#go_button { | |
position: absolute; | |
top: 0; | |
} | |
#move_me { | |
background-color: #EBEBEB; | |
color: #444444; | |
font-size: 11pt; | |
right: 50px; | |
width: 200px; | |
height: 28px; | |
cursor: move; | |
} | |
#close_button { | |
background-color: #BABABA; | |
color: white; | |
font-family: Verdana,Tahoma; | |
font-size: 10pt; | |
right: 6px; | |
width: 45px; | |
height: 20px; | |
text-align: center; | |
} | |
#go_button { | |
display: none; | |
background-color: white; | |
color: silver; | |
font-family: Verdana,Tahoma; | |
font-size: 10.5pt; | |
top: 43px; | |
right: 15px; | |
width: 24px; | |
height: 24px; | |
text-align: center; | |
} | |
table { | |
background-color: #FFFFFF; | |
border-collapse: collapse; | |
border: 1px solid #D7D7D7; | |
} | |
td { | |
text-align: center; | |
padding-top: 12px; | |
padding-bottom: 8px; | |
} | |
td#groove { | |
background: url('http://dl.dropbox.com/u/30782742/img/2AACFEF4.png') no-repeat center; | |
height: 64px; | |
width: 265px; | |
} | |
</style> | |
</head> | |
<script language="VBScript"> | |
<!-- | |
Dim gs, msg | |
api_key = "c90d467ffa0ec4b106514f9f1d1e4a18" | |
arg = Split(tinygs.commandLine, Chr(34)) | |
If Ubound(arg) > 3 Then msg = arg(3) | |
url = "http://tinysong.com/b/" : par = "?key=" & api_key | |
msg = "Enter your search term" | |
Sub Window_OnLoad() | |
move_me.style.backgroundColor = document.bgcolor | |
groove.innerHtml = gs | |
search.input_box.value = msg | |
tab.focus | |
End Sub | |
Function Request(url) | |
Set HTTP = CreateObject("MSXML2.XMLHTTP") | |
On Error Resume Next | |
HTTP.open "GET", url, False | |
HTTP.send "" | |
If Not Err.number Then resp = HTTP.responseText | |
On Error GoTo 0 | |
Request = resp | |
End Function | |
Sub Go() | |
msg = search.input_box.value | |
search.go_button.style.color = "silver" | |
search.go_button.style.display = "none" | |
If Len(msg) And msg <> "Enter your search term" Then | |
shade() : gs = "" | |
sid = Request(url & Replace(search.input_box.value, " ", "+") & par) | |
If InStr(sid, "rate limit exceeded") Then | |
If MsgBox("Rate limit exceeded." & vbCrLf & vbCrLf & "Press OK to get new api key from 'http://tinysong.com/api' and set it on line 137" & vbCrLf, 49, "Error") = vbOK Then CreateObject("WScript.Shell").Run("http://tinysong.com/api") | |
window.close | |
ElseIf InStr(sid, """error""") Then | |
MsgBox "Error occured." & vbCrLf & vbCrLf & "Message is: " & sid & vbCrLf, 48, "Error" | |
window.close | |
ElseIf sid <> "NSF;" Then | |
gs = "<object width='250' height='40'>" &_ | |
" <param name='movie' value='http://grooveshark.com/songWidget.swf'>" & vbCrLf &_ | |
" <param name='flashvars' value='hostname=cowbell.grooveshark.com&songIDs=" & Split(sid, "; ")(1) & "'>" & vbCrLf &_ | |
" <embed src='http://grooveshark.com/songWidget.swf' " & vbCrLf &_ | |
" type='application/x-shockwave-flash' width='250' height='40'" & vbCrLf &_ | |
" flashvars='hostname=cowbell.grooveshark.com&songIDs=" & Split(sid, "; ")(1) & "'></object>" | |
Else | |
msg = "No result." | |
End If | |
window_onLoad() | |
End If | |
End Sub | |
Sub Clean() | |
If InStr("Enter your search term. No result.", search.input_box.value) Then search.input_box.value = "" | |
search.input_box.style.color = "black" | |
search.input_box.style.fontSize = "11pt" | |
End Sub | |
Sub Shade() | |
If search.input_box.value = "" Then search.input_box.value = "Enter your search term" | |
If Not document.activeElement.id = "go_button" Then search.go_button.style.display = "none" | |
search.input_box.style.color = "silver" | |
search.input_box.style.fontSize = "9pt" | |
End Sub | |
Sub Document_onKeyDown() | |
If Window.Event.KeyCode = 9 Then search.go_button.style.display = "none" | |
If Window.Event.KeyCode = 13 Then go() | |
If Window.Event.KeyCode = 27 Then window.close | |
End Sub | |
//--> | |
</script> | |
<body bgcolor="#EBEBEB" id="main"> | |
<input type="button" id="move_me" onmousedown="setpos" onmousemove="domove" onmouseup="stopmove" value="Tiny GrooveShark Client"> | |
<input type="button" id="close_button" value="x" onclick="window.close" onmouseover="me.style.backgroundcolor='#C85051'" onmouseout="me.style.backgroundcolor='#BABABA'"> | |
<table id="tab" width="100%"> | |
<tr><td> | |
<form id="search"> | |
<input type="text" id="input_box" onfocus="clean():search.go_button.style.display='block'" onblur="shade()"> | |
<input type="button" id="go_button" value="¶" title="Submit" onclick="go()" onmouseover="me.style.color='black'" onmouseout="me.style.color='silver'"> | |
</form> | |
</td></tr> | |
<tr><td id="groove"></td></tr> | |
</table> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thread: http://www.hydrogenaudio.org/forums/index.php?showtopic=99550