impress/app/assets/javascripts/pet_query.js

23 lines
602 B
JavaScript
Raw Normal View History

2010-11-05 15:45:05 -07:00
function petImage(id, size) {
return 'https://pets.neopets.com/' + id + '/1/' + size + '.png';
2010-11-05 15:45:05 -07:00
}
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) {
2013-01-10 14:47:46 -08:00
$('#pet-query-notice-template').tmpl({
pet_name: PetQuery.name,
pet_image_url: petImage('cpn/' + PetQuery.name, 1)
}).prependTo('#container');
2010-11-05 15:45:05 -07:00
}
}