PageSourceSearch

https://norwichcityhc.co.uk/js/common.js?%7B500E30DF-42B1-4A36-9020-59B24F18B787%7D

js norwichcityhc.co.uk collected 2026-09-24 18:06:06 UTC 19,579 bytes, 589 lines download raw bytes

1var $jQ = jQuery;
2var alerts = [];
3var openAlert = -1;
4
5var touch_capable = ('ontouchstart' in window ||
6 window.DocumentTouch && document instanceof window.DocumentTouch ||
7 navigator.maxTouchPoints > 0 ||
8 window.navigator.msMaxTouchPoints > 0) &&
9 (window.navigator.userAgent.indexOf("MSIE ") == -1 && window.navigator.userAgent.indexOf("Trident") == -1);
10
11var GLOBAL_IS_DRAGGING = false;
12var attachTouchEvent = function (_element, _handler, _namespace) {
13    if (typeof _element == "undefined" || _element == null || typeof _handler != "function" || _handler == null) {
14        return;
15    }
16    var namespace = typeof _namespace != "undefined" && _namespace != null ? "." + _namespace : "";
17    var element = $(_element);
18
19    element.on("click" + namespace, function (_event) {
20        _event.preventDefault();
21        _event.stopPropagation();
22        return false;
23    });
24    element.on("touchstart" + namespace, function (_event) {
25        GLOBAL_IS_DRAGGING = false;
26    });
27    element.on("touchmove" + namespace, function (_event) {
28        GLOBAL_IS_DRAGGING = true;
29    });
30    element.on("touchend" + namespace, (function (_handler) {
31        return function (_event) {            
32            if (!GLOBAL_IS_DRAGGING) {
33                _event.sender = this;
34                _handler(_event);
35            }
36        };
37    })(_handler));    
38};
39
40window.old_alert = window.alert;
41
42window.alert = function (message, showalerts, fallback) {    
43    if (fallback) {
44        old_alert(message);
45        return;
46    }
47
48    alerts.push(message);    
49    if (showalerts)
50        showAlerts(0);
51};
52
53window.confirm = function (message, element, callback) {
54    showConfirm(message, element, callback);
55    return false;
56};
57
58$(window).load(function () {
59    // after the page has loaded, show the first alert
60    // if the array contains messaes
61    showAlerts(0);	
62});
63
64function showAlerts(showMsg, msgCompare) {
65    if (alerts.length > 0 && showMsg < alerts.length) {
66        if (msgCompare != null && typeof (msgCompare) != 'undefined') {
67
68            msgCompare = msgCompare.replace(/\\n/g, "");
69            
70            var showNum = -1;
71
72            for (var i = 0; i < alerts.length; i++) {                
73                if (alerts[i].replace(/(?:\r\n|\r|\n)/g, '') == msgCompare) {
74                    showNum = i;
75                }
76            }
77
78            if (showNum > -1) {                
79                showModal(alerts[showNum], showNum);
80            }
81        }
82        else {
83            showModal(alerts[showMsg], showMsg);
84        }
85    }
86}
87
88function showModal(message, arrIndex) {
89    $(document).ready(function () {
90        openAlert = arrIndex;
91        
92        $(document.createElement('div')).attr("onclick", "hideModal();").addClass("overlay").appendTo("body").fadeIn();
93
94		var modalclass = 'modal';
95		if (message.indexOf('img src') > 0)
96		{
97			modalclass += ' modalimg';
98		}
99        var modal = $(document.createElement('div')).attr("onclick", "hideModal();").addClass(modalclass).appendTo("body").fadeIn();
100
101        if (message.toString().indexOf("\n") > -1) {
102            message = message.replace(/\n/g, "<br />");
103        }
104
105        $(modal).append("<p class=\"modalTitle\"><img src=\"" + siteroot + "images/ico-logo-alert.png\" /><span>NORWICH CITY HOCKEY CLUB</span></p>");
106        $(modal).append("<p>" + message + "</p>");
107        $(modal).append("<p><a onclick=\"hideModal();\" class=\"button\">OK</a></p>");
108
109        $(document).keyup(function (e) {
110            // hit the esc key
111            if (e.keyCode == 27) {
112                hideModal();
113            }
114        });
115    });
116
117}
118
119function showConfirm(message, element, callback) {
120    $(document).ready(function () {
121
122        $(document.createElement('div')).attr("onclick", "hideModal();").addClass("overlay").appendTo("body").fadeIn();
123
124        var modal = $(document.createElement('div')).attr("onclick", "hideModal();").addClass("modal confirm").appendTo("body").fadeIn();
125
126        $(modal).append("<p class=\"modalTitle\"><img src=\"" + siteroot + "images/ico-logo-alert.png\" /><span>NORWICH CITY HOCKEY CLUB</span></p>");
127        $(modal).append("<p>" + message.replace(/\n/g, "<br />") + "</p>");
128        $(modal).append("<p><a class=\"button ok\" style=\"background-color:green;color:white;\">OK</a></p>");
129        $(modal).append("<p><a class=\"button cancel\" style=\"background-color:red;color:white;\">Cancel</a></p>");
130
131        $(modal).find(".ok").on("click", function () {
132            hideModal();
133
134            var showAlert = false;
135
136            if (typeof (element) != 'undefined' && element != null) {
137                if (typeof (element.href) != 'undefined' && element.href != null) {
138                    // redirect to page
139                    window.location.href = element.href;
140                }
141                else if (typeof (element.type) != 'undefined' && element.type != null) {
142                    var eType = element.type.toString().toLowerCase();
143                    if (eType == "submit" || eType == "button") {
144                        if (typeof (callback) != 'undefined' && callback != null) {
145                            // run any callback function passed in
146							showloading();
147                            callback();
148                        }
149                        else {
150                            showAlert = true;
151                        }
152                    }                    
153					else {
154						if (typeof (callback) === 'function') {
155							// run any callback function passed in
156							showloading();
157							callback();
158						}					
159					}
160                }
161            }
162            else {
163                // no element passed in ....
164                showAlert = true;
165            }
166
167            if (showAlert) {
168                alert('Please contact the site administrator as this popup feature is not currently supported in this mode.');
169            }
170
171            return true;
172        });
173
174        $(modal).find(".cancel").on("click", function () {
175            hideModal();
176            return false;
177        });
178    });
179}
180
181function hideModal() {
182    $(".overlay").fadeOut("fast", function () {
183        $(".overlay").remove();
184    });
185
186    $(".modal").fadeOut("fast", function () {
187        $(".modal").remove();
188    });
189
190    // handle multiple alerts on a page by
191    // trying to show the next one
192    if (openAlert > -1) {
193        openAlert++;
194        showAlerts(openAlert);        
195    }
196}
197
198$(window).resize(function () {
199    setUpScrollingTableExpanding();
200});
201
202$(window).on("orientationchange", function (event) {
203    
204    if (
205        (isMobile.phone ||
206        isMobile.other.blackberry ||
207        isMobile.other.blackberry10 ||
208        isMobile.tablet) && window.innerWidth <= 860) {
209        shiftColumnOrder(false);
210    }
211    else {
212        shiftColumnOrder(true);
213    }
214});
215
216$(document).ready(function () {
217    setUpExpander();
218    
219    $("a, input").on("click", function (e) {
220        var onClick = $(this).attr("onclick");
221        if (onClick != null && typeof (onClick) != 'undefined') {
222            if (onClick.indexOf("alert") > -1) {
223                onClick = onClick.replace("alert('", "");
224                onClick = onClick.replace("');", "");
225                onClick = onClick.replace("')", "");
226                onClick = onClick.replace("return false;", "");
227                onClick = onClick.replace("return false", "");
228                
229                showAlerts(0, onClick.trim());
230                e.stopPropagation();
231                return false;
232            }
233        }
234    });
235
236    setUpScrollingTableExpanding();
237
238    if (window.innerWidth <= 1025) {
239        setUpSingleColumnTable();
240    }
241
242    if (
243        (isMobile.phone ||
244        isMobile.other.blackberry ||
245        isMobile.other.blackberry10 ||
246        isMobile.tablet) && window.innerWidth <= 1025) {
247        shiftColumnOrder(false);
248    }
249
250    
251    if (
252        (isMobile.phone ||
253        isMobile.other.blackberry ||
254        isMobile.other.blackberry10 ||
255        isMobile.tablet) || (window.innerWidth <= 1025)
256    ) {        
257        sortOutTeamsNav();
258    }
259    else {
260        setUpStickyHeader()
261    }
262
263    slider = $("#heroSlider");
264
265    $(slider).on("init", function (slick) {
266        $(this).find(".slick-current").css("transition", "none").addClass("fadeIn");
267    });
268
269    $(slider).randomize().slick({
270        autoplay: true,
271        speed: 500,
272        centerMode: true,
273        centerPadding: '100px',
274        slidesToShow: 1,
275        cssEase: 'linear',
276        dots: false,
277        responsive: [
278            {
279                breakpoint: 1400,
280                settings: {
281                    centerMode: false                    
282                }
283            }            
284        ]
285    });
286
287    $jQ(".vTicker").each(function () {
288        $jQ(this).vTicker();
289    });
290
291    $(slider).on("beforeChange", function (event, slick, currentSlide, nextSlide) {
292        var cSlide = $(slider).find(".slick-slide[data-slick-index='" + currentSlide + "']");
293        var nSlide = $(slider).find(".slick-slide[data-slick-index='" + nextSlide + "']");
294
295        $(cSlide).css("transition", "opacity 1s").removeClass("fadeIn");
296        $(nSlide).addClass("fadeIn");
297    });
298
299    $(".burgerMenu").on("click", function () {
300        var menu = $("#headerNav .navigation > div > ul");
301
302        if (!$(menu).hasClass("open")) {
303            $(menu).slideDown("slow");
304            $(menu).addClass("open");
305        }
306        else {
307            $(menu).slideUp("slow");
308            $(menu).removeClass("open");
309        }
310    });
311
312    $('#flickrGallery a.photo').magnificPopup({
313        type: 'image',
314        gallery: {
315            enabled: true,
316            preload: [5, 5],
317            navigateByImgClick: true,
318            arrowMarkup: '<button title="%title%" type="button" class="mfp-arrow mfp-arrow-%dir%"></button>',
319            tPrev: 'Previous (Left arrow key)',
320            tNext: 'Next (Right arrow key)',
321            tCounter: '<span class="mfp-counter">%curr% of %total%</span>'
322        },
323        zoom: {
324            enabled: true,
325            duration: 300,
326            easing: 'ease-in-out'
327        }
328    });
329
330    if (touch_capable && $(".burgerMenu").css("display") == "block") {
331        attachTouchEvent($("#headerNav .navigation ul li:has(ul) a"), function (_event) {
332            var parent = $(_event.sender).parent();
333
334            if ($(parent).find("ul").css("display") == "none") {
335                $(_event.sender).parent().addClass("active");
336            }
337            else {
338                window.location = $(_event.sender)[0].href;
339            }
340
341            return false;
342        }, "NCHCScroll");
343    }
344    else {        
345        $('#headerNav .navigation ul li:has(ul) a').on("click", function (e) {
346            var parent = $(this).parent();
347
348            if ($(parent).find("ul").css("display") == "none") {
349                e.preventDefault();
350                $(this).parent().addClass("active");
351            }
352        });
353    }
354
355    if (window.innerWidth > 768) {
356        insertDynamicPod();
357    }
358	
359	$("form").each(function() {
360		var button = $(this).find("*[onclick*='return confirm']");
361		
362		if ($(button).length > 0) {
363			// button found so click when enter is pressed on any form field
364			$(this).find("input, select").keypress(function(e) {				
365				if(e.which == 13) {
366					e.preventDefault();
367					$(button).trigger("click");
368				}
369			});
370		}
371	});
372});
373
374
375function setUpScrollingTableExpanding() {
376    $(".scrollingTable.expandingTable > table, .scrollingTable.expandingTables table").each(function () {		
377		var tbWidth = $(this).outerWidth(true);		
378        var container = $(this).parents(".container");
379        var containerWidth = $(container).outerWidth();
380        var scrollingDiv = $(this).parent();
381		var scrollingDivWidth = $(scrollingDiv).outerWidth();
382		if ((tbWidth > containerWidth || tbWidth > scrollingDivWidth) && tbWidth < window.innerWidth && window.innerWidth >= 1150) {
383			$(container).css("width", (tbWidth + 164) + "px");			
384            $(container).css("max-width", "100%");
385        }        
386    });
387}
388
389
390function insertDynamicPod() {
391    var lastPod = $(".lastPod");
392
393    if ($(lastPod).length > 0) {
394        var lastPodOffset = $(lastPod).offset().top;
395        var footerPodsOffset = $(".footerPodsRow").offset().top;
396        var totalSpace = (parseInt(footerPodsOffset) - parseInt(lastPodOffset)) - $(lastPod).height();
397
398        if (totalSpace > 200) {
399            // insert a new pod if there is enough space
400            $("<div class=\"pod dynamic\">&nbsp;</div>").insertAfter($(lastPod));
401        }
402    }    
403}
404
405function shiftColumnOrder(doRevert) {
406    if (doRevert) {
407        $("#rightCol").insertAfter("#centreCol");
408    }
409    else {
410        $("#rightCol").insertBefore("#leftCol");
411    }    
412}
413
414function setUpExpander() {
415	$(".expanderPic").each(function() {
416		$(this).on("click", function() {
417			$(this).closest("tr").prev().find(".expander").trigger("click");
418		});
419	});
420	
421    $(".expander").each(function () {
422		var parentRow = $(this).closest("tr");
423		
424		$(parentRow).on("click", function(e) {
425			e.stopImmediatePropagation();
426			$(this).find(".expander").trigger("click");
427		});
428		
429        $(this).on("click", function (e) {
430			e.stopImmediatePropagation();
431			
432            var tickerObj = $(this).attr("data-ticker");
433            var blockObj = $(this).attr("data-block");
434            var expander = $(this);
435
436            if (typeof (tickerObj) != 'undefined' && tickerObj != null) {
437                var ticker = $("#" + tickerObj);
438                var currentHeight = $(ticker).outerHeight();
439                var expandHeight = $(ticker).find("ul").outerHeight();
440                
441                //var height = ($(ticker).attr("style")).toString().match(/height: *([0-9]+)/gi)[0];
442                //height = height.replace("height: ", "");
443
444                if (parseInt(currentHeight) < parseInt(expandHeight)) {
445                    $(ticker).attr("data-origheight", currentHeight);
446                }
447                
448                // if the data-height attribute doesn't exist, then use an auto
449                // height otherwise set to a defined pixel height
450                if (typeof (expandHeight) != 'undefined' && expandHeight != null) {
451                    var className;
452
453                    if ($(ticker).hasClass("paused")) {
454                        expandHeight = $(ticker).attr("data-origheight");
455                        className = 'fa fa-expand expander';
456                        $jQ(ticker).vTicker('pause', false);
457                    }
458                    else {
459                        $jQ(ticker).vTicker('pause', true);
460                        className = 'fa fa-compress expander';
461                    }
462
463                    $(ticker).animate({ height: expandHeight + "px" }, function () {                        
464                        $(expander).attr("class", className);
465                    });
466                }
467                else {
468                    $(ticker).css("height", "auto");
469                }
470            }
471
472            if (typeof (blockObj) != 'undefined' && blockObj != null) {
473                var block = $("#" + blockObj);
474                var className;
475
476                if ($(block).attr("style").indexOf("display: none") > -1) {
477                    $(block).slideDown("fast", function () {
478                        $(expander).attr("class", "fa fa-compress expander");
479                    });
480                }
481                else {
482                    $(block).slideUp("fast", function () {
483                        $(expander).attr("class", "fa fa-expand expander");                        
484                    });
485                }                
486            }
487        });
488    });
489}
490
491function autoOpenExpanders() {
492	$(".expander").each(function() {
493		$(this).trigger("click");
494	});
495}
496
497function sortOutTeamsNav() {
498    $(".navmenu").each(function () {
499        if ($(this).find("span").text().indexOf("|") > -1) {
500            $(this).find("span").remove();
501        }
502    });
503}
504
505function setUpSingleColumnTable() {
506    $(".columnTable").each(function () {
507        var colTable = $(this);
508        var tds;
509        
510        if ($(colTable).find("table").length > 0 && !$(colTable).hasClass("ignoreInnerTable")) {
511            tds = $(colTable).find("td:has(table), th.showCell:has(table), td.includeCell").clone();
512        }
513        else {
514            tds = $(colTable).find("td:not(.ignoreCell), th.showCell:not(.ignoreCell)").clone();
515        }
516
517        // empty the table
518        $(colTable).empty();
519
520        // append the content of the table cells
521        $(tds).each(function (index) {
522            if (!$(colTable).hasClass("ignoreFirstRow") || ($(colTable).hasClass("ignoreFirstRow") && index > 0)) {
523                if ($(this).html().length > 0 && (!$(colTable).hasClass("removeDuplication") || ($(colTable).hasClass("removeDuplication") && $(colTable).html().indexOf($(this).html()) == -1))) {
524                    $(colTable).append($("<tr>").append($(this)));
525                    $(colTable).find("a[onclick]").each(function () {
526                        $(this).off().on("click", function () {                            
527                            eval($(this).attr("onclick").replace("alert", "showModal"));
528                        });
529                    });
530                }
531            }            
532        });
533
534        if ($(colTable).hasClass("ignoreFirstRow")) {
535            //$(colTable).find("tr").eq(0).remove();
536        }
537
538        if ($(colTable).find("table").hasClass("ignoreFirstRow")) {
539            $(colTable).find("table tr").eq(0).remove();
540        }
541    });
542}
543
544function setUpStickyHeader() {
545    var header = $("#headerNav");
546    var nav = $(header).find(".navigation");
547    var navPos = $(nav).offset().top;
548
549    $(window).scroll(function () {
550        var scrollPos = $(window).scrollTop();
551        
552        if (scrollPos >= navPos) {
553            $(header).addClass("sticky");
554        }
555        else {
556            if (scrollPos <= navPos) {
557                $(header).removeClass("sticky");
558            }
559        }
560    });
561}
562
563$.fn.randomize = function (selector) {
564    var $elems = selector ? $(this).find(selector) : $(this).children(),
565        $parents = $elems.parent();
566
567    $parents.each(function () {
568        $(this).children(selector).sort(function (childA, childB) {
569            // * Prevent last slide from being reordered
570            if ($(childB).index() !== $(this).children(selector).length - 1) {
571                return Math.round(Math.random()) - 0.5;
572            }
573        }.bind(this)).detach().appendTo(this);
574    });
575
576    return this;
577};
578
579function disableScrolling() {
580	scrollTop = window.pageYOffset || document.documentElement.scrollTop;
581    scrollLeft = window.pageXOffset || document.documentElement.scrollLeft;
582    window.onscroll = function() {
583     window.scrollTo(scrollLeft, scrollTop);
584    };
585}
586   
587function enableScrolling() {
588	window.onscroll = function() {};
589}

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.