1 function aitecPrivacyInit() { 2 3 jQuery.post( priv_aitec_ajax.ajaxurl, { action: "get_popup" }, function (response) { 4 if (response.status == "success") { 5 jQuery("body").append(response.message); 6 if (jQuery("#aitec-privacy-notice").length > 0) { 7 new aitecPrivacyPopup( jQuery("#aitec-privacy-notice") ); 8 } 9 } 10 }, 11 'json'); 12 } 13 14 function aitecPrivacyPopup(e) { 15 this.popup = e; 16 this.mandatoryButton = this.popup.find("#aitec-privacy-only-mandatory-button" ); 17 this.acceptAllButton = this.popup.find("#aitec-privacy-accept-all-button"); 18 this.preferencesButton = this.popup.find("#aitec-privacy-preference-button"); 19 20 this.modalElement = document.getElementById("cookiePreference"); 21 this.modal = bootstrap.Modal.getOrCreateInstance(this.modalElement); 22 this.preferenceForm = jQuery(this.modalElement).find("form.cookie-preference"); 23 this.restoreButton = jQuery(this.modalElement).find("#aitec-privacy-preference-restore" ); 24 this.saveButton = jQuery(this.modalElement).find( "#aitec-privacy-preference-save" ); 25 26 var me = this; 27 28 this.savePreferences = function (consent) { 29 jQuery.post( priv_aitec_ajax.ajaxurl, { action: "save_preferences", consent: consent }, function (response) { 30 if (response.status == "success") { 31 //console.log(document.cookie); 32 me.popup.hide(); 33 location.reload() 34 35 } 36 }, 37 'json'); 38 }; 39 40 /* Event hook */ 41 42 me.mandatoryButton.click(function (e) { 43 e.preventDefault(); 44 me.savePreferences('minimal'); 45 }); 46 47 me.acceptAllButton.click(function (e) { 48 e.preventDefault(); 49 me.savePreferences('full'); 50 }); 51 52 me.preferencesButton.click(function (e) { 53 e.preventDefault(); 54 me.popup.hide(); 55 me.modal.show(); 56 }); 57 58 me.restoreButton.click(function (e) { 59 e.preventDefault(); 60 var checkboxes = jQuery(me.modalElement).find(".aitec-privacy-option"); 61 if (checkboxes.length > 0) { 62 checkboxes.each(function(){ 63 if(!jQuery(this).is(":disabled")) 64 jQuery(this).prop('checked', false); 65 }); 66 } 67 }); 68 69 me.saveButton.click(function (e) { 70 e.preventDefault(); 71 var data = me.preferenceForm.serializeArray(); 72 me.saveButton.prop('disabled',true); 73 74 jQuery.post( priv_aitec_ajax.ajaxurl, { action: "save_preferences", data: data }, function(response){ 75 if (response.status == "success") { 76 me.modal.hide(); 77 location.reload() 78 } else { 79 me.saveButton.prop('disabled',false); 80 alert(response.message); 81 } 82 }, 83 'json'); 84 }); 85 86 /* Auto Toggle */ 87 88 if (me.popup.is(":hidden")) 89 me.popup.show(); 90 91 }
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.