Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
89 additions
and
6 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<html> | ||
<head> | ||
<script src="jquery.js"></script> | ||
<script src="syncpad.js"></script> | ||
<link rel="stylesheet" href="syncpad.css"> | ||
</head> | ||
<body> | ||
<a href="#" class="button" id="write">Write tag</a> | ||
</body> | ||
</html> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"BundleType": "Application", | ||
"BundleIdentifier": "syncpad", | ||
"AppName": "SyncPad", | ||
"AppDescription": "NFC Sync", | ||
"RequiredPermissions": [ | ||
|
||
], | ||
"SupportedLanguages": [ | ||
"en" | ||
] | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
.button { | ||
-moz-box-shadow:inset 0px 1px 0px 0px #ffffff; | ||
-webkit-box-shadow:inset 0px 1px 0px 0px #ffffff; | ||
box-shadow:inset 0px 1px 0px 0px #ffffff; | ||
background:-webkit-gradient( linear, left top, left bottom, color-stop(0.05, #ededed), color-stop(1, #dfdfdf) ); | ||
background:-moz-linear-gradient( center top, #ededed 5%, #dfdfdf 100% ); | ||
filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ededed', endColorstr='#dfdfdf'); | ||
background-color:#ededed; | ||
-moz-border-radius:6px; | ||
-webkit-border-radius:6px; | ||
border-radius:6px; | ||
border:1px solid #dcdcdc; | ||
display:inline-block; | ||
color:#777777; | ||
font-family:arial; | ||
font-size:15px; | ||
font-weight:bold; | ||
padding:6px 24px; | ||
text-decoration:none; | ||
text-shadow:1px 1px 0px #ffffff; | ||
} | ||
.classname:hover { | ||
background:-webkit-gradient( linear, left top, left bottom, color-stop(0.05, #dfdfdf), color-stop(1, #ededed) ); | ||
background:-moz-linear-gradient( center top, #dfdfdf 5%, #ededed 100% ); | ||
filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#dfdfdf', endColorstr='#ededed'); | ||
background-color:#dfdfdf; | ||
} | ||
.classname:active { | ||
position:relative; | ||
top:1px; | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
var LOCAL = 'ws://localhost:9000', | ||
CLOUD = 'http://192.168.1.192'; | ||
|
||
var sp = getSpotifyApi(1), | ||
player = sp.require('sp://import/scripts/api/models').player, | ||
exports.init = init; | ||
|
||
function init() { | ||
var ws = new WebSocket(LOCAL); | ||
|
||
ws.onopen = function(){ | ||
ws.send(JSON.stringify({type: 'announce', announce: 'song'})); | ||
}; | ||
|
||
ws.onclose = function(){ | ||
setTimeout(init, 5000); | ||
}; | ||
|
||
ws.onmessage = function(msg) { | ||
var data = JSON.parse(msg.data); | ||
if (!data.write) { | ||
player.play("spotify:track:" + data.track); | ||
player.position = data.position; | ||
} | ||
if (data.write) { | ||
$.post(CLOUD + '/store/' + data.id, {type: 'song', track: player.track.uri, position: player.position}); | ||
} | ||
} | ||
|
||
$("#write").on('click', function(e) { | ||
ws.send(JSON.stringify({type: 'write'})); | ||
}); | ||
} | ||
|
||
|