Skip to content

Commit 66b4a95

Browse files
committed
Add new version
1 parent 736ff16 commit 66b4a95

File tree

9 files changed

+107
-62
lines changed

9 files changed

+107
-62
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,6 @@ node_modules
3434

3535
# Remote-FTP config
3636
.ftpconfig
37+
38+
# OS special
39+
.DS_Store

dist/cookiebar.css

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
/**
22
* cookiebar - It is a pure JS code, that warns the visitors in the notification bar, the page saves cookies. This is Compliant with the new EU cookie law.
3-
* Date 2016-05-23T07:51:40Z
3+
* Date 2016-05-23T09:52:35Z
44
*
55
* @author Tamás András Horváth <[email protected]> (http://icetee.hu)
6-
* @version v0.9.2
6+
* @version v0.9.3
77
* @link https://github.com/icetee/cookiebar#readme
88
* @license MIT
99
*/
@@ -13,25 +13,27 @@
1313
bottom: 0;
1414
box-sizing: initial;
1515
color: #fff;
16-
height: 50px;
16+
min-height: 50px;
1717
left: 0;
1818
position: fixed;
1919
width: 100%;
2020
}
2121
.cookiebar-wrapper {
2222
height: 100%;
23+
overflow: hidden;
2324
padding: 14px;
25+
width: 85%;
2426
}
2527
.cookiebar-desciption {
26-
float: left;
28+
display: inline;
2729
font-size: 1em;
2830
}
29-
.cookiebar-button {
30-
float: left;
31+
.cookiebar-link {
32+
display: inline;
33+
padding-left: 5px;
3134
}
3235
.cookiebar-link a {
3336
color: #3498db;
34-
padding-left: 5px;
3537
text-decoration: none;
3638
}
3739
.cookiebar-link a:hover {
@@ -48,7 +50,9 @@
4850
position: absolute;
4951
right: 20px;
5052
text-transform: uppercase;
51-
top: 11px;
53+
margin: auto;
54+
top: 0;
55+
bottom: 0;
5256
}
5357
.cookiebar-btn:hover {
5458
background: #d34c37 none repeat scroll 0 0;

dist/cookiebar.js

Lines changed: 35 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
/**
22
* cookiebar - It is a pure JS code, that warns the visitors in the notification bar, the page saves cookies. This is Compliant with the new EU cookie law.
3-
* Date 2016-05-23T07:51:40Z
3+
* Date 2016-05-23T09:52:35Z
44
*
55
* @author Tamás András Horváth <[email protected]> (http://icetee.hu)
6-
* @version v0.9.2
6+
* @version v0.9.3
77
* @link https://github.com/icetee/cookiebar#readme
88
* @license MIT
99
*/
@@ -102,24 +102,27 @@ var Cookiebar = function(opt) {
102102
id: "cookiebar",
103103
cls: "cookiebar",
104104
cookie: "cookiebar",
105-
content: {
106-
description: "Az oldal sütiket használ a működéshez. Szolgáltatásaink igénybevételével Ön beleegyezik a sütik használatába!",
107-
link: "További információk",
108-
href: "http://ec.europa.eu/ipg/basics/legal/cookies/index_en.htm",
109-
button: "Elfogadom",
110-
more: "Az EU-s jogszabályok értelmében fel kell hívnunk a figyelmét, hogy oldalaink sütiket (cookie) használnak. Ezek miniatűr, ártalmatlan fájlok, melyeket az ön gépére helyezünk el, hogy a szolgáltatásaink használatát egyszerűbbé tegyük az ön számára. A sütiket természetesen letilthatja a böngészőjében, azonban ha az Elfogadom feliratú gombra kattint, akkor elfogadja azok használatát."
111-
},
112-
fade: {
113-
type: "in",
114-
ms: "500"
115-
},
105+
content: {},
106+
fade: {},
116107
debug: 0
117108
}, opt || {});
118109

110+
this.content = extend({
111+
description: "Az oldal sütiket használ a működéshez. Szolgáltatásaink igénybevételével Ön beleegyezik a sütik használatába!",
112+
link: "További információk",
113+
href: "http://ec.europa.eu/ipg/basics/legal/cookies/index_en.htm",
114+
button: "Elfogadom",
115+
more: "Az EU-s jogszabályok értelmében fel kell hívnunk a figyelmét, hogy oldalaink sütiket (cookie) használnak. Ezek miniatűr, ártalmatlan fájlok, melyeket az ön gépére helyezünk el, hogy a szolgáltatásaink használatát egyszerűbbé tegyük az ön számára. A sütiket természetesen letilthatja a böngészőjében, azonban ha az Elfogadom feliratú gombra kattint, akkor elfogadja azok használatát."
116+
}, this.opt.content || {});
117+
118+
this.fade = extend({
119+
type: "in",
120+
ms: "500"
121+
}, this.opt.fade || {});
122+
119123
this.id = this.opt.id;
120124
this.cls = this.opt.cls;
121125
this.cookie = this.opt.cookie;
122-
this.content = this.opt.content;
123126
this.debug = this.opt.debug;
124127
this.fade = this.opt.fade;
125128
this.status = false;
@@ -129,12 +132,14 @@ var Cookiebar = function(opt) {
129132
};
130133

131134
Cookiebar.prototype.init = function() {
132-
if (this.debug) {
133-
this.setCookie('debug_cookibar', true, 365);
135+
var self = this;
136+
if (self.debug) {
137+
self.setCookie('debug_cookibar', "test", 365, function() {
138+
self.checkCookie();
139+
});
140+
} else {
141+
self.checkCookie();
134142
}
135-
136-
//Check Cookies
137-
this.checkCookie();
138143
};
139144

140145
Cookiebar.prototype.exitsCookie = function() {
@@ -160,9 +165,10 @@ Cookiebar.prototype.setCookie = function(cname, value, exdays, cb) {
160165
var ex = new Date();
161166
ex.setDate(ex.getDate() + exdays);
162167

163-
var cvalue = escape(value) + ((exdays === null) ? "" : "; expires=" + ex.toUTCString() + "; path=/");
168+
var cvalue = escape(value) + ((exdays === null) ? "" : "; expires=" + ex.toUTCString() + "; path=/;");
164169

165170
document.cookie = cname + "=" + cvalue;
171+
166172
if (typeof cb === "function") {
167173
cb();
168174
}
@@ -202,7 +208,7 @@ Cookiebar.prototype.draw = function() {
202208
}
203209

204210
self.setCookie(self.cookie, true, 365, function() {
205-
self.status = true;
211+
self.setStatus(self.cookie);
206212
});
207213

208214
document.getElementById(self.id).style.display = 'none';
@@ -220,6 +226,14 @@ Cookiebar.prototype.checkCookie = function() {
220226
_("#" + self.id).fade(this.fade.type, this.fade.ms);
221227
self.setCookie(self.cookie, null, 365);
222228
}
229+
230+
self.setStatus(cookie);
231+
};
232+
233+
Cookiebar.prototype.setStatus = function(status) {
234+
if (status === "true") {
235+
this.status = true;
236+
}
223237
};
224238

225239
Cookiebar.prototype.getStatus = function() {

dist/cookiebar.min.css

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
/**
22
* cookiebar - It is a pure JS code, that warns the visitors in the notification bar, the page saves cookies. This is Compliant with the new EU cookie law.
3-
* Date 2016-05-23T07:51:40Z
3+
* Date 2016-05-23T09:52:35Z
44
*
55
* @author Tamás András Horváth <[email protected]> (http://icetee.hu)
6-
* @version v0.9.2
6+
* @version v0.9.3
77
* @link https://github.com/icetee/cookiebar#readme
88
* @license MIT
99
*/
1010

11-
.cookiebar{background-color:#2c3e50;bottom:0;box-sizing:initial;color:#fff;height:50px;left:0;position:fixed;width:100%}.cookiebar-wrapper{height:100%;padding:14px}.cookiebar-desciption{float:left;font-size:1em}.cookiebar-button{float:left}.cookiebar-link a{color:#3498db;padding-left:5px;text-decoration:none}.cookiebar-link a:hover{text-decoration:underline}.cookiebar-btn{background:#e74c3c none repeat scroll 0 0;border:0 none;color:#fff;cursor:pointer;font-size:.875em;height:28px;padding:0 10px 2px;position:absolute;right:20px;text-transform:uppercase;top:11px}.cookiebar-btn:hover{background:#d34c37 none repeat scroll 0 0}
11+
.cookiebar{background-color:#2c3e50;bottom:0;box-sizing:initial;color:#fff;min-height:50px;left:0;position:fixed;width:100%}.cookiebar-wrapper{height:100%;overflow:hidden;padding:14px;width:85%}.cookiebar-desciption{display:inline;font-size:1em}.cookiebar-link{display:inline;padding-left:5px}.cookiebar-link a{color:#3498db;text-decoration:none}.cookiebar-link a:hover{text-decoration:underline}.cookiebar-btn{background:#e74c3c none repeat scroll 0 0;border:0 none;color:#fff;cursor:pointer;font-size:.875em;height:28px;padding:0 10px 2px;position:absolute;right:20px;text-transform:uppercase;margin:auto;top:0;bottom:0}.cookiebar-btn:hover{background:#d34c37 none repeat scroll 0 0}

dist/cookiebar.min.js

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

example/example.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@
33
**/
44
ready(function() {
55
var cookiebar = new Cookiebar({
6-
debug: 1
6+
debug: 1,
7+
content: {
8+
description: "Honlapunk ún. sütiket (cookie) használ, hogy biztosítani tudja a személyre szabott, felhasználóbarát böngészést. Az így gyűjtött adatok névtelenek, azokból nem készülnek felhasználói profilok, illetve nem kerülnek további felhasználásra. Az OK-ra kattintva Ön hozzájárul a sütik használatához.",
9+
link: "",
10+
href: "",
11+
button: "OK"
12+
}
713
});
814
});

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "cookiebar",
3-
"version": "0.9.2",
3+
"version": "0.9.3",
44
"description": "It is a pure JS code, that warns the visitors in the notification bar, the page saves cookies. This is Compliant with the new EU cookie law.",
55
"main": "index.js",
66
"config": {

src/scripts/class.js

Lines changed: 33 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,27 @@ var Cookiebar = function(opt) {
33
id: "cookiebar",
44
cls: "cookiebar",
55
cookie: "cookiebar",
6-
content: {
7-
description: "Az oldal sütiket használ a működéshez. Szolgáltatásaink igénybevételével Ön beleegyezik a sütik használatába!",
8-
link: "További információk",
9-
href: "http://ec.europa.eu/ipg/basics/legal/cookies/index_en.htm",
10-
button: "Elfogadom",
11-
more: "Az EU-s jogszabályok értelmében fel kell hívnunk a figyelmét, hogy oldalaink sütiket (cookie) használnak. Ezek miniatűr, ártalmatlan fájlok, melyeket az ön gépére helyezünk el, hogy a szolgáltatásaink használatát egyszerűbbé tegyük az ön számára. A sütiket természetesen letilthatja a böngészőjében, azonban ha az Elfogadom feliratú gombra kattint, akkor elfogadja azok használatát."
12-
},
13-
fade: {
14-
type: "in",
15-
ms: "500"
16-
},
6+
content: {},
7+
fade: {},
178
debug: 0
189
}, opt || {});
1910

11+
this.content = extend({
12+
description: "Az oldal sütiket használ a működéshez. Szolgáltatásaink igénybevételével Ön beleegyezik a sütik használatába!",
13+
link: "További információk",
14+
href: "http://ec.europa.eu/ipg/basics/legal/cookies/index_en.htm",
15+
button: "Elfogadom",
16+
more: "Az EU-s jogszabályok értelmében fel kell hívnunk a figyelmét, hogy oldalaink sütiket (cookie) használnak. Ezek miniatűr, ártalmatlan fájlok, melyeket az ön gépére helyezünk el, hogy a szolgáltatásaink használatát egyszerűbbé tegyük az ön számára. A sütiket természetesen letilthatja a böngészőjében, azonban ha az Elfogadom feliratú gombra kattint, akkor elfogadja azok használatát."
17+
}, this.opt.content || {});
18+
19+
this.fade = extend({
20+
type: "in",
21+
ms: "500"
22+
}, this.opt.fade || {});
23+
2024
this.id = this.opt.id;
2125
this.cls = this.opt.cls;
2226
this.cookie = this.opt.cookie;
23-
this.content = this.opt.content;
2427
this.debug = this.opt.debug;
2528
this.fade = this.opt.fade;
2629
this.status = false;
@@ -30,12 +33,14 @@ var Cookiebar = function(opt) {
3033
};
3134

3235
Cookiebar.prototype.init = function() {
33-
if (this.debug) {
34-
this.setCookie('debug_cookibar', true, 365);
36+
var self = this;
37+
if (self.debug) {
38+
self.setCookie('debug_cookibar', "test", 365, function() {
39+
self.checkCookie();
40+
});
41+
} else {
42+
self.checkCookie();
3543
}
36-
37-
//Check Cookies
38-
this.checkCookie();
3944
};
4045

4146
Cookiebar.prototype.exitsCookie = function() {
@@ -61,9 +66,10 @@ Cookiebar.prototype.setCookie = function(cname, value, exdays, cb) {
6166
var ex = new Date();
6267
ex.setDate(ex.getDate() + exdays);
6368

64-
var cvalue = escape(value) + ((exdays === null) ? "" : "; expires=" + ex.toUTCString() + "; path=/");
69+
var cvalue = escape(value) + ((exdays === null) ? "" : "; expires=" + ex.toUTCString() + "; path=/;");
6570

6671
document.cookie = cname + "=" + cvalue;
72+
6773
if (typeof cb === "function") {
6874
cb();
6975
}
@@ -103,7 +109,7 @@ Cookiebar.prototype.draw = function() {
103109
}
104110

105111
self.setCookie(self.cookie, true, 365, function() {
106-
self.status = true;
112+
self.setStatus(self.cookie);
107113
});
108114

109115
document.getElementById(self.id).style.display = 'none';
@@ -121,6 +127,14 @@ Cookiebar.prototype.checkCookie = function() {
121127
_("#" + self.id).fade(this.fade.type, this.fade.ms);
122128
self.setCookie(self.cookie, null, 365);
123129
}
130+
131+
self.setStatus(cookie);
132+
};
133+
134+
Cookiebar.prototype.setStatus = function(status) {
135+
if (status === "true") {
136+
this.status = true;
137+
}
124138
};
125139

126140
Cookiebar.prototype.getStatus = function() {

0 commit comments

Comments
 (0)