Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
165 additions
and
164 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
min: | ||
html-minifier --minify-js --minify-css --collapse-whitespace --remove-optional-tags --remove-attribute-quotes --remove-redundant-attributes templates/index.tmpl > templates/index.html | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,164 +1,2 @@ | ||
<!DOCTYPE HTML> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<title>Doora</title> | ||
<link rel="stylesheet" href="http://cdn.staticfile.org/dropzone/3.8.2/css/dropzone.css" /> | ||
<style type="text/css"> | ||
body { | ||
background-color: rgb(244, 244, 244); | ||
} | ||
.logo { | ||
display: block; | ||
width: 80px; | ||
margin: 30px auto; | ||
} | ||
#dropzone.dropzone { | ||
position: absolute; | ||
top:0; | ||
bottom: 0; | ||
left: 0; | ||
right: 0; | ||
margin: auto; | ||
width: 800px; | ||
height: 500px; | ||
} | ||
.qrcode { | ||
position: absolute; | ||
top: 75px; | ||
right: 100px; | ||
} | ||
.download-url { | ||
width: 700px; | ||
height: 50px; | ||
position: absolute; | ||
left: 40px; | ||
bottom: 30px; | ||
font-size: 35px; | ||
text-align: center; | ||
} | ||
#dropzone.success .dz-details { | ||
top: 50px; | ||
left: 100px; | ||
width: 200px; | ||
height: 200px; | ||
} | ||
#dropzone.success .dz-details img { | ||
width: 200px; | ||
height: 200px; | ||
} | ||
#dropzone.success .dz-filename span { | ||
position: absolute; | ||
top: 0; | ||
left: 0; | ||
right: 0; | ||
bottom: 0; | ||
margin: auto; | ||
width: 150px; | ||
height: 10px; | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<a href="" class="logo"> | ||
<img src="http://doora.qiniudn.com/logo.png" alt="Logo" /> | ||
</a> | ||
<form id="dropzone" class="dropzone" action="http://up.qiniu.com"></form> | ||
|
||
<script type="text/x-template" id="result-panel-tmpl"> | ||
<div id="qrcode-container" class="qrcode"></div> | ||
<input type="text" class="download-url" value="${download_url}" readonly="readonly" /> | ||
</script> | ||
|
||
<script type="text/javascript"> | ||
// load.js, put it here for speed. | ||
function asyncLoadScript(a){return function(b,c){var d=document.createElement("script");d.type="text/javascript",d.src=a,d.onload=b,d.onerror=c,d.onreadystatechange=function(){var a=this.readyState;if(a==="loaded"||a==="complete")d.onreadystatechange=null,b()},head.insertBefore(d,head.firstChild)}}(function(a){a=a||{};var b={},c,d;c=function(a,d,e){var f=a.halt=!1;a.error=function(a){throw a},a.next=function(c){c&&(f=!1);if(!a.halt&&d&&d.length){var e=d.shift(),g=e.shift();f=!0;try{b[g].apply(a,[e,e.length,g])}catch(h){a.error(h)}}return a};for(var g in b){if(typeof a[g]=="function")continue;(function(e){a[e]=function(){var g=Array.prototype.slice.call(arguments);if(e==="onError"){if(d)return b.onError.apply(a,[g,g.length]),a;var h={};return b.onError.apply(h,[g,g.length]),c(h,null,"onError")}return g.unshift(e),d?(a.then=a[e],d.push(g),f?a:a.next()):c({},[g],e)}})(g)}return e&&(a.then=a[e]),a.call=function(b,c){c.unshift(b),d.unshift(c),a.next(!0)},a.next()},d=a.addMethod=function(d){var e=Array.prototype.slice.call(arguments),f=e.pop();for(var g=0,h=e.length;g<h;g++)typeof e[g]=="string"&&(b[e[g]]=f);--h||(b["then"+d.substr(0,1).toUpperCase()+d.substr(1)]=f),c(a)},d("chain",function(a){var b=this,c=function(){if(!b.halt){if(!a.length)return b.next(!0);try{null!=a.shift().call(b,c,b.error)&&c()}catch(d){b.error(d)}}};c()}),d("run",function(a,b){var c=this,d=function(){c.halt||--b||c.next(!0)},e=function(a){c.error(a)};for(var f=0,g=b;!c.halt&&f<g;f++)null!=a[f].call(c,d,e)&&d()}),d("defer",function(a){var b=this;setTimeout(function(){b.next(!0)},a.shift())}),d("onError",function(a,b){var c=this;this.error=function(d){c.halt=!0;for(var e=0;e<b;e++)a[e].call(c,d)}})})(this);var head=document.getElementsByTagName("head")[0]||document.documentElement;addMethod("load",function(a,b){for(var c=[],d=0;d<b;d++)(function(b){c.push(asyncLoadScript(a[b]))})(d);this.call("run",c)}) | ||
</script> | ||
<script type="text/javascript"> | ||
|
||
function randomString(length) { | ||
var possibles = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789', | ||
chars = []; | ||
for(var i = 0; i < length; i++) { | ||
chars.push(possibles.charAt(Math.floor(Math.random() * possibles.length))); | ||
} | ||
return chars.join(''); | ||
} | ||
|
||
var zepto_js = "http://cdn.staticfile.org/zepto/1.0rc1/zepto.min.js", | ||
qrcode_js = "http://cdn.staticfile.org/jquery.qrcode/1.0/jquery.qrcode.min.js", | ||
dropzone_js = "http://cdn.staticfile.org/dropzone/3.8.2/dropzone.min.js", | ||
zerocb_js = "http://cdn.staticfile.org/zeroclipboard/1.3.5/ZeroClipboard.min.js"; | ||
|
||
load(zepto_js).thenRun(function() { | ||
window.jQuery = $; | ||
load(qrcode_js); | ||
}); | ||
|
||
load(dropzone_js).thenRun(function() { | ||
Dropzone.autoDiscover = false; | ||
var zone = new Dropzone('#dropzone', { | ||
method: 'post', | ||
maxFilesize: 20, | ||
thumbnailWidth: 200, | ||
thumbnailHeight: 200, | ||
init: function() { | ||
this.on('sending', function(file, xhr, formData) { | ||
var filename = file.name, | ||
extension = filename.indexOf('.') > -1 ? filename.split('.').pop() : '', | ||
random_filename = randomString(5), | ||
key = random_filename + (extension ? '.' + extension : ''); | ||
|
||
formData.append('token', '{{ up_token }}'); | ||
formData.append('key', key); | ||
formData.append('x:key', key); | ||
}); | ||
this.on('success', function(file, resp) { | ||
showResultPanel(resp.download_url); | ||
}); | ||
this.on('addedfile', function() { | ||
resetDropzone(); | ||
}); | ||
} | ||
}); | ||
|
||
function resetDropzone() { | ||
$('#dropzone').removeClass('success'); | ||
$('.dz-success').remove(); | ||
$('.dz-error').remove(); | ||
$('#qrcode-container').remove(); | ||
$('.download-url').remove(); | ||
} | ||
|
||
function showResultPanel(download_url) { | ||
var tmpl = $('#result-panel-tmpl').html(), | ||
html = tmpl.replace('${download_url}', download_url); | ||
|
||
$('#dropzone').addClass('success').append(html); | ||
$('.download-url').focus().select(); | ||
|
||
renderQRCode(download_url); | ||
|
||
$('.dz-preview').animate({ | ||
width: '700px', | ||
height: '330px' | ||
}); | ||
} | ||
|
||
function renderQRCode(url) { | ||
$('#qrcode-container').qrcode({ | ||
text: url, | ||
width: 250, | ||
height: 250 | ||
}); | ||
} | ||
}); | ||
|
||
</script> | ||
<script type="text/javascript"> | ||
window.analytics=window.analytics||[],window.analytics.methods=["identify","group","track","page","pageview","alias","ready","on","once","off","trackLink","trackForm","trackClick","trackSubmit"],window.analytics.factory=function(t){return function(){var a=Array.prototype.slice.call(arguments);return a.unshift(t),window.analytics.push(a),window.analytics}};for(var i=0;i<window.analytics.methods.length;i++){var key=window.analytics.methods[i];window.analytics[key]=window.analytics.factory(key)}window.analytics.load=function(t){if(!document.getElementById("analytics-js")){var a=document.createElement("script");a.type="text/javascript",a.id="analytics-js",a.async=!0,a.src=("https:"===document.location.protocol?"https://":"http://")+"cdn.segment.io/analytics.js/v1/"+t+"/analytics.min.js";var n=document.getElementsByTagName("script")[0];n.parentNode.insertBefore(a,n)}},window.analytics.SNIPPET_VERSION="2.0.9", | ||
window.analytics.load("urqa6sq2hk"); | ||
window.analytics.page(); | ||
</script> | ||
</body> | ||
</html> | ||
<!DOCTYPE HTML><html lang=en><head><meta charset=UTF-8><title>Doora</title><link rel=stylesheet href="http://cdn.staticfile.org/dropzone/3.8.2/css/dropzone.css"><style type=text/css>body{background-color:#f4f4f4}.logo{display:block;width:80px;margin:30px auto}#dropzone.dropzone{position:absolute;top:0;bottom:0;left:0;right:0;margin:auto;width:800px;height:500px}.qrcode{position:absolute;top:75px;right:100px}.download-url{width:700px;height:50px;position:absolute;left:40px;bottom:30px;font-size:35px;text-align:center}#dropzone.success .dz-details{top:50px;left:100px;width:200px;height:200px}#dropzone.success .dz-details img{width:200px;height:200px}#dropzone.success .dz-filename span{position:absolute;top:0;left:0;right:0;bottom:0;margin:auto;width:150px;height:10px}</style><body><a href="" class=logo><img src=http://doora.qiniudn.com/logo.png alt="Logo"></a><form id=dropzone class=dropzone action=http://up.qiniu.com></form><script type=text/x-template id=result-panel-tmpl><div id="qrcode-container" class="qrcode"></div> | ||
<input type="text" class="download-url" value="${download_url}" readonly="readonly" /></script><script type=text/javascript>function asyncLoadScript(t){return function(n,r){var e=document.createElement("script");e.type="text/javascript",e.src=t,e.onload=n,e.onerror=r,e.onreadystatechange=function(){var t=this.readyState;("loaded"===t||"complete"===t)&&(e.onreadystatechange=null,n())},head.insertBefore(e,head.firstChild)}}!function(t){t=t||{};var n,r,e={};n=function(t,r,o){var a=t.halt=!1;t.error=function(t){throw t},t.next=function(n){if(n&&(a=!1),!t.halt&&r&&r.length){var o=r.shift(),i=o.shift();a=!0;try{e[i].apply(t,[o,o.length,i])}catch(c){t.error(c)}}return t};for(var i in e)"function"!=typeof t[i]&&!function(o){t[o]=function(){var i=Array.prototype.slice.call(arguments);if("onError"===o){if(r)return e.onError.apply(t,[i,i.length]),t;var c={};return e.onError.apply(c,[i,i.length]),n(c,null,"onError")}return i.unshift(o),r?(t.then=t[o],r.push(i),a?t:t.next()):n({},[i],o)}}(i);return o&&(t.then=t[o]),t.call=function(n,e){e.unshift(n),r.unshift(e),t.next(!0)},t.next()},r=t.addMethod=function(r){for(var o=Array.prototype.slice.call(arguments),a=o.pop(),i=0,c=o.length;c>i;i++)"string"==typeof o[i]&&(e[o[i]]=a);--c||(e["then"+r.substr(0,1).toUpperCase()+r.substr(1)]=a),n(t)},r("chain",function(t){var n=this,r=function(){if(!n.halt){if(!t.length)return n.next(!0);try{null!=t.shift().call(n,r,n.error)&&r()}catch(e){n.error(e)}}};r()}),r("run",function(t,n){for(var r=this,e=function(){r.halt||--n||r.next(!0)},o=function(t){r.error(t)},a=0,i=n;!r.halt&&i>a;a++)null!=t[a].call(r,e,o)&&e()}),r("defer",function(t){var n=this;setTimeout(function(){n.next(!0)},t.shift())}),r("onError",function(t,n){var r=this;this.error=function(e){r.halt=!0;for(var o=0;n>o;o++)t[o].call(r,e)}})}(this);var head=document.getElementsByTagName("head")[0]||document.documentElement;addMethod("load",function(t,n){for(var r=[],e=0;n>e;e++)(function(n){r.push(asyncLoadScript(t[n]))})(e);this.call("run",r)});</script><script type=text/javascript>function randomString(o){for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",n=[],t=0;o>t;t++)n.push(e.charAt(Math.floor(Math.random()*e.length)));return n.join("")}var zepto_js="http://cdn.staticfile.org/zepto/1.0rc1/zepto.min.js",qrcode_js="http://cdn.staticfile.org/jquery.qrcode/1.0/jquery.qrcode.min.js",dropzone_js="http://cdn.staticfile.org/dropzone/3.8.2/dropzone.min.js",zerocb_js="http://cdn.staticfile.org/zeroclipboard/1.3.5/ZeroClipboard.min.js";load(zepto_js).thenRun(function(){window.jQuery=$,load(qrcode_js)}),load(dropzone_js).thenRun(function(){function o(){$("#dropzone").removeClass("success"),$(".dz-success").remove(),$(".dz-error").remove(),$("#qrcode-container").remove(),$(".download-url").remove()}function e(o){var e=$("#result-panel-tmpl").html(),t=e.replace("${download_url}",o);$("#dropzone").addClass("success").append(t),$(".download-url").focus().select(),n(o),$(".dz-preview").animate({width:"700px",height:"330px"})}function n(o){$("#qrcode-container").qrcode({text:o,width:250,height:250})}Dropzone.autoDiscover=!1;new Dropzone("#dropzone",{method:"post",maxFilesize:20,thumbnailWidth:200,thumbnailHeight:200,init:function(){this.on("sending",function(o,e,n){var t=o.name,r=t.indexOf(".")>-1?t.split(".").pop():"",d=randomString(5),i=d+(r?"."+r:"");n.append("token","{{ up_token }}"),n.append("key",i),n.append("x:key",i)}),this.on("success",function(o,n){e(n.download_url)}),this.on("addedfile",function(){o()})}})});</script><script type=text/javascript src="http://tajs.qq.com/stats?sId=40186523" charset=UTF-8></script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,160 @@ | ||
<!DOCTYPE HTML> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<title>Doora</title> | ||
<link rel="stylesheet" href="http://cdn.staticfile.org/dropzone/3.8.2/css/dropzone.css" /> | ||
<style type="text/css"> | ||
body { | ||
background-color: rgb(244, 244, 244); | ||
} | ||
.logo { | ||
display: block; | ||
width: 80px; | ||
margin: 30px auto; | ||
} | ||
#dropzone.dropzone { | ||
position: absolute; | ||
top:0; | ||
bottom: 0; | ||
left: 0; | ||
right: 0; | ||
margin: auto; | ||
width: 800px; | ||
height: 500px; | ||
} | ||
.qrcode { | ||
position: absolute; | ||
top: 75px; | ||
right: 100px; | ||
} | ||
.download-url { | ||
width: 700px; | ||
height: 50px; | ||
position: absolute; | ||
left: 40px; | ||
bottom: 30px; | ||
font-size: 35px; | ||
text-align: center; | ||
} | ||
#dropzone.success .dz-details { | ||
top: 50px; | ||
left: 100px; | ||
width: 200px; | ||
height: 200px; | ||
} | ||
#dropzone.success .dz-details img { | ||
width: 200px; | ||
height: 200px; | ||
} | ||
#dropzone.success .dz-filename span { | ||
position: absolute; | ||
top: 0; | ||
left: 0; | ||
right: 0; | ||
bottom: 0; | ||
margin: auto; | ||
width: 150px; | ||
height: 10px; | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<a href="" class="logo"> | ||
<img src="http://doora.qiniudn.com/logo.png" alt="Logo" /> | ||
</a> | ||
<form id="dropzone" class="dropzone" action="http://up.qiniu.com"></form> | ||
|
||
<script type="text/x-template" id="result-panel-tmpl"> | ||
<div id="qrcode-container" class="qrcode"></div> | ||
<input type="text" class="download-url" value="${download_url}" readonly="readonly" /> | ||
</script> | ||
|
||
<script type="text/javascript"> | ||
// load.js, put it here for speed. | ||
function asyncLoadScript(a){return function(b,c){var d=document.createElement("script");d.type="text/javascript",d.src=a,d.onload=b,d.onerror=c,d.onreadystatechange=function(){var a=this.readyState;if(a==="loaded"||a==="complete")d.onreadystatechange=null,b()},head.insertBefore(d,head.firstChild)}}(function(a){a=a||{};var b={},c,d;c=function(a,d,e){var f=a.halt=!1;a.error=function(a){throw a},a.next=function(c){c&&(f=!1);if(!a.halt&&d&&d.length){var e=d.shift(),g=e.shift();f=!0;try{b[g].apply(a,[e,e.length,g])}catch(h){a.error(h)}}return a};for(var g in b){if(typeof a[g]=="function")continue;(function(e){a[e]=function(){var g=Array.prototype.slice.call(arguments);if(e==="onError"){if(d)return b.onError.apply(a,[g,g.length]),a;var h={};return b.onError.apply(h,[g,g.length]),c(h,null,"onError")}return g.unshift(e),d?(a.then=a[e],d.push(g),f?a:a.next()):c({},[g],e)}})(g)}return e&&(a.then=a[e]),a.call=function(b,c){c.unshift(b),d.unshift(c),a.next(!0)},a.next()},d=a.addMethod=function(d){var e=Array.prototype.slice.call(arguments),f=e.pop();for(var g=0,h=e.length;g<h;g++)typeof e[g]=="string"&&(b[e[g]]=f);--h||(b["then"+d.substr(0,1).toUpperCase()+d.substr(1)]=f),c(a)},d("chain",function(a){var b=this,c=function(){if(!b.halt){if(!a.length)return b.next(!0);try{null!=a.shift().call(b,c,b.error)&&c()}catch(d){b.error(d)}}};c()}),d("run",function(a,b){var c=this,d=function(){c.halt||--b||c.next(!0)},e=function(a){c.error(a)};for(var f=0,g=b;!c.halt&&f<g;f++)null!=a[f].call(c,d,e)&&d()}),d("defer",function(a){var b=this;setTimeout(function(){b.next(!0)},a.shift())}),d("onError",function(a,b){var c=this;this.error=function(d){c.halt=!0;for(var e=0;e<b;e++)a[e].call(c,d)}})})(this);var head=document.getElementsByTagName("head")[0]||document.documentElement;addMethod("load",function(a,b){for(var c=[],d=0;d<b;d++)(function(b){c.push(asyncLoadScript(a[b]))})(d);this.call("run",c)}) | ||
</script> | ||
<script type="text/javascript"> | ||
|
||
function randomString(length) { | ||
var possibles = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789', | ||
chars = []; | ||
for(var i = 0; i < length; i++) { | ||
chars.push(possibles.charAt(Math.floor(Math.random() * possibles.length))); | ||
} | ||
return chars.join(''); | ||
} | ||
|
||
var zepto_js = "http://cdn.staticfile.org/zepto/1.0rc1/zepto.min.js", | ||
qrcode_js = "http://cdn.staticfile.org/jquery.qrcode/1.0/jquery.qrcode.min.js", | ||
dropzone_js = "http://cdn.staticfile.org/dropzone/3.8.2/dropzone.min.js", | ||
zerocb_js = "http://cdn.staticfile.org/zeroclipboard/1.3.5/ZeroClipboard.min.js"; | ||
|
||
load(zepto_js).thenRun(function() { | ||
window.jQuery = $; | ||
load(qrcode_js); | ||
}); | ||
|
||
load(dropzone_js).thenRun(function() { | ||
Dropzone.autoDiscover = false; | ||
var zone = new Dropzone('#dropzone', { | ||
method: 'post', | ||
maxFilesize: 20, | ||
thumbnailWidth: 200, | ||
thumbnailHeight: 200, | ||
init: function() { | ||
this.on('sending', function(file, xhr, formData) { | ||
var filename = file.name, | ||
extension = filename.indexOf('.') > -1 ? filename.split('.').pop() : '', | ||
random_filename = randomString(5), | ||
key = random_filename + (extension ? '.' + extension : ''); | ||
|
||
formData.append('token', '{{ up_token }}'); | ||
formData.append('key', key); | ||
formData.append('x:key', key); | ||
}); | ||
this.on('success', function(file, resp) { | ||
showResultPanel(resp.download_url); | ||
}); | ||
this.on('addedfile', function() { | ||
resetDropzone(); | ||
}); | ||
} | ||
}); | ||
|
||
function resetDropzone() { | ||
$('#dropzone').removeClass('success'); | ||
$('.dz-success').remove(); | ||
$('.dz-error').remove(); | ||
$('#qrcode-container').remove(); | ||
$('.download-url').remove(); | ||
} | ||
|
||
function showResultPanel(download_url) { | ||
var tmpl = $('#result-panel-tmpl').html(), | ||
html = tmpl.replace('${download_url}', download_url); | ||
|
||
$('#dropzone').addClass('success').append(html); | ||
$('.download-url').focus().select(); | ||
|
||
renderQRCode(download_url); | ||
|
||
$('.dz-preview').animate({ | ||
width: '700px', | ||
height: '330px' | ||
}); | ||
} | ||
|
||
function renderQRCode(url) { | ||
$('#qrcode-container').qrcode({ | ||
text: url, | ||
width: 250, | ||
height: 250 | ||
}); | ||
} | ||
}); | ||
|
||
</script> | ||
<script type="text/javascript" src="http://tajs.qq.com/stats?sId=40186523" charset="UTF-8"></script> | ||
</body> | ||
</html> |