Untitled

 avatar
unknown
plain_text
2 years ago
12 kB
11
Indexable
<script>
            jQuery(function($) {
                Dropzone.autoDiscover = false;
                window.initWapfFileUpload = window.initWapfFileUpload || [];
                if(!window.initWapfFileUpload['62e4d28e38781'])
                    window.initWapfFileUpload['62e4d28e38781'] = function(fieldId) {
                        var uploaded = {};
                        var toVal = function() {
                            var tmpArr = [];
                            Object.keys(uploaded).forEach(function(k){ tmpArr.push(uploaded[k]['path']); });
                            $('.input-'+fieldId).val(tmpArr.join(',')).trigger('change');
                        };
                        $('#wapf-dz-'+fieldId+' .wapf-dz-btn').on('click',function(e){e.preventDefault();});
                        if($('#wapf-dz-'+fieldId)[0].dropzone)
                            return;
                        $('#wapf-dz-'+fieldId).dropzone($.extend(
	                        {"maxFiles":1,"thumbnailWidth":1000,"thumbnailHeight":1000,"dictFileTooBig":"File is too big ({{filesize}}MB). Max filesize is {{maxFilesize}}MB.","dictInvalidFileType":"You can't upload files of this type.","dictMaxFilesExceeded":"You can't upload any more files.","previewTemplate":"\n<div data-field-id=\"62e4d28e38781\" data-editor-config=\"{&quot;cropper&quot;:true,&quot;rotate&quot;:false,&quot;flip&quot;:false,&quot;onlyCrop&quot;:true,&quot;ratio&quot;:0.703703703700000016141302694450132548809051513671875}\" class=\"dz-preview aiu-preview\">\n\t<div class=\"dz-image\" style=\"display:flex;justify-content:center;flex-flow:column;width:80px;padding-right:12px\">\n\t\t<img style=\"max-width:100%\" src=\"\" alt=\"\" data-dz-thumbnail \/>\n\t<\/div>\n\t<div class=\"dz-filename\" data-dz-name><\/div>\n\t<div class=\"dz-left\">\n\t\t<div class=\"dz-progress-wrapper\">\n\t\t\t<div class=\"dz-progress\"><\/div>\n\t\t\t<div class=\"dz-upload\" data-dz-uploadprogress><\/div>\n\t\t<\/div>\n\t\t<div class=\"dz-options\">\n\t\t\t\t\t\t<div data-open-type=\"auto\" class=\"start-crop wapf-tt-wrap\" data-dir=\"t\"  data-tip=\"Edit image\" style=\"display:none\">\n                <svg fill=\"currentColor\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\".8rem\" height=\".8rem\" viewBox=\"0 0 512 512\"><path d=\"M497.9 142.1l-46.1 46.1c-4.7 4.7-12.3 4.7-17 0l-111-111c-4.7-4.7-4.7-12.3 0-17l46.1-46.1c18.7-18.7 49.1-18.7 67.9 0l60.1 60.1c18.8 18.7 18.8 49.1 0 67.9zM284.2 99.8L21.6 362.4.4 483.9c-2.9 16.4 11.4 30.6 27.8 27.8l121.5-21.3 262.6-262.6c4.7-4.7 4.7-12.3 0-17l-111-111c-4.8-4.7-12.4-4.7-17.1 0zM88 424h48v36.3l-64.5 11.3-31.1-31.1L51.7 376H88v48z\"\/><\/svg>\n\t\t\t<\/div>\n\t\t\t            <div class=\"wapf-tt-wrap dz-remove\" data-dir=\"t\" data-tip=\"Remove\" data-dz-remove>\n                <svg fill=\"currentColor\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"1rem\" height=\"1rem\" viewBox=\"0 0 352 512\"><path d=\"M242.72 256l100.07-100.07c12.28-12.28 12.28-32.19 0-44.48l-22.24-22.24c-12.28-12.28-32.19-12.28-44.48 0L176 189.28 75.93 89.21c-12.28-12.28-32.19-12.28-44.48 0L9.21 111.45c-12.28 12.28-12.28 32.19 0 44.48L109.28 256 9.21 356.07c-12.28 12.28-12.28 32.19 0 44.48l22.24 22.24c12.28 12.28 32.2 12.28 44.48 0L176 322.72l100.07 100.07c12.28 12.28 32.2 12.28 44.48 0l22.24-22.24c12.28-12.28 12.28-32.19 0-44.48L242.72 256z\"\/><\/svg>\n            <\/div>\n\t\t<\/div>\n\t<\/div>\n<\/div>","maxFilesize":3,"editorTemplate":"<div class=\"aium dark\" tabindex=\"-1\" role=\"dialog\">\n\t<div class=\"aium-inner\">\n\t\t<div class=\"aium-body\">\n\t\t\t\n\t\t\t<div class=\"aium-img\">\n\t\t\t\t<div class=\"aium-crop-container\">\n\t\t\t\t\t<div class=\"img-container\">\n\t\t\t\t\t\t<img src=\"{dataUrl}\">\n\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t<\/div>\n\t\t\t\n\t\t<\/div>\n\t\t\t\t\n\t\t<div class=\"aium-footer\">\n\t\t\t<div class=\"aium-footer-info\">\n\t\t\t\t<span><span><\/span>%<\/span>\n\t\t\t<\/div> \n\t\t\t<div class=\"aium-footer-buttons\">\n\t\t\t\t<div>\n\t\t\t\t\t<button type=\"button\" class=\"zout\">\n\t\t\t\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewBox=\"0 0 384 512\"><path d=\"M376 232H8c-4.42 0-8 3.58-8 8v32c0 4.42 3.58 8 8 8h368c4.42 0 8-3.58 8-8v-32c0-4.42-3.58-8-8-8z\"><\/path><\/svg>\n\t\t\t\t\t<\/button>\n\t\t\t\t\t<button type=\"button\" class=\"zin\">\n\t\t\t\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewBox=\"0 0 384 512\"><path d=\"M376 232H216V72c0-4.42-3.58-8-8-8h-32c-4.42 0-8 3.58-8 8v160H8c-4.42 0-8 3.58-8 8v32c0 4.42 3.58 8 8 8h160v160c0 4.42 3.58 8 8 8h32c4.42 0 8-3.58 8-8V280h160c4.42 0 8-3.58 8-8v-32c0-4.42-3.58-8-8-8z\"><\/path><\/svg>\n\t\t\t\t\t<\/button>\n\t\t\t\t\t\t\t\t\t\t<button type=\"button\" class=\"drag\">\n\t\t\t\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewBox=\"0 0 512 512\"><path d=\"M337.782 434.704l-73.297 73.782c-4.686 4.686-12.284 4.686-16.971 0l-73.296-73.782c-4.686-4.686-4.686-12.284 0-16.97l7.07-7.07c4.686-4.686 12.284-4.686 16.971 0L239 451.887h1V272H60.113v1l41.224 40.741c4.686 4.686 4.686 12.284 0 16.971l-7.071 7.07c-4.686 4.686-12.284 4.686-16.97 0L3.515 264.485c-4.686-4.686-4.686-12.284 0-16.971l73.782-73.297c4.686-4.686 12.284-4.686 16.971 0l7.071 7.071c4.686 4.686 4.686 12.284 0 16.971L60.113 239v1H240V60.113h-1l-40.741 41.224c-4.686 4.686-12.284 4.686-16.971 0l-7.07-7.071c-4.686-4.686-4.687-12.284 0-16.97l73.297-73.782c4.686-4.686 12.284-4.686 16.971 0l73.297 73.782c4.686 4.686 4.686 12.284 0 16.971l-7.071 7.071c-4.686 4.686-12.284 4.686-16.971 0L273 60.113h-1V240h179.887v-1l-41.224-40.741c-4.686-4.686-4.686-12.284 0-16.971l7.071-7.07c4.686-4.686 12.284-4.686 16.97 0l73.782 73.297c4.687 4.686 4.686 12.284 0 16.971l-73.782 73.297c-4.686 4.686-12.284 4.686-16.97 0l-7.071-7.07c-4.686-4.686-4.686-12.284 0-16.971L451.887 273v-1H272v179.887h1l40.741-41.224c4.686-4.686 12.284-4.686 16.971 0l7.07 7.071c4.686 4.685 4.686 12.283 0 16.97z\"><\/path><\/svg>\n\t\t\t\t\t<\/button>\n\t\t\t\t\t<button style=\"display:none\" class=\"crop\">\n\t\t\t\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewBox=\"0 0 299.92 299.92\"><path d=\"M293.4,228.2h-58.68V67.899l43.73-43.73c2.549-2.549,2.549-6.67,0-9.219c-2.549-2.549-6.67-2.549-9.219,0l-43.73,43.73H65.2V6.52C65.2,2.914,62.286,0,58.68,0c-3.606,0-6.52,2.914-6.52,6.52v52.16H6.52C2.914,58.68,0,61.594,0,65.2c0,3.606,2.914,6.52,6.52,6.52h45.64v163c0,3.606,2.914,6.52,6.52,6.52h163v52.16c0,3.606,2.914,6.52,6.52,6.52c3.606,0,6.52-2.914,6.52-6.52v-52.16h58.68c3.606,0,6.52-2.914,6.52-6.52C299.92,231.114,297.006,228.2,293.4,228.2zM212.461,71.72L65.2,218.981V71.72H212.461z M74.419,228.2L221.68,80.939V228.2H74.419z\"\/><\/svg>\n\t\t\t\t\t<\/button>\n\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t\t\t\t\t<div>\n\t\t\t\t\t<button type=\"button\" class=\"crop-cancel\">Cancel<\/button>\n\t\t\t\t\t<button type=\"button\" class=\"crop-done\">Save<\/button>\n\t\t\t\t<\/div>\n\t\t\t<\/div>\n\t\t<\/div>\n\t<\/div>\n<\/div>","disablePreviews":false}, {
                                paramName: 'wapf[field_'+fieldId+']',
                                uploadMultiple:  true,
                                parallelUploads: 1,
                                url: wapf_config.ajax,
                                params: function() {
                                    return {
                                        action : 'wapf_upload',
                                        nonce: 'ce30578898',
                                        field_groups: $('[name=wapf_field_groups]').val()
                                    };
                                },
                                init: function() {

                                    this.on('sending', function() {
                                        $('form.cart .single_add_to_cart_button').prop('disabled',true);
                                    });
                                    this.on('complete', function() {
                                        $('form.cart .single_add_to_cart_button').prop('disabled',false);
                                    });
                                    this.on('success', function(file, response) {
                                        uploaded[file.upload.uuid] = response.data[0];
                                        $(file.previewElement).data('uuid',file.upload.uuid);
                                        $(document).trigger('wapf/file_uploaded',{response: response.data,file: file,fieldId: fieldId, uploads: uploaded});
                                        toVal();
                                                                                $('#wapf-dz-'+fieldId).find('.dz-message').hide();
                                                                            });
                                    this.on('error', function( file, msg ) {
                                        var $wrapper = $('.wapf-dz-error-'+fieldId);
                                        var error = ( typeof msg === 'string' ? msg : (!msg.success && msg.data ? msg.data : '') );
                                        if(error) {
                                            this.removeFile(file);
                                            var $e = $('<div>').html(error).prependTo($wrapper);
                                            setTimeout( function(){$e.hide('fast',function(){$e.remove()}); }, 9000);
                                        }
                                    });
                                    this.on('removedfile', function( file ) {
                                        if(uploaded[file.upload.uuid]) {
                                            $.getJSON(wapf_config.ajax + '?action=wapf_upload_remove&nonce=ce30578898&file=' + decodeURIComponent(uploaded[file.upload.uuid].path));
                                            delete uploaded[file.upload.uuid];
                                            $(document).trigger('wapf/file_deleted', {file: file,fieldId:fieldId, uploads: uploaded});
                                            jQuery('.wttw').trigger('mouseleave');
                                            toVal();
	                                                                                    $('#wapf-dz-'+fieldId).find('.dz-message').show();
	                                                                                }
                                    });
			                                                        }
                            }
                        ));
                    };
                    window.initWapfFileUpload['62e4d28e38781']('62e4d28e38781');
                    $(document).on('wapf/cloned', function(e,fieldId,idx,$clone) {
                        var isSection = $('.field-'+fieldId).hasClass('wapf-section');
                        if(!isSection && fieldId !== '62e4d28e38781') return;
                        var $f = $clone.find((isSection ? '.field-62e4d28e38781 ' : '')+'input');
                        // repeated file fields don't need the previous file value so clear it and remove relevant HTML.
                        $f.val('');
                        var newId = '62e4d28e38781_clone_' + idx;
                        $clone.find('.dzone').attr('id','wapf-dz-'+newId).children().not('.dz-message').html('');
                        $clone.find('.dz-message').show();
                        $clone.find('script').remove();
                        $clone.find('.wapf-dz-error').removeClass('wapf-dz-error-'+fieldId).addClass('wapf-dz-error-'+newId);
                        window.initWapfFileUpload['62e4d28e38781'](newId);
                    });

            });
        </script>
Editor is loading...