1
0
Fork 0
forked from OpenNeo/impress
impress/public/javascripts/pet_query.js

30 lines
817 B
JavaScript
Raw Normal View History

2010-11-05 15:45:05 -07:00
function petImage(id, size) {
return 'http://pets.neopets.com/' + id + '/1/' + size + '.png';
}
var PetQuery = {},
query_string = document.location.hash || document.location.search;
$.each(query_string.substr(1).split('&'), function () {
var split_piece = this.split('=');
if(split_piece.length == 2) {
PetQuery[split_piece[0]] = split_piece[1];
}
});
if(PetQuery.name) {
if(PetQuery.species && PetQuery.color) {
var notice = $('<div></div>', {
'class': 'success',
'html': "Thanks for showing us <strong>" + PetQuery.name + "</strong>! " +
"Keep up the good work!"
}),
image = $('<img/>', {
'class': 'inline-image',
'src': petImage('cpn/' + PetQuery.name, 1)
});
image.prependTo(notice);
notice.prependTo('#container');
}
}