PageSourceSearch

https://downloads.pearljam.com/versioned/38d7dda8/assets/js/main.js

js pearljam.com collected 2026-10-02 02:55:51 UTC 20,587 bytes, 639 lines download raw bytes

1$(function () {
2    var $w = $(window),
3        $body = $(document.body);
4
5    //Mobile Navigation Toggle
6    var toggle = $(".js-menu-toggle");
7
8    window.setTimeout(function () {
9        // Load all external links in new window
10        $("a")
11            .not('[href*="mailto:"]')
12            .each(function () {
13                var isInternalLink = new RegExp(
14                    "/" + window.location.host + "/"
15                );
16                if (!isInternalLink.test(this.href)) {
17                    $(this).attr("target", "_blank");
18                }
19            });
20    }, 50);
21
22    $(toggle).click(function (e) {
23        e.preventDefault();
24        var open = $(this).hasClass("active");
25        if (open) {
26            $(this).removeClass("active");
27            $("nav.js-navigation-bar").css("min-height", 0);
28        } else {
29            $("nav.js-navigation-bar").css("min-height", $(document).height());
30            $(this).addClass("active");
31        }
32        $body.toggleClass("page-menu-open");
33    });
34
35    $(".page-head__navigation-bar__item").each(function () {
36        var $submenu = $(this).next();
37        if (!$submenu.is(".submenu")) {
38            return true;
39        }
40        if ($submenu.is(".submenu")) {
41            $(this).addClass("page-head__navigation-bar__item--has-submenu");
42        }
43        $(this).click(function (e) {
44            if ($submenu.css("margin-top") != "10px") {
45                e.preventDefault();
46                $submenu.toggle();
47                $(this).toggleClass(
48                    "page-head__navigation-bar__item--has-submenu--expanded"
49                );
50            }
51        });
52    });
53
54    // if ($('.page-head .sub-nav').size() || $('.page-head .menu-wrap').size() > 0) {
55    //     $('body').addClass('with-sub-nav');
56    // }
57
58    $(".js-home-hero-slick")
59        .on("init", function () {
60            window.setTimeout(function () {
61                $(".slick-active, .slick-track").css("opacity", 1);
62            }, 50);
63        })
64        .slick({
65            slidesToShow: 1,
66            slidesToScroll: 1,
67            arrows: false,
68            fade: true,
69            asNavFor: ".slider-nav",
70            dots: true,
71            infinite: true,
72            speed: 500,
73            cssEase: "linear",
74            autoplay: true,
75            autoplaySpeed: 10000,
76            lazyLoad: "ondemand",
77        });
78
79    $(".js-mobile-search").click(function (e) {
80        e.preventDefault();
81
82        $(".js-social-buttons").fadeOut("fast", "linear", function () {
83            $(".js-mobile-search-form").fadeIn("fast");
84        });
85
86        $(".js-mobile-search-close").click(function (e) {
87            e.preventDefault();
88
89            $(".js-mobile-search-form").fadeOut("fast", "linear", function () {
90                $(".js-social-buttons").fadeIn("fast");
91            });
92        });
93    });
94
95    $(".js-video-poster").on("click", function (e) {
96        e.preventDefault();
97        var parent = $(this).parent();
98        $(this).fadeOut("slow", function () {
99            html = parent.html();
100            html = html.replace(/iframe-disabled/g, "iframe");
101            parent.html(html);
102        });
103    });
104
105    $(".js-header-social").click(function (e) {
106        e.preventDefault();
107        $(window).scrollTop(0);
108        $(".js-social-overlay").addClass("active");
109        $("body").addClass("social-overlay-open");
110    });
111
112    $(".js-close-social-overlay").click(function (e) {
113        e.preventDefault();
114        $(".js-social-overlay").removeClass("active");
115        $("body").removeClass("social-overlay-open");
116    });
117
118    $(".js-subscribe-cta").click(function (e) {
119        e.preventDefault();
120        $(".js-footer-subscribe").fadeOut("fast", function () {
121            $(".js-subscribe-form").fadeIn("fast");
122        });
123    });
124
125    $(".js-footer-subscribe").click(function (e) {
126        e.preventDefault();
127        $(this).fadeOut("fast", function () {
128            $(".js-subscribe-form").fadeIn("fast");
129        });
130    });
131
132    $('.js-newsletter-subscribe-modal-close, .newsletter-subscribe-modal a').click(function() {
133        $('.newsletter-subscribe-modal,.newsletter-subscribe-modal-overlay').hide()
134    })
135
136    $(".js-subscribe-form").submit(function (e) {
137        e.preventDefault();
138
139        var email = $(this).find("input").val();
140        if (validateEmail(email)) {
141            $.ajax({
142                url: "/ten-club/api/subscribe",
143                cache: false,
144                data: {
145                    email: email,
146                },
147                type: "POST",
148                success: function (response) {
149                    if (response.response != 200) {
150                        if (response.message != "compliance") {
151                            window.alert(
152                                "Sorry, we could not subscribe you to the newsletter. Please try again later."
153                            );
154                            return;
155                        }
156
157                        $('.newsletter-subscribe-modal,.newsletter-subscribe-modal-overlay').show()
158
159                        // if (window.confirm("You have previously unsubscribed. Please use the form in the new window.")) {
160                        //     window.open("https://mailchi.mp/pearljam/subscriber-resubscribe", "_blank");
161                        // }
162
163                        return;
164                    }
165
166                    $(".js-subscribe-form").fadeOut("fast", function () {
167                        $(".js-subscribed").fadeIn("fast");
168                    });
169
170                    // Use FB Tracking pixel to track the new lead
171                    try {
172                        !(function (f, b, e, v, n, t, s) {
173                            if (f.fbq) return;
174                            n = f.fbq = function () {
175                                n.callMethod
176                                    ? n.callMethod.apply(n, arguments)
177                                    : n.queue.push(arguments);
178                            };
179                            if (!f._fbq) f._fbq = n;
180                            n.push = n;
181                            n.loaded = !0;
182                            n.version = "2.0";
183                            n.queue = [];
184                            t = b.createElement(e);
185                            t.async = !0;
186                            t.src = v;
187                            s = b.getElementsByTagName(e)[0];
188                            s.parentNode.insertBefore(t, s);
189                        })(
190                            window,
191                            document,
192                            "script",
193                            "https://connect.facebook.net/en_US/fbevents.js"
194                        );
195                        fbq("init", "248186008898520");
196                        fbq("track", "Lead", {
197                            value: email,
198                        });
199                    } catch (err) {
200                        console.log("Error running FB Tracking Pixel");
201                        console.log(err);
202                    }
203
204                },
205                error: function (xhr) {
206                    window.alert(
207                        "Sorry, we could not subscribe you to the newsletter. Please try again later."
208                    );
209                },
210            });
211        }
212        return false;
213    });
214
215    $(".js-pj-radio").click(function (e) {
216        e.preventDefault();
217        popUpWindow(this.href, "Pearl Jam Radio", "365", "450", "no", "center");
218        return false;
219    });
220
221    $(".js-mobile-tablet-nav").on("change", function () {
222        window.location.href = $(this).find(":selected").val();
223    });
224
225    if ($body.hasClass("tenclub") && !Modernizr.cssfilters) {
226        $(".page-head__site-logo").attr(
227            "style",
228            "background-image: url(/assets/img/whitelogo.png);"
229        );
230    }
231
232    if ($.validator) {
233        $.validator.addMethod(
234            "pwcheck",
235            function (value, element) {
236                return (
237                    this.optional(element) ||
238                    /^(?=.*?[A-Z])(?=.*?[a-z])(?=.*?[0-9]).{6,}$/.test(value)
239                );
240            },
241            "Must contain minimum of 6 characters, upper and lowercase letters and at least one number."
242        );
243
244        $.validator.addMethod(
245            "pobox",
246            function (value, element) {
247                return (
248                    this.optional(element) ||
249                    !new RegExp("p.o. box|po box", "i").test(value)
250                );
251            },
252            "Sorry, we are no longer able to accept PO Box addresses."
253        );
254
255        $.validator.addMethod(
256            "luhn",
257            function (number, element) {
258                var digit, n, sum, _len, _ref;
259                sum = 0;
260                _ref = number.split("").reverse().join("");
261                for (n = 0, _len = _ref.length; n < _len; n++) {
262                    digit = _ref[n];
263                    digit = +digit;
264                    if (n % 2) {
265                        digit *= 2;
266                        if (digit < 10) {
267                            sum += digit;
268                        } else {
269                            sum += digit - 9;
270                        }
271                    } else {
272                        sum += digit;
273                    }
274                }
275                return sum % 10 === 0;
276            },
277            "Incorrect payment card number"
278        );
279    }
280
281    FastClick.attach(document.body);
282
283    // Reload any SVG files that need pulled in
284    // (fixes bug on news page etc, where SVG share icons
285    // were not loading on some devices).
286
287    window.setTimeout(function () {
288        inlineSvgFiles();
289    }, 5000);
290
291    $(".sms-signup-modal").each(function () {
292        var phoneNumber = "";
293        var phoneInputField = $(this).find(
294            '.sms-signup-modal__number input[type="text"]'
295        );
296        var phoneInput = window.intlTelInput(phoneInputField[0], {
297            utilsScript:
298                "https://cdnjs.cloudflare.com/ajax/libs/intl-tel-input/17.0.8/js/utils.js",
299        });
300
301        function setClosedCookie() {
302            Cookies.set("sms-signup-modal", true, {
303                expires: 31,
304                path: "/",
305            });
306        }
307
308        $(this)
309            .find(".js-sms-signup-modal-close")
310            .click(function (e) {
311                e.preventDefault();
312
313                $(".sms-signup-modal-overlay").hide();
314                $(".sms-signup-modal").hide();
315                setClosedCookie();
316            });
317
318        var numberSection = $(this).find(".sms-signup-modal__number");
319        var verifySection = $(this).find(".sms-signup-modal__verify");
320        var confirmedSection = $(this).find(".sms-signup-modal__confirmed");
321
322        numberSection.find("form").submit(function (e) {
323            e.preventDefault();
324            $(this).find(".sms-signup-modal__error").hide();
325            $(this).find(".sms-signup-modal__error__user").hide();
326            $(this).find(".sms-signup-modal__error__opted_out").hide();
327
328            phoneNumber = phoneInput.getNumber();
329            if (phoneNumber.substring(0, 1) !== "+") {
330                $(this).find(".sms-signup-modal__error").show();
331                return;
332            }
333
334            // if (!$(this).find('input[type=checkbox]').is(':checked')) {
335            //     return;
336            // }
337
338            $(this).find("button").attr("disabled", true);
339
340            $.post(
341                "/ajax/validate-sms-number",
342                {
343                    number: phoneNumber,
344                    "g-recaptcha-response": numberSection.find('textarea[name="g-recaptcha-response"]').val()
345                },
346                function (data) {
347                    if (data.success) {
348                        numberSection.hide();
349                        verifySection.show();
350
351                        verifySection.find("input[type=text]").focus();
352                        return;
353                    }
354
355                    numberSection.find("button").attr("disabled", false);
356
357                    if (data.code == 'IN_USE') {
358                        numberSection.find(".sms-signup-modal__error__user").show();
359                    } else if (data.code == 21610) {
360                        numberSection.find(".sms-signup-modal__error__opted_out").show();
361                    } else {
362                        numberSection.find(".sms-signup-modal__error").show();
363                    }
364                },
365                "json"
366            );
367        });
368
369        verifySection.find("form").submit(function (e) {
370            e.preventDefault();
371            $(this).find(".sms-signup-modal__error").hide();
372
373            $(this).find("button").attr("disabled", true);
374
375            var code = $(this).find("input[type=text]").val();
376            $.post(
377                "/ajax/validate-sms-code",
378                {
379                    code: code,
380                    number: phoneNumber,
381                },
382                function (data) {
383                    if (data.success) {
384                        verifySection.hide();
385                        confirmedSection.show();
386                        return;
387                    }
388
389                    verifySection.find(".sms-signup-modal__error").show();
390                    verifySection.find("button").attr("disabled", false);
391                },
392                "json"
393            );
394        });
395
396        verifySection.find("a").click(function (e) {
397            e.preventDefault();
398
399            var self = $(this);
400            $.post(
401                "/ajax/validate-sms-number-resend",
402                {
403                    number: phoneNumber,
404                },
405                function (data) {
406                    self.text("Sent!").off("click");
407                },
408                "json"
409            );
410        });
411    });
412
413    var xval = Math.floor((Math.random() * 8) + 1); // Random number 1 until 8
414
415    $(".home-upcoming-shows").addClass('random-bg__0' + xval);
416    $(".activism-auctions").addClass('random-bg__0' + xval);
417    $(".activism-counter").addClass('random-bg__0' + xval);
418    $("section.related-articles--shop").addClass('random-bg__0' + xval);
419    $(".tour-history-show-detail").addClass('random-bg__0' + xval);
420    $(".tour-history-show-preview").addClass('random-bg__0' + xval);
421    $(".tour-history-list-concerts").addClass('random-bg__0' + xval);
422    $(".tour-history.panelOpen").addClass('random-bg__0' + xval);
423    $(".music").addClass('random-bg__0' + xval);
424    $(".related-articles").addClass('random-bg__0' + xval);
425    $(".tour-history-list-concerts__concert-list-item ul li").addClass('random-bg__0' + xval);
426
427    var upcomingTour = $(".upcoming-tour");
428    var bandBio = $(".band-members-bio");
429
430    if(upcomingTour.hasClass('tabletup')){
431        $(".upcoming-tour.tabletup").addClass('random-bg__0' + xval);
432    }
433    if(upcomingTour.hasClass('mobileonly')){
434        $(".upcoming-tour.mobileonly header").addClass('random-bg__0' + xval);
435    }
436
437
438
439    bandBio.find('.tabletdesktop').addClass('random-bg__0' + xval);
440});
441
442function shareOnFacebook(uri) {
443    if (uri == "this") {
444        uri = window.location.href;
445    }
446    var base =
447        "https://www.facebook.com/sharer/sharer.php?u=" +
448        encodeURIComponent(uri);
449    popUpWindow(base, "Share on Facebook", "464", "210", "no", "center");
450}
451
452function shareOnTwitter(uri) {
453    if (uri == "this") {
454        uri = window.location.href;
455    }
456    var base = "https://twitter.com/home?status=" + encodeURIComponent(uri);
457    popUpWindow(base, "Share on Twitter", "464", "210", "no", "center");
458}
459
460function shareOnEmail(uri) {
461    if (uri == "this") {
462        uri = window.location.href;
463    }
464    var base = "mailto:?body=" + encodeURIComponent(uri);
465    console.log(base);
466    popUpWindow(base, "Share By Email", "464", "210", "no", "center");
467}
468
469// Used in this file and tc-signup.js
470function validateEmail(email) {
471    var re =
472        /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
473    return re.test(email);
474}
475
476Handlebars.registerHelper("grouped_each", function (every, context, options) {
477    var out = "",
478        subcontext = [],
479        i;
480    if (context && context.length > 0) {
481        for (i = 0; i < context.length; i++) {
482            if (i > 0 && i % every === 0) {
483                out += options.fn(subcontext);
484                subcontext = [];
485            }
486            subcontext.push(context[i]);
487        }
488        out += options.fn(subcontext);
489    }
490    return out;
491});
492
493Handlebars.registerHelper("x", function (expression, options) {
494    var fn = function () {},
495        result;
496    try {
497        fn = Function.apply(this, ["window", "return " + expression + " ;"]);
498    } catch (e) {
499        console.warn("{{x " + expression + "}} has invalid javascript", e);
500    }
501
502    try {
503        result = fn.call(this, window);
504    } catch (e) {
505        console.warn("{{x " + expression + "}} hit a runtime error", e);
506    }
507    return result;
508});
509
510Handlebars.registerHelper("xif", function (expression, options) {
511    return Handlebars.helpers["x"].apply(this, [expression, options])
512        ? options.fn(this)
513        : options.inverse(this);
514});
515
516Handlebars.registerHelper("make_url", function (url, slug) {
517    return url + "/" + slug;
518});
519
520Handlebars.registerHelper("format_currency", function (value) {
521    return "$" + parseFloat(value).toFixed(2);
522});
523
524Handlebars.registerHelper(
525    "compare",
526    function (lvalue, operator, rvalue, options) {
527        var operators, result;
528
529        if (arguments.length < 3) {
530            throw new Error("Handlerbars Helper 'compare' needs 2 parameters");
531        }
532
533        if (options === undefined) {
534            options = rvalue;
535            rvalue = operator;
536            operator = "===";
537        }
538
539        operators = {
540            "==": function (l, r) {
541                return l == r;
542            },
543            "===": function (l, r) {
544                return l === r;
545            },
546            "!=": function (l, r) {
547                return l != r;
548            },
549            "!==": function (l, r) {
550                return l !== r;
551            },
552            "<": function (l, r) {
553                return l < r;
554            },
555            ">": function (l, r) {
556                return l > r;
557            },
558            "<=": function (l, r) {
559                return l <= r;
560            },
561            ">=": function (l, r) {
562                return l >= r;
563            },
564            typeof: function (l, r) {
565                return typeof l == r;
566            },
567        };
568
569        if (!operators[operator]) {
570            throw new Error(
571                "Handlerbars Helper 'compare' doesn't know the operator " +
572                    operator
573            );
574        }
575
576        result = operators[operator](lvalue, rvalue);
577
578        if (result) {
579            return options.fn(this);
580        } else {
581            return options.inverse(this);
582        }
583    }
584);
585
586var mn = $(".js-logo-and-nav"),
587    ub = $(".js-user-bar"),
588    nb = $(".notification-bar"),
589    nbheight = nb.length > 0 ? nb.height() : 0,
590    mns = "main-nav-scrolled";
591
592if (nb.length > 0) {
593    $(window).resize(function () {
594        nbheight = nb.height();
595    });
596}
597
598function toggleStickyMenu($window, mn) {
599    if ($window.scrollTop() > 10 + nbheight) {
600        mn.addClass(mns);
601        ub.fadeOut("slow");
602    } else {
603        mn.removeClass(mns);
604        ub.fadeIn("slow");
605    }
606}
607
608if (window.matchMedia) {
609    if (window.matchMedia("(min-width: 1024px)").matches) {
610        $(window).scroll(function () {
611            toggleStickyMenu($(this), mn);
612        });
613        toggleStickyMenu($(window), mn);
614    }
615}
616
617var win = null;
618function popUpWindow(mypage, myname, w, h, scroll, pos) {
619    if (pos == "center") {
620        LeftPosition = screen.width ? (screen.width - w) / 2 : 100;
621        TopPosition = screen.height ? (screen.height - h) / 2 : 100;
622    } else if ((pos != "center" && pos != "random") || pos == null) {
623        LeftPosition = 0;
624        TopPosition = 20;
625    }
626    settings =
627        "width=" +
628        w +
629        ",height=" +
630        h +
631        ",top=" +
632        TopPosition +
633        ",left=" +
634        LeftPosition +
635        ",scrollbars=" +
636        scroll +
637        ",location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no";
638    win = window.open(mypage, myname, settings);
639}

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.