Merge pull request #350 from jgen/master

Fixed bookmarklet.js to allow uploading from Gelbooru. (was broken before)
This commit is contained in:
Shish 2013-11-27 00:29:40 -08:00
commit 9430ddc374

View file

@ -142,14 +142,23 @@ else if(document.getElementById("tags") !== null) {
// Can't seem to grab source due to url containing a &
// var source="http://" + document.location.hostname + document.location.href.match("\/index\.php?page=post&s=view\\&id=.*");
var gmi = document.getElementById("image").src.match(".*img[0-9]+\.gelbooru\.com\/\/images\/[0-9]+\/[a-z0-9]+\.[a-z0-9]+")[0];
// Since Gelbooru does not allow flash, no need to search for flash tag.
// Gelbooru doesn't show file size in statistics either...
if(supext.search(gmi.match("http\:\/\/.*\\.([a-z0-9]+)")[1]) !== -1){
location.href = ste+gmi+"&tags="+tag+"&rating="+rating;//+"&source="+source;
// Updated Nov. 24, 2013 by jgen.
var gmi;
try {
gmi = document.getElementById("image").src.match(".*img[0-9]*\.gelbooru\.com[\/]+images[\/]+[0-9]+[\/]+[a-z0-9]+\.[a-z0-9]+")[0];
// Since Gelbooru does not allow flash, no need to search for flash tag.
// Gelbooru doesn't show file size in statistics either...
if(supext.search(gmi.match("http\:\/\/.*\\.([a-z0-9]+)")[1]) !== -1){
location.href = ste+gmi+"&tags="+tag+"&rating="+rating;//+"&source="+source;
}
else{
alert(notsup);
}
}
else{
alert(notsup);
catch (err)
{
alert("Unable to locate the image on the page!\n(Gelbooru may have changed the structure of their page, please file a bug.)");
}
}