PageSourceSearch

https://love90.org/wp-content/plugins/nimbo-cookies-information/js…mbo-cookies-information-plugin.js?ver=1.1.0

js love90.org collected 2026-10-08 04:18:27 UTC 3,957 bytes, 153 lines download raw bytes

1/**
2 * Plugin name: Nimbo Cookies Information
3 * nimbo-cookies-information-plugin.js v1.1.0
4 */
5
6( function( $ ) {
7	'use strict';
8	$( document ).ready( function() {
9
10		var	$cookiesInfo = $( '#bwp-cookies-info' ),
11			cookieAccepted = 'nimbo_cookies_accepted'; // cookie name; this cookie is used to store the status of the "Cookies information" window: "Yes", if the "Accept" button was pressed, otherwise "No";
12
13
14		/**
15		 * "Cookies information" window
16		 * ----------------------------------------------------
17		 */
18
19		// function: accept cookies
20		function acceptCookies() {
21
22			var $acceptCookiesButton = $( '#bwp-accept-cookies' );
23
24			// click on the button
25			$acceptCookiesButton.on( 'click', function() {
26				// hide "cookies information" window
27				hideCookiesInfo();
28				// set cookie (we must remember that the user agrees to accept cookies)
29				setCookie( cookieAccepted, 'yes' );
30			} );
31
32		}
33
34		// function: hide "cookies information" window
35		function hideCookiesInfo() {
36
37			// hide the window
38			$cookiesInfo.addClass( 'bwp-hidden' );
39			setTimeout( function() {
40				$cookiesInfo.css( 'display', 'none' );
41			}, 200 );
42
43		}
44
45		// accept cookies: start function
46		acceptCookies();
47
48		// delete cookie if window is hidden
49		if ( 'hide' === nimboCookiesInformationData.cookiesInfoWindow ) {
50			if ( getCookie( cookieAccepted ) ) {
51				deleteCookie( cookieAccepted );
52			}
53		}
54
55
56		/**
57		 * "Cookies information" window (for mobile devices)
58		 * ----------------------------------------------------
59		 */
60
61		// function: show or hide "cookies information" window on mobile devices
62		function showHideCookiesInfoMobile() {
63
64			var	$showCookiesInfo = $( '#bwp-show-cookies-info' ),
65				$closeCookiesInfo = $( '#bwp-close-cookies-info' ),
66				hiddenClass = 'bwp-hidden-on-mobile';
67
68			// info icon: click
69			$showCookiesInfo.on( 'click', function() {
70
71				// if the window is hidden
72				if ( $cookiesInfo.hasClass( hiddenClass ) ) {
73
74					// show "cookies information" window with close icon
75					$cookiesInfo.css( 'display', 'block' );
76					setTimeout( function() {
77						$cookiesInfo.removeClass( hiddenClass );
78					}, 4 );
79
80					// hide info icon
81					$showCookiesInfo.addClass( hiddenClass );
82
83				}
84
85			} );
86
87			// close icon: click
88			$closeCookiesInfo.on( 'click', function() {
89
90				// hide "cookies information" window with close icon
91				$cookiesInfo.addClass( hiddenClass );
92				setTimeout( function() {
93					$cookiesInfo.attr( 'style', '' ); // remove "display: block" style
94				}, 200 );
95
96				// show info icon
97				$showCookiesInfo.removeClass( hiddenClass );
98
99			} );
100
101		}
102
103		// show or hide "cookies information" window on mobile devices: start function
104		if ( 'hidden-window' === nimboCookiesInformationData.cookiesInfoOnMobile ) {
105			showHideCookiesInfoMobile();
106		}
107
108
109		/**
110		 * Cookie: set cookie, get cookie, and delete cookie
111		 * ----------------------------------------------------
112		 */
113
114		// function: set cookie
115		function setCookie( name, value ) {
116
117			// cookie value
118			value = encodeURIComponent( value );
119
120			// expiration date (+60 days)
121			var date = new Date;
122			date.setDate( date.getDate() + 60 );
123
124			// set cookie
125			document.cookie = name + '=' + value + '; path=/; expires=' + date.toUTCString();
126
127		}
128
129		// function: get cookie
130		function getCookie( name ) {
131
132			var matches = document.cookie.match( new RegExp(
133				"(?:^|; )" + name.replace(/([\.$?*|{}\(\)\[\]\\\/\+^])/g, '\\$1') + "=([^;]*)"
134			) );
135
136			return matches ? decodeURIComponent( matches[1] ) : undefined;
137
138		}
139
140		// function: delete cookie
141		function deleteCookie( name ) {
142
143			// set the date in the past
144			var date = new Date;
145			date.setDate( date.getDate() - 1 );
146
147			// delete cookie
148			document.cookie = name + '=; path=/; expires=' + date.toUTCString();
149
150		}
151
152	} );
153} )( 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.