-
Notifications
You must be signed in to change notification settings - Fork 0
/
replies_content.html
283 lines (261 loc) · 12.6 KB
/
replies_content.html
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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
<!DOCTYPE html>
<html>
<head>
<title></title>
<meta charset="utf-8">
<meta name="viewport" content="target-densitydpi=device-dpi, width=device-width, initial-scale=1, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
<link rel="stylesheet" href="css/ui-base.css">
<link rel="stylesheet" href="css/ui-box.css">
<link rel="stylesheet" href="css/ui-color.css">
<link rel="stylesheet" href="css/ui-365.css">
<script src="js/zy_control.js"></script>
<script src="js/zy_click.js"></script>
<script src="js/zepto.min.js"></script>
<script src="js/beihai365_comman.js"></script>
<script src="js/beihai365_global.js"></script>
<script src="js/base64.js"></script>
</head>
<body class="um-vp" ontouchstart>
<div id="page_0" class="up ub ub-ver" tabindex="0">
<div id="content" class="ub-f1 tx-l t-bla ub-img6 vh">
<div class="postArea">
<!--<div class="postTitle">
<input type='text' id='atc_title' value='' placeholder="填写标题">
</div>-->
<div class="postText">
<textarea id='atc_content' placeholder="点击这里输入内容"></textarea>
</div>
<input type='hidden' id='img' value=''>
<!--按钮开始-->
<!--<div ontouchstart="zy_touch('btn-act')" onclick='xmlHttpPost()' class="btn uba b-bla uinn5 c-blu2 c-m1 uc-a1 t-wh">发布帖子</div>-->
<!--按钮结束-->
<!--<div ontouchstart="zy_touch('btn-act')" onclick="uexCamera.open();" >打开照相机</div>-->
</div>
<div class="upimgbtn" ontouchstart="zy_touch('btn-act')" onclick="uppick();">
<span>上传照片</span>
</div>
<div class='thumbPlace'></div>
<div class='thumbPlace_zao'></div>
</div>
</div>
</body>
<script>
//前方有狼出没,未满18岁请在父母的陪同下阅读
zy_init();
var timer = null;
var b64 = new Base64();
var quoteHTML = '';
window.uexOnload = function(type) {
if (!type) {
uexCamera.cbOpen = getReadyToUpload;
uexUploaderMgr.cbCreateUploader = uexUploaderMgrCbCreateUploader;
uexUploaderMgr.onStatus = uexUploaderMgrStatusCb;
uexImageBrowser.cbPick = getReadyToUpload;
uexXmlHttpMgr.onData = httpSuccess;
function showhidebtn() {
if ($.trim($('#atc_content').val()).length > 5) {
uexWindow.evaluateScript("replies", "0", "PostBtnShow()");
} else {
uexWindow.evaluateScript("replies", "0", "PostBtnShow('ok')");
}
}
timer = setInterval(showhidebtn, 100);
function showhidebtn() {
if ($.trim($('#atc_content').val()).length) {
uexWindow.evaluateScript("replies", "0", "PostBtnShow()");
} else {
uexWindow.evaluateScript("replies", "0", "PostBtnShow('ok')");
}
}
/*
$('#atc_content').focus(function(){
$('.thumbPlace_zao').hide();
});
$('#atc_content').blur(function(){
//$('.thumbPlace_zao').show();
});
*/
loadContent();
}
}
function loadContent() {
var json_url;
/*
if (localStorage.floorac == 'yinyong') {
json_url = reLink("/index.php?jsoncallback=?&c=floor&ac=quote&fid=" + localStorage.fid + "&tid=" + localStorage.tid + "&pid=" + getLocalStorge('pid') + "&article=" + getLocalStorge('lou'))
$.getJSON(json_url, function(data) {
quoteHTML = data.success;
});
} else
*/
if (localStorage.floorac == 'bianji') {
json_url = reLink("/index.php?jsoncallback=?&c=floor&ac=replymodify&fid=" + getLocalStorge('fid') + "&tid=" + getLocalStorge('tid') + "&pid=" + getLocalStorge('pid'))
$.getJSON(json_url, function(data) {
$("#atc_content").html(data.quote + data.noquote_content);
});
} else if (localStorage.floorac == 'chahua') {
$(".upimgbtn").hide();
$(".paizhaobtn").hide();
}
}
var httpCode = 1;
//发图URL
var picUploadHttp = reLink("/index.php?c=threads&m=uploadimg");
var url;
switch(localStorage.floorac) {
case 'bianji' :
url = "/index.php?c=floor&ac=replymodify&fid=" + localStorage.fid + "&tid=" + localStorage.tid + "&pid=" + getLocalStorge('pid') + "&article=" + getLocalStorge('lou') + "&step=2";
break;
case 'chahua' :
url = "/index.php?c=floor&ac=leaveword&fid=" + localStorage.fid + "&tid=" + localStorage.tid + "&pid=" + getLocalStorge('pid') + "&article=" + getLocalStorge('lou') + "&step=2";
break;
default:
url = "/index.php?c=floor&ac=reply&fid=" + localStorage.fid + "&tid=" + localStorage.tid + "&pid=" + getLocalStorge('pid') + "&article=" + getLocalStorge('lou');
}
url = reLink(url)
function xmlHttpPost() {
uexWindow.evaluateScript("replies", "0", "PostBtnShow('ok')");
uexWindow.toast(0, 5, '请稍等...', 0);
uexXmlHttpMgr.open("2", "post", url, "600000");
var img = $$('img').value;
var atc_content = $$('atc_content').value + "\n" + img;
uexXmlHttpMgr.setPostData("2", "0", "atc_content", atc_content);
uexXmlHttpMgr.send("2");
uexWindow.closeToast();
}
function httpSuccess(opid, status, result) {
if (status == -1) {
uexWindow.toast(0, 5, '出错了', 0);
}
if (status == 1) {
//1表示接收成功
uexWindow.closeToast();
uexXmlHttpMgr.close(opid);
var json = JSON.parse(result);
console.log(json)
if (json.success == 'ok') {
//alert("Fff");
//发布成功后清空保存标记
localStorage.tmp_read_switch = "no";
uexWindow.evaluateScript("replies", "0", "fanhui('go')");
//uexWindow.evaluateScript("reads", "0", "postretun()");
if(localStorage.floorac == "chahua"){
uexWindow.toast(0, 5, '发布成功', 1000);
var reName = ("detail" + localStorage.detailWindowId);
var chahua = $$('atc_content').value;
var lou = getLocalStorge('lou');
uexWindow.evaluatePopoverScript(reName, "detail_content", "oRead.addLeaveword('"+chahua+"','"+lou+"')");
}else if(localStorage.floorac == "bianji"){
uexWindow.toast(0, 5, '编辑成功', 1000);
var reName = ("detail" + localStorage.detailWindowId);
var pid = getLocalStorge('pid');
var lou = getLocalStorge('lou');
uexWindow.evaluatePopoverScript(reName, "detail_content", "oRead.editlouView('"+pid+"','"+lou+"')");
}else{
uexWindow.toast(0, 5, '回复成功', 1000);
var reName = ("detail" + localStorage.detailWindowId);
uexWindow.evaluatePopoverScript(reName, "detail_content", "oRead.loadData(1)");
}
} else {
//timer = setInterval(showhidebtn, 100);
//alert(json.alarm)
//timer = setInterval(showhidebtn, 100);
uexWindow.alert("提示信息", json.alarm, "我知道了")
}
}
if (status == 0) {
uexWindow.toast(1, 5, '正在接收', 0);
}
}
/*
发图
*/
function getReadyToUpload(opCode, dataType, data) {
upload_image_url = data;
var thumbHTML = '<div class="thumbPicBox">' + '<div class="ub">' + '<div id="thumbPic_box" ontouchstart="uexImageBrowser.open(\'' + data + '\',0,0);"><img class="thumbPic" src="' + data + '" /></div>' + '<div class="thumbub" id="thumbub">' + '</div>' + '</div>' + '</div>';
$('.thumbPlace').html(thumbHTML);
httpCode = httpCode + 1;
//alert(httpCode);
uexUploaderMgr.createUploader(httpCode, picUploadHttp);
}
function uexUploaderMgrCbCreateUploader(opCode, dataType, data) {
if (data == 0) {
uexUploaderMgr.uploadFile(opCode, upload_image_url, "photo", "0");
//uexUploaderMgr.closeUploader(opCode);
} else {
alert('上传失败');
cancelPic();
}
}
function uexUploaderMgrStatusCb(opCode, fileSize, percent, serverReback, status) {
switch (status) {
case 0:
//正在上传
//如果做判断会进死循环悲剧
// if(fileSize>1*1024*1024){
//alert(cSZ + 'ddddd' + opCode)
//if(cSZ == opCode){
// alert('上传照片超过2M');
// uexUploaderMgr.closeUploader(opCode);
//}
//cSZ++;
//return false;
// uexUploaderMgr.closeUploader(opCode);
// alert('上传照片超过2M');
//}else{
uexWindow.toast(1, 5, '正在上传:' + percent + '%..', 0);
//}
break;
case 1:
//上传完毕
uexWindow.closeToast();
var rjson = JSON.parse(serverReback);
if (rjson.result == 'success') {
$$('img').value = '[img]' + rjson.url + '[/img]';
var infotext = '<div class="thumbPicInfo"><span><div styel="word-wrap:break-word;">' + rjson.name + '</div>大小:+' + (rjson.size / 1024 / 1024).toFixed(2) + 'M</span></div><div class="thumbPicDel" ontouchstart="cancelPic()"><span>删除</span></div>';
$("#thumbub").css({
height : $(".thumbPicBox").height()
}).html(infotext);
$(".thumbPlace_zao").css({
height : $(".thumbPicBox").height(),
"opacity" : "0"
}).hide();
} else {
alert(rjson.result);
}
uexUploaderMgr.closeUploader(opCode);
$('.upimgbtn').html('<span>替换照片</span>');
break;
case 2:
uexWindow.closeToast();
var rjson = JSON.parse(serverReback);
//alert(rjson.result);
alert("照片上传失败,可能是照片太大了,请缩小图片再试试看。");
cancelPic();
uexUploaderMgr.closeUploader(opCode);
break;
}
}
function cancelPic() {
$(".thumbPlace_zao").css({
"background" : "#fff",
"opacity" : "1"
}).show();
$(".thumbPicBox").hide();
$$('img').value = '';
$('.upimgbtn').html('<span>上传照片</span>');
}
function uppick() {
uexWindow.cbActionSheet = uPpickcbSuccess;
var as = ['拍照', '从手机相册选择'];
uexWindow.actionSheet('', '取消', as);
}
function uPpickcbSuccess(opId, dataType, data) {
if (data == 0) {
uexCamera.open();
} else if (data == 1) {
uexImageBrowser.pick();
}
}
</script>
</html>