bookmarklet now supports oreno.imouto
This commit is contained in:
parent
d3d395c347
commit
26b688fe9b
@ -4,22 +4,45 @@
|
|||||||
var maxsze = (maxsze.match("(?:\.*[0-9])")) * 1024; //This assumes we are only working with MB.
|
var maxsze = (maxsze.match("(?:\.*[0-9])")) * 1024; //This assumes we are only working with MB.
|
||||||
var toobig = "The file you are trying to upload is too big to upload!";
|
var toobig = "The file you are trying to upload is too big to upload!";
|
||||||
var notsup = "The file you are trying to upload is not supported!";
|
var notsup = "The file you are trying to upload is not supported!";
|
||||||
|
if (CA === 0 || CA > 2){ //Default
|
||||||
|
if (confirm("OK = Use Current tags.\nCancel = Use new tags.")==true){
|
||||||
|
}else{
|
||||||
|
var tag=prompt("Enter Tags","");
|
||||||
|
var chk=1; //This makes sure it doesn't use current tags.
|
||||||
|
}
|
||||||
|
}else if (CA === 1){ //Current Tags
|
||||||
|
}else if (CA === 2){ //New Tags
|
||||||
|
var tag=prompt("Enter Tags","");
|
||||||
|
var chk=1;
|
||||||
|
}
|
||||||
|
|
||||||
if (confirm("OK = Use Current tags.\nCancel = Use new tags.")==true){}else{var tag=prompt("Enter Tags","");var chk=1;};
|
// Danbooru | oreno.imouto
|
||||||
|
|
||||||
// Danbooru
|
|
||||||
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 rtg=document.getElementById("stats").innerHTML.match("<li>Rating: (.*)<\/li>")[1];
|
|
||||||
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;
|
||||||
|
if(srx.search("oreno\\.imouto") >= 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(tag.search(/\bflash\b/)===-1){
|
||||||
|
if(srx.search("oreno\\.imouto") >= 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]+)");
|
var filesze=document.getElementById("stats").innerHTML.match("[0-9] \\(((?:\.*[0-9])) ([a-zA-Z]+)");
|
||||||
|
}
|
||||||
if(filesze[2] == "MB"){var filesze = filesze[1] * 1024;}else{var filesze = filesze[2].match("[0-9]+");}
|
if(filesze[2] == "MB"){var filesze = filesze[1] * 1024;}else{var filesze = filesze[2].match("[0-9]+");}
|
||||||
|
|
||||||
if(supext.search(document.getElementById("highres").href.match("http\:\/\/.*\\.([a-z0-9]+)")[1]) !== -1){
|
if(supext.search(hrs.match("http\:\/\/.*\\.([a-z0-9]+)")[1]) !== -1){
|
||||||
if(filesze <= maxsze){
|
if(filesze <= maxsze){
|
||||||
location.href=ste+document.getElementById("highres").href+"&tags="+tag+"&rating="+rtg+"&source="+srx;
|
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[1]+hrs[2]; //this should bypass hotlink protection
|
||||||
|
}
|
||||||
|
location.href=ste+hrs+"&tags="+tag+"&rating="+rtg+"&source="+srx;
|
||||||
}else{alert(toobig);}
|
}else{alert(toobig);}
|
||||||
}else{alert(notsup);}
|
}else{alert(notsup);}
|
||||||
}else{
|
}else{
|
||||||
@ -29,6 +52,7 @@ if(document.getElementById("post_tags") !== null){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* Shimmie
|
/* Shimmie
|
||||||
|
One problem with shimmie is each theme does not show the same info as other themes (I.E only the danbooru & lite themes show statistics)
|
||||||
Shimmie doesn't seem to have any way to grab tags via id unless you have the ability to edit tags.
|
Shimmie doesn't seem to have any way to grab tags via id unless you have the ability to edit tags.
|
||||||
Have to go the round about way of checking the title for tags.
|
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) */
|
This crazy way of checking "should" work with older releases though (Seems to work with 2009~ ver) */
|
||||||
@ -36,7 +60,6 @@ else if(document.getElementsByTagName("title")[0].innerHTML.search("Image [0-9.-
|
|||||||
if (typeof tag !=="ftp://ftp." && chk !==1){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.
|
//TODO: Make rating show in statistics.
|
||||||
var srx="http://" + document.location.hostname + document.location.href.match("\/post\/view\/[0-9]+");
|
var srx="http://" + document.location.hostname + document.location.href.match("\/post\/view\/[0-9]+");
|
||||||
/*TODO: Figure out regex for shortening file link. I.E http://blah.net/_images/1234abcd/everysingletag.png > http://blah.net/_images/1234abcd.png*/
|
|
||||||
/*TODO: Make file size show on all themes (Only seems to show in lite/Danbooru themes.)*/
|
/*TODO: Make file size show on all themes (Only seems to show in lite/Danbooru themes.)*/
|
||||||
if(tag.search(/\bflash\b/)==-1){
|
if(tag.search(/\bflash\b/)==-1){
|
||||||
var img = document.getElementById("main_image").src;
|
var img = document.getElementById("main_image").src;
|
||||||
@ -52,7 +75,6 @@ else if(document.getElementsByTagName("title")[0].innerHTML.search("Image [0-9.-
|
|||||||
}
|
}
|
||||||
// Gelbooru
|
// Gelbooru
|
||||||
else if(document.getElementById("tags") !== null){
|
else if(document.getElementById("tags") !== null){
|
||||||
//Gelbooru has an annoying anti-hotlinking thing which doesn't seem to like the bookmarklet.
|
|
||||||
if (typeof tag !=="ftp://ftp." && chk !==1){var tag=document.getElementById("tags").value;}
|
if (typeof tag !=="ftp://ftp." && chk !==1){var tag=document.getElementById("tags").value;}
|
||||||
var rtg=document.getElementById("stats").innerHTML.match("<li>Rating: (.*)<\/li>")[1];
|
var rtg=document.getElementById("stats").innerHTML.match("<li>Rating: (.*)<\/li>")[1];
|
||||||
//Can't seem to grab source due to url containing a &
|
//Can't seem to grab source due to url containing a &
|
||||||
|
@ -145,8 +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.
|
At the moment this works with Shimmie/Danbooru/Gelbooru/oreno.imouto.
|
||||||
It would also work with Gelbooru but unless someone can figure out how to bypass their hotlinking..meh.
|
|
||||||
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.
|
||||||
@ -156,8 +155,9 @@ class UploadTheme extends Themelet {
|
|||||||
if(file_exists("ext/handle_mp3")){$supported_ext .= " mp3";}
|
if(file_exists("ext/handle_mp3")){$supported_ext .= " mp3";}
|
||||||
if(file_exists("ext/handle_svg")){$supported_ext .= " svg";}
|
if(file_exists("ext/handle_svg")){$supported_ext .= " svg";}
|
||||||
$title = "Booru to " . $config->get_string('title');
|
$title = "Booru to " . $config->get_string('title');
|
||||||
$html .= '<p><a href="javascript:var ste="'. $link . $delimiter .'url="; var supext="'.$supported_ext.'"; var maxsze="'.$max_kb.'"; void(document.body.appendChild(document.createElement("script")).src="'.make_http(make_link("ext/upload/bookmarklet.js")).'")">'.
|
//CA=0: Ask to use current or new tags | CA=1: Always use current tags | CA=2: Always use new tags
|
||||||
$title . '</a> (Click when looking at an image page. Works on sites running Shimmie/Danbooru/Gelbooru. (This also grabs the tags/rating/source!))';
|
$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!))';
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user