diff options
Diffstat (limited to 'js/util.js')
-rw-r--r-- | js/util.js | 36 |
1 files changed, 27 insertions, 9 deletions
diff --git a/js/util.js b/js/util.js index 65a77960a..9bb7c9128 100644 --- a/js/util.js +++ b/js/util.js @@ -49,8 +49,9 @@ $(document).ready(function(){ // run once in case there's something in there counter(); - // set the focus - $("#notice_data-text").focus(); + if($('body')[0].id != 'conversation') { + $("#notice_data-text").focus(); + } } // XXX: refactor this code @@ -222,6 +223,7 @@ $(document).ready(function(){ } $("#notice_data-text").val(""); $("#notice_data-attach").val(""); + $('#notice_data-attach_selected').remove(); counter(); } $("#form_notice").removeClass("processing"); @@ -233,6 +235,7 @@ $(document).ready(function(){ $("#form_notice").each(addAjaxHidden); NoticeReply(); NoticeAttachments(); + NoticeDataAttach(); }); function NoticeReply() { @@ -270,23 +273,25 @@ function NoticeAttachments() { color : '#000', opacity : '0.6', zIndex : 99, - center : true, + center : false, imgLoading : $('address .url')[0].href+'theme/base/images/illustrations/illu_progress_loading-01.gif', bgClickToClose : true, success : function() { $('#jOverlayContent').append('<button>×</button>'); $('#jOverlayContent button').click($.closeOverlay); }, - timeout : 0 + timeout : 0, + autoHide : true, + css : {'max-width':'502px', 'top':'22.5%', 'left':'32.5%'} }; - $('a.attachment').click(function() { - $().jOverlay({url: $('address .url')[0].href+'/attachment/' + ($(this).attr('id').substring('attachment'.length + 1)) + '/ajax'}); + $('#content .notice a.attachment').click(function() { + $().jOverlay({url: $('address .url')[0].href+'attachment/' + ($(this).attr('id').substring('attachment'.length + 1)) + '/ajax'}); return false; }); - + var t; - $("body:not(#shownotice) a.thumbnail").hover( + $("body:not(#shownotice) #content .notice a.thumbnail").hover( function() { var anchor = $(this); $("a.thumbnail").children('img').hide(); @@ -294,7 +299,7 @@ function NoticeAttachments() { if (anchor.children('img').length == 0) { t = setTimeout(function() { - $.get($('address .url')[0].href+'/attachment/' + (anchor.attr('id').substring('attachment'.length + 1)) + '/thumbnail', null, function(data) { + $.get($('address .url')[0].href+'attachment/' + (anchor.attr('id').substring('attachment'.length + 1)) + '/thumbnail', null, function(data) { anchor.append(data); }); }, 500); @@ -310,3 +315,16 @@ function NoticeAttachments() { } ); } + +function NoticeDataAttach() { + NDA = $('#notice_data-attach'); + NDA.change(function() { + S = '<div id="notice_data-attach_selected" class="success"><code>'+$(this).val()+'</code> <button>×</button></div>'; + NDAS = $('#notice_data-attach_selected'); + (NDAS.length > 0) ? NDAS.replaceWith(S) : $('#form_notice').append(S); + $('#notice_data-attach_selected button').click(function(){ + $('#notice_data-attach_selected').remove(); + NDA.val(''); + }); + }); +} |