2012-01-17 04:03:32 +00:00
|
|
|
/* Imageboard to Shimmie */
|
|
|
|
// This should work with "most" sites running Danbooru/Gelbooru/Shimmie
|
2012-01-17 04:28:45 +00:00
|
|
|
|
2012-01-17 07:57:58 +00:00
|
|
|
var maxsze = (maxsze.match("(?:\.*[0-9])")) * 1024; //This assumes we are only working with MB.
|
|
|
|
var toobig = "The file you are trying to upload is too big to upload!";
|
|
|
|
var notsup = "The file you are trying to upload is not supported!";
|
|
|
|
|
2012-01-17 04:28:45 +00:00
|
|
|
if (confirm("OK = Use Current tags.\nCancel = Use new tags.")==true){}else{var tag=prompt("Enter Tags","");var chk=1;};
|
2012-01-17 07:57:58 +00:00
|
|
|
|
2012-01-17 04:03:32 +00:00
|
|
|
// Danbooru
|
|
|
|
if(document.getElementById("post_tags") !== null){
|
2012-01-17 04:28:45 +00:00
|
|
|
if (typeof tag !=="ftp://ftp." && chk !==1){var tag=document.getElementById("post_tags").value;}
|
2012-01-17 07:57:58 +00:00
|
|
|
var rtg=document.getElementById("stats").innerHTML.match("<li>Rating: (.*)<\/li>")[1];
|
2012-01-17 04:03:32 +00:00
|
|
|
var srx="http://" + document.location.hostname + document.location.href.match("\/post\/show\/[0-9]+\/");
|
2012-01-17 07:57:58 +00:00
|
|
|
var filesze=document.getElementById("stats").innerHTML.match("[0-9] \\(((?:\.*[0-9])) ([a-zA-Z]+)");
|
|
|
|
if(filesze[2] == "MB"){var filesze = filesze[1] * 1024;}else{var filesze = filesze[2].match("[0-9]+");}
|
2012-01-17 04:03:32 +00:00
|
|
|
if(tag.search(/\bflash\b/)==-1){
|
2012-01-17 07:57:58 +00:00
|
|
|
if(supext.search(document.getElementById("highres").href.match("http\:\/\/.*\\.([a-z0-9]+)")[1]) !== -1){
|
|
|
|
if(filesze <= maxsze){
|
|
|
|
location.href=ste+document.getElementById("highres").href+"&tags="+tag+"&rating="+rtg[1]+"&source="+srx;
|
|
|
|
}else{alert(toobig);}
|
|
|
|
}else{alert(notsup);}
|
2012-01-17 04:03:32 +00:00
|
|
|
}else{
|
2012-01-17 07:57:58 +00:00
|
|
|
if(supext.search(document.getElementById("highres").href.match("http\:\/\/.*\\.([a-z0-9]+)")[1]) !== -1){
|
|
|
|
if(filesze <= maxsze){
|
|
|
|
location.href=ste+document.getElementsByName("movie")[0].value+"&tags="+tag+"&rating="+rtg[1]+"&source="+srx;
|
|
|
|
}else{alert(toobig);}
|
|
|
|
}else{alert(notsup);}
|
2012-01-17 04:03:32 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
/* Shimmie
|
|
|
|
Shimmie doesn't seem to have any way to grab tags via id unless you have the ability to edit tags.
|
|
|
|
Have to go the round about way of checking the title for tags.
|
|
|
|
This crazy way of checking "should" work with older releases though (Seems to work with 2009~ ver) */
|
|
|
|
else if(document.getElementsByTagName("title")[0].innerHTML.search("Image [0-9.-]+\: ")==0){
|
2012-01-17 04:28:45 +00:00
|
|
|
if (typeof tag !=="ftp://ftp." && chk !==1){var tag=document.getElementsByTagName("title")[0].innerHTML.match("Image [0-9.-]+\: (.*)")[1];}
|
2012-01-17 04:03:32 +00:00
|
|
|
//TODO: Make rating show in statistics.
|
|
|
|
var srx="http://" + document.location.hostname + document.location.href.match("\/post\/view\/[0-9]+");
|
2012-01-17 07:57:58 +00:00
|
|
|
/*TODO: Figure out regex for shortening file link. I.E http://blah.net/_images/1234abcd/everysingletag.png > http://blah.net/_images/1234abcd.png*/
|
|
|
|
/*TODO: Make file size show on all themes (Only seems to show in lite/Danbooru themes.)*/
|
2012-01-17 04:03:32 +00:00
|
|
|
if(tag.search(/\bflash\b/)==-1){
|
2012-01-17 07:57:58 +00:00
|
|
|
var img = document.getElementById("main_image").src;
|
|
|
|
if(supext.search(img.match(".*\\.([a-z0-9]+)")[1]) !== -1){
|
|
|
|
location.href=ste+img+"&tags="+tag+"&source="+srx;
|
|
|
|
}else{alert(notsup);}
|
2012-01-17 04:03:32 +00:00
|
|
|
}else{
|
2012-01-17 07:57:58 +00:00
|
|
|
var mov = document.location.hostname+document.getElementsByName("movie")[0].value;
|
|
|
|
if(supext.search(mov.match(".*\\.([a-z0-9]+)")[1]) !== -1){
|
|
|
|
location.href=ste+mov+"&tags="+tag+"&source="+srx;
|
|
|
|
}else{alert(notsup);}
|
2012-01-17 04:03:32 +00:00
|
|
|
}
|
2012-01-17 04:57:14 +00:00
|
|
|
}
|
2012-01-17 04:03:32 +00:00
|
|
|
// Gelbooru
|
|
|
|
else if(document.getElementById("tags") !== null){
|
2012-01-17 07:57:58 +00:00
|
|
|
//Gelbooru has an annoying anti-hotlinking thing which doesn't seem to like the bookmarklet.
|
2012-01-17 04:28:45 +00:00
|
|
|
if (typeof tag !=="ftp://ftp." && chk !==1){var tag=document.getElementById("tags").value;}
|
2012-01-17 07:57:58 +00:00
|
|
|
var rtg=document.getElementById("stats").innerHTML.match("<li>Rating: (.*)<\/li>")[1];
|
2012-01-17 04:57:14 +00:00
|
|
|
//Can't seem to grab source due to url containing a &
|
|
|
|
//var srx="http://" + document.location.hostname + document.location.href.match("\/index\.php?page=post&s=view\\&id=.*");
|
2012-01-17 04:03:32 +00:00
|
|
|
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.
|
2012-01-17 07:57:58 +00:00
|
|
|
//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="+rtg[1];//+"&source="+srx;
|
|
|
|
}else{alert(notsup);}
|
2012-01-17 04:57:14 +00:00
|
|
|
}
|