'; menu.innerHTML = ' '+upload_form+' '; }else { menu.innerHTML = ''; } } showMenu({'ctrlid':ctrlid,'evt':'click','duration':3,'cache':0,'drag':1}); } function seditor_insertunit(key, text, textend, moveend, selappend) { if($(key + 'message')) { $(key + 'message').focus(); } textend = isUndefined(textend) ? '' : textend; moveend = isUndefined(textend) ? 0 : moveend; selappend = isUndefined(selappend) ? 1 : selappend; startlen = strlen(text); endlen = strlen(textend); if(!isUndefined($(key + 'message').selectionStart)) { if(selappend) { var opn = $(key + 'message').selectionStart + 0; if(textend != '') { text = text + $(key + 'message').value.substring($(key + 'message').selectionStart, $(key + 'message').selectionEnd) + textend; } $(key + 'message').value = $(key + 'message').value.substr(0, $(key + 'message').selectionStart) + text + $(key + 'message').value.substr($(key + 'message').selectionEnd); if(!moveend) { $(key + 'message').selectionStart = opn + strlen(text) - endlen; $(key + 'message').selectionEnd = opn + strlen(text) - endlen; } } else { text = text + textend; $(key + 'message').value = $(key + 'message').value.substr(0, $(key + 'message').selectionStart) + text + $(key + 'message').value.substr($(key + 'message').selectionEnd); } } else if(document.selection && document.selection.createRange) { var sel = document.selection.createRange(); if(!sel.text.length && $(key + 'message').sel) { sel = $(key + 'message').sel; $(key + 'message').sel = null; } if(selappend) { if(textend != '') { text = text + sel.text + textend; } sel.text = text.replace(/\r?\n/g, '\r\n'); if(!moveend) { sel.moveStart('character', -endlen); sel.moveEnd('character', -endlen); } sel.select(); } else { sel.text = text + textend; } } else { $(key + 'message').value += text; } hideMenu(2); if(BROWSER.ie) { doane(); } } function dm_editor_squarestrip(str) { str = str.replace('[', '%5B'); str = str.replace(']', '%5D'); return str; } function dm_ajaxpost(formid, showid, waitid, showidclass, submitbtn, recall) { var waitid = typeof waitid == 'undefined' || waitid === null ? showid : (waitid !== '' ? waitid : ''); var showidclass = !showidclass ? '' : showidclass; var ajaxframeid = 'ajaxframe'; var ajaxframe = $(ajaxframeid); var curform = $(formid); var formtarget = curform.target; var handleResult = function() { var s = ''; var evaled = false; showloading('none'); try { s = jQuery("#"+ajaxframeid).contents().find("body").first().html(); } catch(e) { s = '内部错误 无法显示'; } if(parseInt(s) > 0) { // 上传成功 var attachnew = ''; if(jQuery("#fwin_reply").length > 0){ jQuery("#postform").append(attachnew); seditor_insertunit("post", '[attachimg]' + s, '[/attachimg]', null, 1); }else if(jQuery("#fwin_newthread").length > 0){ jQuery("#postform").append(attachnew); seditor_insertunit("post", '[attachimg]' + s, '[/attachimg]', null, 1); }else { jQuery("#fastpostform").append(attachnew); seditor_insertunit("fastpost", '[attachimg]' + s, '[/attachimg]', null, 1); } hideMenu(); s = dm_lang[0]; evaled = true; } else if (parseInt(s) < 0) { var n = Math.abs(parseInt(s)); s = dm_lang[n]; } if(showidclass) { if(showidclass != 'onerror') { $(showid).className = showidclass; } else { showError(s); } } if(submitbtn) { submitbtn.disabled = false; } if(!evaled) { ajaxinnerhtml($(showid), s); } if(curform) curform.target = formtarget; if(typeof recall == 'function') { recall(); } else { eval(recall); } if(!evaled) evalscript(s); ajaxframe.loading = 0; if(!BROWSER.firefox || BROWSER.safari) { $('append_parent').removeChild(ajaxframe.parentNode); } else { setTimeout( function(){ $('append_parent').removeChild(ajaxframe.parentNode); }, 100 ); } }; if(!ajaxframe) { var div = document.createElement('div'); div.style.display = 'none'; div.innerHTML = ''; $('append_parent').appendChild(div); ajaxframe = $(ajaxframeid); } else if(ajaxframe.loading) { return false; } _attachEvent(ajaxframe, 'load', handleResult); showloading(); curform.target = ajaxframeid; var action = curform.getAttribute('action'); action = hostconvert(action); curform.action = action.replace(/\&inajax\=1/g, '')+'&inajax=1'; curform.submit(); if(submitbtn) { submitbtn.disabled = true; } doane(); return false; }(此文不代表本网站观点,仅代表作者言论,由此文引发的各种争议,本网站声明免责,也不承担连带责任。) |