Merge branch 'master' of github.com:shish/shimmie2
This commit is contained in:
commit
beff330a37
14 changed files with 75 additions and 27 deletions
|
@ -32,12 +32,36 @@ class AdminPageTheme extends Themelet {
|
|||
</form>
|
||||
";
|
||||
$page->add_block(new Block("Misc Admin Tools", $html));
|
||||
|
||||
|
||||
/* First check
|
||||
Requires you to click the checkbox to enable the delete by query form */
|
||||
$dbqcheck = "
|
||||
if(document.getElementById("dbqcheck").checked == false){
|
||||
document.getElementById("dbqtags").disabled = true;
|
||||
document.getElementById("dbqsubmit").disabled = true;
|
||||
}else{
|
||||
document.getElementById("dbqtags").disabled = false;
|
||||
document.getElementById("dbqsubmit").disabled = false;
|
||||
}";
|
||||
|
||||
/* Second check
|
||||
Requires you to confirm the deletion by clicking ok. */
|
||||
$html = "
|
||||
".make_form(make_link("admin_utils"))."
|
||||
<script type='text/javascript'>
|
||||
function checkform(){
|
||||
if(confirm('Are you sure you wish to delete all images using these tags?')){
|
||||
return true;
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
</script>"
|
||||
|
||||
.make_form(make_link("admin_utils"),"post",false,false,"return checkform()")."
|
||||
<input type='checkbox' id='dbqcheck' name='action' onclick='$dbqcheck'>
|
||||
<input type='hidden' name='action' value='delete by query'>
|
||||
<input type='text' name='query'>
|
||||
<input type='submit' value='Go'>
|
||||
<input type='text' id='dbqtags' disabled='true' name='query'>
|
||||
<input type='submit' id='dbqsubmit' disabled='true' value='Go'>
|
||||
</form>
|
||||
";
|
||||
$page->add_block(new Block("Delete by Query", $html));
|
||||
|
|
|
@ -47,7 +47,7 @@ EOD
|
|||
$counter_html
|
||||
<div class='space' id='foot'>
|
||||
<small><small>
|
||||
<a href='$contact_link'>Contact</a> – Serving $num_comma posts –
|
||||
<a href='mailto:$contact_link'>Contact</a> – Serving $num_comma posts –
|
||||
Running <a href='http://code.shishnet.org/shimmie2/'>Shimmie</a>
|
||||
</small></small>
|
||||
</div>
|
||||
|
|
|
@ -254,13 +254,16 @@ function make_http($link) {
|
|||
*
|
||||
* @retval string
|
||||
*/
|
||||
function make_form($target, $method="POST", $multipart=False, $form_id="") {
|
||||
function make_form($target, $method="POST", $multipart=False, $form_id="", $onsubmit="") {
|
||||
global $user;
|
||||
$auth = $user->get_auth_html();
|
||||
$extra = empty($form_id) ? '' : " id='$form_id'";
|
||||
if($multipart) {
|
||||
$extra .= " enctype='multipart/form-data'";
|
||||
}
|
||||
if($onsubmit) {
|
||||
$extra .= " onsubmit='$onsubmit'";
|
||||
}
|
||||
return "<form action='$target' method='$method'$extra>$auth";
|
||||
}
|
||||
|
||||
|
|
|
@ -52,8 +52,12 @@ class TagListTheme extends Themelet {
|
|||
$html .= " <span class='tag_count'>$count</span>";
|
||||
}
|
||||
}
|
||||
|
||||
$page->add_block(new Block("Related", $html, "left"));
|
||||
|
||||
if($config->get_string('tag_list_image_type')=="tags"){
|
||||
$page->add_block(new Block("Tags", $html, "left", 10));}
|
||||
else{
|
||||
$page->add_block(new Block("Related Tags", $html, "left", 10));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -27,11 +27,11 @@ 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='#' onclick='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'>
|
||||
<a href='javascript:document.getElementById("row$i").style.display = "none";".
|
||||
<a href='#' onclick='javascript:document.getElementById("row$i").style.display = "none";".
|
||||
"document.getElementById("hide$i").style.display = "none";".
|
||||
"document.getElementById("hide$s").style.display = "";".
|
||||
"document.getElementById("data$i").value = "";".
|
||||
|
@ -41,7 +41,7 @@ class UploadTheme extends Themelet {
|
|||
$upload_list .="<img id='wrapper' src='ext/upload/plus.png' />";
|
||||
}else{
|
||||
$upload_list .=
|
||||
"<a href='javascript:document.getElementById("row$a").style.display = "";".
|
||||
"<a href='#' onclick='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>";
|
||||
|
@ -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!))';
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -88,7 +88,7 @@ class Layout {
|
|||
|
||||
$debug = get_debug_info();
|
||||
|
||||
$contact = empty($contact_link) ? "" : "<br><a href='$contact_link'>Contact</a>";
|
||||
$contact = empty($contact_link) ? "" : "<br><a href='mailto:$contact_link'>Contact</a>";
|
||||
|
||||
if(empty($this->subheading)) {
|
||||
$subheading = "";
|
||||
|
|
|
@ -6,7 +6,7 @@ class CustomViewImageTheme extends ViewImageTheme {
|
|||
$page->set_title("Image {$image->id}: ".html_escape($image->get_tag_list()));
|
||||
$page->set_heading(html_escape($image->get_tag_list()));
|
||||
$page->add_block(new Block("Navigation", $this->build_navigation($image), "left", 0));
|
||||
$page->add_block(new Block("Statistics", $this->build_stats($image), "left", 10));
|
||||
$page->add_block(new Block("Statistics", $this->build_stats($image), "left", 15));
|
||||
$page->add_block(new Block(null, $this->build_image_editor($image, $editor_parts), "main", 10));
|
||||
$page->add_block(new Block(null, $this->build_pin($image), "main", 11));
|
||||
}
|
||||
|
|
|
@ -42,7 +42,7 @@ class Layout {
|
|||
|
||||
$debug = get_debug_info();
|
||||
|
||||
$contact = empty($contact_link) ? "" : "<br><a href='$contact_link'>Contact</a>";
|
||||
$contact = empty($contact_link) ? "" : "<br><a href='mailto:$contact_link'>Contact</a>";
|
||||
|
||||
$wrapper = "";
|
||||
if(strlen($page->heading) > 100) {
|
||||
|
|
|
@ -42,7 +42,7 @@ class Layout {
|
|||
|
||||
$debug = get_debug_info();
|
||||
|
||||
$contact = empty($contact_link) ? "" : "<br><a href='$contact_link'>Contact</a>";
|
||||
$contact = empty($contact_link) ? "" : "<br><a href='mailto:$contact_link'>Contact</a>";
|
||||
$subheading = empty($page->subheading) ? "" : "<div id='subtitle'>{$page->subheading}</div>";
|
||||
|
||||
$wrapper = "";
|
||||
|
|
|
@ -37,7 +37,7 @@ class Layout {
|
|||
|
||||
$debug = get_debug_info();
|
||||
|
||||
$contact = empty($contact_link) ? "" : "<br><a href='$contact_link'>Contact</a>";
|
||||
$contact = empty($contact_link) ? "" : "<br><a href='mailto:$contact_link'>Contact</a>";
|
||||
|
||||
if(empty($page->subheading)) {
|
||||
$subheading = "";
|
||||
|
|
|
@ -138,7 +138,7 @@ class Layout {
|
|||
|
||||
$debug = get_debug_info();
|
||||
|
||||
$contact = empty($contact_link) ? "" : "<br><a href='$contact_link'>Contact</a>";
|
||||
$contact = empty($contact_link) ? "" : "<br><a href='mailto:$contact_link'>Contact</a>";
|
||||
$subheading = empty($page->subheading) ? "" : "<div id='subtitle'>{$page->subheading}</div>";
|
||||
|
||||
$wrapper = "";
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
class CustomViewImageTheme extends ViewImageTheme {
|
||||
public function display_page($image, $editor_parts) {
|
||||
global $page;
|
||||
$metatags = str_replace(" ", ", ", html_escape($image->get_tag_list()));
|
||||
$page->set_title("Image {$image->id}: ".html_escape($image->get_tag_list()));
|
||||
$page->set_heading(html_escape($image->get_tag_list()));
|
||||
$page->add_html_header("<meta name=\"keywords\" content=\"$metatags\">");
|
||||
|
@ -11,7 +12,7 @@ class CustomViewImageTheme extends ViewImageTheme {
|
|||
$page->add_html_header("<meta property=\"og:image\" content=\"".make_http($image->get_thumb_link())."\">");
|
||||
$page->add_html_header("<meta property=\"og:url\" content=\"".make_http(make_link("post/view/{$image->id}"))."\">");
|
||||
$page->add_block(new Block("Navigation", $this->build_navigation($image), "left", 0));
|
||||
$page->add_block(new Block("Statistics", $this->build_stats($image), "left", 10));
|
||||
$page->add_block(new Block("Statistics", $this->build_stats($image), "left", 15));
|
||||
$page->add_block(new Block(null, $this->build_image_editor($image, $editor_parts), "main", 10));
|
||||
$page->add_block(new Block(null, $this->build_pin($image), "main", 11));
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ class Layout {
|
|||
|
||||
$debug = get_debug_info();
|
||||
|
||||
$contact = empty($contact_link) ? "" : "<br><a href='$contact_link'>Contact</a>";
|
||||
$contact = empty($contact_link) ? "" : "<br><a href='mailto:$contact_link'>Contact</a>";
|
||||
$subheading = empty($page->subheading) ? "" : "<div id='subtitle'>{$page->subheading}</div>";
|
||||
|
||||
$wrapper = "";
|
||||
|
|
|
@ -47,7 +47,7 @@ class Layout {
|
|||
|
||||
$debug = get_debug_info();
|
||||
|
||||
$contact = empty($contact_link) ? "" : "<br><a href='$contact_link'>Contact</a>";
|
||||
$contact = empty($contact_link) ? "" : "<br><a href='mailto:$contact_link'>Contact</a>";
|
||||
$subheading = empty($page->subheading) ? "" : "<div id='subtitle'>{$page->subheading}</div>";
|
||||
|
||||
$wrapper = "";
|
||||
|
|
Reference in a new issue