ckl %!s(int64=6) %!d(string=hai) anos
achega
182d4b020f
Modificáronse 9 ficheiros con 153 adicións e 0 borrados
  1. BIN=BIN
      images/128.png
  2. BIN=BIN
      images/16.png
  3. BIN=BIN
      images/32.png
  4. BIN=BIN
      images/48.png
  5. 5 0
      index.html
  6. 93 0
      js/ImgURL.js
  7. 14 0
      js/background.js
  8. 26 0
      manifest.json
  9. 15 0
      popup.html

BIN=BIN
images/128.png


BIN=BIN
images/16.png


BIN=BIN
images/32.png


BIN=BIN
images/48.png


+ 5 - 0
index.html

@@ -0,0 +1,5 @@
+<html>
+<body style="width: 500px;height: 500px">
+	<iframe frameborder="no" style="width: 100%;height: 100%" style="border: none" src="https://imgurl.org/miniup.html?tdsourcetag=s_pctim_aiomsg"></iframe>
+</body>
+</html>

+ 93 - 0
js/ImgURL.js

@@ -0,0 +1,93 @@
+// ==UserScript==
+// @name         ImgURL上传脚本
+// @namespace    https://imgurl.org/
+// @version      0.21
+// @description  ImgURL快捷上传工具
+// @author       xiaoz.me
+// @match        http://*/*
+// @match        https://*/*
+// @license      GPL
+// @grant        none
+// ==/UserScript==
+
+(function() {
+    'use strict';
+
+    //定义一个全局弹出层
+    window.layerstart = '<div id = "layer" style = "box-shadow: 1px 1px 2px #888888;border-radius:5px;top:0em;left:0;width:80%;height:720px;background-color:#FFFFFF;position:fixed;z-index:999;display:none;border:1px solid #d2d2d2">';
+    layerstart += '<div style="text-align:right;padding:0.8em;border-bottom:1px solid #d2d2d2;"><a href="javascript:;" onclick="closelayer()" style="color:#FFFFFF;background-color:#FF5722;width:80px;text-align:center;padding:0.5em;border-radius:2px;padding-left:1em;padding-right:1em;">关闭</a></div>';
+    window.layerend = '</div>';
+
+    //让层居中显示
+    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 = '<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);
+	    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('<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>');
+	    //使用原生js添加按钮
+	    var div = document.createElement("div");
+	    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>';
+	    document.body.appendChild(div);
+    }
+    //显示上传按钮
+    window.showImgurl = function(){
+	    var up = layerstart;
+	    up += '<iframe src = "https://imgurl.org/miniup.html" width="100%" height="660px" frameborder="0"></iframe>';
+	    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();
+})();

+ 14 - 0
js/background.js

@@ -0,0 +1,14 @@
+chrome.runtime.onInstalled.addListener(function() {
+	chrome.storage.sync.set({color: '#3aa757'}, function() {
+	  console.log("The color is green.");
+	});
+	chrome.declarativeContent.onPageChanged.removeRules(undefined, function() {
+      chrome.declarativeContent.onPageChanged.addRules([{
+        conditions: [new chrome.declarativeContent.PageStateMatcher({
+          pageUrl: {hostEquals: 'developer.chrome.com'},
+        })
+        ],
+            actions: [new chrome.declarativeContent.ShowPageAction()]
+      }]);
+    });
+});

+ 26 - 0
manifest.json

@@ -0,0 +1,26 @@
+ {
+    "name": "ImgURL",
+    "description" : "Base Level Extension",
+    "version": "1.0",
+    "manifest_version": 2,
+    "permissions": ["storage", "declarativeContent"],
+    "browser_action": {
+      "default_popup": "index.html",
+      "default_icon": "images/16.png"
+    },
+    "commands": {
+      "_execute_browser_action": {
+        "suggested_key": {
+          "default": "Ctrl+Shift+U",
+          "mac": "MacCtrl+Shift+U"
+        },
+        "description": "Opens index.html"
+      }
+    },
+    "icons": {
+      "16": "images/16.png",
+      "32": "images/32.png",
+      "48": "images/48.png",
+      "128": "images/128.png"
+    }
+ }

+ 15 - 0
popup.html

@@ -0,0 +1,15 @@
+  <!DOCTYPE html>
+  <html>
+    <head>
+      <style>
+        button {
+          height: 30px;
+          width: 30px;
+          outline: none;
+        }
+      </style>
+    </head>
+    <body>
+      <button id="changeColor"></button>
+    </body>
+  </html>