diff options
| author | czaks <marcin@6irc.net> | 2013-08-02 01:05:29 -0400 |
|---|---|---|
| committer | czaks <marcin@6irc.net> | 2013-08-02 01:05:29 -0400 |
| commit | 49993a355966129768069daa128984cdd66e1214 (patch) | |
| tree | 4178b1c200823b75b3747065be0347e66e80d713 /js | |
| parent | 22cecf9de789d600b68af2796dba026628196e31 (diff) | |
inline-expanding-filename.js: expand images also by clicking a link and not image
Diffstat (limited to 'js')
| -rw-r--r-- | js/inline-expanding-filename.js | 33 |
1 files changed, 33 insertions, 0 deletions
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 <marcin@6irc.net> + * + * 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); + }); +}); |
