first initial

This commit is contained in:
2025-05-27 19:09:17 +07:00
commit 80375d8af3
1587 changed files with 572586 additions and 0 deletions

View File

@@ -0,0 +1,184 @@
"use strict";
// Class definition
var KTDropzoneDemo = function () {
// Private functions
var demo1 = function () {
// single file upload
$('#kt_dropzone_1').dropzone({
url: "https://keenthemes.com/scripts/void.php", // Set the url for your upload script location
paramName: "file", // The name that will be used to transfer the file
maxFiles: 1,
maxFilesize: 5, // MB
addRemoveLinks: true,
accept: function(file, done) {
if (file.name == "justinbieber.jpg") {
done("Naha, you don't.");
} else {
done();
}
}
});
// multiple file upload
$('#kt_dropzone_2').dropzone({
url: "https://keenthemes.com/scripts/void.php", // Set the url for your upload script location
paramName: "file", // The name that will be used to transfer the file
maxFiles: 10,
maxFilesize: 10, // MB
addRemoveLinks: true,
accept: function(file, done) {
if (file.name == "justinbieber.jpg") {
done("Naha, you don't.");
} else {
done();
}
}
});
// file type validation
$('#kt_dropzone_3').dropzone({
url: "https://keenthemes.com/scripts/void.php", // Set the url for your upload script location
paramName: "file", // The name that will be used to transfer the file
maxFiles: 10,
maxFilesize: 10, // MB
addRemoveLinks: true,
acceptedFiles: "image/*,application/pdf,.psd",
accept: function(file, done) {
if (file.name == "justinbieber.jpg") {
done("Naha, you don't.");
} else {
done();
}
}
});
}
var demo2 = function () {
// set the dropzone container id
var id = '#kt_dropzone_4';
// set the preview element template
var previewNode = $(id + " .dropzone-item");
previewNode.id = "";
var previewTemplate = previewNode.parent('.dropzone-items').html();
previewNode.remove();
var myDropzone4 = new Dropzone(id, { // Make the whole body a dropzone
url: "https://keenthemes.com/scripts/void.php", // Set the url for your upload script location
parallelUploads: 20,
previewTemplate: previewTemplate,
maxFilesize: 1, // Max filesize in MB
autoQueue: false, // Make sure the files aren't queued until manually added
previewsContainer: id + " .dropzone-items", // Define the container to display the previews
clickable: id + " .dropzone-select" // Define the element that should be used as click trigger to select files.
});
myDropzone4.on("addedfile", function(file) {
// Hookup the start button
file.previewElement.querySelector(id + " .dropzone-start").onclick = function() { myDropzone4.enqueueFile(file); };
$(document).find( id + ' .dropzone-item').css('display', '');
$( id + " .dropzone-upload, " + id + " .dropzone-remove-all").css('display', 'inline-block');
});
// Update the total progress bar
myDropzone4.on("totaluploadprogress", function(progress) {
$(this).find( id + " .progress-bar").css('width', progress + "%");
});
myDropzone4.on("sending", function(file) {
// Show the total progress bar when upload starts
document.querySelector( id + " .progress-bar").style.opacity = "1";
// And disable the start button
file.previewElement.querySelector(id + " .dropzone-start").setAttribute("disabled", "disabled");
});
// Hide the total progress bar when nothing's uploading anymore
myDropzone4.on("complete", function(progress) {
var thisProgressBar = id + " .dz-complete";
setTimeout(function(){
$( thisProgressBar + " .progress-bar, " + thisProgressBar + " .progress, " + thisProgressBar + " .dropzone-start").css('opacity', '0');
}, 300)
});
// Setup the buttons for all transfers
document.querySelector( id + " .dropzone-upload").onclick = function() {
myDropzone4.enqueueFiles(myDropzone4.getFilesWithStatus(Dropzone.ADDED));
};
// Setup the button for remove all files
document.querySelector(id + " .dropzone-remove-all").onclick = function() {
$( id + " .dropzone-upload, " + id + " .dropzone-remove-all").css('display', 'none');
myDropzone4.removeAllFiles(true);
};
// On all files completed upload
myDropzone4.on("queuecomplete", function(progress){
$( id + " .dropzone-upload").css('display', 'none');
});
// On all files removed
myDropzone4.on("removedfile", function(file){
if(myDropzone4.files.length < 1){
$( id + " .dropzone-upload, " + id + " .dropzone-remove-all").css('display', 'none');
}
});
}
var demo3 = function () {
// set the dropzone container id
var id = '#kt_dropzone_5';
// set the preview element template
var previewNode = $(id + " .dropzone-item");
previewNode.id = "";
var previewTemplate = previewNode.parent('.dropzone-items').html();
previewNode.remove();
var myDropzone5 = new Dropzone(id, { // Make the whole body a dropzone
url: "https://keenthemes.com/scripts/void.php", // Set the url for your upload script location
parallelUploads: 20,
maxFilesize: 1, // Max filesize in MB
previewTemplate: previewTemplate,
previewsContainer: id + " .dropzone-items", // Define the container to display the previews
clickable: id + " .dropzone-select" // Define the element that should be used as click trigger to select files.
});
myDropzone5.on("addedfile", function(file) {
// Hookup the start button
$(document).find( id + ' .dropzone-item').css('display', '');
});
// Update the total progress bar
myDropzone5.on("totaluploadprogress", function(progress) {
document.querySelector( id + " .progress-bar").style.width = progress + "%";
});
myDropzone5.on("sending", function(file) {
// Show the total progress bar when upload starts
document.querySelector( id + " .progress-bar").style.opacity = "1";
});
// Hide the total progress bar when nothing's uploading anymore
myDropzone5.on("complete", function(progress) {
var thisProgressBar = id + " .dz-complete";
setTimeout(function(){
$( thisProgressBar + " .progress-bar, " + thisProgressBar + " .progress").css('opacity', '0');
}, 300)
});
}
return {
// public functions
init: function() {
demo1();
demo2();
demo3();
}
};
}();
KTUtil.ready(function() {
KTDropzoneDemo.init();
});

