From cd3e2ef45849af8f3c38397977d3fe9e81c45b34 Mon Sep 17 00:00:00 2001 From: Michael Foster Date: Sat, 17 Aug 2013 14:54:41 +1000 Subject: [PATCH] js/expand-all-images.js --- js/expand-all-images.js | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 js/expand-all-images.js 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 + * + * 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#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(); + }); +});