forked from OpenNeo/impress
Merge pet_query.js into its only call site
This commit is contained in:
parent
496b517e74
commit
0d23412fba
3 changed files with 25 additions and 24 deletions
|
@ -1,5 +1,28 @@
|
||||||
(function () {
|
(function () {
|
||||||
// don't need to export anything in here
|
function petImage(id, size) {
|
||||||
|
return "https://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) {
|
||||||
|
$("#pet-query-notice-template")
|
||||||
|
.tmpl({
|
||||||
|
pet_name: PetQuery.name,
|
||||||
|
pet_image_url: petImage("cpn/" + PetQuery.name, 1),
|
||||||
|
})
|
||||||
|
.prependTo("#container");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var preview_el = $("#pet-preview"),
|
var preview_el = $("#pet-preview"),
|
||||||
img_el = preview_el.find("img"),
|
img_el = preview_el.find("img"),
|
||||||
|
|
|
@ -1,22 +0,0 @@
|
||||||
function petImage(id, size) {
|
|
||||||
return 'https://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) {
|
|
||||||
$('#pet-query-notice-template').tmpl({
|
|
||||||
pet_name: PetQuery.name,
|
|
||||||
pet_image_url: petImage('cpn/' + PetQuery.name, 1)
|
|
||||||
}).prependTo('#container');
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -117,4 +117,4 @@
|
||||||
|
|
||||||
- content_for :javascripts do
|
- content_for :javascripts do
|
||||||
= include_javascript_libraries :jquery20, :jquery_tmpl
|
= include_javascript_libraries :jquery20, :jquery_tmpl
|
||||||
= javascript_include_tag 'ajax_auth', 'react', 'jquery.timeago', 'pet_query', 'outfits/new'
|
= javascript_include_tag 'ajax_auth', 'react', 'jquery.timeago', 'outfits/new'
|
Loading…
Reference in a new issue