PageSourceSearch

https://www.canveyisland-tc.gov.uk/skins/default/scripts/jquery_local_page_scripts.js

js canveyisland-tc.gov.uk collected 2026-10-03 00:32:02 UTC 24,502 bytes, 776 lines download raw bytes

1//
2var user_account, $_SESSION, ft = 200,
3    closetimer;
4//
5$(document).ready(
6    function () {
7        init();
8        initResponse();
9    }
10);
11//
12function init() {
13    //
14    $('#data-launch-safespace').bind("click", function (e) {
15        e.stopPropagation();
16        isSafeSpaceAvailable(this);
17        $('#body').keyup(function (e) {
18            e.stopPropagation();
19            if (e.keyCode == 27) {
20                destroySafeSpaceWidget();
21            }
22        });
23    });
24    //
25    setupNav_5();
26    //
27    $('.toggle-nav').bind('click', function (e) {
28        $('#mobile-nav-holder').animate({
29            width: "toggle"
30        });
31    });
32    //
33    $('.block').wrapInner('<div class="inner"></div>');
34    $('.phoo_row').wrap('<div class="phoo_row_wrapper"></div>');
35    $('.phoo_row').wrapInner('<div class="fw-wrapper"></div>');
36    //Clean images?
37    //
38    if ($('.testimonialHolder').length > 0) {
39        //
40        var t_per_row = 1;
41        //
42        var divs = $('.testimonialHolder .promoItem');
43        //
44        for (var i = 0; i < divs.length; i += t_per_row) {
45            divs.slice(i, i + t_per_row).wrapAll('<div class="w100pc testimonial-row">');
46        }
47        //
48        $('.testimonialHolder').cycle({
49            fx: 'fade',
50            speed: 1000,
51            timeout: 8000,
52            slides: "> div",
53            pager: '#testimonialPager'
54        });
55        //
56    }
57    //carousell
58    if ($('.carousell').length > 0) {
59        //
60        var t_per_row = 4;
61        //
62        var divs = $('.carousell .block');
63        //
64        for (var i = 0; i < divs.length; i += t_per_row) {
65            divs.slice(i, i + t_per_row).wrapAll('<div class="w100pc carousell-row">');
66        }
67        //
68        $('.carousell .fw-wrapper').cycle({
69            fx: 'scrollHorz',
70            speed: 1000,
71            timeout: 4000,
72            slides: "> div"
73        });
74        //
75    }
76    //Accordian
77    if ($('.accordion').length > 0) {
78        $('.accordion .fw-wrapper').each(function () {
79            $(this).accordion({
80                header: "h3",
81                heightStyle: "content"
82            });
83        });
84    }
85    //Scoll to anchors
86    $('a[href^=#]').bind('click', function (e) {
87        e.preventDefault();
88        var dest = $(this).attr('href');
89        $('html,body').animate({
90            scrollTop: $(dest).offset().top
91        }, 'slow');
92    });
93    //start form processor
94    if ($('#phooFormHolder').length > 0) {
95        //
96        console.log('form');
97        //
98        $('#phooForm').validate({
99            submitHandler: function (form) {
100                //
101                $('#phooFormSubmit').replaceWith('<span class="form-sending">Sending...</span>');
102                //
103                grecaptcha.ready(function () {
104                    grecaptcha.execute($('#recaptcha_site').val(), {
105                        action: 'submit'
106                    }).then(function (token) {
107                        //
108                        $('#g-recaptcha-response').val(token);
109                        // Add your logic to submit to your backend server here.
110                        $(form).ajaxSubmit(function (data) {
111                            //
112                            data = $.parseJSON(data);
113                            if (data.response.substring(0, 8) == 'redirect') {
114                                var dArr = data.response.split('~');
115                                document.location = dArr[1];
116                            } else {
117                                $('#phooFormHolder').html(data.response);
118                            }
119                            //
120                        });
121                        //
122                    });
123                });
124                //                
125            }
126        });
127        //
128    }
129    //
130    $('.fancybox').fancybox({
131        maxWidth: 960,
132        maxHeight: 600,
133        fitToView: false,
134        width: '90%',
135        height: '90%',
136        autoSize: false,
137        closeClick: false,
138        openEffect: 'none',
139        closeEffect: 'none'
140    });
141    //
142    $('.gallery_link').fancybox();
143    //
144    if ($('.phoo_row.page_header').length > 0) {
145        //
146        $('.phoo_row.page_header').parent().insertAfter('#mobile-header').addClass('page-header-wrapper');
147        //
148    }
149    //Page header
150    if ($('.pageheader_wrapper').length > 0) {
151        //
152        $('.pageheader_imgs').cycle({
153            fx: 'fade',
154            speed: 1000,
155            pause: 1,
156            slides: '> div'
157        });
158        //
159    }
160    //HERO
161    if ($('.hero-holder').length > 0) {
162        //
163        $('.hero-holder').each(function (i, item) {
164            //
165            if ($(this).attr('data-controls') == 'show') {
166                //console.log($(this).attr('data-controls'));
167                //
168                $(this).after('<div id="hero-pager_' + i + '" class="hero-pager"></div>');
169                //
170                $(this).cycle({
171                    fx: 'fade',
172                    speed: 1000,
173                    pause: 1,
174                    slides: '> div',
175                    pager: '#hero-pager_' + i
176                });
177                //
178            } else {
179                //
180                $(this).cycle({
181                    fx: 'fade',
182                    speed: 1000,
183                    pause: 1,
184                    slides: '> div'
185                });
186                //
187            }
188            //
189            $(this).on('cycle-before', function (event, optionHash, outgoingSlideEl, incomingSlideEl, forwardFlag) {
190                //
191                //$('#' + incomingSlideEl.id).hide(0);
192                //
193                var T_ANI;
194                //
195                $.each($('#' + incomingSlideEl.id + ' .hero-item-block'), function (i, item) {
196                    //
197                    T_ANI = $(this).attr('data-animation');
198                    $(this).removeClass(T_ANI);
199                    $(this).css('opacity', 0);
200                    //
201                });
202                //
203            });
204            //
205            $(this).on('cycle-after', function (event, optionHash, outgoingSlideEl, incomingSlideEl, forwardFlag) {
206                //
207                $('#' + incomingSlideEl.id).fadeIn(100);
208                //
209                var T_ANI;
210                //
211                $.each($('#' + incomingSlideEl.id + ' .hero-item-block'), function (i, item) {
212                    //
213                    T_ANI = $(this).attr('data-animation');
214                    $(this).addClass(T_ANI);
215                    //
216                });
217                //
218            });
219            //
220        });
221        //
222    }
223    //PROMO
224    if ($('.promo-holder').length > 0) {
225        //
226        $('.promo-holder').each(function (i, item) {
227            //
228            if ($(this).attr('data-controls') == 'show') {
229                //console.log($(this).attr('data-controls'));
230                //
231                $(this).after('<div id="promo-pager_' + i + '" class="promo-pager"></div>');
232                //
233                $(this).cycle({
234                    fx: 'fade',
235                    speed: 1000,
236                    pause: 1,
237                    slides: '> div',
238                    pager: '#promo-pager_' + i
239                });
240                //
241            } else {
242                //
243                $(this).cycle({
244                    fx: 'fade',
245                    speed: 1000,
246                    pause: 1,
247                    slides: '> div'
248                });
249                //
250            }
251            //
252            $(this).on('cycle-before', function (event, optionHash, outgoingSlideEl, incomingSlideEl, forwardFlag) {
253                //
254                //$('#' + incomingSlideEl.id).hide(0);
255                //
256                var T_ANI;
257                //
258                $.each($('#' + incomingSlideEl.id + ' .promo-item-block'), function (i, item) {
259                    //
260                    T_ANI = $(this).attr('data-animation');
261                    $(this).removeClass(T_ANI);
262                    $(this).css('opacity', 0);
263                    //
264                });
265                //
266            });
267            //
268            $(this).on('cycle-after', function (event, optionHash, outgoingSlideEl, incomingSlideEl, forwardFlag) {
269                //
270                $('#' + incomingSlideEl.id).fadeIn(100);
271                //
272                var T_ANI;
273                //
274                $.each($('#' + incomingSlideEl.id + ' .promo-item-block'), function (i, item) {
275                    //
276                    T_ANI = $(this).attr('data-animation');
277                    $(this).addClass(T_ANI);
278                    //
279                });
280                //
281            });
282            //
283        });
284        //
285    }
286    //
287    if ($('.promo-item-block a[href*=#]').length > 0) {
288        //
289        $('.promo-item-block a[href*=#]').bind('click', function (event) {
290            //
291            event.preventDefault();
292            //
293            var aTag = $("a[id='" + $(this).attr('href') + "']");
294            $('html,body').animate({
295                scrollTop: aTag.offset().top - 170
296            }, 'slow');
297            //
298            return false;
299            //
300        });
301        //
302    }
303    //POPUP
304    if ($('.block.popup').length > 0) {
305        $.fancybox.open({
306            content: $('.popup'),
307            maxWidth: 960
308        });
309    }
310    //PRIVACY
311    if ($('#privacy-holder').length > 0) {
312        //
313        /*
314        $.cookie('verified', null, {
315            expires: 28,
316            path: '/'
317        });
318        */
319        //
320        if ($.cookie('verified') == null) {
321            //
322            console.log('#privacy-holder');
323            //
324            $('#privacy-holder').show();
325            //
326            $('#privacy-btn').bind('click', function () {
327                //
328                $.cookie('verified', 'true', {
329                    expires: 28,
330                    path: '/'
331                });
332                //
333                $('#privacy-holder').fadeOut();
334                //
335            });
336            //
337        } else {
338            //
339            $('#privacy-holder').remove();
340            //
341        }
342    }
343    //MORE NEWS
344    if ($('.news_pager_more').length > 0) {
345        //
346        $('.news_pager_more').bind('click', load_more_news);
347        //
348    }
349    // Link DIV
350    if ($('.link_me').length > 0) {
351        //
352        $('.link_me').bind('click', function () {
353            document.location = $(this).find('a').attr('href');
354        });
355        //
356    }
357    //EQUAL HEIGHTS
358    $('.phoo_row.eq_heights .block .inner').matchHeight({
359        property: 'min-height'
360    });
361    //FADE ON SCROLL
362    $('.phoo_row.fade_on_scroll').each(function () {
363        var bottom_of_object = $(this).offset().top + $(this).outerHeight();
364        var top_of_object = $(this).offset().top + 200;
365        var bottom_of_window = $(window).scrollTop() + $(window).height();
366        //
367        if (bottom_of_window > top_of_object) {
368            $(this).animate({
369                'opacity': '1'
370            }, 700);
371        }
372    });
373    //Slide in SCROLL
374    $('.phoo_row.slide_right_on_scroll').each(function () {
375        //
376        var bottom_of_object = $(this).offset().top + $(this).outerHeight();
377        var top_of_object = $(this).offset().top + 200;
378        var bottom_of_window = $(window).scrollTop() + $(window).height();
379        //
380        if (bottom_of_window > top_of_object) {
381            $(this).find('.fw-wrapper').show("slide", {
382                direction: "left"
383            }, 1000);
384        }
385        //
386    });
387    //
388    if ($('.phoo_row.show_more').length > 0) {
389        //
390        $('.phoo_row.show_more').each(function () {
391            //
392            $(this).find('.block:last-child').after('<div class="w100pc"><button class="show-more">Show more</button></div>');
393            //
394        });
395        //
396        $('.show-more').first().fadeIn();
397        //
398        $('.phoo_row.show_more .show-more').bind('click', function () {
399            $(this).fadeOut(100, function () {
400                //
401                $(this).remove();
402                $('.show-more').first().fadeIn();
403                //
404            });
405            $(this).parent().parent().find('.block').slideDown();
406        });
407        //
408    }
409    //
410    $(window).scroll(function () {
411        //
412        fade_on_scroll();
413        //
414    });
415    //////
416    if ($('.img_overlay').length > 0) {
417        var IMG;
418        $('.img_overlay').each(function () {
419            IMG = $(this).find('img');
420            $(this).find('.inner').css('background-image', 'url("' + IMG.attr('src') + '")').wrapInner('<div class="overlay_inner"></div>');
421            IMG.remove();
422        });
423    }
424    //////
425    if ($('.img_bg').length > 0) {
426        var IMG;
427        $('.img_bg').each(function () {
428            IMG = $(this).find('img');
429            $(this).find('.inner').css('background-image', 'url("' + IMG.attr('src') + '")').wrapInner('<div class="overlay_inner"></div>');
430            IMG.remove();
431        });
432    }
433    //
434    if ($('.img_bg_1_3').length > 0) {
435        var IMG;
436        $('.img_bg_1_3').each(function () {
437            IMG = $(this).find('img');
438            $(this).find('.inner').css('background-image', 'url("' + IMG.attr('src') + '")').wrapInner('<div class="overlay_inner"></div>');
439            IMG.remove();
440        });
441    }
442    //
443    if ($('.grey_img_left').length > 0) {
444        var IMG;
445        $('.grey_img_left').each(function () {
446            IMG = $(this).find('img');
447            IMG.wrap('<div class="grey_img_left_img"></div>');
448            $(this).find('.grey_img_left_img').css('background-image', 'url("' + IMG.attr('src') + '")');
449            IMG.remove();
450        });
451    }
452    //
453    if ($('#_twitter').length > 0) {
454        //
455        $('#twitter').twittie({
456            dateFormat: '%b. %d, %Y',
457            template: '<span class="date">{{date}}</span> {{tweet}}',
458            apiPath: 'scripts/ajax_calls/ajax_twitter.php',
459            count: 1
460        }, function () {});
461        //
462    }
463    //BLOG ARCHIVE
464    if ($('#archiveSelect').length > 0) {
465        $('#archiveSelect').bind("change", function () {
466            document.location = 'blog/archive/' + $('#archiveSelect').val()
467        });
468    }
469    //
470    if ($('#debugShowBTN').length > 0) {
471        $('#debugShowBTN').bind('click', function () {
472            $('#debugContent').toggle()
473        });
474    }
475    //
476    if ($('#PFDHeader').length > 0) {
477        //
478        $('.PFD_Prev').insertBefore('.main-bg');
479        $('.PFD_Next').insertBefore('.main-bg');
480        $('#PFD_paging').insertBefore('.main-bg');
481        $('#PFDHeader').insertBefore('.main-bg');
482        //
483        $('#PFDHeader').cycle({
484            fx: 'scrollHorz',
485            speed: 600,
486            slides: "> div",
487            pager: '#PFD_paging',
488            next: '.PFD_Next',
489            prev: '.PFD_Prev',
490            paused: true
491        });
492        //
493    }
494    //
495    if ($('.phoo1440 #PFDHeader').length > 0) {
496        //
497        console.log($('#PFDHeader').outerWidth());
498        var nh = Math.floor($('#PFDHeader').outerWidth() * (700 / 1700));
499        $('#PFDHeader').height(nh);
500        //
501    }
502    //
503    if ($('#portfoliofilter').length > 0) {
504        //
505        var PDATA = $('#portfolio_list_holder').html();
506        $('#portfolio_list_holder').fadeIn();
507        //
508        $('#portfoliofilter').bind('change', function () {
509            //
510            $('#portfolio_list_holder').hide();
511            $('#portfolio_list_holder').html(PDATA);
512            //
513            if ($('#portfoliofilter').val() == 'all') {
514                //
515                $('#portfolio_list_holder').fadeIn();
516                //
517            } else {
518                //
519                var TA;
520                //
521                $('.portfolio_item').each(function (index, element) {
522                    TA = $(this).attr('data').split(',');
523                    console.log($.inArray($('#portfoliofilter').val(), TA));
524                    if ($.inArray($('#portfoliofilter').val(), TA) === -1) {
525                        $(this).remove();
526                    }
527                });
528                //
529                $('#portfolio_list_holder').fadeIn();
530                //
531            }
532            //
533            fade_on_scroll();
534            //
535        });
536        //
537    }
538    //
539    if ($('.promo_arrow').length > 0) {
540        //
541        $('.promo_arrow').click(function () {
542            $('html, body').animate({
543                scrollTop: $('[name="start"]').offset().top
544            }, 500);
545            return false;
546        });
547        //
548    }
549    //
550}
551//
552function isSafeSpaceAvailable() {
553    $.ajax({
554        url: "https://apps.parcelforce.com/sso/Home/IsAlive",
555        success: function (result) {
556            launchSafeSpace();
557        },
558        error: function () {
559            //handle code to show error message
560        }
561    });
562}
563
564function launchSafeSpace() {
565    var targetId = $('[data-launch-safespace]').data("targetElement");
566    var targetEl = document.getElementById(targetId);
567    $.ajax({
568        url: "https://apps.parcelforce.com/sso/",
569        success: function (result) {
570            hostWidgetInContainer(result, targetEl);
571        },
572    });
573}
574
575function hostWidgetInContainer(result, targetEl) {
576    var resultObj = $('<div/>').html(result).contents();
577    var resultObj = $('<div/>').html(result).contents();
578    var widgetObj = resultObj.find('div#safeSpaceWidget-Component');
579    $(widgetObj).insertAfter($(targetEl).children().last());
580    targetEl.style.overflow = "hidden";
581}
582
583function destroySafeSpaceWidget() {
584    var widgetContainer = document.getElementById('safeSpaceWidget-Component');
585    if (widgetContainer) {
586        widgetContainer.parentNode.style.overflow = "";
587        widgetContainer.parentNode.removeChild(widgetContainer);
588    }
589}
590//
591function fade_on_scroll() {
592    //
593    $('.fade_on_scroll').each(function () {
594        //
595        bottom_of_object = $(this).offset().top + $(this).outerHeight();
596        top_of_object = $(this).offset().top + 200;
597        bottom_of_window = $(window).scrollTop() + $(window).height();
598        //
599        if (bottom_of_window > top_of_object) {
600            $(this).animate({
601                'opacity': '1'
602            }, 700);
603        }
604    });
605    //
606}
607//
608function load_more_news() {
609    //
610    $('.news_pager_more').unbind('click');
611    //
612    $.post('scripts/ajax_calls/ajax_more_news.php', {
613        //
614        page: $(this).attr('page-data'),
615        tag_id: $(this).attr('tag-id')
616        //
617    }, function (data) {
618        //
619        $('#news-list-holder').append(data.news_list);
620        $('#news-list-pager').html(data.news_pager);
621        $('.news_pager_more').bind('click', load_more_news);
622        //
623    }, 'json');
624    //
625}
626//
627function setupNav_5() {
628    //
629    var depth;
630    //
631    $('.nav-holder ul').each(function () {
632        depth = $(this).parents('ul').length;
633        $(this).addClass('L' + depth);
634    });
635    //
636    if ($('.top-nav-holder').length > 0) {
637        //	
638        enableTopNav();
639        //
640        $('.top-nav-holder .selected').parents('li').each(function (index, element) {
641            $(this).children('a:not(.selected)').addClass('open');
642        });
643        //
644    }
645    //
646    if ($('.left-nav-holder').length > 0) {
647        //SIBLINGS OF SELECTED
648        $('.left-nav-holder .selected').siblings('li').addClass('selectedSibbling').removeClass('closed');
649        //SIBBLINGS OF CHILDREN
650        $('.left-nav-holder .selected').parents('li').each(function (index, element) {
651            //
652            $(this).addClass('open').removeClass('closed');
653            //USE THIS TO KEEP L0 closed
654            if (!$(this).parent().hasClass('L0')) {
655                $(this).siblings('li').addClass('selectedSibbling').removeClass('closed');
656            }
657            //
658        });
659        //OPEN CHILDREN
660        $('.left-nav-holder .selected > ul > li').addClass('open').removeClass('closed');
661        ///USE THIS TO HIDE L0 OPEN
662        $('.left-nav-holder .L0 > .closed > a').hide();
663        $('.left-nav-holder .L0 > .open > a').hide();
664        $('.left-nav-holder .L0 > .selected > a').hide();
665        $('.left-nav-holder .L0 > .selectedSibbling > a').hide();
666        //
667    } else if ($('#mobile-header:visible').length > 0) {
668        //
669        var carat = '<span class="mobile-carat fl-l"></span>';
670        //
671        $('#mobile-nav-holder ul.L0 ul').each(function (i, item) {
672            if ($(item).find('li').length > 0) {
673                $(item).before(carat);
674            }
675        });
676        //
677        $('.L1 li, .L2 li, .L3 li, .L4 li').toggle();
678        //
679        $('.mobile-carat').bind('click', function () {
680            console.log($(this).parent());
681            $(this).toggleClass('carat-close').parent().find('ul > li').toggle();
682        });
683        //
684    }
685    //	
686}
687//
688function _setupNav_5() {
689    //
690    var depth;
691    //
692    $('.nav-holder ul').each(function () {
693        depth = $(this).parents('ul').length;
694        $(this).addClass('L' + depth);
695    });
696    //
697    if ($('.top-nav-holder').length > 0) {
698        //	
699        enableTopNav();
700        //
701        $('.top-nav-holder .selected').parents('li').each(function () {
702            $(this).children('a:not(.selected)').addClass('open');
703        });
704        //
705    }
706    //
707    var carat = '<span class="mobile-carat fl-l"></span>';
708    //
709    if ($('.mobile-nav-holder').length > 0) {
710        //
711        $('#mobile-nav-holder ul.L0 ul').each(function (i, item) {
712            if ($(item).find('li').length > 0) {
713                $(item).before(carat);
714            }
715        });
716        //
717        $('.L1 li, .L2 li, .L3 li, .L4 li').toggle();
718        //
719        $('.mobile-carat').bind('click', function () {
720            console.log($(this).parent());
721            $(this).toggleClass('carat-close').parent().find('ul > li').toggle();
722        });
723        //
724    }
725    //
726    if ($('.left-nav-holder').length > 0) {
727        //SIBLINGS OF SELECTED
728        $('.left-nav-holder .selected').siblings('li').addClass('selectedSibbling').removeClass('closed');
729        //SIBBLINGS OF CHILDREN
730        $('.left-nav-holder .selected').parents('li').each(function () {
731            //
732            $(this).addClass('open').removeClass('closed');
733            //USE THIS TO KEEP L0 closed
734            if (!$(this).parent().hasClass('L0')) {
735                $(this).siblings('li').addClass('selectedSibbling').removeClass('closed');
736            }
737            //
738        });
739        //OPEN CHILDREN
740        $('.left-nav-holder .selected > ul > li').addClass('open').removeClass('closed');
741        ///USE THIS TO HIDE L0 OPEN
742        $('.left-nav-holder .L0 > .closed > a').hide();
743        $('.left-nav-holder .L0 > .open > a').hide();
744        $('.left-nav-holder .L0 > .selected > a').hide();
745        $('.left-nav-holder .L0 > .selectedSibbling > a').hide();
746        //
747    }
748    //	
749}
750//
751function enableTopNav() {
752    //
753    $('.top-nav-holder .nav.L0 li').bind('mouseover', function () {
754        //
755        $(this).find('ul.L1').slideDown(0);
756        $(this).hover(function () {}, function () {
757            $(this).find('ul.L1').slideUp(0);
758        });
759        //
760    });
761    //
762    $('.top-nav-holder .nav.L0 li a:not(.top-nav-holder .L1 li a)').bind('focus', function () {
763        //
764        $('.top-nav-holder ul.L1').hide();
765        $(this).parent().find('ul.L1').slideDown(0).addClass('focus');
766        //
767    });
768    //
769}
770//
771function disableTopNav() {
772    //
773    $('.top-nav-holder .nav.L0 li').unbind('mouseover');
774    //
775}
776//

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.