Compare commits
3 commits
7f356cdede
...
8a8dd468be
Author | SHA1 | Date | |
---|---|---|---|
8a8dd468be | |||
d84ab44771 | |||
903fb19d5c |
2 changed files with 15 additions and 38 deletions
|
@ -6,12 +6,9 @@
|
|||
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];
|
||||
for (const [key, value] of new URLSearchParams(query_string).entries()) {
|
||||
PetQuery[key] = value;
|
||||
}
|
||||
});
|
||||
|
||||
if (PetQuery.name) {
|
||||
if (PetQuery.species && PetQuery.color) {
|
||||
|
@ -69,21 +66,6 @@
|
|||
},
|
||||
};
|
||||
|
||||
function loadNotable() {
|
||||
// TODO: add HTTPS to notables
|
||||
// $.getJSON('https://notables.openneo.net/api/1/days/ago/1?callback=?', function (response) {
|
||||
// var notables = response.notables;
|
||||
// var i = Math.floor(Math.random() * notables.length);
|
||||
// Preview.Job.fallback = new Preview.Job.Name(notables[i].petName);
|
||||
// if(!Preview.Job.current) {
|
||||
// Preview.Job.fallback.setAsCurrent();
|
||||
// }
|
||||
// });
|
||||
if (!Preview.Job.current) {
|
||||
Preview.Job.fallback.setAsCurrent();
|
||||
}
|
||||
}
|
||||
|
||||
function loadFeature() {
|
||||
$.getJSON("/donations/features", function (features) {
|
||||
if (features.length > 0) {
|
||||
|
@ -92,8 +74,6 @@
|
|||
if (!Preview.Job.current) {
|
||||
Preview.Job.fallback.setAsCurrent();
|
||||
}
|
||||
} else {
|
||||
loadNotable();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -106,16 +86,7 @@
|
|||
job.loading = false;
|
||||
|
||||
function getImageSrc() {
|
||||
if (key.substr(0, 3) === "a:-") {
|
||||
// lol lazy code for prank image :P
|
||||
// TODO: HTTPS?
|
||||
return (
|
||||
"https://swfimages.impress.openneo.net" +
|
||||
"/biology/000/000/0-2/" +
|
||||
key.substr(2) +
|
||||
"/300x300.png"
|
||||
);
|
||||
} else if (base === "cp" || base === "cpn") {
|
||||
if (base === "cp" || base === "cpn") {
|
||||
return petImage(base + "/" + key, quality);
|
||||
} else if (base === "url") {
|
||||
return key;
|
||||
|
@ -148,7 +119,13 @@
|
|||
|
||||
Preview.Job.Name = function (name) {
|
||||
this.name = name;
|
||||
if (name.startsWith("@")) {
|
||||
// This is an image hash "pet name".
|
||||
Preview.Job.apply(this, [name.substr(1), "cp"]);
|
||||
} else {
|
||||
// This is a normal pet name.
|
||||
Preview.Job.apply(this, [name, "cpn"]);
|
||||
}
|
||||
|
||||
this.visit = function () {
|
||||
$(".main-pet-name").val(this.name).closest("form").submit();
|
||||
|
|
|
@ -14,7 +14,7 @@ class PetsController < ApplicationController
|
|||
|
||||
respond_to do |format|
|
||||
format.html do
|
||||
path = destination + @pet.wardrobe_query
|
||||
path = destination + "?" + @pet.wardrobe_query
|
||||
redirect_to path
|
||||
end
|
||||
|
||||
|
@ -38,9 +38,9 @@ class PetsController < ApplicationController
|
|||
|
||||
def destination
|
||||
case (params[:destination] || params[:origin])
|
||||
when 'wardrobe' then wardrobe_path + '?'
|
||||
when 'needed_items' then needed_items_path + '?'
|
||||
else root_path + '#'
|
||||
when 'wardrobe' then wardrobe_path
|
||||
when 'needed_items' then needed_items_path
|
||||
else root_path
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue