1var formsHelper = { 2 addQ : function(target) { 3 var inputTarget = $(target).closest('.input-group').find('input[type="number"]'); 4 var min = ($(inputTarget).attr('min') ? parseInt($(inputTarget).attr('min')) : 0 ); 5 var max = ($(inputTarget).attr('max') ? parseInt($(inputTarget).attr('max')) : 0 ); 6 var current = ($(inputTarget).val() ? parseInt($(inputTarget).val()) : 0 ); 7 8 newQ = (current === max ? current : current+1); 9 $(inputTarget).val(newQ); 10 }, 11 deductQ : function(target) { 12 var inputTarget = $(target).closest('.input-group').find('input[type="number"]'); 13 var min = ($(inputTarget).attr('min') ? parseInt($(inputTarget).attr('min')) : 0 ); 14 var max = ($(inputTarget).attr('max') ? parseInt($(inputTarget).attr('max')) : 0 ); 15 var current = ($(inputTarget).val() ? parseInt($(inputTarget).val()) : 0 ); 16 17 newQ = (current === min ? current : current-1); 18 $(inputTarget).val(newQ); 19 }, 20 formSent : function(data) { 21 $('[data-submitbutton]').html($('[data-submitbutton]').attr('data-originalhtml')); 22 $('[data-submitbutton]').removeAttr('data-originalhtml'); 23 if(data.ok) { 24 $('form')[0].reset(); 25 $('.dropzone_holder').html(''); 26 //Check popupdata 27 // if(popupData !== undefined && $(".popupPage").doesExist()) { 28 // popup.markAsInteracted(); 29 // } 30 31 if(gtag !== undefined && data?.form) { 32 window.dataLayer = window.dataLayer || []; 33 window.dataLayer.push({ 34 'event': 'formSubmission', 35 'formTitle': data.form?.formTitle, 36 'formId': data.form?.formId, 37 }); 38 console.log('formSubmission pushed'); 39 } 40 41 42 //action, title, text, href 43 if(data.successAction && data.successAction == 'page') { 44 window.location = data.href; 45 return 46 } 47 if(data.successAction && data.successAction == 'alert') { 48 if(typeof Swal !== 'undefined') { 49 Swal.fire( 50 data.title, 51 data.text, 52 'success' 53 ) ; 54 } else if(typeof swal !== 'undefined') { 55 swal( 56 data.title, 57 data.text, 58 'success' 59 ) ; 60 } else { 61 alert(data.text); 62 } 63 64 return; 65 } 66 67 Swal.fire( 68 'Verzonden', 69 data.ok, 70 'success' 71 ) 72 } 73 if(data.error) { 74 Swal.fire( 75 'Fout', 76 data.error, 77 'warning' 78 ) 79 } 80 }, 81 checkRequiredFiles : function(formTarget) { 82 var cont = 1; 83 $(formTarget).find('.dropzone_holder[data-required="required"]').each(function(index,el) { 84 if($(el).is(':empty')) { 85 cont = 0; 86 } 87 }); 88 if(!cont) { 89 Swal.fire( 90 'Fout', 91 'Upload een of meer bestanden', 92 'error' 93 ) 94 } 95 return cont; 96 }, 97 processDropzoneQueus : function(formTarget) { 98 $(formTarget).find('.dropzone_holder').each(function(index,el) { 99 var num = $(el).attr('data-num'); 100 var myDropzone = Dropzone.forElement(".upload_holder_"+num); 101 102 myDropzone.processQueue(); 103 $(".upload_holder_"+num).attr('data-queue-done','true'); 104 }) 105 }, 106 queueComplete : function(target) { 107 //sendForm 108 var formSessionId = $(target).closest('form').attr('data-id'); 109 $(target).closest('form').find('[data-submitbutton]').trigger('click'); 110 }, 111 initDropzones : function() { 112 $('*[data-dropzone]').not('[data-initialized]').each(function (index, row) { 113 var buttonTarget = $(row).attr('data-dropzone-button'); 114 var uploadPath = $(row).attr('data-dropzone-uploadpath'); 115 var inputName = $(row).attr('data-dropzone-inputname'); 116 var acceptMime = ($(row).hasAttr('data-dropzone-mime') ? $(row).attr('data-dropzone-mime') : ''); 117 var append = ($(row).hasAttr('data-dropzone-append') ? true : false); 118 var maxFiles = ($(row).hasAttr('data-dropzone-append') ? parseInt($(row).hasAttr('data-dropzone-append')) : 1); 119 var mxMb = ($(row).hasAttr('data-dropzone-maxmb') ? parseInt($(row).hasAttr('data-dropzone-maxmb'))*1000 : 5*1000); 120 121 $(row).dropzone({ 122 url: uploadPath, 123 clickable: '.' + buttonTarget, 124 createImageThumbnails: false, 125 maxFilesize: mxMb, 126 maxFiles: maxFiles, 127 acceptedFiles: acceptMime, 128 autoProcessQueue : false, 129 queuecomplete : function() { 130 formsHelper.queueComplete($(row)); 131 }, 132 error: function (file, errorMessage, er) { 133 Swal.fire( 134 'Fout', 135 errorMessage, 136 'error' 137 ) 138 }, 139 success: function (file, response) { 140 this.removeFile(file); 141 var obj = $.parseJSON(response); 142 143 if (obj.OK == '0') { 144 Swal.fire( 145 'Fout', 146 'Er ging iets mis', 147 'error' 148 ) 149 } else { 150 if (append) { 151 if (acceptMime == 'image/*') { 152 $(row).append('<div class="galimg"><img src="/img/cache/' + obj.THUMB + '" data-original="' + obj.FILENAME + '" /><input type="hidden" name="' + inputName + '" value="' + obj.FILENAME + '" /><br><button class="btn btn-xs btn-danger" type="button" onclick="$(this).closest(\'.galimg\').remove();">wis</button></div>'); 153 } else { 154 $(row).append('<div class="well"><div class="pull-right"><button class="btn btn-xs btn-danger" type="button" onclick="$(this).closest(\'.well\').remove();">wis</button></div><div class="filename">' + obj.FILENAME + '</div><input type="hidden" name="' + inputName + '" value="' + obj.FILENAME + '" /></div>'); 155 } 156 157 } else { 158 if (acceptMime == 'image/*') { 159 $(row).html('<img src="/img/cache/' + obj.THUMB + '" data-original="' + obj.FILENAME + '" /><input type="hidden" name="' + inputName + '" value="' + obj.FILENAME + '" />'); 160 } 161 if (acceptMime == 'video/*') { 162 $(row).html('<video src="/img/original/' + obj.FILENAME + '"></video><input type="hidden" name="' + inputName + '" value="' + obj.FILENAME + '" />'); 163 } 164 } 165 166 } 167 } 168 }); 169 170 $(row).attr('data-initialized', 'true'); 171 }); 172 } 173}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.