From 8e4ae87c657588688d0cfe11b093aa5ffad689be Mon Sep 17 00:00:00 2001 From: Daku Date: Sat, 18 Feb 2012 01:27:12 +0000 Subject: [PATCH 1/4] fix for image pages not loading for danbooru/lite themes --- themes/danbooru/view.theme.php | 2 +- themes/lite/view.theme.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/themes/danbooru/view.theme.php b/themes/danbooru/view.theme.php index ae5895e6..e909bd6e 100644 --- a/themes/danbooru/view.theme.php +++ b/themes/danbooru/view.theme.php @@ -7,7 +7,7 @@ class CustomViewImageTheme extends ViewImageTheme { $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", 15)); - $page->add_block(new Block(null, $this->build_image_editor($image, $editor_parts), "main", 10)); + $page->add_block(new Block(null, $this->build_info($image, $editor_parts), "main", 10)); $page->add_block(new Block(null, $this->build_pin($image), "main", 11)); } diff --git a/themes/lite/view.theme.php b/themes/lite/view.theme.php index 1327b33a..1d075041 100644 --- a/themes/lite/view.theme.php +++ b/themes/lite/view.theme.php @@ -13,7 +13,7 @@ class CustomViewImageTheme extends ViewImageTheme { $page->add_html_header("id}"))."\">"); $page->add_block(new Block("Navigation", $this->build_navigation($image), "left", 0)); $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_info($image, $editor_parts), "main", 10)); $page->add_block(new Block(null, $this->build_pin($image), "main", 11)); } From 74e307b55fcaf25259d3b606b70e798b1a2e7284 Mon Sep 17 00:00:00 2001 From: Daku Date: Sun, 26 Feb 2012 15:13:07 +0000 Subject: [PATCH 2/4] update tags if image already exists --- ext/image/main.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ext/image/main.php b/ext/image/main.php index 15b08f87..6db78525 100644 --- a/ext/image/main.php +++ b/ext/image/main.php @@ -307,6 +307,8 @@ class ImageIO extends Extension { return null; } else { + $merged = array_merge($image->get_tag_array(), $existing->get_tag_array()); //TODO: Make this only work if &update=1 is set + send_event(new TagSetEvent($existing, $merged)); //Update tags even if image exists $error = "Image {$existing->id} ". "already has hash {$image->hash}:

".Themelet::build_thumb_html($existing); throw new ImageAdditionException($error); From e5e27a78049d2b12bd0495e6497d69a2b8d220c0 Mon Sep 17 00:00:00 2001 From: Daku Date: Fri, 2 Mar 2012 07:25:06 +0000 Subject: [PATCH 3/4] bookmarklet should now play nice with tags that contain + --- ext/upload/bookmarklet.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ext/upload/bookmarklet.js b/ext/upload/bookmarklet.js index 590adaef..b16dcd94 100644 --- a/ext/upload/bookmarklet.js +++ b/ext/upload/bookmarklet.js @@ -1,16 +1,19 @@ /* Imageboard to Shimmie */ // This should work with "most" sites running Danbooru/Gelbooru/Shimmie +//TODO: Make this use jQuery! 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 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){ + //Do nothing }else{ var tag=prompt("Enter Tags",""); var chk=1; //This makes sure it doesn't use current tags. } }else if (CA === 1){ //Current Tags + //Do nothing }else if (CA === 2){ //New Tags var tag=prompt("Enter Tags",""); var chk=1; @@ -19,6 +22,7 @@ if (CA === 0 || CA > 2){ //Default // 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;} + tag = tag.replace(/\+/g, "%2B"); //This should stop + not showing in tags :x var srx="http://" + document.location.hostname + document.location.href.match("\/post\/show\/[0-9]+"); if(srx.search("oreno\\.imouto") >= 0 || srx.search("konachan\\.com") >= 0){ var rtg=document.getElementById("stats").innerHTML.match("

  • Rating: (.*) Date: Fri, 2 Mar 2012 08:44:18 +0000 Subject: [PATCH 4/4] option to sort taglists alphabetically rather than by tag count --- ext/tag_list/main.php | 10 ++++++++++ ext/tag_list/theme.php | 3 +++ 2 files changed, 13 insertions(+) diff --git a/ext/tag_list/main.php b/ext/tag_list/main.php index 58d8b24e..20fcdfd7 100644 --- a/ext/tag_list/main.php +++ b/ext/tag_list/main.php @@ -14,6 +14,8 @@ class TagList extends Extension { $config->set_default_int("tags_min", 3); $config->set_default_string("info_link", 'http://en.wikipedia.org/wiki/$tag'); $config->set_default_string("tag_list_image_type", 'related'); + $config->set_default_string("tag_list_related_sort", 'alphabetical'); + $config->set_default_string("tag_list_popular_sort", 'tagcount'); $config->set_default_bool("tag_list_pages", false); } @@ -98,6 +100,14 @@ class TagList extends Extension { "Image's tags only" => "tags", "Show related" => "related" ), "
    Image tag list: "); + $sb->add_choice_option("tag_list_related_sort", array( + "Tag Count" => "tagcount", + "Alphabetical" => "alphabetical" + ), "
    Sort related list by: "); + $sb->add_choice_option("tag_list_popular_sort", array( + "Tag Count" => "tagcount", + "Alphabetical" => "alphabetical" + ), "
    Sort popular list by: "); $sb->add_bool_option("tag_list_numbers", "
    Show tag counts: "); $event->panel->add_block($sb); } diff --git a/ext/tag_list/theme.php b/ext/tag_list/theme.php index a0684041..2ed81e74 100644 --- a/ext/tag_list/theme.php +++ b/ext/tag_list/theme.php @@ -36,6 +36,8 @@ class TagListTheme extends Themelet { $html = ""; $n = 0; + if($config->get_string('tag_list_related_sort') == 'alphabetical') asort($tag_infos); + foreach($tag_infos as $row) { $tag = $row['tag']; $h_tag = html_escape($tag); @@ -77,6 +79,7 @@ class TagListTheme extends Themelet { $html = ""; $n = 0; + if($config->get_string('tag_list_popular_sort') == 'alphabetical') asort($tag_infos); foreach($tag_infos as $row) { $tag = $row['tag'];