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
0 parents
commit 499ec98
Showing
9 changed files
with
325 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
Empty file.
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,82 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8"> | ||
<title>My First App</title> | ||
<link rel="stylesheet" href="sp://import/css/adam.css"> | ||
<link rel="stylesheet" href="tutorial.css"> | ||
<script src="jquery.js"></script> | ||
<style> | ||
.displayed { | ||
display: block; | ||
margin-left: auto; | ||
margin-right: auto; | ||
text-align: center; | ||
} | ||
</style> | ||
</head> | ||
<body onload="sp = getSpotifyApi(1); tutorial = sp.require('tutorial'); tutorial.init();"> | ||
<h1 id="header">Hello, world!</h1> | ||
|
||
<span class="displayed"> | ||
<a id="linx" href=""> | ||
<img id="rijks" width="500" class="displayed" src="http://www.rijksmuseum.nl/assetimage2.jsp?id=SK-A-4878&200x200"/> | ||
<span id="title" class="displayed"/> | ||
</a> | ||
</span> | ||
<script> | ||
|
||
function startSlide(token) { | ||
var url = "http://www.rijksmuseum.nl/api/oai/ceda5165-6087-4455-aa15-2c1642b1f481/?verb=listrecords&metadataPrefix=oai_dc"; | ||
if(token) url = url +"&resumptiontoken="+ token; | ||
$.get(url,function(data) { | ||
//alert(data); | ||
//alert($(data).find("dc").first().find("format").first().text()); | ||
var records = $(data).find("metadata"); | ||
|
||
var i = 0; | ||
var record = records[i]; | ||
|
||
$("#rijks")[0].src = $(record).find("format").first().text(); | ||
$("#title")[0].innerHTML = $(record).find("title").first().text(); | ||
|
||
var token = $(data).find("resumptionToken").text(); | ||
//alert(token); | ||
|
||
getNext(98,records,token); | ||
|
||
//alert($("#rijks")[0].src); | ||
}); | ||
} | ||
startSlide(); | ||
|
||
function search(query) { | ||
var url = "http://www.rijksmuseum.nl/zoeken/search.jsp?lang=nl&query=song&x=0&y=0&focus=all"; | ||
$.get(url,function(data) { | ||
var uri = $(data).find("div.zoekimg").first()[0].style.background; | ||
var pat1=new RegExp("&resize100square.*"); | ||
var pat2=new RegExp(".*url\\("); | ||
\alert(uri.replace(pat1,"").replace(pat2,"")); | ||
}); | ||
} | ||
search(); | ||
|
||
|
||
function getNext(index, records,token) { | ||
index++; | ||
var record = records[index]; | ||
|
||
$("#rijks")[0].src = $(record).find("format").first().text();// +"&200x200"; | ||
$("#title")[0].innerHTML = $(record).find("title").first().text(); | ||
//alert($(record).find("format").next().first().text()); | ||
$("#linx")[0].href = $(record).find("format").next().first().text(); | ||
|
||
if( index < 100) | ||
$("#rijks").ready( function(){ setTimeout(function() { getNext(index,records,token); }, 10000);}); | ||
else | ||
startSlide(token); | ||
|
||
} | ||
</script> | ||
</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 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8"> | ||
<title>My First App</title> | ||
<link rel="stylesheet" href="sp://import/css/adam.css"> | ||
<link rel="stylesheet" href="tutorial.css"> | ||
</head> | ||
<body> | ||
<h1 id="header">Hello, world!</h1> | ||
</body> | ||
</html> |
Large diffs are not rendered by default.
Oops, something went wrong.
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,17 @@ | ||
{ | ||
"BundleType": "Application", | ||
"AppIcon": { | ||
"36x18": "tutorial.png" | ||
}, | ||
"AppName": { | ||
"en": "Tutorial" | ||
}, | ||
"SupportedLanguages": [ | ||
"en" | ||
], | ||
"RequiredPermissions": [ | ||
"http://ws.audioscrobbler.com", | ||
"http://www.rijksmuseum.nl/", | ||
"files.posterous.com" | ||
] | ||
} |
150 changes: 150 additions & 0 deletions
150
Riiksify/search.jsp?lang=nl&query=song&x=0&y=0&focus=all
Large diffs are not rendered by default.
Oops, something went wrong.
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,5 @@ | ||
h1 { | ||
text-align: center; | ||
font-size: 24px; | ||
padding: 20px; | ||
} |
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,55 @@ | ||
var sp = getSpotifyApi(1); | ||
var models = sp.require('sp://import/scripts/api/models'); | ||
var player = models.player; | ||
|
||
exports.init = init; | ||
|
||
function init() { | ||
|
||
updatePageWithTrackDetails(); | ||
|
||
player.observe(models.EVENT.CHANGE, function (e) { | ||
|
||
// Only update the page if the track changed | ||
if (e.data.curtrack == true) { | ||
updatePageWithTrackDetails(); | ||
} | ||
}); | ||
|
||
// searchLastFMForEvents("stockholm"); | ||
} | ||
|
||
function updatePageWithTrackDetails() { | ||
|
||
var header = document.getElementById("header"); | ||
|
||
// This will be null if nothing is playing. | ||
var playerTrackInfo = player.track; | ||
|
||
if (playerTrackInfo == null) { | ||
header.innerText = "Nothing playing!"; | ||
} else { | ||
var track = playerTrackInfo.data; | ||
header.innerHTML = track.name + " on the album " + track.album.name + " by " + track.album.artist.name + "."; | ||
} | ||
} | ||
|
||
function searchLastFMForEvents(city) { | ||
|
||
var req = new XMLHttpRequest(); | ||
req.open("GET", "http://ws.audioscrobbler.com/2.0/?method=geo.getevents&location=" + city + "&api_key=YOUR_KEY_HERE", true); | ||
|
||
req.onreadystatechange = function() { | ||
|
||
console.log(req.status); | ||
|
||
if (req.readyState == 4) { | ||
if (req.status == 200) { | ||
console.log("Search complete!"); | ||
console.log(req.responseText); | ||
} | ||
} | ||
}; | ||
|
||
req.send(); | ||
} |