ftnupload.htm 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. <!--{block return}-->
  2. <div class="p_opt" unselectable="on" id="{$editorid}_ftnupload" style="display: none;">
  3. <div id="iframeurl" style="height:0px;"></div>
  4. <div class="hm bbda" id="{$editorid}_ftnattach">
  5. <iframe id="ftniframe" name="ftniframe" frameborder="0" scrolling="no" src="about:blank" width="510px" height="310px"></iframe>
  6. <div class="ftn_buttondiv">
  7. <button id="ftn_over" class="pn" value="true" name="editsubmit" onclick="loadiframe(null,'ftniframe',0,1);updateAttachList();this.disabled=true;this.className='pn'" disabled>
  8. <span>{lang xf_storage:sava_attachlist}</span>
  9. </button>
  10. </div>
  11. </div>
  12. <div class="notice uploadinfo">{lang xf_storage:filesize_limit}
  13. </div>
  14. </div>
  15. <script lang="text/javascript" reload="1">
  16. _attachEvent($('e_ftn'),'click',function(e){loadiframe(null,'ftniframe');});
  17. _attachEvent($('e_attach'),'click',function(e){
  18. if (ATTACHNUM['attachunused'] == 0 && ATTACHNUM['attachused'] == 0) {
  19. loadiframe(null,'ftniframe');switchAttachbutton('ftnupload');
  20. }
  21. });
  22. _attachEvent($('e_btn_ftnupload').getElementsByTagName('a')[0], 'click',
  23. function(e){hideConfirm();});
  24. _attachEvent($('e_btn_attachlist').getElementsByTagName('a')[0], 'click',
  25. function(e){showConfirm();});
  26. _attachEvent($('e_btn_upload').getElementsByTagName('a')[0], 'click',
  27. function(e){showConfirm();});
  28. if(BROWSER.firefox && window.HTMLElement) { //为 firefox 增加 innerText 方法
  29. HTMLElement.prototype.__defineGetter__("innerText", function(){
  30. var anyString = "";
  31. var childS = this.childNodes;
  32. for(var i=0; i<childS.length; i++) {
  33. if(childS[i].nodeType==1)
  34. anyString += childS[i].innerText;
  35. else if(childS[i].nodeType==3)
  36. anyString += childS[i].nodeValue;
  37. }
  38. return anyString;
  39. });
  40. HTMLElement.prototype.__defineSetter__("innerText", function(sText){
  41. this.textContent=sText;
  42. });
  43. }
  44. function showConfirm() {
  45. $('attach_confirms').style.display='';
  46. }
  47. function hideConfirm() {
  48. $('attach_confirms').style.display='none';
  49. }
  50. function loadiframe(url,iframeid,time,force){
  51. var swfupload = 1;
  52. var formhash = '{FORMHASH}';
  53. if(BROWSER.ie){
  54. var loading = "<div style='color:#777;font-size:12px;margin:-15px 0 0 -10px;padding:0px;'>{lang xf_storage:wait_for_url}</div>";
  55. } else {
  56. var loading = "<div style='color:#777;font-size:12px;margin:-8px 0 0 -7px;padding:0px;'>{lang xf_storage:wait_for_url}</div>";
  57. }
  58. var iframe = $(iframeid);
  59. if(url == null){
  60. ajaxget('plugin.php?id=xf_storage:ftn_upload&formhash='+formhash,'iframeurl','',null,null,function(){
  61. url = $('iframeurl_ajax').innerText;
  62. time = time ? time : 200;
  63. force = force ? force : 0;
  64. if(iframe.src == "about:blank") {
  65. iframe.contentWindow.document.write(loading);
  66. //return false;
  67. setTimeout(function()
  68. {
  69. iframe.src = "about:blank";
  70. iframe.src = url;
  71. },time);
  72. } else if(force == 1) {
  73. setTimeout(function()
  74. {
  75. iframe.src = "about:blank";
  76. iframe.src = url;
  77. },time);
  78. }
  79. });
  80. } else {
  81. time = time ? time : 200;
  82. force = force ? force : 0;
  83. if(iframe.src == "about:blank") {
  84. setTimeout(function()
  85. {
  86. iframe.src = "about:blank";
  87. iframe.src = url;
  88. },time);
  89. } else if(force == 1) {
  90. setTimeout(function()
  91. {
  92. iframe.src = "about:blank";
  93. iframe.src = url;
  94. },time);
  95. }
  96. }
  97. // 页面超时监控,仅IE有效
  98. // if (BROWSER.ie) {
  99. // var linster = setTimeout(function() {
  100. // if(iframe.readyState != 'complete' && swfupload == 1){
  101. // if(confirm('{lang xf_storage:timeout_tips}')){
  102. // switchAttachbutton('swfupload');
  103. // }
  104. // } else if(iframe.readyState != 'complete' && swfupload == 0) {
  105. // if(confirm('{lang xf_storage:timeout_tips}')){
  106. // switchAttachbutton('upload');
  107. // }
  108. // }
  109. // },60000);
  110. // }
  111. }
  112. </script>
  113. <!--{/block}-->