From a25f4054707a691b2ad06683c41d8ecaaded8895 Mon Sep 17 00:00:00 2001 From: Daku Date: Thu, 2 Feb 2012 13:01:40 +0000 Subject: [PATCH] bookmarklet now supports sankaku and konachan --- ext/upload/bookmarklet.js | 14 +++++++++----- ext/upload/theme.php | 4 ++-- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/ext/upload/bookmarklet.js b/ext/upload/bookmarklet.js index 86710973..5f45c6fc 100644 --- a/ext/upload/bookmarklet.js +++ b/ext/upload/bookmarklet.js @@ -16,19 +16,19 @@ if (CA === 0 || CA > 2){ //Default var chk=1; } -// Danbooru | oreno.imouto +// Danbooru | oreno.imouto | konachan | sankakucomplex if(document.getElementById("post_tags") !== null){ if (typeof tag !=="ftp://ftp." && chk !==1){var tag=document.getElementById("post_tags").value;} var srx="http://" + document.location.hostname + document.location.href.match("\/post\/show\/[0-9]+\/"); var hrs=document.getElementById("highres").href; - if(srx.search("oreno\\.imouto") >= 0){ + if(srx.search("oreno\\.imouto") >= 0 || srx.search("konachan\\.com") >= 0){ var rtg=document.getElementById("stats").innerHTML.match("
  • Rating: (.*) Rating: (.*)<\/li>")[1]; } if(tag.search(/\bflash\b/)===-1){ - if(srx.search("oreno\\.imouto") >= 0){ //oreno's theme seems to have moved the filesize + if(srx.search("oreno\\.imouto") >= 0 || srx.search("konachan\\.com") >= 0){ //oreno's theme seems to have moved the filesize var filesze = document.getElementById("highres").innerHTML.match("[a-zA-Z0-9]+ \\(+([0-9]+\\.[0-9]+) ([a-zA-Z]+)"); }else{ var filesze=document.getElementById("stats").innerHTML.match("[0-9] \\(((?:\.*[0-9])) ([a-zA-Z]+)"); @@ -39,10 +39,14 @@ if(document.getElementById("post_tags") !== null){ if(filesze <= maxsze){ if(srx.search("oreno\\.imouto") >= 0){ //this regex tends to be a bit picky with tags -_-;; - var hrs=hrs.match("(http\:\/\/[a-z0-9]+\.[a-z]+\.org\/[a-z0-9]+\/[a-z0-9]+)\/[a-z0-9A-Z%_]+(\.[a-zA-Z0-9]+)"); + var hrs=hrs.match("(http\:\/\/[a-z0-9]+\.[a-z]+\.[a-z]\/[a-z0-9]+\/[a-z0-9]+)\/[a-z0-9A-Z%_-]+(\.[a-zA-Z0-9]+)"); var hrs=hrs[1]+hrs[2]; //this should bypass hotlink protection + }else if(srx.search("konachan\\.com") >= 0){ + //konachan affixs konachan.com to the start of the tags, this requires different regex + var hrs=hrs.match("(http\:\/\/[a-z0-9]+\.[a-z]+\.[a-z]\/[a-z0-9]+\/[a-z0-9]+)\/[a-z0-9A-Z%_]+\.[a-zA-Z0-9%_-]+(\.[a-z0-9A-Z]+)") + var hrs=hrs[1]+hrs[2]; } - location.href=ste+hrs+"&tags="+tag+"&rating="+rtg+"&source="+srx; + location.href="|"+ste+hrs+"&tags="+tag+"&rating="+rtg+"&source="+srx; }else{alert(toobig);} }else{alert(notsup);} }else{ diff --git a/ext/upload/theme.php b/ext/upload/theme.php index 0e5e7127..47cc9147 100644 --- a/ext/upload/theme.php +++ b/ext/upload/theme.php @@ -145,7 +145,7 @@ class UploadTheme extends Themelet { { /* Imageboard > Shimmie Bookmarklet This is more or less, an upgraded version of the "Danbooru>Shimmie" bookmarklet. - At the moment this works with Shimmie/Danbooru/Gelbooru/oreno.imouto. + At the moment this is known to work with Shimmie/Danbooru/Gelbooru/oreno.imouto/konachan/sankakucomplex. The bookmarklet is now also loaded via the .js file in this folder. */ //Bookmarklet checks if shimmie supports ext. If not, won't upload to site/shows alert saying not supported. @@ -157,7 +157,7 @@ class UploadTheme extends Themelet { $title = "Booru to " . $config->get_string('title'); //CA=0: Ask to use current or new tags | CA=1: Always use current tags | CA=2: Always use new tags $html .= '

    '. - $title . ' (Click when looking at an image page. Works on sites running Shimmie/Danbooru/Gelbooru/oreno.imouto. (This also grabs the tags/rating/source!))'; + $title . ' (Click when looking at an image page. Works on sites running Shimmie/Danbooru/Gelbooru. (This also grabs the tags/rating/source!))'; } }