@@ -40,12 +40,12 @@ | |||
</div> | |||
<div class="row"> | |||
<div class="col-sm-12"> | |||
<h2>Or just click here</h2> | |||
<h2>Or paste them</h2> | |||
</div> | |||
</div> | |||
<div class="row"> | |||
<div class="col-sm-12"> | |||
<h3>Your Choice</h3> | |||
<h3>Or click</h3> | |||
</div> | |||
</div> | |||
</div> |
@@ -26,6 +26,19 @@ $(document).ready(function () { | |||
linkExpireSelect($('#uploadSettings').find("#expireunit")); | |||
}); | |||
document.onpaste = function (event) { | |||
var items = (event.clipboardData || event.originalEvent.clipboardData).items; | |||
for (index in items) { | |||
var item = items[index]; | |||
if (item.kind === 'file') { | |||
// Convert file to blob | |||
var file = item.getAsFile(); | |||
// Upload the file | |||
upload(file); | |||
} | |||
} | |||
} | |||
}); | |||
function linkExpireSelect(element) { | |||
@@ -182,32 +195,36 @@ var dropZone = new Dropzone(document.body, { | |||
clickable: "#uploadButton", | |||
previewTemplate: function () { }, | |||
addedfile: function (file) { | |||
// Convert file to blob | |||
var blob = file.slice(0, file.size); | |||
// Create a token for this upload | |||
var token = { | |||
callback: null, | |||
cancel: function() { | |||
this.callback(); | |||
}, | |||
isCancelable: function() { | |||
return this.callback !== null; | |||
} | |||
}; | |||
// Create the Upload | |||
var fileID = createUpload(file.name, token); | |||
// Process the file | |||
processFile(blob, file.name, file.type, file.size, fileID, token); | |||
// Upload the file to the server | |||
upload(file); | |||
// Remove this file from the dropzone set | |||
this.removeFile(file); | |||
} | |||
}); | |||
function upload(file) { | |||
// Convert file to blob | |||
var blob = file.slice(0, file.size); | |||
// Create a token for this upload | |||
var token = { | |||
callback: null, | |||
cancel: function () { | |||
this.callback(); | |||
}, | |||
isCancelable: function () { | |||
return this.callback !== null; | |||
} | |||
}; | |||
// Create the Upload | |||
var fileID = createUpload(file.name, token); | |||
// Process the file | |||
processFile(blob, file.name, file.type, file.size, fileID, token); | |||
} | |||
var fileCount = 0; | |||
function createUpload(fileName, token) { |
@@ -305,6 +305,55 @@ function parseErrorMessage(errorObj) { | |||
} | |||
return errorMsg; | |||
} | |||
var re_weburl = new RegExp( | |||
"^" + | |||
// protocol identifier (optional) | |||
// short syntax // still required | |||
"(?:(?:(?:https?|ftp):)?\\/\\/)" + | |||
// user:pass BasicAuth (optional) | |||
"(?:\\S+(?::\\S*)?@)?" + | |||
"(?:" + | |||
// IP address exclusion | |||
// private & local networks | |||
"(?!(?:10|127)(?:\\.\\d{1,3}){3})" + | |||
"(?!(?:169\\.254|192\\.168)(?:\\.\\d{1,3}){2})" + | |||
"(?!172\\.(?:1[6-9]|2\\d|3[0-1])(?:\\.\\d{1,3}){2})" + | |||
// IP address dotted notation octets | |||
// excludes loopback network 0.0.0.0 | |||
// excludes reserved space >= 224.0.0.0 | |||
// excludes network & broacast addresses | |||
// (first & last IP address of each class) | |||
"(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])" + | |||
"(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}" + | |||
"(?:\\.(?:[1-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))" + | |||
"|" + | |||
// host & domain names, may end with dot | |||
// can be replaced by a shortest alternative | |||
// (?![-_])(?:[-\\w\\u00a1-\\uffff]{0,63}[^-_]\\.)+ | |||
"(?:" + | |||
"(?:" + | |||
"[a-z0-9\\u00a1-\\uffff]" + | |||
"[a-z0-9\\u00a1-\\uffff_-]{0,62}" + | |||
")?" + | |||
"[a-z0-9\\u00a1-\\uffff]\\." + | |||
")+" + | |||
// TLD identifier name, may end with dot | |||
"(?:[a-z\\u00a1-\\uffff]{2,}\\.?)" + | |||
")" + | |||
// port number (optional) | |||
"(?::\\d{2,5})?" + | |||
// resource path (optional) | |||
"(?:[/?#]\\S*)?" + | |||
"$", "i" | |||
); | |||
function isValidURL(str) { | |||
if (!re_weburl.test(str)) { | |||
return false; | |||
} else { | |||
return true; | |||
} | |||
} | |||
/***************************** TIMER Page Load *******************************/ | |||
var loopTime; |
@@ -88,10 +88,6 @@ | |||
<CopyToPublishDirectory>Never</CopyToPublishDirectory> | |||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | |||
</Content> | |||
<Content Update="App_Data\ConnectionStrings.config"> | |||
<CopyToPublishDirectory>Never</CopyToPublishDirectory> | |||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | |||
</Content> | |||
<Content Update="App_Data\MachineKey.config"> | |||
<CopyToPublishDirectory>Never</CopyToPublishDirectory> | |||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> |