// ==UserScript== // @name ImgURL上传脚本 // @namespace https://imgurl.org/ // @version 0.1 // @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; //改变css $("#layer").css({"top":layertop,"left":layerleft}); } //创建一个遮罩层 window.keepout = function(){ var fade = '
'; $("body").append(fade); } //关闭层 window.closelayer = function(){ $("#layer").hide(); //showSidebar(); $("#layer").remove(); $("#fade").remove(); } //创建一个显示按钮 function imgurl(){ //var imgButton = layerstart; //imgButton += ''; //imgButton += layerend; //$("body").append(); $("body").append('
'); } //显示上传按钮 window.showImgurl = function(){ var up = layerstart; up += ''; up += layerend; $("body").append(up); $("#layer").show(); //显示遮罩 keepout(); //居中显示层 layerCenter(); } imgurl(); })();