cookiechoices
for bootstrap 2.3.2
by toubia95
HTML
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/twitter-bootstrap/2.3.2/css/bootstrap-combined.min.css">
CSS
/* https://www.cookiechoices.org/ */
/* http://getbootstrap.com/2.3.2/ */
/* http://www.bootstrapcdn.com/#legacy_tab */
JavaScript
/*
Copyright 2014 Google Inc. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Adaptation du script https://www.cookiechoices.org/
pour le framework http://getbootstrap.com/2.3.2/
par Gilles TOUBIANA ([email protected])
le 8/01/2015
*/
(function (window) {
if ( !! window.cookieChoices) {
return window.cookieChoices;
}
var document = window.document;
// IE8 does not support textContent, so we should fallback to innerText.
var supportsTextContent = 'textContent' in document.body;
var cookieChoices = (function () {
// Bootstrap styles
var butterBarClass = "well well-small navbar-fixed-bottom";
var dismissLinkClass = "btn btn-mini btn-danger pull-right";
var dialogClass = "well";
// CookieChoices ID
var cookieName = 'displayCookieConsent';
var cookieConsentId = 'cookieChoiceInfo';
var dismissLinkId = 'cookieChoiceDismiss';
function _createHeaderElement(cookieText, dismissText, linkText, linkHref) {
// styles de la barre
var butterBarStyles = 'border-radius: 0;margin: 0;';
var cookieConsentElement = document.createElement('div');
cookieConsentElement.id = cookieConsentId;
cookieConsentElement.style.cssText = butterBarStyles;
cookieConsentElement.className = butterBarClass;
cookieConsentElement.appendChild(_createDismissLink(dismissText));
...