- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathloadplot.js
More file actions
Latest commit
53 lines (46 loc) · 1.34 KB
/
Copy pathloadplot.js
File metadata and controls
53 lines (46 loc) · 1.34 KB
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
(function(){
functionzxsq_ajaxpost(formid,recall){
varrequest;
if(window.XMLHttpRequest){
request=newXMLHttpRequest();
}elseif(window.ActiveXObject){
request=newActiveXObject("Microsoft.XMLHTTP");
}else{
return;
}
request.onreadystatechange=function(){recall(request,formid);};
varsendData=newFormData(jQuery('#'+formid)[0]);
request.open('POST',jQuery('#'+formid)[0].action,true);
request.send(sendData);
}
jQuery(document).ready(function(){
varzxsq_mindmap_forms=document.querySelectorAll('.zxsq_mindmap_form form');
for(vari=0;i<zxsq_mindmap_forms.length;i++){
varcur_form=zxsq_mindmap_forms[i];
varformid=cur_form.id;
vartextarea=cur_form.querySelector('textarea');
varoldcode=textarea.value;
textarea.defaultValue=oldcode.replace(/<br\/>\n/g,'\n');
zxsq_ajaxpost(formid,showMindMap);
}
});
functionshowMindMap(request,formid){
varimgid='img_'+formid;
if(request.readyState==4){
if(request.status==200){
try{
varres=JSON.parse(request.responseText);
jQuery('#'+imgid)[0].src=res['imgpath'];
returntrue;
}catch(e){
onError(imgid);
}
}else{
onError(imgid);
}
}
}
functiononError(id){
jQuery('#'+id)[0].src="wp-content/plugins/wp-plot/images/error.jpg";
}
})();