PageSourceSearch

https://optimering.nu/wp-content/plugins/gdpr-cookie-compliance-addon/assets/js/gdpr_cc_addon.js?ver=2.7.9

js optimering.nu collected 2026-10-02 22:28:20 UTC 5,506 bytes, 168 lines download raw bytes

1(function($) {
2    $(document).ready(function() {
3
4    	function gdpr_cookie_compliance_setup_get_session( event_type ) {
5    		var gdpr_uvid_session = false;
6    		
7    		if ( typeof( sessionStorage ) !== "undefined" ) {
8    			gdpr_uvid_session = sessionStorage.getItem("gdpr_uvid");
9    			if ( ! gdpr_uvid_session ) {
10    				sessionStorage.setItem( "gdpr_uvid", moove_frontend_gdpr_scripts.gdpr_uvid );
11    				gdpr_uvid_session = sessionStorage.getItem("gdpr_uvid");
12    			}				
13			}
14			
15			return gdpr_uvid_session;
16    	}
17    	
18    	function gdpr_cookie_compliance_get_cookies(){
19		  	var pairs = document.cookie.split(";");
20		  	var cookies = {};
21		  	for (var i=0; i<pairs.length; i++){
22		    	var pair = pairs[i].split("=");
23		    	cookies[(pair[0]+'').trim()] = unescape(pair[1]);
24		  	}
25		  	return cookies;
26		}
27
28		$(document).on('click','.gdpr-cd-details-toggle', function(e){
29			e.preventDefault();
30			var _this = $(this);
31			var text = _this.text();
32			var text2 = _this.attr('data-close');
33			_this.text(text2).append('<span></span>');
34			_this.attr('data-close',text);
35			_this.toggleClass('cd-details-open');
36			_this.parent().find('.gdpr-table-responsive-cnt').toggle();
37
38		});
39
40		function gdpr_cookie_compliance_set_cookies(name, value, days){
41		  	var expires;
42	          if (days) {
43	            var date = new Date();
44	            date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
45	            expires = "; expires=" + date.toGMTString();
46	          } else {
47	            expires = "";
48	          }
49
50	          document.cookie = encodeURIComponent(name) + "=" + encodeURIComponent(value) + expires + "; path=/";
51	          (JSON.parse(value));
52		}
53
54		var started = false;
55		var timeout_req = 2000;
56		var gdpr_timeout = 0;
57		var analytics_inserted = [];
58		$.fn.gdpr_cookie_compliance_analytics = function(event, extras) {
59			if ( typeof ( analytics_inserted[event] ) === 'undefined' || analytics_inserted[event] !== JSON.stringify( extras ) ) {
60				analytics_inserted[event] = JSON.stringify( extras );
61				if ( moove_frontend_gdpr_scripts.stats_enabled ) {
62					var gdpr_uvid_session = gdpr_cookie_compliance_setup_get_session( event );				
63					if ( !started ) {
64						gdpr_timeout = 0;
65					} else {
66						gdpr_timeout = gdpr_timeout + timeout_req;
67					}
68					started = true;
69
70					if ( event === 'script_inject' ) {
71			    		if ( typeof( localStorage ) !== "undefined" ) {
72			    			gdpr_uvid_session = localStorage.getItem("gdpr_uvid");
73			    			if ( ! gdpr_uvid_session ) {
74			    				localStorage.setItem( "gdpr_uvid", moove_frontend_gdpr_scripts.gdpr_uvid );
75			    				gdpr_uvid_session = sessionStorage.getItem("gdpr_uvid");
76			    			} else {
77			    				if ( typeof( sessionStorage ) !== "undefined" ) {
78					    			_gdpr_uvid_session = sessionStorage.getItem("gdpr_uvid");
79					    			if ( ! _gdpr_uvid_session ) {
80					    				_gdpr_uvid_session.setItem( "gdpr_uvid", moove_frontend_gdpr_scripts.gdpr_uvid );
81					    				gdpr_uvid_session = sessionStorage.getItem("gdpr_uvid");
82					    			}
83					    			_event 		= 'existing_session';
84					    			_extras 	= '';
85					    			try {
86					            jQuery().gdpr_cookie_compliance_analytics_with_uvid( _event, _extras, _gdpr_uvid_session );
87					            jQuery().gdpr_cookie_compliance_analytics_with_uvid( 'script_injected', extras, _gdpr_uvid_session );
88						        } catch(err) {
89						        	// error
90						        }
91									}		
92			    			}				
93						}				
94					} 
95					setTimeout( function(){	
96						if ( gdpr_uvid_session && event ) {
97							$.post(
98				              	moove_frontend_gdpr_scripts.ajaxurl,
99				              	{
100					                action: 	"moove_gdpr_premium_save_analytics",
101					                event: 		event,
102					                extras: 	extras,
103					                gdpr_uvid: 	gdpr_uvid_session,
104					            },
105				              	function( msg ) {
106				              		// console.warn(gdpr_uvid_session);
107				              		if ( gdpr_timeout >= timeout_req ) {
108				              			gdpr_timeout = gdpr_timeout - timeout_req;
109				              		}
110				              	}
111				            );
112						}
113					}, gdpr_timeout );	
114				}
115			}
116		}	
117
118		$.fn.gdpr_cookie_compliance_consent_log = function( value ) {
119			if ( moove_frontend_gdpr_scripts.consent_log_enabled ) {
120				$.post(
121        	moove_frontend_gdpr_scripts.ajaxurl,
122        	{
123            action: 	"save_consent_log",
124            extras: 	value,
125        	},
126        	function( msg ) {
127        		console.warn( msg );        		
128        	}
129      	);
130			}
131		}	
132
133		
134
135		$.fn.gdpr_cookie_compliance_analytics_with_uvid = function(event, extras, uvid) {
136			if ( moove_frontend_gdpr_scripts.stats_enabled ) {
137				var gdpr_uvid_session = uvid;				
138				if ( !started ) {
139					gdpr_timeout = 0;
140				} else {
141					gdpr_timeout = gdpr_timeout + timeout_req;
142				}
143				started = true;
144
145				setTimeout( function(){	
146					if ( gdpr_uvid_session && event ) {
147						$.post(
148            	moove_frontend_gdpr_scripts.ajaxurl,
149            	{
150                action: 	"moove_gdpr_premium_save_analytics",
151                event: 		event,
152                extras: 	extras,
153                gdpr_uvid: 	gdpr_uvid_session,
154            	},
155            	function( msg ) {
156            		// console.warn(gdpr_uvid_session);
157            		if ( gdpr_timeout >= timeout_req ) {
158            			gdpr_timeout = gdpr_timeout - timeout_req;
159            		}
160            	}
161          	);
162					}
163				}, gdpr_timeout );
164				
165			}
166		}
167    });
168})(jQuery);

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.