bookmarklet now supports sankaku and konachan
This commit is contained in:
		
							parent
							
								
									26b688fe9b
								
							
						
					
					
						commit
						a25f405470
					
				| @ -16,19 +16,19 @@ if (CA === 0 || CA > 2){ //Default | |||||||
| 	var chk=1; | 	var chk=1; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| // Danbooru | oreno.imouto
 | // Danbooru | oreno.imouto | konachan | sankakucomplex
 | ||||||
| if(document.getElementById("post_tags") !== null){ | if(document.getElementById("post_tags") !== null){ | ||||||
| 	if (typeof tag !=="ftp://ftp." && chk !==1){var tag=document.getElementById("post_tags").value;} | 	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 srx="http://" + document.location.hostname + document.location.href.match("\/post\/show\/[0-9]+\/"); | ||||||
| 	var hrs=document.getElementById("highres").href; | 	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]; | 		var rtg=document.getElementById("stats").innerHTML.match("<li>Rating: (.*) <span")[1]; | ||||||
| 	}else{ | 	}else{ | ||||||
| 		var rtg=document.getElementById("stats").innerHTML.match("<li>Rating: (.*)<\/li>")[1]; | 		var rtg=document.getElementById("stats").innerHTML.match("<li>Rating: (.*)<\/li>")[1]; | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	if(tag.search(/\bflash\b/)===-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]+)"); | 			var filesze = document.getElementById("highres").innerHTML.match("[a-zA-Z0-9]+ \\(+([0-9]+\\.[0-9]+) ([a-zA-Z]+)"); | ||||||
| 		}else{ | 		}else{ | ||||||
| 			var filesze=document.getElementById("stats").innerHTML.match("[0-9] \\(((?:\.*[0-9])) ([a-zA-Z]+)"); | 			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(filesze <= maxsze){ | ||||||
| 				if(srx.search("oreno\\.imouto") >= 0){ | 				if(srx.search("oreno\\.imouto") >= 0){ | ||||||
| 					//this regex tends to be a bit picky with tags -_-;;
 | 					//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
 | 					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(toobig);} | ||||||
| 		}else{alert(notsup);} | 		}else{alert(notsup);} | ||||||
| 	}else{ | 	}else{ | ||||||
|  | |||||||
| @ -145,7 +145,7 @@ class UploadTheme extends Themelet { | |||||||
| 				{ | 				{ | ||||||
| 			/* Imageboard > Shimmie Bookmarklet | 			/* Imageboard > Shimmie Bookmarklet | ||||||
| 				This is more or less, an upgraded version of the "Danbooru>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. | 				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.
 | 			//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'); | 			$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
 | 			//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="'. $link . $delimiter .'url="; var supext="'.$supported_ext.'"; var maxsze="'.$max_kb.'"; var CA=0; void(document.body.appendChild(document.createElement("script")).src="'.make_http(make_link("ext/upload/bookmarklet.js")).'")">'. | 			$html .= '<p><a href="javascript:var ste="'. $link . $delimiter .'url="; var supext="'.$supported_ext.'"; var maxsze="'.$max_kb.'"; var CA=0; void(document.body.appendChild(document.createElement("script")).src="'.make_http(make_link("ext/upload/bookmarklet.js")).'")">'. | ||||||
| 				$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!))'; | ||||||
| 			} | 			} | ||||||
| 				 | 				 | ||||||
| 		} | 		} | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user