";
foreach($images as $image) {
- $table .= $this->build_thumb_html($image, $query);
+ $table .= $this->build_thumb_html($image);
}
$table .= "
";
return $table;
diff --git a/lib/shimmie.js b/lib/shimmie.js
index e7b5cc7f..e52a7700 100644
--- a/lib/shimmie.js
+++ b/lib/shimmie.js
@@ -86,6 +86,23 @@ $(document).ready(function() {
a = document.getElementById("nextlink");
a.href = a.href + '?' + query;
}
+
+ /*
+ * If an image list has a data-query attribute, append
+ * that query string to all thumb links inside the list.
+ * This allows us to cache the same thumb for all query
+ * strings, adding the query in the browser.
+ */
+ $(".shm-image-list").each(function(idx, elm) {
+ var query = $(this).data("query");
+ if(query) {
+ if(window.console) {console.log("Found list with query: "+query);}
+ $(this).find(".shm-thumb-link").each(function(idx2, elm2) {
+ if(window.console) {console.log("Appending to url: "+$(this).attr("href"));}
+ $(this).attr("href", $(this).attr("href") + query);
+ });
+ }
+ });
});
diff --git a/themes/danbooru/index.theme.php b/themes/danbooru/index.theme.php
index 155e4a24..b27aa028 100644
--- a/themes/danbooru/index.theme.php
+++ b/themes/danbooru/index.theme.php
@@ -49,9 +49,10 @@ class CustomIndexTheme extends IndexTheme {
}
protected function build_table($images, $query) {
- $table = "
";
+ $h_query = html_escape($query);
+ $table = "
";
foreach($images as $image) {
- $table .= "\t" . $this->build_thumb_html($image, $query) . "\n";
+ $table .= "\t" . $this->build_thumb_html($image) . "\n";
}
$table .= "
";
return $table;
diff --git a/themes/danbooru/themelet.class.php b/themes/danbooru/themelet.class.php
index 6ef57ee8..c74dece9 100644
--- a/themes/danbooru/themelet.class.php
+++ b/themes/danbooru/themelet.class.php
@@ -1,6 +1,6 @@
id}", $query);
$h_thumb_link = $image->get_thumb_link();
@@ -16,7 +16,7 @@ class Themelet extends BaseThemelet {
$tsize = get_thumbnail_size($image->width, $image->height);
}
- return "
";
}
diff --git a/themes/danbooru2/index.theme.php b/themes/danbooru2/index.theme.php
index 429bd0fe..4d0ca68f 100644
--- a/themes/danbooru2/index.theme.php
+++ b/themes/danbooru2/index.theme.php
@@ -49,9 +49,10 @@ class CustomIndexTheme extends IndexTheme {
}
protected function build_table($images, $query) {
- $table = "
";
+ $h_query = html_escape($query);
+ $table = "
";
foreach($images as $image) {
- $table .= "\t" . $this->build_thumb_html($image, $query) . "\n";
+ $table .= "\t" . $this->build_thumb_html($image) . "\n";
}
$table .= "
";
return $table;
diff --git a/themes/danbooru2/themelet.class.php b/themes/danbooru2/themelet.class.php
index 6ef57ee8..c74dece9 100644
--- a/themes/danbooru2/themelet.class.php
+++ b/themes/danbooru2/themelet.class.php
@@ -1,6 +1,6 @@
id}", $query);
$h_thumb_link = $image->get_thumb_link();
@@ -16,7 +16,7 @@ class Themelet extends BaseThemelet {
$tsize = get_thumbnail_size($image->width, $image->height);
}
- return "
";
}
diff --git a/themes/futaba/themelet.class.php b/themes/futaba/themelet.class.php
index cfff9d50..35034e4e 100644
--- a/themes/futaba/themelet.class.php
+++ b/themes/futaba/themelet.class.php
@@ -4,7 +4,7 @@ class Themelet extends BaseThemelet {
* Generic thumbnail code; returns HTML rather than adding
* a block since thumbs tend to go inside blocks...
*/
- public function build_thumb_html(Image $image, $query=null) {
+ public function build_thumb_html(Image $image) {
global $config;
$h_view_link = make_link("post/view/{$image->id}", $query);
$h_thumb_link = $image->get_thumb_link();
@@ -20,7 +20,7 @@ class Themelet extends BaseThemelet {
$tsize = get_thumbnail_size($image->width, $image->height);
}
- return "
";
}
diff --git a/themes/lite/themelet.class.php b/themes/lite/themelet.class.php
index c61c9e4a..41a5ba5f 100644
--- a/themes/lite/themelet.class.php
+++ b/themes/lite/themelet.class.php
@@ -4,7 +4,7 @@ class Themelet extends BaseThemelet {
* Generic thumbnail code; returns HTML rather than adding
* a block since thumbs tend to go inside blocks...
*/
- public function build_thumb_html(Image $image, $query=null) {
+ public function build_thumb_html(Image $image) {
global $config;
$i_id = (int) $image->id;
$h_view_link = make_link('post/view/'.$i_id, $query);
@@ -22,7 +22,7 @@ class Themelet extends BaseThemelet {
}
return '
\n";