PageSourceSearch

https://www.ayotree.org/wp-content/themes/ayotree/js/ayotree.js?ver=1596696298

js ayotree.org collected 2026-10-10 02:23:48 UTC 20,637 bytes, 573 lines download raw bytes

1(function($) {
2    $( document ).ready(function() {
3
4        // Simple email validation, check for @ and .
5        function validateEmail(str) {
6            return (str.includes('@') && (str.includes('.')));
7        }
8
9        // Homepage try free link
10        $(".btnTryFree1").on('click', function(e) {
11            var email = $(this).parent().parent().find(".txtEmail1").val();
12            var lang = getQueryParams('lang', window.location.href);
13            if (email.trim() && validateEmail(email)) {
14	            if(lang == 'vi' ) {
15		        	window.location.href = "https://ayotree.com/registernew.aspx?secret=1&app=standard&lang=vi&email=" + email;    
16	            } else {
17		            window.location.href = "https://ayotree.com/registernew.aspx?secret=1&app=standard&email=" + email;
18	            }
19            } else {
20                alert('Please enter a valid Email Address.')
21            }
22            return false;
23        });
24        $("#btnTryFree2").on('click', function(e) {
25            var email = $("#txtEmail2").val();
26            var lang = getQueryParams('lang', window.location.href);
27            if (email.trim() && validateEmail(email)) {
28                if(lang == 'vi' ) {
29		        	window.location.href = "https://ayotree.com/registernew.aspx?secret=1&app=standard&lang=vi&email=" + email;    
30	            } else {
31		            window.location.href = "https://ayotree.com/registernew.aspx?secret=1&app=standard&email=" + email;
32	            }
33            } else {
34                alert('Please enter a valid Email Address.')
35            }
36            return false;
37        });
38
39    });
40})(jQuery);
41
42
43function getQueryParams( params, url ){
44    let href = url;
45    //this expression is to get the query strings
46    let reg = new RegExp( '[?&]' + params + '=([^&#]*)', 'i' );
47    let queryString = reg.exec(href);
48    return queryString ? queryString[1] : null;
49};
50
51(function($) {
52    $( document ).ready(function() {
53
54        // Contact us FAQ collapse functionality
55        let $faq = $('#faq');
56        if (!$faq.length) return;
57
58        $faq.find('h4').each(function(ind, el) {
59            let target = '#faq-' + ind;
60            $(this)
61                .attr('data-toggle', 'collapse')
62                .attr('data-target', target)
63                // .attr('tabindex', '0')
64                .next().attr('id', target).addClass('collapse');
65            $(this).on('click', function() {
66                if (window.innerWidth >= 768) return;
67                $(this).next().collapse('toggle');
68            });
69        });
70        $faq.find('p.collapse').collapse('hide');
71
72    });
73})(jQuery);
74
75(function($) {
76    $( document ).ready(function() {
77
78        let $contactForm = $('#ayotree-request-demo-form');
79        if (!$contactForm.length) return;
80        var dateToday = new Date(); 
81        dateToday.setDate(dateToday.getDate() + 2);
82        // Datepicker
83        // https://bootstrap-datepicker.readthedocs.io/en/stable/
84        let $datePicker = $('.datepicker');
85        if ($datePicker.length) {
86            $datePicker.datepicker({
87                container: '#datepicker-container',
88                showOnFocus: false,
89                startDate: '+2d',
90                defaultDate: dateToday,
91                minDate: 2
92            });
93        }
94
95    });
96})(jQuery);
97
98(function($) {
99    $( document ).ready(function() {
100
101        // For Test Drive Ayotree Form (page-confirmation)
102        let $form = $('#form-confirmation');
103        if (!$form.length) return;
104
105        console.log(localStorage);
106        localStorage.clear();
107
108    });
109})(jQuery);
110
111(function($) {
112    $( document ).ready(function() {
113
114        let $contactForm = $('#ayotree-contact-form');
115
116        if (!$contactForm.length) return;
117
118        // Use honey.js to prevent spam
119        // https://github.com/hungluu/honeyjs
120        if (typeof honey === 'function') honey($contactForm[0]);
121
122        $contactForm.on('submit', function(e) {
123            e.preventDefault();
124
125            let vName = $('#formName').val().trim();
126            let vEmail = $('#formEmail').val().trim();
127            let vSubject = $('#formTopic').val();
128            let vMessage = $('#formText').val();
129
130            let messageSuccess = 'Thank you for contacting us, we will get back to you as soon as possible.';
131            let messageFail = 'Unfortunately something went wrong, please inform the site administrator.';
132            var lang = getQueryParams('lang', window.location.href);
133            if (lang == '')
134                lang ='en';
135            $.ajax({
136                type: "POST",
137                contentType: "application/json; charset=utf-8",
138                dataType: "json",
139                url: "https://ayotree.com/Apis/ApiSendMail.asmx/Sent",
140                data: JSON.stringify({
141                    Name: encodeURI(vName),
142                    FromAddress: encodeURI(vEmail),
143                    Subject: encodeURI(vSubject),
144                    Message: encodeURI(vMessage)
145                }),
146                success: function (response) {
147                    if (response.d != 'false') {
148                        // Reset the form after submission
149                        $contactForm[0].reset();
150                        window.location.href = 'https://ayotree.com/comfirmation.aspx?ComeFrom=contact&lang='+ lang;
151                    }
152                    else {
153                        alert(messageFail);
154                    }
155                },
156                error: function() {
157                    alert(messageFail);
158                }
159            });
160        });
161
162    });
163})(jQuery);
164
165(function($) {
166    $( document ).ready(function() {
167
168        let $contactForm = $('#ayotree-request-demo-form');
169
170        if (!$contactForm.length) return;
171
172        // Use honey.js to prevent spam
173        // https://github.com/hungluu/honeyjs
174        if (typeof honey === 'function') honey($contactForm[0]);
175
176        $contactForm.on('submit', function(e) {
177            e.preventDefault();
178
179            let vName = $("#demo_name").val().trim();
180            let vEmail = $("#email").val().trim();
181            let vSubject = 'Request a Product Demo';
182            let vOrganization = 'Organization: ' + $("#organization").val();
183			let vDate = $("#preferred_demo_date").val();
184			let vTime = $("#start_time").val();
185			let vDuration = $("#demo_duration").val();
186			let vTimeZone = $("#time_zone").val();
187            let vMessage = 'Name:'+ vName +'<br/>Email: '+ vEmail +'<br/>' + vOrganization + '<br/>Date:' + vDate + '<br/> Start Time:' +  + '<br/> Duration:' + vDuration
188            + '<br/> Time Zone:' + vTimeZone;
189
190            let messageSuccess = 'Thank you for contacting us, we will get back to you as soon as possible.';
191            let messageFail = 'Unfortunately something went wrong, please inform the site administrator.';
192            var lang = getQueryParams('lang', window.location.href);
193            if (lang == '')
194                lang ='en';
195
196            $.ajax({
197                type: "POST",
198                contentType: "application/json; charset=utf-8",
199                dataType: "json",
200                url: "https://ayotree.com/Apis/ApiSendMail.asmx/SentRequest",
201                data: JSON.stringify({
202                    Name: encodeURI(vName),
203                    FromAddress: encodeURI(vEmail),
204                    Subject: encodeURI(vSubject),
205                    sDate: encodeURI(vDate),
206					sTime: encodeURI(vTime),
207					sDuration: encodeURI(vDuration),
208					sOrganization: encodeURI(vOrganization),
209					sTimeZone: encodeURI(vTimeZone),
210                }),
211                success: function (response) {
212                    if (response.d != 'false') {
213                        // Reset the form after submission
214                        $contactForm[0].reset();
215                        window.location.href = 'https://ayotree.com/comfirmation.aspx?ComeFrom=contract&lang='+lang;
216                    }
217                    else {
218                        alert(messageFail);
219                    }
220                },
221                error: function() {
222                    alert(messageFail);
223                }
224            });
225
226        });
227
228    });
229})(jQuery);
230
231(function($) {
232    $( document ).ready(function() {
233
234        // Product Tour Form page
235
236        // Datepicker
237        // https://bootstrap-datepicker.readthedocs.io/en/stable/
238        let $datePickerProductTour = $('#datepicker-product-tour-container');
239        if (!$datePickerProductTour.length) return;
240
241        $datePickerProductTour.datepicker({
242            daysOfWeekDisabled: '07',
243            maxViewMode: 'days',
244            todayHighlight: true,
245            startDate: '2d',
246            templates: {
247                leftArrow: '<i class="fa fa-chevron-left"></i>',
248                rightArrow: '<i class="fa fa-chevron-right"></i>'
249            },
250        });
251
252        // Update the input to the datepicker value
253        $datePickerProductTour.on('changeDate', function() {
254            $('#datepicker-product-tour').val(
255                $datePickerProductTour.datepicker('getFormattedDate')
256                );
257        });
258
259        // Set the next available day
260        let date = new Date();
261        let formattedDate = formatDate(date.setDate(date.getDate() + 3));
262        $datePickerProductTour.datepicker('setDate', new Date(formattedDate));
263
264        // Availble Product Demo Times
265        let $productDemoTimes = $('#list-group-product-demo-times');
266        let $availableDemoTimeInput = $('#datepicker-product-tour-available-time');
267
268        // Set Available time field
269        $availableDemoTimeInput.val($productDemoTimes.find('.active').text());
270        $productDemoTimes.find('a').on('click', function(e) {
271            $availableDemoTimeInput.val($(this).text());
272        });
273
274        // Fix active class bug with collapsed more times
275        $productDemoTimes.find('a').on('click', function() {
276            $productDemoTimes.find('a').removeClass('active');
277            $(this).addClass('active');
278        });
279
280        let $submitForm = $('#submit-request-product-tour');
281        if ($submitForm.length) {
282            $submitForm.on('click', function(e) {
283                // If the form is filled out, save the fields to the localstorage.
284                if (true) {
285                    localStorage.setItem('product_tour_day', $('#datepicker-product-tour').val());
286                    localStorage.setItem('product_tour_time', $('#datepicker-product-tour-available-time').val());
287
288                    window.location.href = $(this).data('link');
289                }
290            });
291        }
292
293        // Format Date to yyyy-mm-dd
294        // https://stackoverflow.com/questions/23593052/format-javascript-date-to-yyyy-mm-dd
295        function formatDate(date) {
296            let d = new Date(date);
297            let month = '' + (d.getMonth() + 1);
298            let day = '' + d.getDate();
299            let year = d.getFullYear();
300
301            if (month.length < 2) month = '0' + month;
302            if (day.length < 2) day = '0' + day;
303
304            return [year, month, day].join('-');
305        }
306    });
307})(jQuery);
308
309(function($) {
310    $( document ).ready(function() {
311
312        // Automatically send the timezone when a user is on this page and automatically set the timezone field
313
314        // Use jstz to determine autodetect timezone
315        // https://github.com/iansinnott/jstz
316        // Use moment.js to parse, validate, manipulate, and display dates
317        // https://github.com/moment/moment
318        if (typeof jstz === 'undefined' || typeof moment !== 'function') return;
319
320        // Only run on form pages
321        if ($('#time_zone').length == 0 || $('#ayotree-request-demo-form') == 0) return;
322
323        var tzTimeZone = jstz.determine();
324        var sTimeZone = moment().format("Z");
325
326        $.ajax({
327            type: "POST",
328            contentType: "application/json; charset=utf-8",
329            dataType: "json",
330            url: "https://ayotree.com/Apis/ApiSendMail.asmx/OlsonTimeZoneToTimeZoneInfo",
331            data: JSON.stringify({
332                olsonTimeZoneId: tzTimeZone.name()
333            }),
334            success: function (data) {
335                var myData = data.d;
336                // console.log(data);
337                // Set the timezone field value automatically
338                if (myData != null) {
339                    $("#time_zone").val(myData);
340                }
341                else{
342                     $.ajax({
343                        type: "POST",
344                        contentType: "application/json; charset=utf-8",
345                        dataType: "json",
346                        url: "https://ayotree.com/Apis/ApiSendMail.asmx/FindTimeZone",
347                        data: JSON.stringify({
348                            sTimeZone: sTimeZone
349                        }),
350                        success: function (data) {
351                            var myData = data.d;
352                            if (myData != null) {
353                                $("#time_zone").val(myData);
354                            }
355                        }
356                    });
357                }
358            }
359        });
360
361    });
362})(jQuery);
363
364(function($) {
365    $( document ).ready(function() {
366
367        let $form = $('#test-drive-ayotree');
368        if (!$form.length) return;
369
370        $('.submit-test-drive').on('click', function(e) {
371            // If the form is filled out, save the fields to the localstorage.
372            if ($form[0].reportValidity()) {
373                localStorage.setItem('name', $('#demo_name').val());
374                localStorage.setItem('email', $('#email').val());
375                localStorage.setItem('country', $('#country').val());
376                localStorage.setItem('time_zone', $('#time_zone').val());
377                localStorage.setItem('preferred_language', $('#preferred_language').val());
378                localStorage.setItem('school_type', $('#school_type').val());
379                localStorage.setItem('offer_online', $('#offer_online').val());
380                localStorage.setItem('locations_amount', $('#locations_amount').val());
381                localStorage.setItem('teacher_amount', $('#teacher_amount').val());
382                localStorage.setItem('students_amount', $('#students_amount').val());
383
384                // Redirect to data-link
385                window.location.href = $(this).data('link');
386            }
387        });
388
389    });
390})(jQuery);
391
392(function($) {
393    $( document ).ready(function() {
394
395        // Try Ayotree Free Form
396        let $tryAyotreePlan = $('#try-ayotree-plan');
397        if (!$tryAyotreePlan.length) return;
398
399        // Set the hidden radio input value when clicking on the plan
400        $tryAyotreePlan.find($('a.list-group-item')).on('click', function(e) {
401            let planType = $(this).data('plan');
402            $('#' + planType).prop('checked', true).change();
403        });
404
405        $form = $('#try-ayotree-free');
406        $('#submit-try-ayotree-free').on('click', function(e) {
407            // Check for equality with the password inputs
408            if ($("#password").val() != $("#password_confirm").val()) {
409                alert('Your passwords must be the same!');
410                return false;
411            }
412            // Check the rest of the form
413            if ($form[0].reportValidity()) {
414                localStorage.setItem('url', $('#url').val());
415                localStorage.setItem('password', $('#password').val());
416
417                window.location.href = $(this).data('link');
418            }
419        });
420
421    });
422})(jQuery);
423
424(function($) {
425    $( document ).ready(function() {
426
427        // Smooth scroll to anchor link
428        $('.link-smooth-scroll').click(function() {
429            event.preventDefault();
430            let sectionTo = $(this).attr('href');
431            $('html, body').stop().animate({
432                scrollTop: $(sectionTo).offset().top
433            }, 1000, function() {
434                window.location.hash = sectionTo;
435            });
436        });
437
438    });
439})(jQuery);
440
441(function($) {
442    $( document ).ready(function() {
443
444        let $navbar = $("#wrapper-navbar");
445        let $featuresLinks = $("#features-links");
446        let $featuresMobileDropdown = $('#features-mobile-dropdown');
447
448        // Initiate headroom.js
449        $navbar.headroom({
450            "offset": 205,
451            "tolerance": 5,
452            onPin: function() {
453                if ($featuresMobileDropdown.length) {
454                    $featuresMobileDropdown.removeClass('features-headroom--pinned');
455                }
456            },
457            onUnpin: function() {
458                if ($featuresMobileDropdown.length) {
459                    $featuresMobileDropdown.addClass('features-headroom--pinned');
460                }
461            }
462        });
463
464        // Push content down with a div with the navbar's height
465        $navbar.after('<div class="top-space" style="margin-top:' + $navbar.height() + 'px;"></div>');
466
467        $( window ).resize($.debounce( 250, function() {
468            $('.top-space').css('margin-top', $navbar.height());
469        }));
470
471           // Features page sticky links
472        if ($featuresLinks.length) {
473            stickFeaturesMobileDropdown();
474
475            $(window).resize($.debounce( 250, function() {
476                $featuresMobileDropdown.unstick();
477                stickFeaturesMobileDropdown();
478            }));
479
480            function stickFeaturesMobileDropdown() {
481                $featuresMobileDropdown.sticky({
482                    topSpacing: window.innerWidth > 600 ? $navbar.height() + $('#wpadminbar').height() : $navbar.height(),
483                });
484            }
485
486            function featuresLinks(self) {
487                $featuresLinks.find('.active').removeClass('active');
488                $featuresLinks.find('a[href="#' + self.element.i
488d + '"]').addClass('active');
489            }
490
491            let $featureSections = $('.feature-section');
492            // Weird bug, have to set waypoints for both up and down directions
493            $featureSections.waypoint({
494                handler: function(direction) {
495                    if (direction == 'down') {
496                        featuresLinks(this);
497                    }
498                },
499                offset: 2
500            });
501            $featureSections.waypoint({
502                handler: function(direction) {
503                    if (direction == 'up') {
504                        featuresLinks(this);
505                    }
506                },
507                offset: -2
508            });
509
510            // Close dropdown menu when link is clicked
511            let $featuresMobileDropdownBtn = $('#features-mobile-dropdown-btn');
512            $featuresLinks.find('a').on('click', function() {
513                $featuresLinks.collapse('hide');
514                $featuresMobileDropdownBtn.find('.features-mobile-dropdown-btn-text').text($(this).text());
515            });
516
517        }
518
519    });
520})(jQuery);
521
522(function($) {
523    $( document ).ready(function() {
524
525        // Homepage owlCarousel
526        let $owlCarousel = $(".owl-carousel");
527        if ($owlCarousel.length) {
528            $owlCarousel.owlCarousel({
529                items: 1,
530                nav: true,
531                dots: true,
532                margin: 30,
533            });
534        }
535
536    });
537})(jQuery);
538
539(function($) {
540    $( document ).ready(function() {
541
542        // Pricing change prices using data-annual or data-monthly
543        let $pricingSubscriptionLinks = $('.pricing-subscription-list a');
544        $pricingSubscriptionLinks.on('click', function(e) {
545            let dataPrice = $(this).data('price');
546            let $content = $('[data-' + $(this).data('price') + ']');
547            $content.each(function(index, value) {
548                $(value).html($(value).data(dataPrice));
549            });
550        });
551
552        let $pricingPopup = $('.pricing-mobile-popout');
553        let $pricingBackBtn = $('#pricing-mobile-back');
554        let $pricingBtn = $('#pricing-mobile-started');
555
556        $('#tab-annual a').on('click', function(e) {
557            if (window.innerWidth >= 768) return;
558
559            $pricingPopup.addClass('active');
560            $('body').addClass('overflow-hidden');
561            window.scrollTo(0, 0);
562            // Update mobile button "Get Started for Free" link href
563            $pricingBtn.attr('href', 'https://ayotree.com/registernew.aspx?secret=1&app=' + $(this).data('plan') + '&email=');
564        });
565
566        $pricingBackBtn.on('click', function(e) {
567            e.preventDefault();
568            $pricingPopup.removeClass('active');
569            $('body').removeClass('overflow-hidden');
570        });
571
572    });
573})(jQuery);

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.