View File

@@ -0,0 +1 @@
"use strict";var KTDropzoneDemo={init:function(){$("#kt_dropzone_1").dropzone({url:"https://keenthemes.com/scripts/void.php",paramName:"file",maxFiles:1,maxFilesize:5,addRemoveLinks:!0,accept:function(e,o){"justinbieber.jpg"==e.name?o("Naha, you don't."):o()}}),$("#kt_dropzone_2").dropzone({url:"https://keenthemes.com/scripts/void.php",paramName:"file",maxFiles:10,maxFilesize:10,addRemoveLinks:!0,accept:function(e,o){"justinbieber.jpg"==e.name?o("Naha, you don't."):o()}}),$("#kt_dropzone_3").dropzone({url:"https://keenthemes.com/scripts/void.php",paramName:"file",maxFiles:10,maxFilesize:10,addRemoveLinks:!0,acceptedFiles:"image/*,application/pdf,.psd",accept:function(e,o){"justinbieber.jpg"==e.name?o("Naha, you don't."):o()}}),function(){var e="#kt_dropzone_4",o=$(e+" .dropzone-item");o.id="";var n=o.parent(".dropzone-items").html();o.remove();var t=new Dropzone(e,{url:"https://keenthemes.com/scripts/void.php",parallelUploads:20,previewTemplate:n,maxFilesize:1,autoQueue:!1,previewsContainer:e+" .dropzone-items",clickable:e+" .dropzone-select"});t.on("addedfile",function(o){o.previewElement.querySelector(e+" .dropzone-start").onclick=function(){t.enqueueFile(o)},$(document).find(e+" .dropzone-item").css("display",""),$(e+" .dropzone-upload, "+e+" .dropzone-remove-all").css("display","inline-block")}),t.on("totaluploadprogress",function(o){$(this).find(e+" .progress-bar").css("width",o+"%")}),t.on("sending",function(o){document.querySelector(e+" .progress-bar").style.opacity="1",o.previewElement.querySelector(e+" .dropzone-start").setAttribute("disabled","disabled")}),t.on("complete",function(e){setTimeout(function(){$("#kt_dropzone_4 .dz-complete .progress-bar, #kt_dropzone_4 .dz-complete .progress, #kt_dropzone_4 .dz-complete .dropzone-start").css("opacity","0")},300)}),document.querySelector(e+" .dropzone-upload").onclick=function(){t.enqueueFiles(t.getFilesWithStatus(Dropzone.ADDED))},document.querySelector(e+" .dropzone-remove-all").onclick=function(){$(e+" .dropzone-upload, "+e+" .dropzone-remove-all").css("display","none"),t.removeAllFiles(!0)},t.on("queuecomplete",function(o){$(e+" .dropzone-upload").css("display","none")}),t.on("removedfile",function(o){t.files.length<1&&$(e+" .dropzone-upload, "+e+" .dropzone-remove-all").css("display","none")})}(),function(){var e="#kt_dropzone_5",o=$(e+" .dropzone-item");o.id="";var n=o.parent(".dropzone-items").html();o.remove();var t=new Dropzone(e,{url:"https://keenthemes.com/scripts/void.php",parallelUploads:20,maxFilesize:1,previewTemplate:n,previewsContainer:e+" .dropzone-items",clickable:e+" .dropzone-select"});t.on("addedfile",function(o){$(document).find(e+" .dropzone-item").css("display","")}),t.on("totaluploadprogress",function(o){document.querySelector(e+" .progress-bar").style.width=o+"%"}),t.on("sending",function(o){document.querySelector(e+" .progress-bar").style.opacity="1"}),t.on("complete",function(e){setTimeout(function(){$("#kt_dropzone_5 .dz-complete .progress-bar, #kt_dropzone_5 .dz-complete .progress").css("opacity","0")},300)})}()}};KTUtil.ready(function(){KTDropzoneDemo.init()});

