Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // was this...
- $('.cookie-warning .accept').click(function(e){
- e.preventDefault();
- Cookies.set('allowed', 'yes');
- $('.cookie-warning').fadeOut();
- });
- $('.cookie-warning .decline').click(function(e){
- e.preventDefault();
- $('.cookie-warning').fadeOut();
- });
- if (Cookies.get('allowed') == 'yes') {
- Cookies.set('quotes', 'hide');
- $('.cookie-warning').hide();
- } else {
- $('.cookie-warning').hide();
- $('.cookie-warning').delay(4000).fadeIn();
- }
- // now this...
- var cookie = {
- init: function(){
- this.cacheDom();
- this.bindEvents();
- this.showQuotes();
- },
- cacheDom: function() {
- this.$warning = $('.cookie-warning');
- this.$accept = this.$warning.find('.accept');
- this.$decline = this.$warning.find('.decline');
- },
- bindEvents: function() {
- this.$accept.on('click', this.acceptCookie.bind(this));
- this.$decline.on('click', this.declineCookie.bind(this));
- },
- acceptCookie: function() {
- this.$warning.fadeOut();
- Cookies.set('allowed', 'yes');
- },
- declineCookie: function() {
- this.$warning.fadeOut();
- },
- showQuotes: function() {
- if (Cookies.get('allowed') == 'yes') {
- Cookies.set('quotes', 'hide');
- this.$warning.hide();
- } else {
- this.$warning.hide();
- this.$warning.delay(4000).fadeIn();
- }
- }
- }
- cookie.init();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement