From 8d2e1d71ea4ff263cd7ac6cb24ef8451830d97fd Mon Sep 17 00:00:00 2001 From: ckcz123 Date: Fri, 15 May 2020 14:54:59 +0800 Subject: [PATCH] =?UTF-8?q?=E7=B4=A0=E6=9D=90=E9=80=89=E6=8B=A9=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E9=A2=84=E8=A7=88=E5=9B=BE=E7=89=87=E5=92=8C=E9=9F=B3?= =?UTF-8?q?=E9=A2=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- _server/editor_ui.js | 47 +++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 44 insertions(+), 3 deletions(-) diff --git a/_server/editor_ui.js b/_server/editor_ui.js index 47e26bdb..2bb6e774 100644 --- a/_server/editor_ui.js +++ b/_server/editor_ui.js @@ -781,21 +781,62 @@ editor_ui_wrapper = function (editor) { // 显示每一项内容 var html = "

"; - html += "
"; + html += ""+ + "
"; data.forEach(function (one) { - html += `= 0? 'checked' : ''} /> ${one}
`; + html += `= 0? 'checked' : ''} /> ${one}`; + // 预览图片 + if (one.endsWith('.png') || one.endsWith('.jpg') || one.endsWith('.jpeg') || one.endsWith('.gif')) { + html += ""; + html += '
'; + } + // 试听音频 + if (one.endsWith('.mp3') || one.endsWith('.wmv') || one.endsWith('.ogg') || one.endsWith('.wav')) { + html += ""; + html += '
'; + } + html += '
'; }); html += "

"; uievent.elements.materialList.innerHTML = html; }); } - uievent._selectAll = function (checked) { + uievent._selectAllMaterial = function (checked) { Array.from(document.getElementsByClassName('materialCheckbox')).forEach(function (one) { one.checked = checked; }) } + uievent._previewMaterialImage = function (button) { + var br = button.nextElementSibling; + var img = br.nextElementSibling; + if (br.style.display == 'none') { + button.innerText = '折叠'; + br.style.display = 'block'; + img.style.display = 'block'; + img.src = img.getAttribute('key'); + } else { + button.innerText = '预览'; + br.style.display = 'none'; + img.style.display = 'none'; + } + } + + uievent._previewMaterialAudio = function (button) { + var br = button.nextElementSibling; + var audio = br.nextElementSibling; + if (br.style.display == 'none') { + button.innerText = '折叠'; + br.style.display = 'block'; + audio.style.display = 'block'; + } else { + button.innerText = '试听'; + br.style.display = 'none'; + audio.style.display = 'none'; + } + } + editor.constructor.prototype.uievent=uievent; } \ No newline at end of file