PageSourceSearch

https://novelfm.in/js/cookies-message.js

js novelfm.in collected 2026-10-02 01:56:35 UTC 4,018 bytes, 121 lines download raw bytes

1
2
3
4;( function ( $ ) {
5
6	$.CookiesMessage = function ( options ) {
7
8
9	// ----------------
10	// 001 - Default settings
11
12	var defaults = {
13	messageText: "This website uses cookies to ensure you get the best experience on our website.",
14	messageBg: "#ffffff",						// Message box background color
15	messageColor: "#444444",					// Message box text color
16	messageLinkColor: "#ffffff",				// Message box links color
17	closeEnable: true,							// Show the close icon
18	closeColor: "#353f4f",						// Close icon color
19	closeBgColor: "transparent",				// Close icon background color
20	acceptEnable: true,							// Show the Accept button
21	acceptText: "Accept All",		            // Accept button text
22	infoEnable: true,							// Show the More Info button
23	infoText: "More Details",					// More Info button text
24	infoUrl: "https://max2dgame.com/cookies.html",				    // More Info button URL
25	cookieExpire: 180							// Cookie expire time (days)
26	};
27		
28	options = $.extend(defaults, options);
29
30	var cookieName 	= location.host;
31	var cookieValue = "Cookies policy accepted";
32	var cookiePath 	= "/";
33
34
35
36	// ----------------
37	// 002 - Initialize
38
39    function inizialize(options) {
40    	//== Message composition
41    	var partClose = '';
42    	if (options.closeEnable == true) { partClose += '<a href="#" id="cookies-close" style="background-color:'+ options.closeBgColor +';"><svg version="1.1" id="cookies-close-icon" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="16px" height="16px" viewBox="248.5 248.5 15 15" enable-background="new 248.5 248.5 15 15" xml:space="preserve" ><polygon id="x-mark-icon" points="263.5,260.876 258.621,255.999 263.499,251.121 260.876,248.5 256,253.377 251.122,248.5 248.5,251.121 253.378,255.999 248.5,260.878 251.121,263.5 256,258.62 260.879,263.499" style="fill:'+ options.closeColor +';"/></svg></a>'; };
43			var partLinks = '';
44			if (options.acceptEnable == true) { partLinks += '<a href="#" id="cookies-ok">'+ options.acceptText +'</a>'; };
45			if (options.infoEnable == true) { partLinks += '<a href="'+ options.infoUrl +'" id="cookies-info">'+ options.infoText +'</a>'; };
46			var displayMessage = '<div id="cookies"><p>'+ options.messageText + '<span>' + partLinks + '</span>' +'</p>'+ partClose +'</div>';
47			$("body").prepend(displayMessage);
48			$("#cookies").hide().slideDown();
49
50			//== Custom style
51			$("#cookies").css({ "background-color":options.messageBg, "color":options.messageColor });
52			$("#cookies p a").css({ "color":options.messageLinkColor });
53    }
54
55
56
57	// ----------------
58	// 003 - Check user's technical cookie
59
60	var mycookie = getCookie(cookieName);
61	if(!mycookie) {
62	   inizialize(options);
63	}
64
65
66
67	// ----------------
68	// 004 - Get and Set cookie functions
69
70	function Trim(strValue) {
71	  return strValue.replace(/^\s+|\s+$/g, '');
72	}
73
74
75	function getCookie(cookieName) {
76	  var result = false;
77	  if(document.cookie) {
78	    var mycookieArray = document.cookie.split(';');
79	    for(i=0; i<mycookieArray.length; i++) {
80	      var mykeyValue = mycookieArray[i].split('=');
81	      if(Trim(mykeyValue[0]) == cookieName) result = mykeyValue[1];
82	    }
83	  }
84	  return result;
85	}
86
87
88	function setCookie(cname, cvalue, cexpire, cpath) {
89		var d = new Date();
90    d.setTime(d.getTime() + (cexpire*24*60*60*1000));
91    var expires = "expires="+d.toUTCString();
92    document.cookie = cname + "=" + cvalue + "; " + expires + "; path="+ cpath +";";
93	}
94
95
96
97	// ----------------
98	// 005 - Accept link event handler
99
100	$('#cookies-ok').on( 'click', function ( event ) {
101    event.preventDefault();
102    setCookie(cookieName, cookieValue, options.cookieExpire, cookiePath);
103		$("#cookies").slideToggle();
104	});
105
106	$('#cookies-reject').on( 'click', function ( event ) {
107    event.preventDefault();
108    setCookie(cookieName, cookieValue, options.cookieExpire, cookiePath);
109		$("#cookies").slideToggle();
110	});
111
112	$('#cookies-close').on( 'click', function ( event ) {
113    event.preventDefault();
114		$("#cookies").slideToggle();
115	});
116
117  
118  };
119
120
121})(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.