|
发表于 2019-4-16 15:40:45
|
显示全部楼层
zzr 发表于 2019-4-16 15:04
大佬帮忙解密下index.js吧。。。。这种静态的基本都用了三方接口,[ol]layui.use('element', function(){ var element = layui.element; element.on('nav(demo)', function(elem){ //console.log(elem) layer.msg(elem.text()); });});$(document).ready(function() { $('.picurl > input').bind('focus mouseover', function() { if(this.value) { this.select() } }); $("input[type='file']").change(function(e) { images_upload(this.files) }); var obj = $('body'); obj.on('dragenter', function(e) { e.stopPropagation(); e.preventDefault() }); obj.on('dragover', function(e) { e.stopPropagation(); e.preventDefault() }); obj.on('drop', function(e) { e.preventDefault(); images_upload(e.originalEvent.dataTransfer.files) })});function url_uploaddj() {layer.open({ type: 1 //Page层类型 ,area: ['500px', '300px'] ,title: '在线上传' ,shade: 0.6 //遮罩透明度 ,maxmin: true //允许全屏最小化 ,anim: 0 //0-6的动画形式,-1不开启 ,content: '上传'}); };var url_upload = function() { var urls = $("#urls").val(); var url_arr = urls.split("\n"); if(urls == "" || url_arr.length == 0) { layer.msg('请贴入需要上传的网络图片地址.'); return }else{ layer.closeAll(); } $('.layui-row > button')[1].innerHTML = '上传中'; for(var i = 0; i button')[1].innerHTML = '成功 ' + (i + 1) + '/' + url_arr.length; var apc = "

https://ww1.sinaimg.cn/large/" + data.pid + ".jpg
"; $('.preview').css('display', 'block'); $(".preview>hr").after(apc) } else { $('.layui-row > button')[1].innerHTML = '第' + (i + 1) + '张上传失败' } if(typeof data.pid != 'undefined') { $('.layui-row > button')[1].innerHTML = '上传成功' } else { $('.layui-row > button')[1].innerHTML = '上传失败'; $('#url-res-txt').append(data.error_msg + '\n'); alert(data.error_msg) } }, error: function(XMLResponse) { alert("error:" + XMLResponse.responseText) } }) }};var images_upload = function(files) { var flag = 0; $('textarea').empty(); $(files).each(function(key, value) { $('.layui-row > button')[0].innerHTML = '上传中'; image_form = new FormData(); image_form.append('file', value); console.log(image_form); $.ajax({ url: 'https://api.oioweb.cn/sinaimg.php?type=multipart', //multipart本地图片上传 type: 'POST', data: image_form, mimeType: 'multipart/form-data', contentType: false, cache: false, processData: false, dataType: 'json', success: function(data) { flag++; if(typeof data.pid != 'undefined') { $('#url-res-txt').append('https://ww1.sinaimg.cn/large/' + data.pid + '.jpg\n'); $('.layui-row > button')[0].innerHTML = '成功 ' + flag + '/' + files.length; var apc = "

https://ww1.sinaimg.cn/large/" + data.pid + ".jpg
"; $('.preview').css('display', 'block'); $(".preview>hr").after(apc) } else { $('.layui-row > button')[0].innerHTML = '第' + flag + '张上传失败' } if(flag == $("input[type='file']")[0].files.length) { if(typeof data.pid != 'undefined') { $('.layui-row > button')[0].innerHTML = '上传成功' } else { $('.layui-row > button')[0].innerHTML = '上传失败'; $('#url-res-txt').append(data.error_msg + '\n'); alert(data.error_msg) } } }, error: function(XMLResponse) { alert("error:" + XMLResponse.responseText) } }) })};document.onpaste = function(e) { var data = e.clipboardData; for(var i = 0; i a || i.x c || i.y = n.max / 2 && (i.x -= .03 * o, i.y -= .03 * m), t = (n.max - l) / n.max, r.beginPath(), r.lineWidth = t / 2, r.strokeStyle = "rgba(" + d.c + "," + (t + .2) + ")", r.moveTo(i.x, i.y), r.lineTo(n.x, n.y), r.stroke())) }), x(i) } var a, c, u, m = document.createElement("canvas"), d = t(), l = "c_n" + d.l, r = m.getContext("2d"), x = window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.oRequestAnimationFrame || window.msRequestAnimationFrame || function(n) { window.setTimeout(n, 1e3 / 45) }, w = Math.random, y = { x: null, y: null, max: 2e4 }; m.id = l, m.style.cssText = "position:fixed;top:0;left:0;z-index:" + d.z + ";opacity:" + d.o, e("body")[0].appendChild(m), o(), window.onresize = o, window.onmousemove = function(n) { n = n || window.event, y.x = n.clientX, y.y = n.clientY }, window.onmouseout = function() { y.x = null, y.y = null }; for(var s = [], f = 0; d.n > f; f++) { var h = w() * a, g = w() * c, v = 2 * w() - 1, p = 2 * w() - 1; s.push({ x: h, y: g, xa: v, ya: p, max: 6e3 }) } u = s.concat([y]), setTimeout(function() { i() }, 100)}();layer.msg('小提示:可以直接Ctrl+V粘贴上传喔~', function(){});[/ol]复制代码 |
|