fixed downloading flash with bookmarklet + added comments
This commit is contained in:
parent
3b73013d1d
commit
c2ad8322ef
@ -27,7 +27,7 @@ class UploadTheme extends Themelet {
|
||||
|
||||
if($i==0){
|
||||
$upload_list .= "<div id='hide$i'><img id='wrapper' src='ext/upload/minus.png' />" .
|
||||
"<a href='javascript:document.getElementById("row$a").style.display = "";javascript:document.getElementById("hide$i").style.display = "none";javascript:document.getElementById("hide$a").style.display = "";'>".
|
||||
"<a href='javascript:document.getElementById("row$a").style.display = "";document.getElementById("hide$i").style.display = "none";document.getElementById("hide$a").style.display = "";'>".
|
||||
"<img src='ext/upload/plus.png'></a></div></td>";
|
||||
}else{
|
||||
$upload_list .="<div id='hide$i'>
|
||||
@ -113,15 +113,31 @@ class UploadTheme extends Themelet {
|
||||
{
|
||||
/* 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.
|
||||
Most likely this will stop working when Danbooru updates to v2, all depends if they switch the ids or not >_>.
|
||||
Clicking the link on a danbooru image page should give you something along the lines of:
|
||||
'http://www.website.com/shimmie/upload?url="http://sonohara.donmai.us/data/crazylongurl.jpg&tags="too many tags"&rating="s"&source="http://danbooru.donmai.us/post/show/012345/"'
|
||||
TODO: Possibly make the entire/most of the script into a .js file, and just make the bookmarklet load it on click (Something like that?)
|
||||
*/
|
||||
$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;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!))';
|
||||
$html .= '<p><a href="javascript:'.
|
||||
/* This should stop the bookmarklet being insanely long...not that it's already huge or anything. */
|
||||
'var ste="'. $link . $delimiter .'url=";var tag=document.getElementById("post_tags").value;var rtg=document.documentElement.innerHTML.match("<li>Rating: (.*)<\/li>");var srx="http://" + document.location.hostname+document.location.href.match("\/post\/show\/.*\/");' .
|
||||
//The default confirm sucks, mainly due to being unable to change the text in the Ok/Cancel box (Yes/No would be better.)
|
||||
'if (confirm("OK = Use Current tags.\nCancel = Use new tags.")==true){' . //Just incase some people don't want the insane amount of tags danbooru has.
|
||||
//The flash check is kind of picky, although it should work on "most" images..there will be either some old or extremely new ones that lack the flash tag.
|
||||
'if(tag.search(/\bflash\b/)==-1){'.
|
||||
'location.href=ste+document.getElementById("highres").href+"&tags="+tag+"&rating="+rtg[1]+"&source="+srx;}'.
|
||||
'else{'.
|
||||
'location.href=ste+document.getElementsByName("movie")[0].value+"&tags="+tag+"&rating="+rtg[1]+"&source="+srx;}'.
|
||||
//The following is more or less the same as above, instead using the tags on danbooru, should load a prompt box instead.
|
||||
'}else{'.
|
||||
'var p=prompt("Enter Tags","");'.
|
||||
'if(tag.search(/\bflash\b/)==-1){'.
|
||||
'location.href=ste+document.getElementById("highres").href+"&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!))';
|
||||
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user