bookmarklet now supports sankaku and konachan

This commit is contained in:
Daku 2012-02-02 13:01:40 +00:00
parent 26b688fe9b
commit a25f405470
2 changed files with 11 additions and 7 deletions

View File

@ -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("<li>Rating: (.*) <span")[1];
}else{
var rtg=document.getElementById("stats").innerHTML.match("<li>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{

View File

@ -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 .= '<p><a href="javascript:var ste=&quot;'. $link . $delimiter .'url=&quot;; var supext=&quot;'.$supported_ext.'&quot;; var maxsze=&quot;'.$max_kb.'&quot;; var CA=0; void(document.body.appendChild(document.createElement(&quot;script&quot;)).src=&quot;'.make_http(make_link("ext/upload/bookmarklet.js")).'&quot;)">'.
$title . '</a> (Click when looking at an image page. Works on sites running Shimmie/Danbooru/Gelbooru/oreno.imouto. (This also grabs the tags/rating/source!))';
$title . '</a> (Click when looking at an image page. Works on sites running Shimmie/Danbooru/Gelbooru. (This also grabs the tags/rating/source!))';
}
}