PageRenderTime 39ms CodeModel.GetById 14ms RepoModel.GetById 0ms app.codeStats 0ms

/!PHP/ZManual/js/edit.js

http://mootoolstools.googlecode.com/
JavaScript | 292 lines | 202 code | 29 blank | 61 comment | 24 complexity | eff3e1d974f236f640d15ad0c7639834 MD5 | raw file
  1. /*
  2. '-----------------------------------------------
  3. '??: -----------------------------------------
  4. '??:20041010----------------------------------
  5. '??:????----------------------------------
  6. '??:------------------------------------------
  7. '-----------------------------------------------
  8. */
  9. function fortable()
  10. {
  11. var arr = showModalDialog("table.htm", "", "dialogWidth:250px; dialogHeight:200px; status:1;help:0");
  12. if (arr != null){
  13. var tmp=arr.split("*");
  14. row=tmp[0];
  15. col=tmp[1];
  16. var string;
  17. string="<table style='WIDTH: "+tmp[2]+"px;' border="+tmp[3]+" bgcolor="+tmp[6]+" cellspacing="+tmp[5]+" cellpadding="+tmp[4]+">";
  18. for(i=1;i<=row;i++){
  19. string=string+"<tr>";
  20. for(j=1;j<=col;j++){
  21. string=string+"<td>&nbsp;</td>";
  22. }
  23. string=string+"</tr>";
  24. }
  25. string=string+"</table>";
  26. content=monolith_article_body.document.body.innerHTML;
  27. content=content+string;
  28. monolith_article_body.document.body.innerHTML=content;
  29. }
  30. else monolith_article_body.focus();
  31. }
  32. /*
  33. '-----------------------------------------------
  34. '??:Zerolone----------------------------------
  35. '??:20041010----------------------------------
  36. '??:?????--------------------------------
  37. '??:------------------------------------------
  38. '-----------------------------------------------
  39. */
  40. function Allmedia()
  41. {
  42. var arr = showModalDialog("Media.htm", "", "dialogWidth:500px; dialogHeight:200px; status:1;help:0");
  43. if (arr != null){
  44. var ss;
  45. ss=arr.split("*")
  46. Code = ss[0];
  47. path = ss[1];
  48. row = ss[2];
  49. col = ss[3];
  50. var string;
  51. if (Code=="Flash")
  52. {
  53. string="<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0' width="+row+" height="+col+"><param name='movie' value="+path+"><param name='quality' value='high'></object>";
  54. monolith_article_body.document.body.innerHTML += string;
  55. }
  56. else if (Code=="MediaPlayer")
  57. {
  58. string="<object classid='clsid:22D6F312-B0F6-11D0-94AB-0080C74C7E95' width="+row+" height="+col+"><param name=Filename value="+path+"><param name='BufferingTime' value='5'><param name='AutoSize' value='-1'><param name='AnimationAtStart' value='-1'><param name='AllowChangeDisplaySize' value='-1'><param name='ShowPositionControls' value='0'><param name='TransparentAtStart' value='1'><param name='ShowStatusBar' value='1'></object>";
  59. monolith_article_body.document.body.innerHTML += string;
  60. }
  61. else if (Code=="RealPlayer")
  62. {
  63. string="<object classid='clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA' width="+row+" height="+col+"><param name='CONTROLS' value='ImageWindow'><param name='CONSOLE' value='Clip1'><param name='AUTOSTART' value='-1'><param name=src value="+path+"></object><br><object classid='clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA' width="+row+" height=60><param name='CONTROLS' value='ControlPanel,StatusBar'><param name='CONSOLE' value='Clip1'></object>";
  64. monolith_article_body.document.body.innerHTML += string;
  65. }
  66. }
  67. else monolith_article_body.focus();
  68. }
  69. /*
  70. '-----------------------------------------------
  71. '??: -----------------------------------------
  72. '??:20041010----------------------------------
  73. '??:??????????????????------
  74. '??:------------------------------------------
  75. '-----------------------------------------------
  76. */
  77. function pic()
  78. {
  79. var arr = showModalDialog("InsertPic.php", "", "dialogWidth:510px; dialogHeight:392px; status:1;help:0");
  80. if (arr != null)
  81. {
  82. var ss;
  83. ss=arr.split("*");
  84. a=ss[0];
  85. b=ss[1];
  86. c=ss[2];
  87. d=ss[3];
  88. e=ss[4];
  89. f=ss[5];
  90. g=ss[6];
  91. h=ss[7];
  92. i=ss[8];
  93. if (a=="UpLoadPic")
  94. {
  95. monolith_article_body.document.body.innerHTML=monolith_article_body.document.body.innerHTML + b;
  96. }
  97. else
  98. {
  99. var str1;
  100. str1="<img src='"+a+"' alt='"+b+"'"
  101. if(d.value!='')str1=str1+"width='"+d+"'"
  102. if(e.value!='')str1=str1+"height='"+e+"' "
  103. str1=str1+" border='"+i+"' align='"+h+"' vspace='"+f+"' hspace='"+g+"' style='"+c+"'"
  104. str1=str1+">"
  105. // content=monolith_article_body.document.body.innerHTML;
  106. // content=content+str1;
  107. // monolith_article_body.document.body.innerHTML=content;
  108. monolith_article_body.document.body.innerHTML+=str1;
  109. }
  110. }
  111. else monolith_article_body.focus();
  112. }
  113. /*
  114. '-----------------------------------------------
  115. '??: -----------------------------------------
  116. '??:20041208----------------------------------
  117. '??:????????????News_Pic1---------
  118. '??:------------------------------------------
  119. '-----------------------------------------------
  120. */
  121. function Insertpic1()
  122. {
  123. var arr = showModalDialog("InsertPic1.php", "", "dialogWidth:510px; dialogHeight:360px; status:1;help:0");
  124. AddNewsForm.News_Pic1.value= arr;
  125. AddNewsForm.News_Pic1.focus();
  126. }
  127. function Insertpic2()
  128. {
  129. var arr = showModalDialog("InsertPic2.php", "", "dialogWidth:510px; dialogHeight:360px; status:1;help:0");
  130. AddNewsForm.News_Pic2.value= arr;
  131. AddNewsForm.News_Pic2.focus();
  132. }
  133. /*
  134. '-----------------------------------------------
  135. '??:Zerolone----------------------------------
  136. '??:20041208----------------------------------
  137. '??:????----------------------------------
  138. '??:ThePicUrl ????------------------------
  139. '-----------------------------------------------
  140. */
  141. function View(ThePicUrl)
  142. {
  143. ViewImg.src=ThePicUrl;
  144. Layer1.style.visibility = "visible";
  145. // Layer1.style.posLeft = screen.height/2;
  146. Layer1.style.posLeft = document.body.scrollLeft + event.clientX + 50;
  147. Layer1.style.posTop = document.body.scrollTop + event.clientY + 50;
  148. }
  149. /*
  150. '-----------------------------------------------
  151. '??:Zerolone----------------------------------
  152. '??:20041208----------------------------------
  153. '??:??????------------------------------
  154. '??:------------------------------------------
  155. '-----------------------------------------------
  156. */
  157. function HiddenLayer()
  158. {
  159. Layer1.style.visibility = "Hidden";
  160. ViewImg.src = "../images/LoadingPic.gif";
  161. }
  162. function setMode(newMode)
  163. {
  164. bTextMode = newMode;
  165. var cont;
  166. if (bTextMode) {
  167. cleanHtml();
  168. cleanHtml();
  169. cont=monolith_article_body.document.body.innerHTML;
  170. monolith_article_body.document.body.innerText=cont;
  171. } else {
  172. cont=monolith_article_body.document.body.innerText;
  173. monolith_article_body.document.body.innerHTML=cont;
  174. }
  175. monolith_article_body.focus();
  176. }
  177. function cleanHtml()
  178. {
  179. var fonts = monolith_article_body.document.body.all.tags("FONT");
  180. var curr;
  181. for (var i = fonts.length - 1; i >= 0; i--) {
  182. curr = fonts[i];
  183. if (curr.style.backgroundColor == "#ffffff") curr.outerHTML = curr.innerHTML;
  184. }
  185. }
  186. function Page()
  187. {
  188. var str1;
  189. str1="[---??---]";
  190. monolith_article_body.document.body.innerHTML+=str1;
  191. }
  192. function help()
  193. {
  194. var helpmess;
  195. helpmess="---------------????---------------\r\n\r\n"+
  196. "1.?????????????\r\n\r\n"+
  197. "2.????????????\r\n\r\n"+
  198. "???HTML?????.\r\n\r\n"+
  199. "3.???????,?????.\r\n\r\n"+
  200. "4.????js??????????.\r\n\r\n";
  201. alert(helpmess);
  202. }
  203. function insertcode()
  204. {
  205. var str1;
  206. str1='<table align="center" border="1" width="90%" bgcolor="#EFEFEF" bordercolor="#BDBABD" cellspacing="0" cellpadding="0"><tr><td><table border="0" width="100%" cellspacing="5" cellpadding="5"><tr><td width="10"></td><td>[??????]</td></tr></table></td></tr></table>';
  207. frames.monolith_article_body.focus();//? id ?obj??????????? ,??????
  208. frames.monolith_article_body.document.selection.createRange().pasteHTML(str1) ;
  209. }
  210. function insertnote()
  211. {
  212. var str1;
  213. str1='<table align="center" border="1" width="90%" bgcolor="#FFFBE7" bordercolor="#BDBABD" cellspacing="0" cellpadding="0"><tr><td><table border="0" width="100%" cellspacing="5" cellpadding="5"><tr><td width="26" valign="top"><img src="image/note.png" alt="??"></td><td>[????????]</td></tr></table></td></tr></table>';
  214. frames.monolith_article_body.focus();
  215. frames.monolith_article_body.document.selection.createRange().pasteHTML(str1) ;
  216. }
  217. function insertimportant()
  218. {
  219. var str1;
  220. str1='<table align="center" border="1" width="90%" bgcolor="#FFFBE7" bordercolor="#BDBABD" cellspacing="0" cellpadding="0"><tr><td><table border="0" width="100%" cellspacing="5" cellpadding="5"><tr><td width="26" valign="top"><img src="image/important.png" alt="??"></td><td>[????????]</td></tr></table></td></tr></table>';
  221. frames.monolith_article_body.focus();
  222. frames.monolith_article_body.document.selection.createRange().pasteHTML(str1) ;
  223. }
  224. function inserttip()
  225. {
  226. var str1;
  227. str1='<table align="center" border="1" width="90%" bgcolor="#FFFBE7" bordercolor="#D6D3B5" cellspacing="0" cellpadding="0"><tr><td><table border="0" width="100%" cellspacing="5" cellpadding="5"><tr><td width="26" valign="top"><img src="image/tip.png" alt="??"></td><td>[????????]</td></tr></table></td></tr></table>';
  228. frames.monolith_article_body.focus();
  229. frames.monolith_article_body.document.selection.createRange().pasteHTML(str1) ;
  230. }
  231. function insertwarning()
  232. {
  233. var str1;
  234. str1='<table align="center" border="1" width="90%" bgcolor="#FFFBE7" bordercolor="#D6D3B5" cellspacing="0" cellpadding="0"><tr><td><table border="0" width="100%" cellspacing="5" cellpadding="5"><tr><td width="26" valign="top"><img src="image/warning.png" alt="??"></td><td>[????????]</td></tr></table></td></tr></table>';
  235. frames.monolith_article_body.focus();
  236. frames.monolith_article_body.document.selection.createRange().pasteHTML(str1) ;
  237. }
  238. function insertcaution()
  239. {
  240. var str1;
  241. str1='<table align="center" border="1" width="90%" bgcolor="#FFFBE7" bordercolor="#D6D3B5" cellspacing="0" cellpadding="0"><tr><td><table border="0" width="100%" cellspacing="5" cellpadding="5"><tr><td width="26" valign="top"><img src="image/caution.png" alt="??"></td><td>[????????]</td></tr></table></td></tr></table>';
  242. frames.monolith_article_body.focus();
  243. frames.monolith_article_body.document.selection.createRange().pasteHTML(str1) ;
  244. }
  245. //Function to format text in the text box
  246. function formattext(command, option){
  247. frames.monolith_article_body.document.execCommand(command, true, option);
  248. frames.monolith_article_body.focus();
  249. }
  250. /*
  251. '-----------------------------------------------
  252. '??:Discuz?----------------------------------
  253. '??:------------------------------------------
  254. '??:????----------------------------------
  255. '??:------------------------------------------
  256. '-----------------------------------------------
  257. */
  258. function runCode(obj) {
  259. var winname = window.open('', "_blank", '');
  260. winname.document.open('text/html', 'replace');
  261. winname.document.writeln(obj.value.replace(/t extarea/g, "textarea"));
  262. winname.document.close();
  263. }