-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathpost_post_ajax.htm
95 lines (72 loc) · 2.57 KB
/
post_post_ajax.htm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
<!--{json width:"940",title:"回复帖子"}-->
<style type="text/css">
.post_form dt {width: 5%;}
.post_form dd {width: 93%;}
</style>
<form action="?post-post-fid-$fid-tid-$tid-pid-$pid-ajax-1.htm" method="post" id="post_form_$pid" class="post_form" target="_blank">
<input type="hidden" name="FORM_HASH" value="{FORM_HASH}" />
<!--{hook common_form_hash_after.htm}-->
<dl>
<!--{hook post_post_subject_before.htm}-->
<dt>回复:</dt>
<dd>$thread[subject]</dd>
<!--{hook post_post_subject_after.htm}-->
<dt><label for="message">内容:</label></dt>
<dd style="position: relative;"><textarea name="message" id="post_message_$pid" style="width: 855px; height: 400px;">$message</textarea></dd>
<!--{hook post_post_message_after.htm}-->
<dt></dt>
<dd>
<input type="submit" class="button bigblue" id="post_submit_$pid" value="回复" />
<input type="button" class="button biggrey" value="取消" id="post_cancel_$pid" />
<!--{hook post_post_button_end.htm}-->
</dd>
</dl>
</form>
<!--{hook post_post_ajax_js_before.htm}-->
<script type="text/javascript">
function delay_execute(dialog, recall) {
// hook post_post_delay_execute_start.htm
$('#post_message_$pid')[0].focus();
// 自动伸缩,自动提交
$('#post_message_$pid').keyup(function(e) {
if((e.ctrlKey && (e.which == 13 || e.which == 10)) || (e.altKey && e.which == 83)) {
$('#post_submit_$pid').trigger('click');
return false;
}
});
$('#post_submit_$pid').click(function() {
$('div.alert').remove();
$('#post_submit_$pid').disable();
var postdata = $("#post_form_$pid").serialize();
$.post($('#post_form_$pid').attr('action'), postdata, function(s){
$('#post_submit_$pid').enable();
var json = json_decode(s);
if(error = json_error(json)) {alert(error); return false;}
if(json.status <=0) {
alert(json.message);
return false;
}
json = json.message;
if(json.message) {
$('#post_message_$pid').parent().alert(json.message, {width: 250, delay: 3000});
$('#post_message_$pid')[0].focus();
return false;
}
var page = json.post.page;
// hook post_post_submit_after_js.htm
dialog.set_body('<div class="ok">回复成功!</div>');
setTimeout(function(){
dialog.close(1);
window.location= '?thread-index-fid-$fid-tid-$tid-page-'+page+'-scrollbottom-1.htm';
}, 500);
});
// hook post_post_ajax_post_after.htm
return false;
});
$('#post_cancel_$pid').click(function() {
dialog.close(1);
});
// hook post_post_delay_execute_end.htm
// hook common_form_hash_after_js.htm
}
</script>