View File

@@ -0,0 +1,327 @@
"use strict";
// Class definition
var KTUppy = function () {
const Tus = Uppy.Tus;
const ProgressBar = Uppy.ProgressBar;
const StatusBar = Uppy.StatusBar;
const FileInput = Uppy.FileInput;
const Informer = Uppy.Informer;
// to get uppy companions working, please refer to the official documentation here: https://uppy.io/docs/companion/
const Dashboard = Uppy.Dashboard;
const Dropbox = Uppy.Dropbox;
const GoogleDrive = Uppy.GoogleDrive;
const Instagram = Uppy.Instagram;
const Webcam = Uppy.Webcam;
// Private functions
var initUppy1 = function(){
var id = '#kt_uppy_1';
var options = {
proudlyDisplayPoweredByUppy: false,
target: id,
inline: true,
replaceTargetContent: true,
showProgressDetails: true,
note: 'No filetype restrictions.',
height: 470,
metaFields: [
{ id: 'name', name: 'Name', placeholder: 'file name' },
{ id: 'caption', name: 'Caption', placeholder: 'describe what the image is about' }
],
browserBackButtonClose: true
}
var uppyDashboard = Uppy.Core({
autoProceed: true,
restrictions: {
maxFileSize: 1000000, // 1mb
maxNumberOfFiles: 5,
minNumberOfFiles: 1
}
});
uppyDashboard.use(Dashboard, options);
uppyDashboard.use(Tus, { endpoint: 'https://master.tus.io/files/' });
uppyDashboard.use(GoogleDrive, { target: Dashboard, companionUrl: 'https://companion.uppy.io' });
uppyDashboard.use(Dropbox, { target: Dashboard, companionUrl: 'https://companion.uppy.io' });
uppyDashboard.use(Instagram, { target: Dashboard, companionUrl: 'https://companion.uppy.io' });
uppyDashboard.use(Webcam, { target: Dashboard });
}
var initUppy2 = function(){
var id = '#kt_uppy_2';
var options = {
proudlyDisplayPoweredByUppy: false,
target: id,
inline: true,
replaceTargetContent: true,
showProgressDetails: true,
note: 'Images and video only, 23 files, up to 1 MB',
height: 470,
metaFields: [
{ id: 'name', name: 'Name', placeholder: 'file name' },
{ id: 'caption', name: 'Caption', placeholder: 'describe what the image is about' }
],
browserBackButtonClose: true
}
var uppyDashboard = Uppy.Core({
autoProceed: true,
restrictions: {
maxFileSize: 1000000, // 1mb
maxNumberOfFiles: 5,
minNumberOfFiles: 1,
allowedFileTypes: ['image/*', 'video/*']
}
});
uppyDashboard.use(Dashboard, options);
uppyDashboard.use(Tus, { endpoint: 'https://master.tus.io/files/' });
}
var initUppy3 = function(){
var id = '#kt_uppy_3';
var uppyDrag = Uppy.Core({
autoProceed: true,
restrictions: {
maxFileSize: 1000000, // 1mb
maxNumberOfFiles: 5,
minNumberOfFiles: 1,
allowedFileTypes: ['image/*', 'video/*']
}
});
uppyDrag.use(Uppy.DragDrop, { target: id + ' .kt-uppy__drag' });
uppyDrag.use(ProgressBar, {
target: id + ' .kt-uppy__progress',
hideUploadButton: false,
hideAfterFinish: false
});
uppyDrag.use(Informer, { target: id + ' .kt-uppy__informer' });
uppyDrag.use(Tus, { endpoint: 'https://master.tus.io/files/' });
uppyDrag.on('complete', function(file) {
var imagePreview = "";
$.each(file.successful, function(index, value){
var imageType = /image/;
var thumbnail = "";
if (imageType.test(value.type)){
thumbnail = '<div class="kt-uppy__thumbnail"><img src="'+value.uploadURL+'"/></div>';
}
var sizeLabel = "bytes";
var filesize = value.size;
if (filesize > 1024){
filesize = filesize / 1024;
sizeLabel = "kb";
if(filesize > 1024){
filesize = filesize / 1024;
sizeLabel = "MB";
}
}
imagePreview += '<div class="kt-uppy__thumbnail-container" data-id="'+value.id+'">'+thumbnail+' <span class="kt-uppy__thumbnail-label">'+value.name+' ('+ Math.round(filesize, 2) +' '+sizeLabel+')</span><span data-id="'+value.id+'" class="kt-uppy__remove-thumbnail"><i class="flaticon2-cancel-music"></i></span></div>';
});
$(id + ' .kt-uppy__thumbnails').append(imagePreview);
});
$(document).on('click', id + ' .kt-uppy__thumbnails .kt-uppy__remove-thumbnail', function(){
var imageId = $(this).attr('data-id');
uppyDrag.removeFile(imageId);
$(id + ' .kt-uppy__thumbnail-container[data-id="'+imageId+'"').remove();
});
}
var initUppy4 = function(){
var id = '#kt_uppy_4';
var uppyDrag = Uppy.Core({
autoProceed: false,
restrictions: {
maxFileSize: 1000000, // 1mb
maxNumberOfFiles: 5,
minNumberOfFiles: 1
}
});
uppyDrag.use(Uppy.DragDrop, { target: id + ' .kt-uppy__drag' });
uppyDrag.use(ProgressBar, { target: id + ' .kt-uppy__progress' });
uppyDrag.use(Informer, { target: id + ' .kt-uppy__informer' });
uppyDrag.use(Tus, { endpoint: 'https://master.tus.io/files/' });
uppyDrag.on('complete', function(file) {
var imagePreview = "";
$.each(file.successful, function(index, value){
var imageType = /image/;
var thumbnail = "";
if (imageType.test(value.type)){
thumbnail = '<div class="kt-uppy__thumbnail"><img src="'+value.uploadURL+'"/></div>';
}
var sizeLabel = "bytes";
var filesize = value.size;
if (filesize > 1024){
filesize = filesize / 1024;
sizeLabel = "kb";
if(filesize > 1024){
filesize = filesize / 1024;
sizeLabel = "MB";
}
}
imagePreview += '<div class="kt-uppy__thumbnail-container" data-id="'+value.id+'">'+thumbnail+' <span class="kt-uppy__thumbnail-label">'+value.name+' ('+ Math.round(filesize, 2) +' '+sizeLabel+')</span><span data-id="'+value.id+'" class="kt-uppy__remove-thumbnail"><i class="flaticon2-cancel-music"></i></span></div>';
});
$(id + ' .kt-uppy__thumbnails').append(imagePreview);
});
var uploadBtn = $(id + ' .kt-uppy__btn');
uploadBtn.click(function () {
uppyDrag.upload();
});
$(document).on('click', id + ' .kt-uppy__thumbnails .kt-uppy__remove-thumbnail', function(){
var imageId = $(this).attr('data-id');
uppyDrag.removeFile(imageId);
$(id + ' .kt-uppy__thumbnail-container[data-id="'+imageId+'"').remove();
});
}
var initUppy5 = function(){
// Uppy variables
// For more info refer: https://uppy.io/
var elemId = 'kt_uppy_5';
var id = '#' + elemId;
var $statusBar = $(id + ' .kt-uppy__status');
var $uploadedList = $(id + ' .kt-uppy__list');
var timeout;
var uppyMin = Uppy.Core({
debug: true,
autoProceed: true,
showProgressDetails: true,
restrictions: {
maxFileSize: 1000000, // 1mb
maxNumberOfFiles: 5,
minNumberOfFiles: 1
}
});
uppyMin.use(FileInput, { target: id + ' .kt-uppy__wrapper', pretty: false });
uppyMin.use(Informer, { target: id + ' .kt-uppy__informer' });
// demo file upload server
uppyMin.use(Tus, { endpoint: 'https://master.tus.io/files/' });
uppyMin.use(StatusBar, {
target: id + ' .kt-uppy__status',
hideUploadButton: true,
hideAfterFinish: false
});
$(id + ' .uppy-FileInput-input').addClass('kt-uppy__input-control').attr('id', elemId + '_input_control');
$(id + ' .uppy-FileInput-container').append('<label class="kt-uppy__input-label btn btn-label-brand btn-bold btn-font-sm" for="' + (elemId + '_input_control') + '">Attach files</label>');
var $fileLabel = $(id + ' .kt-uppy__input-label');
uppyMin.on('upload', function(data) {
$fileLabel.text("Uploading...");
$statusBar.addClass('kt-uppy__status--ongoing');
$statusBar.removeClass('kt-uppy__status--hidden');
clearTimeout( timeout );
});
uppyMin.on('complete', function(file) {
$.each(file.successful, function(index, value){
var sizeLabel = "bytes";
var filesize = value.size;
if (filesize > 1024){
filesize = filesize / 1024;
sizeLabel = "kb";
if(filesize > 1024){
filesize = filesize / 1024;
sizeLabel = "MB";
}
}
var uploadListHtml = '<div class="kt-uppy__list-item" data-id="'+value.id+'"><div class="kt-uppy__list-label">'+value.name+' ('+ Math.round(filesize, 2) +' '+sizeLabel+')</div><span class="kt-uppy__list-remove" data-id="'+value.id+'"><i class="flaticon2-cancel-music"></i></span></div>';
$uploadedList.append(uploadListHtml);
});
$fileLabel.text("Add more files");
$statusBar.addClass('kt-uppy__status--hidden');
$statusBar.removeClass('kt-uppy__status--ongoing');
});
$(document).on('click', id + ' .kt-uppy__list .kt-uppy__list-remove', function(){
var itemId = $(this).attr('data-id');
uppyMin.removeFile(itemId);
$(id + ' .kt-uppy__list-item[data-id="'+itemId+'"').remove();
});
}
var initUppy6 = function(){
var id = '#kt_uppy_6';
var options = {
proudlyDisplayPoweredByUppy: false,
target: id + ' .kt-uppy__dashboard',
inline: false,
replaceTargetContent: true,
showProgressDetails: true,
note: 'No filetype restrictions.',
height: 470,
metaFields: [
{ id: 'name', name: 'Name', placeholder: 'file name' },
{ id: 'caption', name: 'Caption', placeholder: 'describe what the image is about' }
],
browserBackButtonClose: true,
trigger: id + ' .kt-uppy__btn'
}
var uppyDashboard = Uppy.Core({
autoProceed: true,
restrictions: {
maxFileSize: 1000000, // 1mb
maxNumberOfFiles: 5,
minNumberOfFiles: 1
}
});
uppyDashboard.use(Dashboard, options);
uppyDashboard.use(Tus, { endpoint: 'https://master.tus.io/files/' });
uppyDashboard.use(GoogleDrive, { target: Dashboard, companionUrl: 'https://companion.uppy.io' });
uppyDashboard.use(Dropbox, { target: Dashboard, companionUrl: 'https://companion.uppy.io' });
uppyDashboard.use(Instagram, { target: Dashboard, companionUrl: 'https://companion.uppy.io' });
uppyDashboard.use(Webcam, { target: Dashboard });
}
return {
// public functions
init: function() {
initUppy1();
initUppy2();
initUppy3();
initUppy4();
initUppy5();
initUppy6();
swal.fire({
"title": "Notice",
"html": "Uppy demos uses <b>https://master.tus.io/files/</b> URL for resumable upload examples and your uploaded files will be temporarely stored in <b>tus.io</b> servers.",
"type": "info",
"buttonsStyling": false,
"confirmButtonClass": "btn btn-brand kt-btn kt-btn--wide",
"confirmButtonText": "Ok, I understand",
"onClose": function(e) {
console.log('on close event fired!');
}
});
}
};
}();
KTUtil.ready(function() {
KTUppy.init();
});

File diff suppressed because one or more lines are too long