diff --git a/upload/static/js/common.js b/upload/static/js/common.js index 96d89a3..7abeef9 100644 --- a/upload/static/js/common.js +++ b/upload/static/js/common.js @@ -1572,7 +1572,47 @@ function getClipboardData() { } function setCopy(text, msg) { - $F('_setCopy', arguments); + var cp = document.createElement('textarea'); + cp.style.fontSize = '12pt'; + cp.style.border = '0'; + cp.style.padding = '0'; + cp.style.margin = '0'; + cp.style.position = 'absolute'; + cp.style.left = '-9999px'; + var yPosition = window.pageYOffset || document.documentElement.scrollTop; + cp.style.top = yPosition + 'px'; + cp.setAttribute('readonly', ''); + cp.value = text; + $('append_parent').appendChild(cp); + cp.select(); + cp.setSelectionRange(0, cp.value.length); + try { + var success = document.execCommand('copy', false, null); + } catch (e) { + var success = false; + } + $('append_parent').removeChild(cp); + + if(success) { + if(msg) { + showPrompt(null, null, '' + msg + '', 1500); + } + } else if(BROWSER.ie) { + var r = clipboardData.setData('Text', text); + if(r) { + if(msg) { + showPrompt(null, null, '' + msg + '', 1500); + } + } else { + showDialog('
复制失败,请选择“允许访问”
', 'alert'); + } + } else { + var msg = '
点此复制到剪贴板
' + + AC_FL_RunContent('id', 'clipboardswf', 'name', 'clipboardswf', 'devicefont', 'false', 'width', '200', 'height', '40', 'src', STATICURL + 'image/common/clipboard.swf', 'menu', 'false', 'allowScriptAccess', 'sameDomain', 'swLiveConnect', 'true', 'wmode', 'transparent', 'style' , 'margin-top:-20px') + '
'; + showDialog(msg, 'info'); + text = text.replace(/[\xA0]/g, ' '); + CLIPBOARDSWFDATA = text; + } } function copycode(obj) { diff --git a/upload/static/js/common_extra.js b/upload/static/js/common_extra.js index cb566e5..873a8c1 100644 --- a/upload/static/js/common_extra.js +++ b/upload/static/js/common_extra.js @@ -185,25 +185,6 @@ function _copycode(obj) { setCopy(BROWSER.ie ? obj.innerText.replace(/\r\n\r\n/g, '\r\n') : obj.textContent, '代码已复制到剪贴板'); } -function _setCopy(text, msg){ - if(BROWSER.ie) { - var r = clipboardData.setData('Text', text); - if(r) { - if(msg) { - showPrompt(null, null, '' + msg + '', 1500); - } - } else { - showDialog('
复制失败,请选择“允许访问”
', 'alert'); - } - } else { - var msg = '
点此复制到剪贴板
' + - AC_FL_RunContent('id', 'clipboardswf', 'name', 'clipboardswf', 'devicefont', 'false', 'width', '200', 'height', '40', 'src', STATICURL + 'image/common/clipboard.swf', 'menu', 'false', 'allowScriptAccess', 'sameDomain', 'swLiveConnect', 'true', 'wmode', 'transparent', 'style' , 'margin-top:-20px') + '
'; - showDialog(msg, 'info'); - text = text.replace(/[\xA0]/g, ' '); - CLIPBOARDSWFDATA = text; - } -} - function _showselect(obj, inpid, t, rettype) { var showselect_row = function (inpid, s, v, notime, rettype) { if(v >= 0) {