Compare commits
No commits in common. "8a8dd468bee857dcde59a3d2dca9ebb9d7bbec73" and "7f356cdede718f69fc4a29b2a0d59f631c3e28a6" have entirely different histories.
8a8dd468be
...
7f356cdede
2 changed files with 38 additions and 15 deletions
|
@ -6,9 +6,12 @@
|
|||
var PetQuery = {},
|
||||
query_string = document.location.hash || document.location.search;
|
||||
|
||||
for (const [key, value] of new URLSearchParams(query_string).entries()) {
|
||||
PetQuery[key] = value;
|
||||
$.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) {
|
||||
|
@ -66,6 +69,21 @@
|
|||
},
|
||||
};
|
||||
|
||||
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) {
|
||||
|
@ -74,6 +92,8 @@
|
|||
if (!Preview.Job.current) {
|
||||
Preview.Job.fallback.setAsCurrent();
|
||||
}
|
||||
} else {
|
||||
loadNotable();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -86,7 +106,16 @@
|
|||
job.loading = false;
|
||||
|
||||
function getImageSrc() {
|
||||
if (base === "cp" || base === "cpn") {
|
||||
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") {
|
||||
return petImage(base + "/" + key, quality);
|
||||
} else if (base === "url") {
|
||||
return key;
|
||||
|
@ -119,13 +148,7 @@
|
|||
|
||||
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