PageSourceSearch

https://ville-boisemont.fr/modules/custom/consent_mode_pulsar/js/consent_mode.js?v=1.x

js ville-boisemont.fr collected 2026-10-02 21:47:13 UTC 3,194 bytes, 84 lines download raw bytes

1window.dataLayer = window.dataLayer || [];
2function gtag() {
3  dataLayer.push(arguments);
4}
5
6let consentUpdate = {
7  ad_personalization: drupalSettings.consent_mode_pulsar.ad_personalization,
8  ad_storage: drupalSettings.consent_mode_pulsar.ad_storage,
9  ad_user_data: drupalSettings.consent_mode_pulsar.ad_user_data,
10  analytics_storage: drupalSettings.consent_mode_pulsar.analytics_storage,
11  functionality_storage: drupalSettings.consent_mode_pulsar.functionality_storage,
12  personalization_storage: drupalSettings.consent_mode_pulsar.personalization_storage,
13  security_storage: "granted",
14  wait_for_update: 500
15};
16
17gtag("consent", "default", consentUpdate);
18gtag("set", "ads_data_redaction", true);
19gtag("set", "url_passthrough", false);
20
21
22/** Personnalisations for COOKIESJSR **/
23
24		
25let validparamGA = ['ad_storage','analytics_storage','ad_user_data','ad_personalization','personalization_storage','functionality_storage','security_storage'];
26
27function changeGtag(nameservice,statut){
28	if(validparamGA.includes(nameservice)){ 	consentUpdate[nameservice] = statut ? 'granted' : 'denied'; 	}
29  gtag('consent', 'update', consentUpdate);
30}
31
32function getCookiejsrValue() 
33{
34	let name="cookiesjsr"; const regex = new RegExp(`(^| )${name}=([^;]+)`);  const match = document.cookie.match(regex);
35  if (match) {  return JSON.parse(decodeURIComponent(match[2]))  }
36}
37
38function reloadAllPermCookies(){
39	jQuery.each(getCookiejsrValue(),function(nameservice,statut){
40			if(validparamGA.includes(nameservice)){ consentUpdate[nameservice] = statut ? 'granted' : 'denied'; }
41	});
42	gtag('consent', 'update', consentUpdate);
43}
44
45function btnCookiesJsrServiceAction(){
46	setTimeout(function() {
47		  jQuery('.cookiesjsr-switch').click(function() {
48		
49				let serviceskeys = Object.keys(document.cookiesjsr.services);
50		  	let categories = jQuery.map(document.cookiesjsr.services, function(value, key) {   return value; 	});
51		
52		  	nameservice =  jQuery(this).find('input').attr('aria-describedby') ;
53		  	nameservice = nameservice.replace("desc_","");
54		  	btn = jQuery(this);
55				let iscategory = serviceskeys.findIndex(k => k.toLowerCase() === nameservice.toLowerCase());
56				
57				if(iscategory !== undefined){
58						jQuery.each(categories[iscategory].services, function(index,service) {
59						  	if(validparamGA.includes(service.key)){  consentUpdate[service.key] = btn.is( ".active" ) ?  'denied' : 'granted' ; }	 
60						});
61						gtag('consent', 'update', consentUpdate);
62		
63				}else{ changeGtag(nameservice, btn.is( ".active" )? false : true); }
64		  });
65	}, 500);
66}
67
68function btnCookiesJsrActions(){
69		setTimeout(function() { 
70			jQuery('.cookiesjsr-btn.allowAll').click(function(){ setTimeout(function() { 	reloadAllPermCookies();},500); 	});
71			jQuery('.cookiesjsr-btn.denyAll').click(function(){ setTimeout(function() { 	reloadAllPermCookies();},500); 	});
72			jQuery('.cookiesjsr-btn.save').click(function(){ 	setTimeout(function() { 	reloadAllPermCookies();},500); });
73	}, 500);
74}
75
76jQuery(document).ready(function() {
77	btnCookiesJsrActions(); reloadAllPermCookies();
78	jQuery('.nav-link-editcookiesettings').click(function(){
79		btnCookiesJsrActions(); btnCookiesJsrServiceAction();
80	})
81});
82
83/**/
84

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.