├── .circleci └── config.yml ├── .gitignore ├── .prettierrc ├── README.md ├── Uploader.swf ├── css ├── app.css └── bootstrap.min.css ├── icons ├── image-128.png ├── image-16.png ├── image-48.png ├── image-64.png ├── image.png ├── suc.png └── yun.png ├── js ├── background.js ├── crypto.js ├── jquery.js ├── main.js ├── options.js ├── qiniu.min.js ├── token.js └── webuploader.nolog.min.js ├── manifest.json ├── options.html └── popup.html /.circleci/config.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | workflows: 3 | version: 2 4 | main: 5 | jobs: 6 | - build 7 | - publish: 8 | requires: 9 | - build 10 | filters: 11 | tags: 12 | only: /^v\d+\.\d+\.\d+$/ 13 | jobs: 14 | build: 15 | docker: 16 | - image: cibuilds/chrome-extension:latest 17 | steps: 18 | - checkout 19 | - run: 20 | name: "Package Extension" 21 | command: git archive -o image-host.zip HEAD 22 | - persist_to_workspace: 23 | root: /root/project 24 | paths: 25 | - image-host.zip 26 | publish: 27 | docker: 28 | - image: cibuilds/chrome-extension:latest 29 | steps: 30 | - attach_workspace: 31 | at: /root/project 32 | - run: 33 | name: "Upload & Publish Extension to the Google Chrome Store" 34 | command: | 35 | if [ "${CIRCLE_BRANCH}" == "master" ]; then 36 | ACCESS_TOKEN=$(curl "https://accounts.google.com/o/oauth2/token" -d "client_id=${CLIENT_ID}&client_secret=${CLIENT_SECRET}&refresh_token=${REFRESH_TOKEN}&grant_type=refresh_token&redirect_uri=urn:ietf:wg:oauth:2.0:oob" | jq -r .access_token) 37 | curl -H "Authorization: Bearer ${ACCESS_TOKEN}" -H "x-goog-api-version: 2" -X PUT -T image-host.zip -v "https://www.googleapis.com/upload/chromewebstore/v1.1/items/${APP_ID}" 38 | curl -H "Authorization: Bearer ${ACCESS_TOKEN}" -H "x-goog-api-version: 2" -H "Content-Length: 0" -X POST -v "https://www.googleapis.com/chromewebstore/v1.1/items/${APP_ID}/publish" 39 | fi -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .vscode 2 | .idea -------------------------------------------------------------------------------- /.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "semi": false, 3 | "singleQuote": true 4 | } 5 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # 七牛云图床 [![CircleCI](https://circleci.com/gh/neal1991/image-host/tree/master.svg?style=svg)](https://circleci.com/gh/neal1991/image-host/tree/master) 2 | 3 | 通过七牛云云存储建立私有图床,目前功能主要包括: 4 | * 直接选择本地图片上传 5 | * 拖放本地图片上传 6 | * 复制图片粘贴上传 7 | * 生成三种格式的图片链接 8 | * 一键复制链接到剪切板 9 | 10 | ## 配置 11 | 12 | ![](http://mzzeast.shumsg.cn/FlgkICkL-2lNw8MlDpY2lyq5T38p) 13 | 14 | ## 上传 15 | 16 | ![](http://mzzeast.shumsg.cn/FjAbiKaTjbNaxTXHJoLM7s0Vj3S8) 17 | 18 | 三种上传方式:选择文件、拖拽上传、粘贴上传 19 | 20 | ## 安装 21 | 22 | 23 | 24 | 25 | 26 | 你也可以下载本项目,在 选择以开发者模式加载已解压的拓展程序。 27 | 28 | ## Reference 29 | 30 | * [七牛云对象存储文档](https://developer.qiniu.com/kodo) 31 | * [WebUploader API文档](http://fex.baidu.com/webuploader/doc/index.html) 32 | -------------------------------------------------------------------------------- /Uploader.swf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/madneal/image-host/e76bc96f368bf06a68056ad89fe6dd9b72724300/Uploader.swf -------------------------------------------------------------------------------- /css/app.css: -------------------------------------------------------------------------------- 1 | 2 | #container { 3 | width: 400px; 4 | height: 400px; 5 | margin: 20px auto 0 ; 6 | } 7 | 8 | #uploader { 9 | width: 380px; 10 | height: 200px; 11 | margin-left: 10px; 12 | border: 2px dashed #eee; 13 | display: flex; 14 | justify-content: center; 15 | align-items: center; 16 | flex-direction: column; 17 | } 18 | 19 | .display { 20 | margin-left: 10px; 21 | } 22 | 23 | .link-area { 24 | padding: 15px; 25 | } 26 | 27 | .link { 28 | display: flex; 29 | } 30 | 31 | .link h4 { 32 | width: 50px; 33 | } 34 | 35 | .link input { 36 | width: 290px; 37 | } 38 | 39 | .link button.input-action { 40 | visibility: hidden; 41 | } 42 | 43 | .link > label { 44 | width: 6em; 45 | line-height: 34px; 46 | margin: 0; 47 | } 48 | 49 | button.input-action { 50 | position: absolute; 51 | right: 0; 52 | bottom: 0; 53 | background-color: #dedede; 54 | text-transform: uppercase; 55 | cursor: pointer; 56 | line-height: 1; 57 | font-size: 11px; 58 | padding: 2px 5px; 59 | border-radius: 4px; 60 | text-shadow: 0 1px 1px rgba(255, 255, 255, 0.5); 61 | -webkit-touch-callout: none; 62 | -webkit-user-select: none; 63 | -moz-user-select: none; 64 | -ms-user-select: none; 65 | user-select: none; 66 | } 67 | 68 | .link:hover button.input-action { 69 | visibility: visible; 70 | } 71 | 72 | .link .content { 73 | position: relative; 74 | } 75 | 76 | #link-area { 77 | margin-top: 1em; 78 | } 79 | 80 | .status { 81 | display: none; 82 | margin-top: 5px; 83 | } 84 | 85 | .status img { 86 | width: 16px; 87 | height: 16px; 88 | } 89 | 90 | #pickfiles { 91 | position: relative; 92 | } 93 | 94 | #pickfiles div:last-child { 95 | position: absolute; 96 | left: 0 !important; 97 | top: 0 !important; 98 | width: 100% !important; 99 | height: 100% !important; 100 | opacity: 0; 101 | } 102 | -------------------------------------------------------------------------------- /icons/image-128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/madneal/image-host/e76bc96f368bf06a68056ad89fe6dd9b72724300/icons/image-128.png -------------------------------------------------------------------------------- /icons/image-16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/madneal/image-host/e76bc96f368bf06a68056ad89fe6dd9b72724300/icons/image-16.png -------------------------------------------------------------------------------- /icons/image-48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/madneal/image-host/e76bc96f368bf06a68056ad89fe6dd9b72724300/icons/image-48.png -------------------------------------------------------------------------------- /icons/image-64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/madneal/image-host/e76bc96f368bf06a68056ad89fe6dd9b72724300/icons/image-64.png -------------------------------------------------------------------------------- /icons/image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/madneal/image-host/e76bc96f368bf06a68056ad89fe6dd9b72724300/icons/image.png -------------------------------------------------------------------------------- /icons/suc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/madneal/image-host/e76bc96f368bf06a68056ad89fe6dd9b72724300/icons/suc.png -------------------------------------------------------------------------------- /icons/yun.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/madneal/image-host/e76bc96f368bf06a68056ad89fe6dd9b72724300/icons/yun.png -------------------------------------------------------------------------------- /js/background.js: -------------------------------------------------------------------------------- 1 | chrome.browserAction.onClicked.addListener(function (tab) { 2 | var w = 500; 3 | var h = 450; 4 | var left = Math.round((screen.width / 2) - (w / 2)); 5 | var top = Math.round((screen.height / 2) - (h / 2)); 6 | if (!checkOptions()) { 7 | chrome.notifications.create({ 8 | type: "basic", 9 | iconUrl: "icons/image.png", 10 | title: "提示", 11 | message: "首次使用请填写七牛云配置文件", 12 | requireInteraction: true, 13 | }); 14 | return 15 | } 16 | chrome.windows.create({ 17 | url: 'popup.html', 18 | width: w, 19 | height: h, 20 | focused: true, 21 | 'left': left, 22 | 'top': top, 23 | type: 'popup' 24 | }); 25 | }); 26 | 27 | function checkOptions() { 28 | const fields = ['ak', 'sk', 'bucket', 'domain']; 29 | fields.forEach(key => { 30 | if (!localStorage.getItem(key)) { 31 | return false; 32 | } 33 | }); 34 | return true; 35 | } 36 | -------------------------------------------------------------------------------- /js/crypto.js: -------------------------------------------------------------------------------- 1 | /* 2 | CryptoJS v3.1.2 3 | code.google.com/p/crypto-js 4 | (c) 2009-2013 by Jeff Mott. All rights reserved. 5 | code.google.com/p/crypto-js/wiki/License 6 | */ 7 | var CryptoJS=CryptoJS||function(g,l){var e={},d=e.lib={},m=function(){},k=d.Base={extend:function(a){m.prototype=this;var c=new m;a&&c.mixIn(a);c.hasOwnProperty("init")||(c.init=function(){c.$super.init.apply(this,arguments)});c.init.prototype=c;c.$super=this;return c},create:function(){var a=this.extend();a.init.apply(a,arguments);return a},init:function(){},mixIn:function(a){for(var c in a)a.hasOwnProperty(c)&&(this[c]=a[c]);a.hasOwnProperty("toString")&&(this.toString=a.toString)},clone:function(){return this.init.prototype.extend(this)}}, 8 | p=d.WordArray=k.extend({init:function(a,c){a=this.words=a||[];this.sigBytes=c!=l?c:4*a.length},toString:function(a){return(a||n).stringify(this)},concat:function(a){var c=this.words,q=a.words,f=this.sigBytes;a=a.sigBytes;this.clamp();if(f%4)for(var b=0;b>>2]|=(q[b>>>2]>>>24-8*(b%4)&255)<<24-8*((f+b)%4);else if(65535>>2]=q[b>>>2];else c.push.apply(c,q);this.sigBytes+=a;return this},clamp:function(){var a=this.words,c=this.sigBytes;a[c>>>2]&=4294967295<< 9 | 32-8*(c%4);a.length=g.ceil(c/4)},clone:function(){var a=k.clone.call(this);a.words=this.words.slice(0);return a},random:function(a){for(var c=[],b=0;b>>2]>>>24-8*(f%4)&255;b.push((d>>>4).toString(16));b.push((d&15).toString(16))}return b.join("")},parse:function(a){for(var c=a.length,b=[],f=0;f>>3]|=parseInt(a.substr(f, 10 | 2),16)<<24-4*(f%8);return new p.init(b,c/2)}},j=b.Latin1={stringify:function(a){var c=a.words;a=a.sigBytes;for(var b=[],f=0;f>>2]>>>24-8*(f%4)&255));return b.join("")},parse:function(a){for(var c=a.length,b=[],f=0;f>>2]|=(a.charCodeAt(f)&255)<<24-8*(f%4);return new p.init(b,c)}},h=b.Utf8={stringify:function(a){try{return decodeURIComponent(escape(j.stringify(a)))}catch(c){throw Error("Malformed UTF-8 data");}},parse:function(a){return j.parse(unescape(encodeURIComponent(a)))}}, 11 | r=d.BufferedBlockAlgorithm=k.extend({reset:function(){this._data=new p.init;this._nDataBytes=0},_append:function(a){"string"==typeof a&&(a=h.parse(a));this._data.concat(a);this._nDataBytes+=a.sigBytes},_process:function(a){var c=this._data,b=c.words,f=c.sigBytes,d=this.blockSize,e=f/(4*d),e=a?g.ceil(e):g.max((e|0)-this._minBufferSize,0);a=e*d;f=g.min(4*a,f);if(a){for(var k=0;ka;a++){if(16>a)m[a]=d[e+a]|0;else{var c=m[a-3]^m[a-8]^m[a-14]^m[a-16];m[a]=c<<1|c>>>31}c=(n<<5|n>>>27)+l+m[a];c=20>a?c+((j&h|~j&g)+1518500249):40>a?c+((j^h^g)+1859775393):60>a?c+((j&h|j&g|h&g)-1894007588):c+((j^h^ 15 | g)-899497514);l=g;g=h;h=j<<30|j>>>2;j=n;n=c}b[0]=b[0]+n|0;b[1]=b[1]+j|0;b[2]=b[2]+h|0;b[3]=b[3]+g|0;b[4]=b[4]+l|0},_doFinalize:function(){var d=this._data,e=d.words,b=8*this._nDataBytes,g=8*d.sigBytes;e[g>>>5]|=128<<24-g%32;e[(g+64>>>9<<4)+14]=Math.floor(b/4294967296);e[(g+64>>>9<<4)+15]=b;d.sigBytes=4*e.length;this._process();return this._hash},clone:function(){var e=d.clone.call(this);e._hash=this._hash.clone();return e}});g.SHA1=d._createHelper(l);g.HmacSHA1=d._createHmacHelper(l)})(); 16 | (function(){var g=CryptoJS,l=g.enc.Utf8;g.algo.HMAC=g.lib.Base.extend({init:function(e,d){e=this._hasher=new e.init;"string"==typeof d&&(d=l.parse(d));var g=e.blockSize,k=4*g;d.sigBytes>k&&(d=e.finalize(d));d.clamp();for(var p=this._oKey=d.clone(),b=this._iKey=d.clone(),n=p.words,j=b.words,h=0;h>>2]>>>24-8*(a%4)&255)<<16|(e[a+1>>>2]>>>24-8*((a+1)%4)&255)<<8|e[a+2>>>2]>>>24-8*((a+2)%4)&255,g=0;4>g&&a+0.75*g>>6*(3-g)&63));if(e=c.charAt(64))for(;b.length%4;)b.push(e);return b.join("")},parse:function(b){var e=b.length,f=this._map,c=f.charAt(64);c&&(c=b.indexOf(c),-1!=c&&(e=c));for(var c=[],a=0,d=0;d< 26 | e;d++)if(d%4){var g=f.indexOf(b.charAt(d-1))<<2*(d%4),h=f.indexOf(b.charAt(d))>>>6-2*(d%4);c[a>>>2]|=(g|h)<<24-8*(a%4);a++}return j.create(c,a)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="}})(); -------------------------------------------------------------------------------- /js/main.js: -------------------------------------------------------------------------------- 1 | $(function() { 2 | const keys = ['ak', 'sk', 'bucket', 'domain', 'region'] 3 | let isConfig = true 4 | 5 | keys.forEach(key => { 6 | if (!localStorage[key]) { 7 | isConfig = false 8 | } 9 | }) 10 | 11 | if (!isConfig) { 12 | chrome.tabs.create({ url: 'options.html' }) 13 | return 14 | } 15 | const uptoken = genUpToken( 16 | localStorage['ak'], 17 | localStorage['sk'], 18 | localStorage['bucket'] 19 | ) 20 | 21 | const domain = 22 | localStorage['domain'].indexOf('http') == -1 23 | ? 'http://' + localStorage['domain'] 24 | : localStorage['domain'] 25 | 26 | const serverRegion = `https://up${localStorage['region'] === '-z0' ? '' : localStorage['region']}.qiniup.com` 27 | 28 | var uploader = WebUploader.create({ 29 | auto: true, 30 | swf: 'Uploader.swf', 31 | server: serverRegion, 32 | pick: '#pickfiles', 33 | resize: false, 34 | dnd: '#container', 35 | paste: document.body, 36 | disableGlobalDnd: true, 37 | accept: [ 38 | { 39 | title: 'Images', 40 | extensions: 'gif,jpg,jpeg,bmp,png', 41 | mimeTypes: 'image/*' 42 | } 43 | ], 44 | compress: false, 45 | prepareNextFile: true, 46 | chunked: true, 47 | chunkSize: 4194304, 48 | threads: 5, 49 | fileNumLimit: 100, 50 | fileSingleSizeLimit: 10000 * 1024 * 1024, 51 | duplicate: true, 52 | formData: { 53 | token: uptoken 54 | } 55 | }) 56 | uploader.on('startUpload', () => { 57 | $('.status').css('display', 'flex') 58 | $('.words').html('上传中...') 59 | }) 60 | uploader.on('uploadSuccess', (file, res) => { 61 | $('.words').html('上传完成') 62 | setTimeout(() => { 63 | $('.status').css('display', 'none') 64 | }, 3000) 65 | $('#link-area').css('visibility', 'visible') 66 | console.log('response:', res) 67 | const link = domain + '/' + res.key 68 | const markdownLink = `![](${link})` 69 | const aLink =`` 70 | $('#link').val(link) 71 | $('#markdown').val(markdownLink) 72 | $('#a-link').val(aLink) 73 | }) 74 | uploader.on('uploadError', (file, reason) => { 75 | if (reason === 'http') { 76 | reason = '请检查AK/SK等配置正确,然后重新开启本窗口' 77 | } 78 | $('.words').html(`上传失败: ${reason}`) 79 | $('.status').css('display', 'flex') 80 | $('.status img').css('display', 'none') 81 | setTimeout(() => { 82 | $('.status').css('display', 'none') 83 | $('.status img').css('display', 'unset') 84 | }, 5000) 85 | $('#link-area').css('visibility', 'visible') 86 | }) 87 | 88 | $('#container') 89 | .on('dragenter', function(e) { 90 | e.preventDefault() 91 | $('#container').addClass('draging') 92 | e.stopPropagation() 93 | }) 94 | .on('drop', function(e) { 95 | e.preventDefault() 96 | $('#container').removeClass('draging') 97 | e.stopPropagation() 98 | }) 99 | .on('dragleave', function(e) { 100 | e.preventDefault() 101 | $('#container').removeClass('draging') 102 | e.stopPropagation() 103 | }) 104 | .on('dragover', function(e) { 105 | e.preventDefault() 106 | $('#container').addClass('draging') 107 | e.stopPropagation() 108 | }) 109 | 110 | $('#link-area button[data-action=copy]').on('click', function(e) { 111 | const btn = e.target 112 | const targetId = $(btn).attr('data-action-target') 113 | const val = $(targetId).val() 114 | copyToClipboard(val) 115 | }) 116 | 117 | function copyToClipboard(input) { 118 | const el = document.createElement('textarea') 119 | el.style.fontsize = '12pt' 120 | el.style.border = '0' 121 | el.style.padding = '0' 122 | el.style.margin = '0' 123 | el.style.position = 'absolute' 124 | el.style.left = '-9999px' 125 | el.setAttribute('readonly', '') 126 | el.value = input 127 | 128 | document.body.appendChild(el) 129 | el.select() 130 | 131 | let success = false 132 | try { 133 | success = document.execCommand('copy', true) 134 | } catch (err) {} 135 | 136 | document.body.removeChild(el) 137 | 138 | return success 139 | } 140 | }) 141 | -------------------------------------------------------------------------------- /js/options.js: -------------------------------------------------------------------------------- 1 | function Options() { 2 | const radioFields = ['region']; 3 | const fields = ['ak', 'sk', 'bucket', 'domain', ...radioFields] 4 | 5 | var bindUI = function () { 6 | //用localstorage中的值填充每个fields 7 | fields.forEach(field => { 8 | const ls = localStorage.getItem(field) 9 | if (radioFields.includes(field)) { 10 | const inputs = document.querySelectorAll(`#${field} input`); 11 | for (const input of inputs) { 12 | input.checked = input.value === ls; 13 | } 14 | } 15 | document.querySelector(`#${field}`).value = ls ? ls : ''; 16 | }); 17 | 18 | //监听save按钮的click事件 19 | document.querySelector('.save').addEventListener('click', e => { 20 | fields.forEach(field => { 21 | let val = document.querySelector(`#${field}`).value.trim(); 22 | if (radioFields.includes(field)) { 23 | val = document.querySelector(`#${field} input:checked`).value.trim(); 24 | } 25 | if (!val) { 26 | chrome.notifications.create({ 27 | type: "basic", 28 | iconUrl: "image.png", 29 | title: "提示", 30 | message: "为了图床的正常使用,请不要留空", 31 | requireInteraction: true, 32 | }); 33 | return 34 | } 35 | localStorage.setItem(field, val); 36 | }); 37 | document.querySelector('.save').innerText = '保存成功'; 38 | setTimeout(() => { 39 | chrome.tabs.query({currentWindow: true, active: true}, function (tabs) { 40 | chrome.tabs.remove(tabs[0].id); 41 | }); 42 | }, 500) 43 | }) 44 | }; 45 | 46 | return { 47 | init: function () { 48 | bindUI(); 49 | } 50 | }; 51 | } 52 | 53 | const options = new Options(); 54 | options.init(); 55 | -------------------------------------------------------------------------------- /js/qiniu.min.js: -------------------------------------------------------------------------------- 1 | !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.qiniu=e():t.qiniu=e()}("undefined"!=typeof self?self:this,function(){return function(t){function e(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,e),o.l=!0,o.exports}var n={};return e.m=t,e.c=n,e.d=function(t,n,r){e.o(t,n)||Object.defineProperty(t,n,{configurable:!1,enumerable:!0,get:r})},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="/dist/",e(e.s=58)}([function(t,e){var n=t.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=n)},function(t,e){var n=t.exports={version:"2.6.5"};"number"==typeof __e&&(__e=n)},function(t,e,n){var r=n(30)("wks"),o=n(22),i=n(0).Symbol,a="function"==typeof i;(t.exports=function(t){return r[t]||(r[t]=a&&i[t]||(a?i:o)("Symbol."+t))}).store=r},function(t,e,n){var r=n(7);t.exports=function(t){if(!r(t))throw TypeError(t+" is not an object!");return t}},function(t,e,n){var r=n(0),o=n(1),i=n(19),a=n(5),s=n(9),u=function(t,e,n){var c,f,l,h=t&u.F,p=t&u.G,d=t&u.S,g=t&u.P,m=t&u.B,v=t&u.W,y=p?o:o[e]||(o[e]={}),b=y.prototype,w=p?r:d?r[e]:(r[e]||{}).prototype;for(c in p&&(n=e),n)(f=!h&&w&&void 0!==w[c])&&s(y,c)||(l=f?w[c]:n[c],y[c]=p&&"function"!=typeof w[c]?n[c]:m&&f?i(l,r):v&&w[c]==l?function(t){var e=function(e,n,r){if(this instanceof t){switch(arguments.length){case 0:return new t;case 1:return new t(e);case 2:return new t(e,n)}return new t(e,n,r)}return t.apply(this,arguments)};return e.prototype=t.prototype,e}(l):g&&"function"==typeof l?i(Function.call,l):l,g&&((y.virtual||(y.virtual={}))[c]=l,t&u.R&&b&&!b[c]&&a(b,c,l)))};u.F=1,u.G=2,u.S=4,u.P=8,u.B=16,u.W=32,u.U=64,u.R=128,t.exports=u},function(t,e,n){var r=n(6),o=n(21);t.exports=n(8)?function(t,e,n){return r.f(t,e,o(1,n))}:function(t,e,n){return t[e]=n,t}},function(t,e,n){var r=n(3),o=n(43),i=n(28),a=Object.defineProperty;e.f=n(8)?Object.defineProperty:function(t,e,n){if(r(t),e=i(e,!0),r(n),o)try{return a(t,e,n)}catch(t){}if("get"in n||"set"in n)throw TypeError("Accessors not supported!");return"value"in n&&(t[e]=n.value),t}},function(t,e){t.exports=function(t){return"object"==typeof t?null!==t:"function"==typeof t}},function(t,e,n){t.exports=!n(10)(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},function(t,e){var n={}.hasOwnProperty;t.exports=function(t,e){return n.call(t,e)}},function(t,e){t.exports=function(t){try{return!!t()}catch(t){return!0}}},function(t,e,n){var r=n(47),o=n(26);t.exports=function(t){return r(o(t))}},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(t){var e=t+864e5;return(new Date).getTime()>e}function i(t){return(0,m.default)(t).filter(function(t){return t.startsWith("x:")}).map(function(e){return[e,t[e].toString()]})}function a(t){return"qiniu_js_sdk_upload_file_"+t.name+"_size_"+t.size}function s(t){try{return JSON.parse(localStorage.getItem(a(t)))||[]}catch(t){return window.console&&window.console.warn&&console.warn("getLocalFileInfo failed"),[]}}function u(t){return{Authorization:"UpToken "+t}}function c(){return window.XMLHttpRequest?new XMLHttpRequest:new window.ActiveXObject("Microsoft.XMLHTTP")}function f(t){return new p.default(function(e,n){var r=new FileReader;r.readAsArrayBuffer(t),r.onload=function(t){var n=t.target.result;e(n)},r.onerror=function(){n(new Error("fileReader 读取错误"))}})}function l(t,e){return new p.default(function(n,r){var o=c();o.open(e.method,t),e.onCreate&&e.onCreate(o),e.headers&&(0,m.default)(e.headers).forEach(function(t){return o.setRequestHeader(t,e.headers[t])}),o.upload.addEventListener("progress",function(t){t.lengthComputable&&e.onProgress&&e.onProgress({loaded:t.loaded,total:t.total})}),o.onreadystatechange=function(){var t=o.responseText;if(4===o.readyState){var e=o.getResponseHeader("x-reqId")||"";if(200!==o.status){var i="xhr request failed, code: "+o.status+";";return t&&(i=i+" response: "+t),void r({code:o.status,message:i,reqId:e,isRequestError:!0})}try{n({data:JSON.parse(t),reqId:e})}catch(t){r(t)}}},o.send(e.body)})}function h(){return"http:"===window.location.protocol?"http:":"https:"}e.__esModule=!0;var p=r(n(18)),d=r(n(34)),g=r(n(86)),m=r(n(36));e.isChunkExpired=o,e.getChunks=function(t,e){for(var n=[],r=Math.ceil(t.size/e),o=0;o-1},e.createObjectURL=function(t){return(window.URL||window.webkitURL||window.mozURL).createObjectURL(t)},e.getTransform=function(t,e){var n=t.width,r=t.height;switch(e){case 1:return{width:n,height:r,matrix:[1,0,0,1,0,0]};case 2:return{width:n,height:r,matrix:[-1,0,0,1,n,0]};case 3:return{width:n,height:r,matrix:[-1,0,0,-1,n,r]};case 4:return{width:n,height:r,matrix:[1,0,0,-1,0,r]};case 5:return{width:r,height:n,matrix:[0,1,1,0,0,0]};case 6:return{width:r,height:n,matrix:[0,1,-1,0,r,0]};case 7:return{width:r,height:n,matrix:[0,-1,-1,0,r,n]};case 8:return{width:r,height:n,matrix:[0,-1,1,0,0,n]}}};var v=n(56),y=n(39),b=r(n(91))},function(t,e){t.exports=!0},function(t,e){t.exports={}},function(t,e,n){var r=n(46),o=n(31);t.exports=Object.keys||function(t){return r(t,o)}},function(t,e){var n={}.toString;t.exports=function(t){return n.call(t).slice(8,-1)}},function(t,e,n){"use strict";e.__esModule=!0,e.default=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}},function(t,e,n){t.exports={default:n(59),__esModule:!0}},function(t,e,n){var r=n(20);t.exports=function(t,e,n){if(r(t),void 0===e)return t;switch(n){case 1:return function(n){return t.call(e,n)};case 2:return function(n,r){return t.call(e,n,r)};case 3:return function(n,r,o){return t.call(e,n,r,o)}}return function(){return t.apply(e,arguments)}}},function(t,e){t.exports=function(t){if("function"!=typeof t)throw TypeError(t+" is not a function!");return t}},function(t,e){t.exports=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}}},function(t,e){var n=0,r=Math.random();t.exports=function(t){return"Symbol(".concat(void 0===t?"":t,")_",(++n+r).toString(36))}},function(t,e,n){var r=n(6).f,o=n(9),i=n(2)("toStringTag");t.exports=function(t,e,n){t&&!o(t=n?t:t.prototype,i)&&r(t,i,{configurable:!0,value:e})}},function(t,e){e.f={}.propertyIsEnumerable},function(t,e){var n=Math.ceil,r=Math.floor;t.exports=function(t){return isNaN(t=+t)?0:(t>0?r:n)(t)}},function(t,e){t.exports=function(t){if(void 0==t)throw TypeError("Can't call method on "+t);return t}},function(t,e,n){var r=n(7),o=n(0).document,i=r(o)&&r(o.createElement);t.exports=function(t){return i?o.createElement(t):{}}},function(t,e,n){var r=n(7);t.exports=function(t,e){if(!r(t))return t;var n,o;if(e&&"function"==typeof(n=t.toString)&&!r(o=n.call(t)))return o;if("function"==typeof(n=t.valueOf)&&!r(o=n.call(t)))return o;if(!e&&"function"==typeof(n=t.toString)&&!r(o=n.call(t)))return o;throw TypeError("Can't convert object to primitive value")}},function(t,e,n){var r=n(30)("keys"),o=n(22);t.exports=function(t){return r[t]||(r[t]=o(t))}},function(t,e,n){var r=n(1),o=n(0),i=o["__core-js_shared__"]||(o["__core-js_shared__"]={});(t.exports=function(t,e){return i[t]||(i[t]=void 0!==e?e:{})})("versions",[]).push({version:r.version,mode:n(13)?"pure":"global",copyright:"© 2019 Denis Pushkarev (zloirock.ru)"})},function(t,e){t.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")},function(t,e,n){var r=n(26);t.exports=function(t){return Object(r(t))}},function(t,e,n){"use strict";var r=n(20);t.exports.f=function(t){return new function(t){var e,n;this.promise=new t(function(t,r){if(void 0!==e||void 0!==n)throw TypeError("Bad Promise constructor");e=t,n=r}),this.resolve=r(e),this.reject=r(n)}(t)}},function(t,e,n){t.exports={default:n(83),__esModule:!0}},function(t,e){e.f=Object.getOwnPropertySymbols},function(t,e,n){t.exports={default:n(88),__esModule:!0}},function(t,e,n){e.f=n(2)},function(t,e,n){var r=n(0),o=n(1),i=n(13),a=n(37),s=n(6).f;t.exports=function(t){var e=o.Symbol||(o.Symbol=i?{}:r.Symbol||{});"_"==t.charAt(0)||t in e||s(e,t,{value:a.f(t)})}},function(t,e,n){"use strict";e.__esModule=!0,e.regionUphostMap={z0:{srcUphost:"up.qiniup.com",cdnUphost:"upload.qiniup.com"},z1:{srcUphost:"up-z1.qiniup.com",cdnUphost:"upload-z1.qiniup.com"},z2:{srcUphost:"up-z2.qiniup.com",cdnUphost:"upload-z2.qiniup.com"},na0:{srcUphost:"up-na0.qiniup.com",cdnUphost:"upload-na0.qiniup.com"},as0:{srcUphost:"up-as0.qiniup.com",cdnUphost:"upload-as0.qiniup.com"}},e.region={z0:"z0",z1:"z1",z2:"z2",na0:"na0",as0:"as0"}},function(t,e){},function(t,e,n){"use strict";var r=n(60)(!0);n(42)(String,"String",function(t){this._t=String(t),this._i=0},function(){var t,e=this._t,n=this._i;return n>=e.length?{value:void 0,done:!0}:(t=r(e,n),this._i+=t.length,{value:t,done:!1})})},function(t,e,n){"use strict";var r=n(13),o=n(4),i=n(44),a=n(5),s=n(14),u=n(61),c=n(23),f=n(65),l=n(2)("iterator"),h=!([].keys&&"next"in[].keys()),p=function(){return this};t.exports=function(t,e,n,d,g,m,v){u(n,e,d);var y,b,w,x=function(t){if(!h&&t in C)return C[t];switch(t){case"keys":case"values":return function(){return new n(this,t)}}return function(){return new n(this,t)}},S=e+" Iterator",_="values"==g,P=!1,C=t.prototype,U=C[l]||C["@@iterator"]||g&&C[g],I=U||x(g),F=g?_?x("entries"):I:void 0,k="Array"==e&&C.entries||U;if(k&&(w=f(k.call(new t)))!==Object.prototype&&w.next&&(c(w,S,!0),r||"function"==typeof w[l]||a(w,l,p)),_&&U&&"values"!==U.name&&(P=!0,I=function(){return U.call(this)}),r&&!v||!h&&!P&&C[l]||a(C,l,I),s[e]=I,s[S]=p,g)if(y={values:_?I:x("values"),keys:m?I:x("keys"),entries:F},v)for(b in y)b in C||i(C,b,y[b]);else o(o.P+o.F*(h||P),e,y);return y}},function(t,e,n){t.exports=!n(8)&&!n(10)(function(){return 7!=Object.defineProperty(n(27)("div"),"a",{get:function(){return 7}}).a})},function(t,e,n){t.exports=n(5)},function(t,e,n){var r=n(3),o=n(62),i=n(31),a=n(29)("IE_PROTO"),s=function(){},u=function(){var t,e=n(27)("iframe"),r=i.length;for(e.style.display="none",n(49).appendChild(e),e.src="javascript:",(t=e.contentWindow.document).open(),t.write(" 106 | 107 | 108 | 109 | -------------------------------------------------------------------------------- /popup.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 七牛云图床 9 | 10 | 11 | 12 | 13 | 14 |
15 |
16 | 17 |
18 |

拖放图片到这里上传图片

19 |
20 | 21 |
22 |
23 |
24 | 上传成功 25 |
26 |
27 | 50 | 51 |
52 |
53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | --------------------------------------------------------------------------------