summaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
Diffstat (limited to 'js')
-rw-r--r--js/expand-all-images.js28
-rw-r--r--js/post-hover.js1
2 files changed, 29 insertions, 0 deletions
diff --git a/js/expand-all-images.js b/js/expand-all-images.js
new file mode 100644
index 00000000..6cca09c8
--- /dev/null
+++ b/js/expand-all-images.js
@@ -0,0 +1,28 @@
+/*
+ * expand-all-images.js
+ * https://github.com/savetheinternet/Tinyboard/blob/master/js/expand-all-images.js
+ *
+ * Adds an "Expand all images" button to the top of the page.
+ *
+ * Released under the MIT license
+ * Copyright (c) 2012-2013 Michael Save <savetheinternet@tinyboard.org>
+ *
+ * Usage:
+ * $config['additional_javascript'][] = 'js/jquery.min.js';
+ * $config['additional_javascript'][] = 'js/inline-expanding.js';
+ * $config['additional_javascript'][] = 'js/expand-all-images.js';
+ *
+ */
+
+onready(function(){
+ $('hr:first').before('<div id="expand-all-images" style="text-align:right"><a class="unimportant" href="javascript:void(0)"></a></div>');
+ $('div#expand-all-images a')
+ .text(_('Expand all images'))
+ .click(function() {
+ $('a img.post-image').each(function() {
+ if (!$(this).parent()[0].dataset.expanded)
+ $(this).parent().click();
+ });
+ $(this).parent().remove();
+ });
+});
diff --git a/js/post-hover.js b/js/post-hover.js
index 783740df..10542f20 100644
--- a/js/post-hover.js
+++ b/js/post-hover.js
@@ -110,6 +110,7 @@ onready(function(){
}
$post = $('[data-board="' + board + '"] div.post#reply_' + id + ', [data-board="' + board + '"]div#thread_' + id);
+
if(hovering && $post.length > 0) {
start_hover($link);
}