Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;(function($){
- $(document).ready(function(){
- var dropItLikesItsHot = $("div.dropzone").dropZone();
- Dropzone.autoDiscover = false;
- });
- var markupButton = "<button class=\"dropzone-del\"><i class=\"fa fa-remove\"></i> Remove File</button>";
- $.fn.extend({
- dropZone: function() {
- return new Dropzone($(this)[0],
- {
- init: function (){
- var $that = $(this); // this jQuery Plugin Obj
- var _that = this; // this Dropzone Obj
- //dropZone addFile Event
- _that.on("addedfile", function(file) {
- var removeButton = Dropzone.createElement(markupButton);
- removeButton.addEventListener("click", function(e){
- e.preventDefault();
- _that.removeFile(file);
- //del from server sessions/filesystem
- $that.delFromServer(file.name);
- });
- //on this file obj append a button
- file.previewElement.appendChild(removeButton);
- })
- },
- url: "/embroidery-quote/ajax",
- paramName: "file"
- });
- },
- delFromServer: function(key) {
- $.get("/embroidery-quote/ajax", {'do': 'remove_artwork', 'key': key});
- }
- });
- })(jQuery);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement