|
|
@ -1,7 +1,7 @@ |
|
|
|
// ==UserScript==
|
|
|
|
// ==UserScript==
|
|
|
|
// @name ImgURL上传脚本
|
|
|
|
// @name ImgURL上传脚本
|
|
|
|
// @namespace https://imgurl.org/
|
|
|
|
// @namespace https://imgurl.org/
|
|
|
|
// @version 0.1
|
|
|
|
// @version 0.2
|
|
|
|
// @description ImgURL快捷上传工具
|
|
|
|
// @description ImgURL快捷上传工具
|
|
|
|
// @author xiaoz.me
|
|
|
|
// @author xiaoz.me
|
|
|
|
// @match http://*/*
|
|
|
|
// @match http://*/*
|
|
|
@ -26,38 +26,55 @@ |
|
|
|
var layerleft = (bwidth - 1280) / 2; |
|
|
|
var layerleft = (bwidth - 1280) / 2; |
|
|
|
|
|
|
|
|
|
|
|
//改变css
|
|
|
|
//改变css
|
|
|
|
$("#layer").css({"top":layertop,"left":layerleft}); |
|
|
|
//$("#layer").css({"top":layertop,"left":layerleft});
|
|
|
|
|
|
|
|
//原生js改变css
|
|
|
|
|
|
|
|
//alert(layertop);
|
|
|
|
|
|
|
|
document.getElementById("layer").style.top = layertop + "px"; |
|
|
|
|
|
|
|
document.getElementById("layer").style.left = layerleft + "px"; |
|
|
|
} |
|
|
|
} |
|
|
|
//创建一个遮罩层
|
|
|
|
//创建一个遮罩层
|
|
|
|
window.keepout = function(){ |
|
|
|
window.keepout = function(){ |
|
|
|
var fade = '<div id = "fade" style = "width:100%;height:100%;background:rgba(0, 0, 0, 0.5);position: fixed;left: 0;top: 0;z-index: 99;" onclick = "closelayer()"></div>'; |
|
|
|
var fade = '<div id = "fade" style = "width:100%;height:100%;background:rgba(0, 0, 0, 0.5);position: fixed;left: 0;top: 0;z-index: 99;" onclick = "closelayer()"></div>'; |
|
|
|
$("body").append(fade); |
|
|
|
//$("body").append(fade);
|
|
|
|
|
|
|
|
var div = document.createElement("div"); |
|
|
|
|
|
|
|
div.innerHTML = fade; |
|
|
|
|
|
|
|
document.body.appendChild(div); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//关闭层
|
|
|
|
//关闭层
|
|
|
|
window.closelayer = function(){ |
|
|
|
window.closelayer = function(){ |
|
|
|
$("#layer").hide(); |
|
|
|
//$("#layer").hide();
|
|
|
|
|
|
|
|
document.getElementById("layer").style.display = "none"; |
|
|
|
//showSidebar();
|
|
|
|
//showSidebar();
|
|
|
|
$("#layer").remove(); |
|
|
|
//$("#layer").remove();
|
|
|
|
$("#fade").remove(); |
|
|
|
var layer = document.getElementById("layer"); |
|
|
|
|
|
|
|
layer.parentNode.removeChild(layer); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//$("#fade").remove();
|
|
|
|
|
|
|
|
var fade = document.getElementById("fade"); |
|
|
|
|
|
|
|
fade.parentNode.removeChild(fade); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//创建一个显示按钮
|
|
|
|
//创建一个显示按钮
|
|
|
|
function imgurl(){ |
|
|
|
function imgurl(){ |
|
|
|
//var imgButton = layerstart;
|
|
|
|
//$("body").append('<div id = "imgbtn" style = "position:fixed;right:1em;bottom:1em;z-index:88;cursor:pointer;" onclick = "showImgurl()"><img src = "https://libs.xiaoz.top/material/image.png" width = "36px" height = "36px" /></div>');
|
|
|
|
//imgButton += '<iframe src = "http://localhost/imgurl/miniup.html" width="100%" height="660px" frameborder="0"></iframe>';
|
|
|
|
//使用原生js添加按钮
|
|
|
|
//imgButton += layerend;
|
|
|
|
var div = document.createElement("div"); |
|
|
|
//$("body").append();
|
|
|
|
div.innerHTML = '<div id = "imgbtn" style = "position:fixed;right:1em;bottom:1em;z-index:88;cursor:pointer;" onclick = "showImgurl()"><img src = "https://libs.xiaoz.top/material/image.png" width = "36px" height = "36px" /></div>'; |
|
|
|
$("body").append('<div id = "imgbtn" style = "position:fixed;right:1em;bottom:1em;z-index:88;cursor:pointer;" onclick = "showImgurl()"><img src = "https://libs.xiaoz.top/material/image.png" width = "36px" height = "36px" /></div>'); |
|
|
|
document.body.appendChild(div); |
|
|
|
} |
|
|
|
} |
|
|
|
//显示上传按钮
|
|
|
|
//显示上传按钮
|
|
|
|
window.showImgurl = function(){ |
|
|
|
window.showImgurl = function(){ |
|
|
|
var up = layerstart; |
|
|
|
var up = layerstart; |
|
|
|
up += '<iframe src = "https://imgurl.org/miniup.html" width="100%" height="660px" frameborder="0"></iframe>'; |
|
|
|
up += '<iframe src = "https://imgurl.org/miniup.html" width="100%" height="660px" frameborder="0"></iframe>'; |
|
|
|
up += layerend; |
|
|
|
up += layerend; |
|
|
|
$("body").append(up); |
|
|
|
//$("body").append(up);
|
|
|
|
|
|
|
|
var div = document.createElement("div"); |
|
|
|
|
|
|
|
div.innerHTML = up; |
|
|
|
|
|
|
|
document.body.appendChild(div); |
|
|
|
|
|
|
|
|
|
|
|
$("#layer").show(); |
|
|
|
//$("#layer").show();
|
|
|
|
|
|
|
|
document.getElementById("layer").style.display = "block"; |
|
|
|
|
|
|
|
|
|
|
|
//显示遮罩
|
|
|
|
//显示遮罩
|
|
|
|
keepout(); |
|
|
|
keepout(); |
|
|
|