From 42b902ecb56c762c1685173ac1205e26080a84cd Mon Sep 17 00:00:00 2001 From: Daku <dakutree@gmail.com> Date: Fri, 23 Dec 2011 21:28:47 +0000 Subject: [PATCH] Bookmarklet should now grab the rating, aswell as the image page link for source. --- ext/upload/theme.php | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/ext/upload/theme.php b/ext/upload/theme.php index a18adbe5..7ce049cf 100644 --- a/ext/upload/theme.php +++ b/ext/upload/theme.php @@ -80,13 +80,17 @@ class UploadTheme extends Themelet { $title . '</a> (Drag & drop onto your bookmarks toolbar, then click when looking at an image)'; } { + /* Danbooru > Shimmie Bookmarklet. + This "should" work on any site running danbooru, unless for some odd reason they switched around the id's or aren't using post/list. + */ $title = "Danbooru to " . $config->get_string('title'); $html .= '<p><a href="javascript:var img=document.getElementById("highres").href;var ste="' . - $link . $delimiter . 'url=";var tag=document.getElementById("post_old_tags").value;if (confirm("OK = Use Current tags.\nCancel = Use new tags.")==true)' . - '{if(tag.search(/\bflash\b/)==-1){location.href=ste+img+"&tags="+tag;}else{location.href=ste+document.getElementsByName("movie")[0].value' . - '+"&tags="+tag;}}else{var p=prompt("Enter Tags","");if(tag.search(/\bflash\b/)==-1){location.href=ste+img+"&tags="+p;}' . - 'else{location.href=ste+document.getElementsByName("movie")[0].value+"&tags="+p;}}">' . - $title . '</a> (As above, Click on a Danbooru-run image page. (This also grabs the tags!))'; + $link . $delimiter . 'url=";var tag=document.getElementById("post_old_tags").value;var doc=document.documentElement.innerHTML;var rtg=doc.match("<li>Rating: (.*)<\/li>");var srx="http://" + document.location.hostname + document.location.href.match("\/post\/show\/.*\/");' . + 'if (confirm("OK = Use Current tags.\nCancel = Use new tags.")==true)' . + '{if(tag.search(/\bflash\b/)==-1){location.href=ste+img+"&tags="+tag+"&rating="+rtg[1]+"&source="+srx;}else{location.href=ste+document.getElementsByName("movie")[0].value' . + '+"&tags="+tag+"&rating="+rtg[1]+"&source="+srx;}}else{var p=prompt("Enter Tags","");if(tag.search(/\bflash\b/)==-1){location.href=ste+img+"&tags="+p+"&rating="+rtg[1]+"&source="+srx;}' . + 'else{location.href=ste+document.getElementsByName("movie")[0].value+"&tags="+p+"&rating="+rtg[1]+"&source="+srx;}}">' . + $title . '</a> (As above, Click on a Danbooru-run image page. (This also grabs the tags, rating & source!))'; }