PageSourceSearch

https://twistedfresh.com/js/ezengage.js?v=brussels

js twistedfresh.com collected 2026-10-07 03:18:55 UTC 10,512 bytes, 240 lines download raw bytes

1/* EZENGAGE General Javascript
2 * Author: EZLinks Golf LLC
3 * Created: November 2018
4 * Modified: January 2019
5 */
6$(document).ready(function() {
7    // Reg_Form Validation
8    //-----------------------------------------------
9
10    $("form.reg_form").validate(FormValidation);
11
12    // Shuffle Plugin
13    //-----------------------------------------------
14
15    if ($("#portfolio-gallery").length > 0) {
16
17        const shuffleInstance = new Shuffle($("#portfolio-gallery") ,{
18            itemSelector: '.shuffle-item',
19            sizer: '.sizer-element',
20            easing: 'cubic-bezier(0.77, 0, 0.175, 1)',
21            isCentered: true,
22            speed: 400
23        });
24        
25        $(".portfolio-shuffle a[data-filter]").on('click', function(e) {
26            e.preventDefault();
27
28            let $this = $(this);
29            shuffleInstance.filter($this.attr("data-filter"));
30
31            //Make sure only one filter is active
32            $this.addClass("active").parent().siblings().find(".active").removeClass("active");
33        });
34
35        shuffleInstance.on(Shuffle.EventType.LAYOUT, function() {
36            $("#portfolio-gallery .shuffle-item--visible").attr("data-group", "gallery");
37            $("#portfolio-gallery .shuffle-item--hidden").attr("data-group", "");
38        });
39
40        $("#portfolio-gallery").imagesLoaded(function() {
41            shuffleInstance.update();
42        });
43
44        $("#Photos-tab").on("click", function() {
45            setTimeout(function() {
46                shuffleInstance.update();
47            }, 200);
48        });
49    }
50
51    //Modaal Initilization
52    //-----------------------------------------------
53
54    $('#portfolio-gallery .modaal').modaal({
55        type: 'image',
56        animation_speed: 100,
57        custom_class: 'EZModal-modaal',
58        outer_controls: true,
59        overlay_opacity: 0.3
60    });
61
62    $('.modaal-img').modaal({
63        type: 'image',
64        animation_speed: 100,
65        custom_class: 'EZModal-modaal',
66        outer_controls: true,
67        overlay_opacity: 0.3
68    });
69
70    //Reg_Form restyling
71    //-----------------------------------------------
72    const regForm = $('form.reg_form');
73
74    function arrayChunk(arr, chunkLen) {
75        let chunkList = []
76        let chunkCount = Math.ceil(arr.length / chunkLen)
77        for (var i = 0; i < chunkCount; i++) {
78            chunkList.push(arr.splice(0, chunkLen))
79        }
80        return chunkList
81    }
82
83    function getOptions(arr) {
84        let optionsList = ''
85        for (var i = 0; i < arr.length; i++) {
86            optionsList = optionsList.concat(`<option value="${arr[i].innerText}">${arr[i].innerText}</option>`)
87        }
88        return optionsList
89    }
90
91    function makeSafeForCSS(name) {
92        return name.replace(/[^a-z0-9]/g, function(s) {
93            var c = s.charCodeAt(0);
94            if (c == 32) return '-';
95            if (c >= 65 && c <= 90) return '_' + s.toLowerCase();
96            return '__' + ('000' + c.toString(16)).slice(-4);
97        });
98    }
99
100    const updateForm = function() {
101        regForm.replaceWith(function() {
102            let UpdatedForm = '';
103            let form = '';
104            $(this).children().each(function() {
105                if (['hidden', 'text/javascript', 'text'].includes(this.type)) {
106                    if (this.type == 'text') {
107                        form = form.concat(`<input type="hidden" name="${$(this).attr('name')}" style="${$(this).attr('style')}">`);
108                    } else {
109                        form = form.concat(this.outerHTML)
110                    }
111                } else {
112                    $(this.firstChild).children().each(function() {
113                        let chunk = arrayChunk($(this).children(), 2);
114                        $(chunk).each(function() {
115                            let child = $(this).children();
116                            let updateProfile = document.location.href.includes('new_accountv2');
117                            let requiredClass = '';
118                            let requiredTrue = '';
119                            if (child.hasClass('required')) {
120                                requiredClass = ' required'
121                                requiredTrue = ' required="true"'
122                            }
123                            if (child.attr('type') == 'text' || child.attr('type') == 'password') {
124                                form = form.concat(`
125                                <div class="form-group">
126                                    <label for="${makeSafeForCSS(child.attr('name'))}">${$(this)[0].innerText}</label>
127                                    <input type="${child.attr('type')}" ${updateProfile ? `value='${child.attr('value')}' ` : ``}class="form-control${requiredClass}"${requiredTrue} name="${child.attr('name')}" id="${makeSafeForCSS(child.attr('name'))}" placeholder="${child.attr('title')}">
128                                </div>
129                            `);
130                            } else if (child.is('select')) {
131                                form = form.concat(`
132                                <div class="form-group">
133                                    <label for="${makeSafeForCSS(child.attr('name'))}">${$(this)[0].innerText}</label>
134                                    <select id="${makeSafeForCSS(child.attr('name'))}" ${updateProfile ? `value='${child.attr('value')}' ` : ``}class="form-control${requiredClass}"${requiredTrue} name="${child.attr('name')}">
135                                    ${getOptions(child.children())}
136                                    </select>
137                                </div>
138                            `);
139                            } else if (child.attr('type') === 'submit') {
140                                form = form.concat(`
141                                <div class="row form-group">
142                                    <div class="col"><button class='btn btn-template form-control' type='${child.attr('type')}' name='${child.attr('name')}' value='${child.attr('value')}'>${child.attr('value')}</button></div>
143                                    ${(child.length > 1) ? `
144                                    <div class="col"><button class='btn btn-template form-control' type='${$(this).children("[type=button]").attr('type')}' name='${$(this).children("[type=button]").attr('name')}' value='${$(this).children("[type=button]").attr('value')}' onclick="${$(this).children("[type=button]").attr('onclick')}">${$(this).children("[type=button]").attr('value')}</button></div>
145                                    <div class="w-100"></div>
146                                    <div class="text-center col">
147                                        <span id='${child.attr('id')}' class='${child.attr('class')}'>${child.text()}</span>
148                                        <button class='btn btn-template form-control' type='${child.find("[type=submit]").attr('type')}' name='${child.find("[type=submit]").attr('name')}' value='${child.find("[type=submit]").attr('value')}' onclick="${child.find("[type=submit]").attr('onclick')}">${child.find("[type=submit]").attr('value')}</button>
149                                    </div>
150                                    ` : ``}
151                                </div>`);
152                            } else if (child.is('textarea')) {
153                                form = form.concat(`
154                                <div class="form-group">
155                                    <label for="${makeSafeForCSS(child.attr('name'))}">${$(this)[0].innerText}</label>
156                                    <textarea name="${child.attr('name')}" id="${makeSafeForCSS(child.attr('name'))}" class="form-control${requiredClass}"${requiredTrue} placeholder="${child.attr('title')}"></textarea>
157                                </div>
158                            `)
159                            } else {
160                                if (child.length > 0) {
161                                    form = form.concat(child.html());
162                                }
163                            }
164                        });
165                    })
166                }
167            });
168
169            updatedForm = `
170            <form method="${$(this).attr('method')}" action="${$(this).attr('action')}" onsubmit="${$(this).attr('onsubmit')}">
171                <div class="reformed" id="${$(this).find("input[name^='type']").attr('value')}">
172                ${form}
173                </div>
174            </form>
175        `;
176            return $(updatedForm);
177        });
178    };
179
180    // updateForm();
181
182    // Replicating Hover on Focused items
183    //-----------------------------------------------
184    $(".affect-parent").on({
185      focus: function() {
186        $(this).parents("[id], .trans").addClass("focus");
187      },
188      blur: function() {
189        $(this).parents("[id], .trans").removeClass("focus");
190      }
191    });
192
193    // Plyr Video
194    //-----------------------------------------------
195    if ($("#hero video").length > 0) {
196        const player = new Plyr('#EZVideo', heroVideo);
197    }
198
199    if($(".video").length > 0) {
200        const players = Plyr.setup('.EZVideos');
201        let opened = [];
202        let fullsceen = false;
203
204        players.forEach(function(player) {
205            player.on('enterfullscreen', function(event) {
206                $("body").addClass("video-full-screen");
207                opened = [];
208                fullsceen = true;
209            });
210
211            player.on('exitfullscreen', function(event) {
212                if (opened.length === players.length - 1) {
213                    $("body").removeClass("video-full-screen");
214                } else if ((fullsceen === true) && (opened.length === players.length - 2)) {
215                    opened = [];
216                    fullsceen = false;
217                } else {
218                    opened.push("open")
219                }
220            });
221        })
222    }
223
224    // Slick Slideshow
225    //-----------------------------------------------
226    if ($("#hero.slideshow").length > 0) {
227        $("#EZCarousel").slick(heroSlideshow);
228    }
229
230    // BasicTable Initialization
231    //-----------------------------------------------
232    $(".table").basictable();
233
234    // Enable Parallax on chrome becase that's the only browser where it works
235    //-----------------------------------------------
236
237    // if ((!!window.chrome && !!window.chrome.webstore) && $("#hero.parallax").length > 0) {
238    //     $("#hero.parallax").css("background-attachment", "fixed");
239    // }
240});

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.