diff options
Diffstat (limited to 'js/util.js')
-rw-r--r-- | js/util.js | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/js/util.js b/js/util.js index c710ae839..acf44a17c 100644 --- a/js/util.js +++ b/js/util.js @@ -17,6 +17,41 @@ */ $(document).ready(function(){ + $('input#notice_data-attach').toggle(); + $('label[for=notice_data-attach]').text('Upload a file as an attachment?'); + $('label[for=notice_data-attach]').click(function () { + if ('Upload a file as an attachment?' == $(this).text()) { + $(this).text('Upload: '); + $('input#notice_data-attach').slideDown('fast'); + } else { + $('input#notice_data-attach').slideUp('fast', function() {$('label[for=notice_data-attach]').text('Upload a file as an attachment?');}); + } + }); + + $('a.attachment').click(function() {$().jOverlay({url: $('address .url')[0].href+'/attachment/' + ($(this).attr('id').substring('attachment'.length + 1)) + '/ajax'}); return false; }); + $("a.thumbnail").hover( + function() { + var anchor = $(this); + $("a.thumbnail").children('img').remove(); + + setTimeout(function() { + anchor.closest(".entry-title").addClass('ov'); + $.get($('address .url')[0].href+'/attachment/' + (anchor.attr('id').substring('attachment'.length + 1)) + '/thumbnail', null, function(data) { + anchor.append(data); + }); + }, 250); + + setTimeout(function() { + anchor.children('img').remove(); + anchor.closest(".entry-title").removeClass('ov'); + }, 3000); + }, + function() { + $(this).children('img').remove(); + $(this).closest(".entry-title").removeClass('ov'); + } + ); + // count character on keyup function counter(event){ var maxLength = 140; @@ -203,6 +238,7 @@ $(document).ready(function(){ } } $("#notice_data-text").val(""); + $("#notice_data-attach").val(""); counter(); } $("#form_notice").removeClass("processing"); |