secret
Last active

Tiny GrooveShark Client

  • Download Gist
tinygs.hta
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222
<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="&#182;" 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>

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.