forked from cdnjs/cdnjs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add jquery.cookieBar v0.0.1 with git autoupdate config
close cdnjs#7456, cc @carlwoodhouse
- Loading branch information
Showing
5 changed files
with
199 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/*! | ||
* jQuery Cookiebar Plugin | ||
* https://github.com/carlwoodhouse/jquery.cookieBar | ||
* | ||
* Copyright 2012, Carl Woodhouse | ||
* Disclaimer: if you still get fined for not complying with the eu cookielaw, it's not our fault. | ||
*/ | ||
|
||
.cookie-message { | ||
position:fixed; | ||
top:0;left:0;right:0; | ||
padding:0 85px 0 20px; | ||
background:#fff; | ||
border-bottom:1px solid #ccc; | ||
box-shadow:0px 0px 3px #ccc; | ||
z-index: 99; | ||
} | ||
.cookie-message a { | ||
position:absolute; | ||
top:0; *top:-2px; right:20px; | ||
cursor:pointer; | ||
} | ||
.cookie-message p, .cookie-message a { | ||
color:#333; | ||
font:bold 11px/18px Arial; | ||
margin:0.6em 0; | ||
} | ||
.blue { | ||
border-bottom:1px solid #0E83AE; | ||
background-color:#0990c3; | ||
background: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(0%, #0e83ae), color-stop(50%, #0990c3), color-stop(100%, #0e9dd2)); | ||
background: -webkit-linear-gradient(#0e83ae, #0990c3, #0e9dd2); | ||
background: -moz-linear-gradient(#0e83ae, #0990c3, #0e9dd2); | ||
background: -o-linear-gradient(#0e83ae, #0990c3, #0e9dd2); | ||
background: -ms-linear-gradient(#0e83ae, #0990c3, #0e9dd2); | ||
background: linear-gradient(#0e83ae, #0990c3, #0e9dd2); | ||
} | ||
.blue p, .blue a { color:#fff; } |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
/*! | ||
* jQuery Cookiebar Plugin | ||
* https://github.com/carlwoodhouse/jquery.cookieBar | ||
* | ||
* Copyright 2012, Carl Woodhouse | ||
* Disclaimer: if you still get fined for not complying with the eu cookielaw, it's not our fault. | ||
* Licence: MIT | ||
*/ | ||
|
||
(function( $ ){ | ||
$.fn.cookieBar = function( options ) { | ||
var settings = $.extend( { | ||
'closeButton' : 'none', | ||
'secure' : false, | ||
'path' : '/', | ||
'domain' : '' | ||
}, options); | ||
|
||
return this.each(function() { | ||
var cookiebar = $(this); | ||
|
||
// just in case they didnt hide it by default. | ||
cookiebar.hide(); | ||
|
||
// if close button not defined. define it! | ||
if(settings.closeButton == 'none') | ||
{ | ||
cookiebar.append('<a class="cookiebar-close">Continue</a>'); | ||
settings = $.extend( { | ||
'closeButton' : '.cookiebar-close' | ||
}, options); | ||
} | ||
|
||
if ($.cookie('cookiebar') != 'hide') { | ||
cookiebar.show(); | ||
} | ||
|
||
cookiebar.find(settings.closeButton).click(function() { | ||
cookiebar.hide(); | ||
$.cookie('cookiebar', 'hide', { path: settings.path, secure: settings.secure, domain: settings.domain, expires: 30 }); | ||
return false; | ||
}); | ||
}); | ||
}; | ||
|
||
// self injection init | ||
$.cookieBar = function( options ) { | ||
$('body').prepend('<div class="ui-widget"><div style="display: none;" class="cookie-message ui-widget-header blue"><p>By using this website you allow us to place cookies on your computer. They are harmless and never personally identify you.</p></div></div>'); | ||
$('.cookie-message').cookieBar(options); | ||
}; | ||
})( jQuery ); | ||
|
||
/*! | ||
* Dependancy: | ||
* jQuery Cookie Plugin | ||
* https://github.com/carhartl/jquery-cookie | ||
* | ||
* Copyright 2011, Klaus Hartl | ||
* Dual licensed under the MIT or GPL Version 2 licenses. | ||
* http://www.opensource.org/licenses/mit-license.php | ||
* http://www.opensource.org/licenses/GPL-2.0 | ||
*/ | ||
(function($) { | ||
$.cookie = function(key, value, options) { | ||
// key and at least value given, set cookie... | ||
if (arguments.length > 1 && (!/Object/.test(Object.prototype.toString.call(value)) || value === null || value === undefined)) { | ||
options = $.extend({}, options); | ||
|
||
if (value === null || value === undefined) { | ||
options.expires = -1; | ||
} | ||
|
||
if (typeof options.expires === 'number') { | ||
var days = options.expires, t = options.expires = new Date(); | ||
t.setDate(t.getDate() + days); | ||
} | ||
|
||
value = String(value); | ||
|
||
return (document.cookie = [ | ||
encodeURIComponent(key), '=', options.raw ? value : encodeURIComponent(value), | ||
options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE | ||
options.path ? '; path=' + options.path : '', | ||
options.domain ? '; domain=' + options.domain : '', | ||
options.secure ? '; secure' : '' | ||
].join('')); | ||
} | ||
|
||
// key and possibly options given, get cookie... | ||
options = value || {}; | ||
var decode = options.raw ? function(s) { return s; } : decodeURIComponent; | ||
|
||
var pairs = document.cookie.split('; '); | ||
for (var i = 0, pair; pair = pairs[i] && pairs[i].split('='); i++) { | ||
// IE saves cookies with empty string as "c; ", e.g. without "=" as opposed to EOMB, thus pair[1] may be undefined | ||
if (decode(pair[0]) === key) return decode(pair[1] || ''); | ||
} | ||
return null; | ||
}; | ||
})(jQuery); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/*! | ||
* jQuery Cookiebar Plugin | ||
* https://github.com/carlwoodhouse/jquery.cookieBar | ||
* | ||
* Copyright 2012, Carl Woodhouse | ||
* Disclaimer: if you still get fined for not complying with the eu cookielaw, it's not our fault. | ||
*/ | ||
|
||
!function(a){a.fn.cookieBar=function(b){var c=a.extend({closeButton:"none",secure:!1,path:"/",domain:""},b);return this.each(function(){var d=a(this);d.hide(),"none"==c.closeButton&&(d.append('<a class="cookiebar-close">Continue</a>'),c=a.extend({closeButton:".cookiebar-close"},b)),"hide"!=a.cookie("cookiebar")&&d.show(),d.find(c.closeButton).click(function(){return d.hide(),a.cookie("cookiebar","hide",{path:c.path,secure:c.secure,domain:c.domain,expires:30}),!1})})},a.cookieBar=function(b){a("body").prepend('<div class="ui-widget"><div style="display: none;" class="cookie-message ui-widget-header blue"><p>By using this website you allow us to place cookies on your computer. They are harmless and never personally identify you.</p></div></div>'),a(".cookie-message").cookieBar(b)}}(jQuery), | ||
|
||
/*! | ||
* Dependancy: | ||
* jQuery Cookie Plugin | ||
* https://github.com/carhartl/jquery-cookie | ||
* | ||
* Copyright 2011, Klaus Hartl | ||
* Dual licensed under the MIT or GPL Version 2 licenses. | ||
* http://www.opensource.org/licenses/mit-license.php | ||
* http://www.opensource.org/licenses/GPL-2.0 | ||
*/ | ||
|
||
function(a){a.cookie=function(b,c,d){if(arguments.length>1&&(!/Object/.test(Object.prototype.toString.call(c))||null===c||void 0===c)){if(d=a.extend({},d),(null===c||void 0===c)&&(d.expires=-1),"number"==typeof d.expires){var e=d.expires,f=d.expires=new Date;f.setDate(f.getDate()+e)}return c=String(c),document.cookie=[encodeURIComponent(b),"=",d.raw?c:encodeURIComponent(c),d.expires?"; expires="+d.expires.toUTCString():"",d.path?"; path="+d.path:"",d.domain?"; domain="+d.domain:"",d.secure?"; secure":""].join("")}d=c||{};for(var g,h=d.raw?function(a){return a}:decodeURIComponent,i=document.cookie.split("; "),j=0;g=i[j]&&i[j].split("=");j++)if(h(g[0])===b)return h(g[1]||"");return null}}(jQuery); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
{ | ||
"name": "jquery.cookieBar", | ||
"filename": "jquery.cookieBar.min.js", | ||
"description": "A simple, lightweight jQuery plugin for creating a notification bar that is dismissable and dismiss is saved by cookie. Perfect for implementing the new eu cookielaw!", | ||
"version": "0.0.1", | ||
"homepage": "https://carlwoodhouse.github.io/jquery.cookieBar/", | ||
"author": { | ||
"name": "Carl Woodhouse", | ||
"url": "https://github.com/carlwoodhouse" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git@github.com:carlwoodhouse/jquery.cookieBar.git" | ||
}, | ||
"keywords": [ | ||
"jQuery plugin", | ||
"lightweight", | ||
"jquery.cookieBar", | ||
"cookieBar" | ||
], | ||
"license": "MIT", | ||
"autoupdate": { | ||
"source": "git", | ||
"target": "git://github.com/carlwoodhouse/jquery.cookieBar.git", | ||
"basePath": "", | ||
"files": [ | ||
"*cookieBar*" | ||
] | ||
} | ||
} |