CounterBlackout: false,
MaxLength: 140,
PatternUsername: /^[0-9a-zA-Z\-_.]*$/,
- HTTP20x30x: [200, 201, 202, 203, 204, 205, 206, 300, 301, 302, 303, 304, 305, 306, 307],
- UploadCounter: 0
+ HTTP20x30x: [200, 201, 202, 203, 204, 205, 206, 300, 301, 302, 303, 304, 305, 306, 307]
},
S: { // Selector
form.find('#'+SN.C.S.NoticeTextCount).text(jQuery.data(form[0], 'ElementData').MaxLength);
}
- if ($('body')[0].id != 'conversation' && window.location.hash.length === 0) {
+ if ($('body')[0].id != 'conversation' && window.location.hash.length === 0 && $(window).scrollTop() == 0) {
form.find('textarea').focus();
}
},
FormNoticeXHR: function(form) {
SN.C.I.NoticeDataGeo = {};
form.append('<input type="hidden" name="ajax" value="1"/>');
-
form.ajaxForm({
dataType: 'xml',
timeout: '60000',
}
else {
if (parseInt(xhr.status) === 0 || jQuery.inArray(parseInt(xhr.status), SN.C.I.HTTP20x30x) >= 0) {
- form.resetForm();
- SN.U.NoticeClearAttachments(form);
- SN.C.I.UploadCounter = 0;
- SN.U.NoticeNewAttachment($('fieldset', form));
+ form
+ .resetForm()
+ .find('#'+SN.C.S.NoticeDataAttachSelected).remove();
SN.U.FormNoticeEnhancements(form);
}
else {
}
}
form.resetForm();
- SN.U.NoticeClearAttachments(form);
- SN.C.I.UploadCounter = 0;
- SN.U.NoticeNewAttachment($('fieldset', form));
+ form.find('#'+SN.C.S.NoticeInReplyTo).val('');
+ form.find('#'+SN.C.S.NoticeDataAttachSelected).remove();
SN.U.FormNoticeEnhancements(form);
}
},
}
});
},
-
- NoticeClearAttachments: function(form) {
- $('input:file', form).remove();
- $('div[class=' + SN.C.S.Success + ']', form).remove();
- },
NoticeReply: function() {
if ($('#'+SN.C.S.NoticeDataText).length > 0 && $('#content .notice_reply').length > 0) {
}
},
- NoticeDataAttach: function(NDANum) {
- NDA = $('#'+SN.C.S.NoticeDataAttach+NDANum);
+ NoticeDataAttach: function() {
+ NDA = $('#'+SN.C.S.NoticeDataAttach);
NDA.change(function() {
- S = '<div id="'+SN.C.S.NoticeDataAttachSelected+SN.C.I.UploadCounter+'" class="'+SN.C.S.Success+'"><code>'+$(this).val()+'</code> <button class="close">×</button></div>';
- $('#'+SN.C.S.FormNotice).append(S);
-
- $('#'+SN.C.S.NoticeDataAttachSelected+SN.C.I.UploadCounter+' button').click(function(){
- $('#'+this.parentNode.getAttribute("id")).remove();
- $('#'+this.parentNode.getAttribute("id").replace("_selected", "")).remove();
+ S = '<div id="'+SN.C.S.NoticeDataAttachSelected+'" class="'+SN.C.S.Success+'"><code>'+$(this).val()+'</code> <button class="close">×</button></div>';
+ NDAS = $('#'+SN.C.S.NoticeDataAttachSelected);
+ if (NDAS.length > 0) {
+ NDAS.replaceWith(S);
+ }
+ else {
+ $('#'+SN.C.S.FormNotice).append(S);
+ }
+ $('#'+SN.C.S.NoticeDataAttachSelected+' button').click(function(){
+ $('#'+SN.C.S.NoticeDataAttachSelected).remove();
NDA.val('');
return false;
});
- SN.C.I.UploadCounter++;
- NDA.attr('style', 'display: none;');
- SN.U.NoticeNewAttachment(NDA.parent());
- $('#notice_data-attach-label').attr('for', SN.C.S.NoticeDataAttach+SN.C.I.UploadCounter);
});
},
-
- NoticeNewAttachment: function(parent) {
- NEWFILE = '<input id="'+SN.C.S.NoticeDataAttach+SN.C.I.UploadCounter+'" class="attach" type="file" name="attach'+SN.C.I.UploadCounter+'" title="'+NoticeAttachment_text.AttachFile+'"/>';
- parent.append(NEWFILE);
- SN.U.NoticeDataAttach(SN.C.I.UploadCounter);
- },
NoticeLocationAttach: function() {
var NLat = $('#'+SN.C.S.NoticeLat).val();
SN.U.FormNoticeEnhancements($(this));
});
- SN.U.NoticeDataAttach("");
+ SN.U.NoticeDataAttach();
}
},