From 9f5465c0e5480b1a8904e13e5ebbd26b7c541540 Mon Sep 17 00:00:00 2001 From: Daku Date: Tue, 17 Jan 2012 04:28:45 +0000 Subject: [PATCH] Bookmarklet now asks if you want to use current/new tags again. --- ext/upload/bookmarklet.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/ext/upload/bookmarklet.js b/ext/upload/bookmarklet.js index b32b8009..6cde44fa 100644 --- a/ext/upload/bookmarklet.js +++ b/ext/upload/bookmarklet.js @@ -1,8 +1,10 @@ /* Imageboard to 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 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("
  • Rating: (.*)<\/li>")[1]; var srx="http://" + document.location.hostname + document.location.href.match("\/post\/show\/[0-9]+\/"); 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. 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){ - 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. var srx="http://" + document.location.hostname + document.location.href.match("\/post\/view\/[0-9]+"); /*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){ //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 :< - var ste="http://localhost/shimmie_trunk/upload?url="; - var tag=document.getElementById("tags").value; + if (typeof tag !=="ftp://ftp." && chk !==1){var tag=document.getElementById("tags").value;} var rtg=document.documentElement.innerHTML.match("
  • 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 gmi=document.getElementById("image").src.match(".*img[0-9]+\.gelbooru\.com\/\/images\/[0-9]+\/[a-z0-9]+\.[a-z0-9]+")[0];