From 49993a355966129768069daa128984cdd66e1214 Mon Sep 17 00:00:00 2001 From: czaks Date: Fri, 2 Aug 2013 01:05:29 -0400 Subject: [PATCH] inline-expanding-filename.js: expand images also by clicking a link and not image --- js/inline-expanding-filename.js | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 js/inline-expanding-filename.js diff --git a/js/inline-expanding-filename.js b/js/inline-expanding-filename.js new file mode 100644 index 00000000..048a0e1a --- /dev/null +++ b/js/inline-expanding-filename.js @@ -0,0 +1,33 @@ +/* + * inline-expanding-filename.js + * Binds image filename link to expanding, to make kusaba x users somewhat more accustomed. + * https://github.com/vichan-devel/Tinyboard/blob/master/js/inline-expanding.js + * + * Released under the MIT license + * Copyright (c) 2012-2013 Marcin Ɓabanowski + * + * Usage: + * $config['additional_javascript'][] = 'js/jquery.min.js'; + * $config['additional_javascript'][] = 'js/inline-expanding.js'; + * $config['additional_javascript'][] = 'js/inline-expanding-filename.js'; + * + */ + +onready(function(){ + var inline_expanding_filename = function() { + $(this).find(".fileinfo > a").click(function(){ + var imagelink = $(this).parent().parent().find('a[target="_blank"]:first'); + if(imagelink.length > 0) { + imagelink.click(); + return false; + } + }); + }; + + $('div[id^="thread_"]').each(inline_expanding_filename); + + // allow to work with auto-reload.js, etc. + $(document).bind('new_post', function(e, post) { + inline_expanding_filename.call(post); + }); +});