Bookmarklet now asks if you want to use current/new tags again.

This commit is contained in:
Daku 2012-01-17 04:28:45 +00:00
parent fcb8307f58
commit 9f5465c0e5

View File

@ -1,8 +1,10 @@
/* Imageboard to Shimmie */ /* Imageboard to Shimmie */
// This should work with "most" sites running Danbooru/Gelbooru/Shimmie // This should work with "most" sites running Danbooru/Gelbooru/Shimmie
if (confirm("OK = Use Current tags.\nCancel = Use new tags.")==true){}else{var tag=prompt("Enter Tags","");var chk=1;};
// Danbooru // Danbooru
if(document.getElementById("post_tags") !== null){ if(document.getElementById("post_tags") !== null){
var tag=document.getElementById("post_tags").value; if (typeof tag !=="ftp://ftp." && chk !==1){var tag=document.getElementById("post_tags").value;}
var rtg=document.documentElement.innerHTML.match("<li>Rating: (.*)<\/li>")[1]; var rtg=document.documentElement.innerHTML.match("<li>Rating: (.*)<\/li>")[1];
var srx="http://" + document.location.hostname + document.location.href.match("\/post\/show\/[0-9]+\/"); var srx="http://" + document.location.hostname + document.location.href.match("\/post\/show\/[0-9]+\/");
if(tag.search(/\bflash\b/)==-1){ if(tag.search(/\bflash\b/)==-1){
@ -16,7 +18,7 @@ Shimmie doesn't seem to have any way to grab tags via id unless you have the abi
Have to go the round about way of checking the title for 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) */ 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){ else if(document.getElementsByTagName("title")[0].innerHTML.search("Image [0-9.-]+\: ")==0){
var tag=document.getElementsByTagName("title")[0].innerHTML.match("Image [0-9.-]+\: (.*)")[1]; if (typeof tag !=="ftp://ftp." && chk !==1){var tag=document.getElementsByTagName("title")[0].innerHTML.match("Image [0-9.-]+\: (.*)")[1];}
//TODO: Make rating show in statistics. //TODO: Make rating show in statistics.
var srx="http://" + document.location.hostname + document.location.href.match("\/post\/view\/[0-9]+"); var srx="http://" + document.location.hostname + document.location.href.match("\/post\/view\/[0-9]+");
/*TODO: Figure out regex for shortening file link. /*TODO: Figure out regex for shortening file link.
@ -32,8 +34,7 @@ else if(document.getElementsByTagName("title")[0].innerHTML.search("Image [0-9.-
else if(document.getElementById("tags") !== null){ else if(document.getElementById("tags") !== null){
//Gelbooru has an annoying anti-hotlinking thing which doesn't seem to like the bookmarklet... //Gelbooru has an annoying anti-hotlinking thing which doesn't seem to like the bookmarklet...
//So if someone can figure out how to bypass the hotlinking, please update the code :< //So if someone can figure out how to bypass the hotlinking, please update the code :<
var ste="http://localhost/shimmie_trunk/upload?url="; if (typeof tag !=="ftp://ftp." && chk !==1){var tag=document.getElementById("tags").value;}
var tag=document.getElementById("tags").value;
var rtg=document.documentElement.innerHTML.match("<li>Rating: (.*)<\/li>")[1]; var rtg=document.documentElement.innerHTML.match("<li>Rating: (.*)<\/li>")[1];
var srx="http://" + document.location.hostname + document.location.href.match("\/index\.php\\?page=post&s=view&id=.*"); //Gelbooru has really ugly urls.. var srx="http://" + document.location.hostname + document.location.href.match("\/index\.php\\?page=post&s=view&id=.*"); //Gelbooru has really ugly urls..
var gmi=document.getElementById("image").src.match(".*img[0-9]+\.gelbooru\.com\/\/images\/[0-9]+\/[a-z0-9]+\.[a-z0-9]+")[0]; var gmi=document.getElementById("image").src.match(".*img[0-9]+\.gelbooru\.com\/\/images\/[0-9]+\/[a-z0-9]+\.[a-z0-9]+")[0];