PageSourceSearch

https://jeio.it/wp-content/themes/blankslate/daw/daw_functions.js?ver=17105570872

js jeio.it collected 2026-09-26 20:44:46 UTC 7,267 bytes, 235 lines download raw bytes

1// document ready
2jQuery( function ( $ ) {
3    'use strict';
4
5	console.log("DAW ready", daw_vars.site_url)
6
7    $('.wpcf7-form').submit(function(event) {
8        //your code here
9        console.log("event", event)
10
11        //var arrayData = $(this).serializeArray()
12
13        //console.log("arrayData", arrayData)
14
15
16    });
17
18    function daw_get_token() {
19        console.log("daw_get_token")
20        var app_type = "prod"; // dev|test|prod
21
22        var api_host = "https://lunelli.azure-api.net/"
23        var subscription_key = ''
24        var clientId = ''
25        var clientSecret = ''
26		var api_host_login = "https://lunelli.azure-api.net/identity/login"
27
28        switch (app_type) {
29            case "dev":
30                api_host = "https://lunelli.azure-api.net/dev/"
31
32                subscription_key = ''
33                clientId = '***************************'
34                clientSecret = ''
35                break;
36            case "test":
37                api_host = "https://lunelli.azure-api.net/tst/"
38                subscription_key = ''
39                clientId = '**********************************'
40                clientSecret = ''
41                break;
42
43            case "prod":
44				api_host = "https://lunelli.azure-api.net/form"
45                subscription_key = ''
46                clientId = '*********************************'
47                clientSecret = ''
48                break;
49        }
50
51        var rooturl = api_host
52        var rooturl = api_host_login
53
54
55        //rooturl = api_host + 'identity/login'
56
57		var data = {
58                "clientId":clientId,
59                "clientSecret":clientSecret
60            }
61		//data = JsonConvert.DeserializeObject<dataset>(respContent);
62
63        $.ajax({
64            url : rooturl ,
65            type : 'POST',
66            path: '/identity/login',
67            data : JSON.stringify(data),
68            //contentType: "application/json",
69			contentType: "application/json; charset=utf-8",
70			dataType: "json",
71            beforeSend: function(xhrObj){
72                // Request headers
73                xhrObj.setRequestHeader("Content-Type","application/json");
74                xhrObj.setRequestHeader("Ocp-Apim-Subscription-Key",subscription_key);
75                //xhrObj.setRequestHeader("clientId",clientId);
76                //xhrObj.setRequestHeader("clientSecret",clientSecret);
77            },
78
79            success : function(data) {
80                //alert('Data: +'data);
81                console.log("data", data)
82				if (data.access_token != 'undefined') {
83					var access_token = data.access_token
84					console.log("access_token", access_token)
85				}
86
87            },
88            error : function(request,error)
89            {
90                alert("app_type: " + app_type + " - Request: "+JSON.stringify(request));
91            }
92        });
93
94    }
95
96	$(".test-token").click(function(){
97        daw_get_token()
98    })
99
100
101	/******************/
102	// aggiunta automatica asterischi a campi required
103	$('input.wpcf7-validates-as-required').each((index, element)=>{
104
105		var content = $(element).attr('placeholder');
106		$(element).attr('placeholder', content+'*');
107
108		// custom select
109        if($('.custom-select').find('select.wpcf7-validates-as-required').length !== 0) {
110            $('.custom-select')
111        }
112
113
114	})
115
116    setTimeout(function() {
117        $('.custom-select').each(function() {
118            if ($(this).find('select.wpcf7-validates-as-required').length !== 0) {
119                console.log("found")
120                $(this).find('.select-selected').append("*")
121            }
122        });
123    }, 1000)
124
125
126	/********************/
127	// gestione visibilità form visita
128	if ($('#form-prenotazione-visita').length) {
129		var debug = false
130
131		var cookieName = "daw-form-prenotazione-visited"
132
133
134		console.log('cookieName', cookieName)
135
136		if (
137		document.cookie.indexOf(cookieName+'=true') === -1
138		|| debug
139		) {
140			// crea cookie -- da creare all'invio del form
141			//var expires = new Date();
142			//expires.setDate(expires.getDate()+30);
143			//document.cookie = cookieName+"=true; expires="+expires.toUTCString();
144		} else {
145			// cookie esistente, nascondi form
146			$('#form-prenotazione-visita').hide()
147		}
148
149		// nascondi campo codice voucher
150		$('.wpcf7-form-control-wrap.VoucherCode').hide()
151
152		// preimposta il valore di "esperienza" in base a quello ricevuto
153		//$('.wpcf7-form-control-wrap.InterestExperience select')
154		// Finti campi visibili per lo tile
155		//$('.select-selected')
156		setTimeout(function() {
157			$('.wpcf7-form-control-wrap.InterestExperience select').val(2).change();
158		}, 500)
159
160		//$('.select-selected')
161	}
162
163	/***************************/
164    /* gestione percorso custom per form prenota-la-tua-visita in basse all'esperienza scelta*/
165
166    var val = $('#thankyouURL').val()
167
168    $('.custom-select').click(function() {
169        if ($(this).find('.interestExperience')) {
170            //console.log('.custom-select interestExperience click')
171            var item = $(this).find('.select-items .same-as-selected').html()
172
173            //console.log("item", item)
174            var quale = ""
175
176            switch (item) {
177                case "I Classici Bisol":
178                    quale = "Classici_Bisol"
179                    break;
180                case "I Cru":
181                    quale = "Cru_Bisol"
182                    break;
183                case "Tour &amp; Tasting Classici":
184                    quale = "Tour_Tasting_Classici_Bisol"
185                    break;
186                case "Tour &amp; Tasting Cru":
187                    quale = "Tour_Tasting_Cru_Bisol"
188                    break;
189            }
190            console.log("quale", quale)
191
192            if (quale != "") {
193                $('#thankyouURL').val(val + "?esperienza=" + quale)
194                var thankyouURL = daw_vars.site_url + "/" + document.getElementById("thankyouURL").value;
195                console.log("thankyouURL: " + thankyouURL)
196            }
197            //console.log("$('#thankyouURL').val()", $('#thankyouURL').val())
198            //hasClass('same-as-selected') {
199        }
200
201    })
202
203    // popola idbooking
204    if ($('#idBooking')) {
205        var id_booking = getParameterByName("id_booking")
206        //console.log("popola idBooking", id_booking)
207        $('#idBooking').val(id_booking)
208    }
209
210    $('.interestExperience select').change(function(){
211
212        var id = ($(this).data('id'));
213        console.log("id", id)
214    });
215});
216
217//
218document.addEventListener( 'wpcf7mailsent', function( event ) {
219    var thankyouURL = daw_vars.site_url + "/" + document.getElementById("thankyouURL").value;
220    console.log("wpcf7mailsent", thankyouURL)
221
222    location = thankyouURL;
223}, false );
224
225function getParameterByName(name, url) {
226    if (!url) {
227        url = window.location.href;
228    }
229    name = name.replace(/[\[\]]/g, "\\$&");
230    var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"),
231        results = regex.exec(url);
232    if (!results) return null;
233    if (!results[2]) return '';
234    return decodeURIComponent(results[2].replace(/\+/g, " "));
235}

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.