PageSourceSearch

https://epernay-agglo.fr/sites/epernay-agglo/themes/bootstrap_barr…/js/global.js?v=10.6.18

js epernay-agglo.fr collected 2026-10-02 19:10:40 UTC 6,388 bytes, 174 lines download raw bytes

1/**
2 * @file
3 * Global utilities.
4 *
5 */
6(function ($, Drupal) {
7	'use strict';
8	Drupal.behaviors.bootstrap_barrio_site = {
9		attach: function (context, settings) {
10		}
11	};
12
13	function getCookie(cname) {
14		var name = cname + "=";
15		var decodedCookie = decodeURIComponent(document.cookie);
16		var ca = decodedCookie.split(';');
17		for(var i = 0; i <ca.length; i++) {
18			var c = ca[i];
19			while (c.charAt(0) == ' ') {
20				c = c.substring(1);
21			}
22			if (c.indexOf(name) == 0) {
23				return c.substring(name.length, c.length);
24			}
25		}
26		return "";
27	}
28
29	$("#block-notificationwebpush").hide();
30
31	if (document.cookie.match(/^(?:.*;)?\s*cookie_pushpad\s*=\s*([^;]+)(?:.*)?$/) === null) {
32		var web_push_compatibility = false;
33		(function(p,u,s,h,x){p.pushpad=p.pushpad||function(){(p.pushpad.q=p.pushpad.q||[]).push(arguments)};h=u.getElementsByTagName('head')[0];x=u.createElement('script');x.async=1;x.src=s;h.appendChild(x);})(window,document,'https://pushpad.xyz/pushpad.js');
34		pushpad('init', 7611,{ hostname: "partenaire-gc-ng-dv.gallimedia.info", serviceWorkerPath: '/serviceworker-pwa'});
35		pushpad('status', function(isSubscribed) {
36			web_push_compatibility = true;
37			console.log("check status pushpad ici");
38			document.cookie = "cookie_pushpad=1; path=/";
39			if (isSubscribed) {
40				$("#web_push_state").text('Gérez votre abonnement');
41			}
42			else {
43				$("#web_push_state").text('Abonnement');
44			}
45
46			$("#block-notificationwebpush").show();
47		});
48
49		if (web_push_compatibility == false) {
50			document.cookie = "cookie_pushpad=0; path=/";
51		}
52		else {
53			document.cookie = "cookie_pushpad=1; path=/";
54		}
55	}
56
57	if (getCookie("cookie_pushpad") == 1) $("#block-notificationwebpush").show();
58
59	//toolbar open
60	var body= $('body');
61	window.onload = function() {
62		//putHeight();
63	}
64	/* Moteur de recherche */
65	var searchInput = $('.block-views-exposed-filter-blockrecherche-globale-page-search .form-type-textfield input');
66	searchInput.attr('placeholder','Rechercher…');
67
68	/* Input Newsletter*/
69	var NewsInput = $('.block-simplenews .form-type-email input');
70	NewsInput.attr('placeholder','Votre adresse mail…');
71
72	/* menu principal  mobile*/
73	var rubrique = $('.menu-mobile .we-mega-menu-submenu .navigation > ul > li.menu-item--expanded > a');
74	rubrique.click(function(event) {
75		event.preventDefault();
76		$(this).siblings('ul').slideToggle('slow');
77		$(this).toggleClass( "open" );
78		return false;
79	});
80	function isInstalled() {
81  		// For iOS
82  		if(window.navigator.standalone) return true
83  		// For Android
84  		if(window.matchMedia('(display-mode: standalone)').matches) return true
85  		// If neither is true, it's not installed
86  		return false
87	}
88	if(isInstalled()) {
89                body.addClass("ispwa");
90        }
91	$(document).ready(function() {
92		$(".menu-mobile").attr("data-action","click");
93                $(".we-mega-menu-li[href='#0']").click(function(event) {
94                        event.preventDefault();
95                        $(this).toggleClass( "clicked" );
96                        return false;
97                });
98		$(".views-field-field-zone-texte iframe body").css({
99			"width": "100%",
100			"max-width": "none"
101
102		});
103		//new WOW().init();
104
105		//$('.path-frontpage .block-views-blocktemoignages-block-temoignages').parallax({imageSrc: '/sites/template-entreprise/themes/bootstrap_barrio_site/images/parallax.jpg'});
106
107		/* fix menu to-top*/
108		/*$(window).scroll(function () {
109			if ($(this).scrollTop() > 150 ) {
110				body.addClass("scrolling");
111			} else {
112				body.removeClass("scrolling");
113			}
114		 });*/
115
116		/* parallax */
117		//$('.parallax').parallax("50%", 0.1);
118
119		/* ui onglet */
120                if ($('.with-ui-tabs')) {
121                        var blockOnglet=$('.block-tabs');
122                        blockOnglet.prepend('<div class="tabs-content"></div>');
123                        blockOnglet.prepend('<ul class="tabs"></ul>');
124                        var blockViews=$('.block-tabs > .group-tab');
125                        var onglets=$('.block-tabs .tabs');
126                        var ongletContent=$('.block-tabs .tabs-content');
127                        $.each(blockViews, function(key,value){
128                                onglets.append('<li key="'+key+'" class="tab"><a href="#0">'+value.childNodes[1].innerHTML+'</a></li>');
129                                $(this).attr("id","tab-content-"+key);
130                        });
131                        ongletContent.append(blockViews);
132                        var onglet=onglets.children("li");
133                        $('.block-tabs .tabs .tab[key="0"]').addClass('active');
134                        $('.block-tabs .tabs-content #tab-content-0').addClass('active');
135
136                        function setHeight() {
137                                var elementHeight=ongletContent.children(".active").children(".field").height() || 0;
138                                ongletContent.height(elementHeight);
139                        }
140                        setHeight();
141                        $(window).resize(()=>{setHeight();});
142                        onglet.children("a").click(function(){
143                                var idActive = $(this).parent().attr("key");
144                                $(this).parent().siblings().removeClass('active');
145                                $(this).parent().addClass("active");
146                                ongletContent.children("#tab-content-"+idActive).siblings().removeClass('active');
147                                ongletContent.children("#tab-content-"+idActive).addClass("active");
148                                setHeight();
149                        });
150                }
151		/* carte svg */
152		$("#plan-ville-liste a").hover(function(){
153                	var idVille = $(this).attr("id");
154                	$("#communes #"+idVille).toggleClass("active");
155        	})
156        	$("#communes a").hover(function(){
157                	var idVille = $(this).attr("id");
158                	$("#plan-ville-liste #"+idVille).toggleClass("active");
159        	})
160
161		/* Retour vers le haut */
162		$('body').append('<a href="#top" class="to_top" title="Revenir en haut de page">Haut</a>');
163		$(".to_top").click(function(){
164			$("html, body").animate({scrollTop: 0},"slow");
165		});
166
167		/* theme navbar toggler */
168		/*
169		$('button.navbar-toggler').click(function(){
170			$('.navbar-collapse').toggleClass( "show" );
171                });
172*/
173	});
174})(jQuery, Drupal);

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.