+ },
+
+ FormNoticeXHR: function() {
+ $('#'+SN.C.S.FormNotice).append('<input type="hidden" name="ajax" value="1"/>');
+ $('#'+SN.C.S.FormNotice).ajaxForm({
+ timeout: '60000',
+ beforeSend: function(xhr) {
+ if ($('#'+SN.C.S.NoticeDataText)[0].value.length === 0) {
+ $('#'+SN.C.S.FormNotice).addClass(SN.C.S.Warning);
+ return false;
+ }
+ $('#'+SN.C.S.FormNotice).addClass(SN.C.S.Processing);
+ $('#'+SN.C.S.NoticeActionSubmit).addClass(SN.C.S.Disabled);
+ $('#'+SN.C.S.NoticeActionSubmit).attr(SN.C.S.Disabled, SN.C.S.Disabled);
+ return true;
+ },
+ error: function (xhr, textStatus, errorThrown) {
+ $('#'+SN.C.S.FormNotice).removeClass(SN.C.S.Processing);
+ $('#'+SN.C.S.NoticeActionSubmit).removeClass(SN.C.S.Disabled);
+ $('#'+SN.C.S.NoticeActionSubmit).removeAttr(SN.C.S.Disabled, SN.C.S.Disabled);
+ if (textStatus == 'timeout') {
+ alert ('Sorry! We had trouble sending your notice. The servers are overloaded. Please try again, and contact the site administrator if this problem persists');
+ }
+ else {
+ if ($('.'+SN.C.S.Error, xhr.responseXML).length > 0) {
+ $('#'+SN.C.S.FormNotice).append(document._importNode($('.'+SN.C.S.Error, xhr.responseXML)[0], true));
+ }
+ else {
+ if(jQuery.inArray(parseInt(xhr.status), SN.C.I.HTTP20x30x) < 0) {
+ alert('Sorry! We had trouble sending your notice ('+xhr.status+' '+xhr.statusText+'). Please report the problem to the site administrator if this happens again.');
+ }
+ else {
+ SN.C.I.NoticeDataText.val('');
+// SN.U.NoticeTextCounter($('#'+SN.C.S.NoticeDataText), $('#'+SN.C.S.NoticeTextCount), SN.C.I.NoticeTextCharMax);
+ }
+ }
+ }
+ },
+ success: function(data, textStatus) {
+ if ($('#'+SN.C.S.Error, data).length > 0) {
+ var result = document._importNode($('p', data)[0], true);
+ alert(result.textContent || result.innerHTML);
+ }
+ else {
+ if($('body')[0].id == 'bookmarklet') {
+ self.close();
+ }
+ if ($('#'+SN.C.S.CommandResult, data).length > 0) {
+ var result = document._importNode($('p', data)[0], true);
+ alert(result.textContent || result.innerHTML);
+ }
+ else {
+ notice = $('li', data)[0];
+ if ($('#'+notice.id).length === 0) {
+ var notice_irt_value = $('#'+SN.C.S.NoticeInReplyTo).val();
+ var notice_irt = '#notices_primary #notice-'+notice_irt_value;
+ if($('body')[0].id == 'conversation') {
+ if(notice_irt_value.length > 0 && $(notice_irt+' .notices').length < 1) {
+ $(notice_irt).append('<ul class="notices"></ul>');
+ }
+ $($(notice_irt+' .notices')[0]).append(document._importNode(notice, true));
+ }
+ else {
+ $("#notices_primary .notices").prepend(document._importNode(notice, true));
+ }
+ $('#'+notice.id).css({display:'none'});
+ $('#'+notice.id).fadeIn(2500);
+// SN.U.NoticeAttachments();
+// SN.U.NoticeReply();
+ }
+ }
+ $('#'+SN.C.S.NoticeDataText).val('');
+ $('#'+SN.C.S.NoticeDataAttach).val('');
+ $('#'+SN.C.S.NoticeInReplyTo).val('');
+// SN.U.NoticeTextCounter($('#'+SN.C.S.NoticeDataText), $('#'+SN.C.S.NoticeTextCount), SN.C.I.NoticeTextCharMax);
+ }
+ },
+ complete: function(xhr, textStatus) {
+ $('#'+SN.C.S.FormNotice).removeClass(SN.C.S.Processing);
+ $('#'+SN.C.S.NoticeActionSubmit).removeAttr(SN.C.S.Disabled);
+ $('#'+SN.C.S.NoticeActionSubmit).removeClass(SN.C.S.Disabled);
+ }
+ });