diff --git a/application/views/admin/images.php b/application/views/admin/images.php index a7d6808..4b6b165 100644 --- a/application/views/admin/images.php +++ b/application/views/admin/images.php @@ -73,10 +73,10 @@
-
+
-
+
diff --git a/static/js/imgurl.js b/static/js/imgurl.js new file mode 100644 index 0000000..e86f9df --- /dev/null +++ b/static/js/imgurl.js @@ -0,0 +1,93 @@ +// ==UserScript== +// @name ImgURL上传脚本 +// @namespace https://imgurl.org/ +// @version 0.22 +// @description ImgURL快捷上传工具 +// @author xiaoz.me +// @match http://*/* +// @match https://*/* +// @license GPL +// @grant none +// ==/UserScript== + +(function() { + 'use strict'; + + //定义一个全局弹出层 + window.layerstart = ''; + + //让层居中显示 + window.layerCenter = function(){ + var bwidth = window.screen.availWidth; + var bheight = window.screen.availHeight; + var layertop = (bheight - 720) / 2; + var layerleft = (bwidth - 1280) / 2; + + if(layertop <= 70){ + layertop = "1em"; + } + else{ + layertop = layertop + "px"; + } + + //改变css + //$("#layer").css({"top":layertop,"left":layerleft}); + //原生js改变css + //alert(layertop); + document.getElementById("layer").style.top = layertop; + document.getElementById("layer").style.left = "10%"; + } + //创建一个遮罩层 + window.keepout = function(){ + var fade = '
'; + //$("body").append(fade); + var div = document.createElement("div"); + div.innerHTML = fade; + document.body.appendChild(div); + } + + //关闭层 + window.closelayer = function(){ + //$("#layer").hide(); + document.getElementById("layer").style.display = "none"; + //showSidebar(); + //$("#layer").remove(); + var layer = document.getElementById("layer"); + layer.parentNode.removeChild(layer); + + //$("#fade").remove(); + var fade = document.getElementById("fade"); + fade.parentNode.removeChild(fade); + } + + //创建一个显示按钮 + function imgurl(){ + //$("body").append('
'); + //使用原生js添加按钮 + var div = document.createElement("div"); + div.innerHTML = '
'; + document.body.appendChild(div); + } + //显示上传按钮 + window.showImgurl = function(){ + var up = layerstart; + up += ''; + up += layerend; + //$("body").append(up); + var div = document.createElement("div"); + div.innerHTML = up; + document.body.appendChild(div); + + //$("#layer").show(); + document.getElementById("layer").style.display = "block"; + + //显示遮罩 + keepout(); + //居中显示层 + layerCenter(); + } + + imgurl(); +})(); \ No newline at end of file