PageSourceSearch

https://ne-expo.com/js/register.js?v=s_6-d5QMarvOLvyFcGzCmFzZhdShOFUZQN9msRZL-7A

js ne-expo.com collected 2026-09-26 14:40:31 UTC 16,662 bytes, 606 lines download raw bytes

1function initProfession() {
2    function professionOnChange() {
3        var other = $("#profession-other");
4        var professionOther = other.find("#Attendee_ProfessionOther");
5
6        if (this.value == "othr") {
7            other.show();
8            professionOther.rules("add", {
9                notempty: true,
10                messages: {
11                    notempty: "Profession Other is required"
12                }
13            });
14        } else {
15            other.hide();
16            professionOther.rules("remove", "notempty");
17        }
18    }
19
20    var profession = $("#Attendee_Profession");
21    profession.on("change", professionOnChange);
22    profession.trigger("change");
23}
24
25function initOwn() {
26    function ownOnChange() {
27        var unitPosition = $("#unit-position");
28        var position = unitPosition.find("#Attendee_Position");
29
30        if (this.value == "unit") {
31            unitPosition.show();
32            position.rules("add", {
33                required: true,
34                messages: {
35                    required: "Position is required"
36                }
37            });
38        } else {
39            unitPosition.hide();
40            position.rules("remove", "required");
41        }
42    }
43
44    var own = $("#Attendee_Own");
45    own.on("change", ownOnChange);
46    own.trigger("change");
47}
48
49function initPosition() {
50    function positionOnChange() {
51        var details = $("#position-details");
52        var liveIn = details.find("#Attendee_LiveIn");
53
54        if (this.value && this.value != "none") {
55            details.show();
56            liveIn.rules("add", {
57                required: true,
58                messages: {
59                    required: "Live In is required"
60                }
61            });
62      } else {
63            details.hide();
64            liveIn.rules("remove", "required");
65        }
66    }
67
68    var position = $("#Attendee_Position");
69    position.on("change", positionOnChange);
70    position.trigger("change");
71}
72
73function initHowFound() {
74    function howFoundOnChange() {
75        var other = $("#howfound-other");
76        var howFoundOther = other.find("#Attendee_HowFoundOther");
77
78        if (this.value == "othr") {
79            other.show();
80            howFoundOther.rules("add", {
81                notempty: true,
82                messages: {
83                    notempty: "How Found Other is required"
84                }
85            });
86       } else {
87            other.hide();
88            howFoundOther.rules("remove", "notempty");
89        }
90    }
91
92    var howFound = $("#Attendee_HowFound");
93    howFound.on("change", howFoundOnChange);
94    howFound.trigger("change");
95}
96
97function initSubscribe() {
98    function subscribeOnChange() {
99        var qualification = $("#qualification");
100        var subscribeQualification = qualification.find("#Attendee_Qualification");
101
102        if (this.value == "yes") {
103            qualification.show();
104            subscribeQualification.rules("add", {
105                notempty: true,
106                messages: {
107                    notempty: "Qualification is required"
108                }
109            });
110       } else {
111            qualification.hide();
112            subscribeQualification.rules("remove", "notempty");
113        }
114    }
115
116    var subscribe = $("#Attendee_Subscribe");
117    subscribe.on("change", subscribeOnChange);
118    subscribe.trigger("change");
119}
120
121function initSubmit() {
122    var button = $("button[type=submit]");
123
124    button.on("click", function () {
125        var form = $("#register-form");
126
127        if (!form.valid()) {
128            window.scrollTo({
129                top: 0,
130                behavior: "smooth"
131            });
132        }
133    });
134}
135
136function initValidation() {
137    $.validator.addMethod(
138        "notempty",
139        function (value) {
140            return value.trim() !== "";
141        }
142    );
143}
144
145function initRequiredFields() {
146    $("input[type=text], select").each(function () {
147        var f = $(this);
148
149        f.on("blur", function () {
150            validateField($(this), true);
151        });
152
153        if (f.val().trim()) {
154            f.siblings("label").addClass("-sm");
155        }
156
157        validateField(f, false);
158    });
159}
160
161function validateField(field, validate) {
162    var value = field.val().trim();
163    var name = field.attr("name");
164    var control = field.parent();
165
166    var isValid = true;
167    if (validate) {
168        isValid = field.valid();
169    }
170
171    if (isValid && value) {
172        control.addClass("-valid");
173
174        switch (name) {
175            case "Attendee.PostCode":
176                getZipCodeDetails(value);
177                break;
178
179            /*case "Attendee.Address1":
180            case "Attendee.Address2":
181                formatAddress(_this);
182                break;
183
184            case "Attendee.Phone":
185            case "Attendee.Fax":
186                formatPhone(_this);
187                break;*/
188        }
189    } else {
190        control.removeClass("-valid");
191
192        switch (name) {
193            case "Attendee.PostCode":
194                $("#postcode-details").text("").hide();
195                break;
196
197            /*case "Attendee.Address1":
198            case "Attendee.Address2":
199                var div = $("#Formatted_" + _this.attr("id"));
200                div.find("a").off("click");
201                div.hide();
202                break;*/
203        }
204    }
205}
206
207function getZipCodeDetails(value) {
208    $.post("/Register/GetZipCodeDetails", {
209        postcode: value,
210        __RequestVerificationToken: $('input[name="__RequestVerificationToken"]').val()
211    })
212        .done(function (data) {
213            $("#postcode-details").text(data).show();
214        })
215        .fail(function () {
216            $("#postcode-details").text("Zip Code is not found").show();
217        });
218}
219
220function formatAddress(elem) {
221    var value = elem.val().trim();
222
223    $.post("/Register/FormatAddress", {
224        address: value,
225        __RequestVerificationToken: $('input[name="__RequestVerificationToken"]').val()
226    })
227        .done(function (data) {
228            elem.val(data);
229
230            var div = $("#Formatted_" + elem.attr("id"));
231
232            div.show();
233            div.find("a").on("click", function () {
234                elem.val(value);
235                div.hide();
236                $(this).off("click");
237            });
238        })
239        .fail(function () {
240            alert("Failed to format!");
241        });
242}
243
244function formatPhone(elem) {
245    var value = elem.val().trim();
246
247    $.post("/Register/FormatPhone", {
248        phone: value,
249        __RequestVerificationToken: $('input[name="__RequestVerificationToken"]').val()
250    })
251        .done(function (data) {
252            elem.val(data);
253        })
254        .fail(function () {
255            alert("Failed to format!");
256        });
257}
258
259function initSelect() {
260    var className = "-sm";
261
262    $("select + label").each(function () {
263        var label = $(this);
264        var selects = $(label.siblings("select")).selectize();
265
266        var select = $(selects[0]);
267        var input = select.siblings(".selectize-control").find("input");
268
269        input.on("focus", function () {
270            var control = $(this).parents(".selectize-control");
271            var label = control.siblings("label");
272            if (!label.hasClass(className)) {
273                label.addClass(className);
274            }
275        });
276
277        input.on("blur", function () {
278            var control = $(this).parents(".selectize-control");
279            var label = control.siblings("label");
280            var select = control.siblings("select");
281
282            if (select.val()) {
283                control.parent().addClass("-valid");
284            } else {
285                control.parent().removeClass("-valid");
286                label.removeClass(className);
287            }
288        });
289    });
290}
291
292function initRegister() {
293    initSelect();
294    initRequiredFields();
295    initValidation();
296    initProfession();
297    initOwn();
298    initPosition();
299    initHowFound();
300    initSubscribe();
301    initSubmit();
302}
303
304function initInvite() {
305    var index = 2;
306
307    $("#add-invitee").on("click", function () {
308        var container = $("#control-container");
309        var fieldSet = container.find(".form__fieldset")[0];
310
311        var cloneFieldSet = $(fieldSet).clone();
312        var nameInput = cloneFieldSet.find("input[id='Invitee_Name']");
313        var emailInput = cloneFieldSet.find("input[id='Invitee_Email']");
314
315        var inputName = "Name_" + index;
316
317        cloneFieldSet.find("label[for='Invitee_Name']")
318            .removeClass("-sm")
319            .attr("for", inputName);
320        cloneFieldSet.find("span[data-valmsg-for='Invitee.Name']")
321            .attr("data-valmsg-for", inputName)
322            .data("valmsg-for", inputName)
323            .text("");
324
325        nameInput
326            .removeClass("input-validation-error")
327            .attr("id", inputName)
328            .attr("name", inputName)
329            .on("focus", focusInput)
330            .on("blur", blurInput)
331            .val("");
332
333        inputName = "Email_" + index;
334
335        cloneFieldSet.find("label[for='Invitee_Email'")
336            .removeClass("-sm")
337            .attr("for", inputName);
338        cloneFieldSet.find("span[data-valmsg-for='Invitee.Email']")
339            .attr("data-valmsg-for", inputName)
340            .data("valmsg-for", inputName)
341            .text("");
342
343        emailInput
344            .removeClass("input-validation-error")
345            .attr("id", inputName)
346            .attr("name", inputName)
347            .on("focus", focusInput)
348            .on("blur", blurInput)
349            .val("");
350
351        cloneFieldSet.appendTo(container);
352
353        nameInput.rules("add", {
354            required: true,
355            messages: {
356                required: "Name is required"
357            }
358        });
359        emailInput.rules("add", {
360            required: true,
361            email: true,
362            messages: {
363                required: "E-mail is required",
364                email: "Enter a valid E-mail"
365            }
366        });
367
368        index++;
369    });
370
371    $("#btnSend").on("click", function () {
372        var txtName = $("#txtName");
373        var txtEmail = $("#txtEmail");
374        var txtMessage = $("#txtMessage");
375        var chkSendCopy = $("#chkSendCopy");
376
377        var name = txtName.val().trim();
378        var email = txtEmail.val().trim();
379        var message = txtMessage.val().trim();
380        var sendCopy = chkSendCopy.length > 0 ? chkSendCopy.is(":checked") : false;
381
382        var dvMessage = $("#dvMessage");
383
384        dvMessage.removeClass("alert-danger");
385        dvMessage.removeClass("alert-success");
386        dvMessage.removeClass("alert-warning");
387
388        dvMessage.show();
389
390        if (!name) {
391            dvMessage.text("Name is required");
392            dvMessage.addClass("alert-danger");
393            return;
394        }
395
396        if (!email) {
397            dvMessage.text("Email is required");
398            dvMessage.addClass("alert-danger");
399            return;
400        }
401
402        var emailRegex = /^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/;
403
404        if (!emailRegex.test(email)) {
405            dvMessage.text("Email is not valid");
406            dvMessage.addClass("alert-danger");
407            return;
408        }
409
410        if (!message) {
411            dvMessage.text("Message is required");
412            dvMessage.addClass("alert-danger");
413            return;
414        }
415
416        var personId = $("#PersonId").val();
417
418        var btn = $(this);
419
420        btn.prop("disabled", true);
421
422        $.post(location.href,
423            {
424                name: name,
425                email: email,
426                message: message,
427                sendCopy: sendCopy,
428                personId: personId,
429                __RequestVerificationToken: $('input[name="__RequestVerificationToken"]').val()
430            },
431            function (data) {
432                btn.prop("disabled", false);
433
434                txtName.val("");
435                txtEmail.val("");
436                txtMessage.val("");
437                chkSendCopy.prop("checked", false);
438
439                if (data.warning) {
440                    dvMessage.text(data.warning);
441                    dvMessage.addClass("alert-warning");
442                    return;
443                }
444
445                if (data.error) {
446                    dvMessage.text(data.error);
447                    dvMessage.addClass("alert-danger");
448                    return;
449                }
450
451                dvMessage.addClass("alert-success");
452                dvMessage.text("Thank you! Your invitation was sent.");
453            }
454        );
455    });
456}
457
458function initReserveBoothCode() {
459    $("input[name='exhibitorType']").on("click", function () {
460        var value = this.value;
461
462        var dvCode = $("#dvReserveBoothCode");
463        var dvControls = $("#dvControls");
464
465        $("#Exhibitor_UserName").val("");
466        $("#Exhibitor_Company, #Exhibitor_Email").prop("disabled", false);
467
468        $("input[type='text']").val("").next("label").removeClass("-sm");
469        $("select").next().next("label").removeClass("-sm");
470
471        var selects = $("select");
472
473        for (var select of selects) {
474            select.selectize.setValue("");
475        }
476
477        if (value == "existing") {
478            dvCode.show();
479            dvControls.hide();
480        } else {
481            dvCode.hide();
482            dvControls.show();
483        }
484    });
485}
486
487function initPaymentType() {
488    $("input[name='paymentType']").on("click", function () {
489        var value = this.value;
490
491        var dvCreditCard = $("#dvCreditCard");
492        var dvBillMe = $("#dvBillMe");
493
494        if (value == "cc") {
495            dvCreditCard.show();
496            dvBillMe.hide();
497        } else {
498            dvCreditCard.hide();
499            dvBillMe.show();
500        }
501    });
502}
503
504function initExhibit() {
505    initSelect();
506    initRequiredFields();
507    initValidation();
508    initReserveBoothCode();
509    initPaymentType();
510}
511
512function initSession(timeoutMinutes) {
513    var timeout = timeoutMinutes * 60 * 1000;
514
515    var modal = $("#timeoutModal");
516    var modalOverlay = $("#modalOverlay");
517    var spnSession = $("#spnSession");
518
519    $("#btnClose").on("click", function () {
520        modal.hide();
521        modalOverlay.hide();
522    });
523
524    $("#btnExtend").on("click", function () {
525        modal.hide();
526        modalOverlay.hide();
527
528        spnSession.hide();
529
530        timeout = timeoutMinutes * 60 * 1000;
531
532        $.get("/ReserveBooth/Extend");
533    });
534
535    var timer = setInterval(function () {
536        timeout -= 1000;
537
538        if (timeout == 120000) {
539            modal.show();
540            modalOverlay.show();
541
542            spnSession.show();
543        }
544
545        if (timeout <= 120000) {
546            var t = time(timeout);
547
548            spnSession.text(t);
549        }
550
551        if (timeout == 0) {
552            clearInterval(timer);
553            alert('Your session has expired!')
554        }
555    }, 1000);
556}
557
558function two(x) {
559    return ((x > 9) ? "" : "0") + x;
560}
561
562function time(ms) {
563    var sec = Math.floor(ms / 1000);
564    var min = Math.floor(sec / 60);
565    var hr = Math.floor(min / 60);
566
567    sec = sec % 60;
568    min = min % 60;
569
570    var t = two(min) + ":" + two(sec);
571
572    return "Your session will expire in " + t;
573}
574
575function updateCart() {
576    $.get("/Cart/Count", function (data) {
577        $("#cart-count").text(data.count);
578    });
579}
580
581function initCart() {
582    updateCart();
583
584    $(".add-to-cart").on("click", function () {
585        var _this = this;
586        var type = $(this).data("type");
587        var id = $(this).data("id");
588        var qty = $("#slQty_" + id).val();
589
590        $.post("/Cart/Add", {
591            type: type,
592            id: id,
593            qty: qty,
594            __RequestVerificationToken: $('input[name="__RequestVerificationToken"]').val()
595        }, function (data) {
596            if (data.error) {
597                alert(data.error);
598                return;
599            }
600
601            updateCart();
602
603            $(_this).text("Added to Cart").prop("disabled", true);
604        });
605    });
606}

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.