PostNotice AJAX working in all browsers except IE
darcs-hash:20081123015559-eefa4-5ce05e6e79236c6d5ebc87f0aa3ec4de51bae130.gz
This commit is contained in:
parent
cc10e1505f
commit
04a4e883f0
|
@ -50,7 +50,6 @@ class NewnoticeAction extends Action {
|
|||
if (!$content) {
|
||||
$this->show_form(_('No content!'));
|
||||
return;
|
||||
// } else if (mb_strlen($content) > 140) {
|
||||
} else {
|
||||
$content = common_shorten_links($content);
|
||||
|
||||
|
|
32
js/util.js
32
js/util.js
|
@ -26,9 +26,9 @@ $(document).ready(function(){
|
|||
counter.text(remaining);
|
||||
|
||||
if (remaining <= 0) {
|
||||
counter.addClass("toomuch");
|
||||
$("#status_form").addClass("response_error");
|
||||
} else {
|
||||
counter.removeClass("toomuch");
|
||||
$("#status_form").removeClass("response_error");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -56,7 +56,7 @@ $(document).ready(function(){
|
|||
// XXX: refactor this code
|
||||
|
||||
var favoptions = { dataType: 'xml',
|
||||
success: function(xml) { var new_form = document._importNode($('form', xml).get(0), true);
|
||||
success: function(xml) { alert("success");var new_form = document._importNode($('form', xml).get(0), true);
|
||||
var dis = new_form.id;
|
||||
var fav = dis.replace('disfavor', 'favor');
|
||||
$('form#'+fav).replaceWith(new_form);
|
||||
|
@ -117,6 +117,32 @@ $(document).ready(function(){
|
|||
$("form.unsubscribe").ajaxForm(UnSubscribe);
|
||||
$("form.subscribe").each(addAjaxHidden);
|
||||
$("form.unsubscribe").each(addAjaxHidden);
|
||||
|
||||
|
||||
var PostNotice = { dataType: 'xml',
|
||||
beforeSubmit: function(formData, jqForm, options) { if ($("#status_textarea").get(0).value.length == 0) {
|
||||
$("#status_form").addClass("response_error");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
},
|
||||
success: function(xml) {
|
||||
if ($(".error", xml).length > 0) {
|
||||
var response_error = document._importNode($(".error", xml).get(0), true);
|
||||
response_error = response_error.textContent || response_error.innerHTML;
|
||||
alert(response_error);
|
||||
}
|
||||
else {
|
||||
$("#notices").prepend(document._importNode($("li", xml).get(0), true));
|
||||
$("#status_textarea").val("");
|
||||
counter();
|
||||
$(".notice_single:first").css({display:"none"});
|
||||
$(".notice_single:first").fadeIn(2500);
|
||||
}
|
||||
}
|
||||
}
|
||||
$("#status_form").ajaxForm(PostNotice);
|
||||
$("#status_form").each(addAjaxHidden);
|
||||
});
|
||||
|
||||
function doreply(nick,id) {
|
||||
|
|
|
@ -43,4 +43,4 @@ document._importNode = function(node, allChildren) {
|
|||
return document.createTextNode(node.nodeValue);
|
||||
break;
|
||||
}
|
||||
};
|
||||
};
|
||||
|
|
|
@ -189,6 +189,7 @@ form#favor, form.favor {
|
|||
input#favor, input.favor,
|
||||
input#disfavor, input.disfavor {
|
||||
background-color:#fcfff5;
|
||||
background-color:transparent;
|
||||
background-image:url(icon_heart-02.gif);
|
||||
background-repeat:no-repeat;
|
||||
cursor: pointer;
|
||||
|
@ -339,6 +340,8 @@ font-size:14px;
|
|||
font-size: 13px;
|
||||
line-height: 16px;
|
||||
border-bottom: 1px solid #dec5b5;
|
||||
background-color:#FCFFF5;
|
||||
opacity:1;
|
||||
}
|
||||
.notice_single:hover {
|
||||
background-color: #f7ebcc;
|
||||
|
@ -349,10 +352,11 @@ font-size:14px;
|
|||
padding: 0;
|
||||
}
|
||||
#notice_delete_form #confirmation_text {
|
||||
display: block;
|
||||
display: block;
|
||||
font-size: 14px;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
input#submit_yes, input#submit_no {
|
||||
margin: 18px 10px 0px 0px;
|
||||
padding: 4px;
|
||||
|
@ -673,6 +677,13 @@ textarea {
|
|||
font-weight: bold;
|
||||
text-align: right;
|
||||
}
|
||||
.response_error textarea,
|
||||
.response_error .on_max {
|
||||
background-color:#fee;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* ----- Subscribe Form ----- */
|
||||
#content .subscribe .submit, #content .unsubscribe .submit, #remotesubscribe .button, #remotesubscribe {
|
||||
clear: left;
|
||||
|
@ -964,4 +975,4 @@ margin-left:4.5em;
|
|||
display: inline;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user