Permalink
Browse files

V2.0

Newer & groovier!
  • Loading branch information...
1 parent 69e972a commit 296e8fd50223b1bca42e572b60c3bd734e0edad1 @michaelw90 committed May 5, 2012
Showing with 250 additions and 99 deletions.
  1. +27 −4 README.md
  2. +0 −75 demo.html
  3. +148 −0 index.html
  4. +74 −19 src/cprompt.js
  5. +1 −1 src/cprompt.min.js
View
31 README.md
@@ -1,11 +1,34 @@
cPrompt
=======
-A simple drop-in JS script that will prompt your users to allow cookies on your site. As per the new EU law released on the 26th May.
-
-**A brain child of @panda_doodle, with @michaelw90 coding it.**
+Starting on May 26th 2011 sites for any organisation based within the UK (even if their site is hosted overseas) must seek consent to store cookies on a user's computer, or device. Failure to comply could result in a fine up to £500,000.
Demo
=====
-A demo can be seen [here](http://michaelwright.me/cPrompt).
+A live demo can be seen [here](http://michaelwright.me/cPrompt), with some extra implementation information.
+
+Who's behind it?
+===============
+- [@michaelw90](http://twitter.com/michaelw90) - Coding
+- [@panda_doodle](http://twitter.com/panda_doodle) - Idea & design.
+
+FAQs
+====
+
+**Q. Does this protect me &amp; my site against the law?**<br />
+*A. The requisites of every site differ, this is only a javascript solution, the cookie that is set can be accessed in server side code. If using this code, you need to ensure that it covers your site, however every effort has been taken to try to make this as compliant as possible.*
+
+**Q. Can I set a 'Cookie Policy' URL for my visitors to read? I hear the law stipulates that I should have one.**<br />
+*A. You can use the following chunk of code to set a cookie policy URL that will appear in the prompts:*
+
+`cPrompt.cookieLink = 'http://mycookiepolicy.com/me.html';`
+
+**Q. What if the user has javascript disabled?**<br />
+*A. You could revert to a server side fallback, so that you are absolutely definitely covered.*
+
+**Q. I'm being fined, I'm going to sue you 'cause you got me fined!**<br />
+*A. Well, this is a very dickish thing to do. By you using this you accept that it doesn't necessarily provide full protection &amp; that you will ensure your own site protects you. Even from bears!*
+
+**Q. This is pretty awesome, can I thank you?**<br />
+*A. Why not watch the code, follow me on Twitter, or simply share this! All of these are a sign of thanks, and make me feel warm &amp; fuzzy inside.*
View
75 demo.html
@@ -1,75 +0,0 @@
-<!doctype html>
-<html>
-<head>
- <style>
- body {
- margin: 0;
- padding: 0;
- }
- h1 {
- background: #800000;
- font-size: 50px;
- margin: 0;
- padding: 20px 50px;
- color: #FFF;
- font-family: "Times New Roman";
- }
- p {
- padding: 0 20px;
- font-family: verdana;
- font-size: 16px;
- line-height: 150%;
- }
- pre.code {
- margin: 0 100px;
- background: #DEDEDE;
- font-family: courier;
- font-size: 12px;
- padding: 5px;
- }
- span.code {
- background: #DEDEDE;
- font-size: 12px;
- font-family: courier;
- }
- </style>
- <meta charset="utf-8">
- <title>Test Cookie Script</title>
- <script src='./src/cprompt.min.js'></script>
-</head>
-<body>
- <a href="http://github.com/michaelw90/cPrompt"><img style="position: absolute; top: 0; right: 0; border: 0;" src="https://a248.e.akamai.net/camo.github.com/30f550e0d38ceb6ef5b81500c64d970b7fb0f028/687474703a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f6f72616e67655f6666373630302e706e67" alt="Fork me on GitHub"></a>
- <h1>cPrompt</h1>
-
- <p>
- The idea is simple, a piece of JavaScript that can be thrown into any page, that can be used to automatically show the above banner to new visitors to check that you are allowed to store cookies.<br />
- The ability is then in place so that you can simply check that this cookie is set by calling the following line which will return a boolean depending on whether you're able to set cookies or not:
- </p>
- <pre class='code'>cPrompt.checkCookie()</pre>
-
- <p>
- Using it around Google Analytics is as simple as doing this:
-<pre class='code'>
-if(cPrompt.checkCookie()){
- /**
- Google Analytics Code Here
- **/
-}
-</pre>
- </p>
-
- <p>
- <strong>Note:</strong> This will display on every page load for the user, and doesn't make use of the clause within the law that allows you to assume acceptance if the user ignores the notice.
- </p>
- <p>
- <script>
- if(cPrompt.checkCookie()){
- document.write('You can see this as you have accepted the cookie saving feature!');
- }else{
- document.write('You can see this as you have <strong>not</strong> yet accepted the cookie saving feature');
- }
- </script>
- <p>
-</body>
-
-</html>
View
148 index.html
@@ -0,0 +1,148 @@
+<!doctype html>
+<html>
+<head>
+ <style>
+ body {
+ margin: 0;
+ padding: 0;
+ }
+ h1 {
+ background: #800000;
+ font-size: 50px;
+ margin: 0;
+ padding: 20px 50px;
+ color: #FFF;
+ font-family: "Times New Roman";
+ }
+ p {
+ padding: 0 20px;
+ }
+ p, li, ul, ol {
+ font-family: verdana;
+ font-size: 16px;
+ line-height: 150%;
+ text-align: justify;
+ }
+ li {
+ margin-left: 25px;
+ }
+ pre.code {
+ margin: 0 100px;
+ background: #DEDEDE;
+ font-family: courier;
+ font-size: 12px;
+ padding: 5px;
+ }
+ span.code {
+ background: #DEDEDE;
+ font-size: 12px;
+ font-family: courier;
+ }
+ .footer {
+ font-size: 12px;
+ }
+ .subfooter {
+ clear: both;
+ font-size: 8px;
+ }
+ .image {
+ float: right;
+ margin: 10px 20px 10px 20px;
+ padding: 5px;
+ background: #FFF;
+ border: 1px solid #CCC;
+ }
+ .image img {
+ border: 2px solid #FFF;
+ }
+ .image .caption {
+ font-style: italic;
+ display: block;
+ text-align: center;
+ font-size: 11px;
+ }
+ </style>
+ <script type="text/javascript">
+
+ var _gaq = _gaq || [];
+ _gaq.push(['_setAccount', 'UA-29511072-1']);
+ _gaq.push(['_trackPageview']);
+
+ (function() {
+ var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
+ ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
+ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
+ })();
+
+ </script>
+ <meta charset="utf-8">
+ <title>Simple EU Cookie Law Permission Prompt - Michael Wright</title>
+ <script src='./src/cprompt.min.js'>
+ /**
+ Simple Cookie Prompt
+ Idea: @panda_doodle - Coded: @michaelw90
+ **/
+ </script>
+
+</head>
+<body>
+ <h1>
+ Simple Cookie Prompt
+ </h1>
+ <a href="http://github.com/michaelw90/cPrompt"><img style="position: absolute; top: 0; right: 0; border: 0;" src="https://a248.e.akamai.net/camo.github.com/30f550e0d38ceb6ef5b81500c64d970b7fb0f028/687474703a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f6f72616e67655f6666373630302e706e67" alt="Fork me on GitHub"></a>
+ <p>
+ Starting on May 26th 2011 sites for any organisation based within the UK (even if their site is hosted overseas) must seek consent to store cookies on a user's computer, or device. Failure to comply could result in a fine up to &pound;500,000.
+ </p>
+ <p>
+ The idea is simple, a piece of JavaScript that can be thrown into any page, that can be used to automatically show the above banner to new visitors to check that you are allowed to store cookies.<br />
+ The ability is then in place so that you can simply check what stage of cookies have been accepted with the following line:
+ </p>
+ <pre class='code'>cPrompt.checkCookie()</pre>
+
+ <div class='image'>
+ <img src='http://placekitten.com/g/350/290' />
+ <span class='caption'>It's a known fact that kittens love cookies!</span>
+ </div>
+ <ol start='0'>There are 4 possible returned values:
+ <li>The user has actively opted out of all cookies on the site. <em>Shows the red notification.</em></li>
+ <li>The user has seen a warning about cookies, but neither accepted nor declined, this is classed as inferred acception. <em>Shows the blue notification</em></li>
+ <li>The user has accepted all cookies to the site. <em>Shows the green notification.</em></li>
+ <li> The user's first visit to the site, no cookies accepted or declined. <em>Shows the yellow notifcation</em></li>
+ </ol>
+
+ <p>
+ You should only store/use cookies if the above returns either <strong>1</strong> or <strong>2</strong>.
+ </p>
+
+ <p>
+ The user is able to close the prompt that appears, and by them doing so it will show an icon in the bottom left hand corner of the page that they can click on for more information.
+ </p>
+ <p>
+ Using it around any block of code that stores cookies is as simple as doing this:
+<pre class='code'>
+if(cPrompt.checkCookie() == 1 || cPrompt.checkCookie() == 2){
+ /**
+ Cookie Storing Code Here
+ **/
+}
+</pre>
+ </p>
+
+ <p>
+ There is an option to specify a URL to a cookie policy on your site, this can be done by using the following line of code:
+ </p>
+ <pre class='code'>cPrompt.cookieLink = 'http://mycookiepolicy.com/me.html';</pre>
+
+ <p style='float: left;' class='footer'>
+ Handcrafted by <a href='http://twitter.com/michaelw90'>@michaelw90</a> &amp; dreamt up by <a href='http://twitter.com/panda_doole'>@panda_doodle</a>
+ </p>
+ <div style='float: right; margin: 10px;'>
+ <a href="https://twitter.com/share" data-url="http://michaelwright.me/cPrompt" data-text="A simple, and effective cookie opt in system for the new EU Cookie law" class="twitter-share-button" data-via="michaelw90" data-lang="en" data-related="michaelw90">Tweet</a>
+ <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
+ </div>
+ <p class='subfooter'>
+ Before using this script please ensure that it covers all of your site's requisites in terms of law compliance. I don't accept any responsibility if you get fined, eaten, attacked or bitten by the ICO or anyone else (including bears).
+ </p>
+</body>
+
+</html>
View
93 src/cprompt.js
@@ -6,37 +6,92 @@ var cPrompt = {
cookie: false,
+ n: 3,
+
+ cookieLink: '',
+
+ prompts: [],
+
+ p: null,
+
init: function(){
- if(!this.checkCookie()){
- this.loadPrompt();
+ this.prompts = [
+ ['background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAUCAIAAAAY12rUAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyBpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMC1jMDYwIDYxLjEzNDc3NywgMjAxMC8wMi8xMi0xNzozMjowMCAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYW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BSZElH/4iKmU2debNSOZJTaSNTEWe1LYtgNhEDDYcEb5z58wJ//AHurzFv3//AUaRr9nzcMV5UAL/3/+zMjJ+XffAexJ4fOXP7PmsRbnMf64ev1HeCzWVE884Ni8GuQ1Rl5eSkxh1tECOhkgwAA7U9lztkN0jwAAAABJRU5ErkJggg==) no-repeat 8px center; color: #f02932; background-color: #f9e5e6; padding: 6px 10px 10px 40px;', "Opting out or refusing to accept cookies may cause this website to function incorrectly. <label for='cPrompt_check'>To accept cookies please tick this box</label><input type='checkbox' style='position: relative; top: 3px;' id='cPrompt_check' onclick='cPrompt.doClick(1);'>"],
+
+ ['background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAIAAABvFaqvAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyBpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMC1jMDYwIDYxLjEzNDc3NywgMjAxMC8wMi8xMi0xNzozMjowMCAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhv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hzPUSg8YTcSbwsTIGGylA8/MTMjlXryDISdx7gIm92g7A3VJEZxFLTDt7bxw+xre+AbqdzdSQytYGLHWIk/efjx958ndF+8+IWUgYJpSEhcyVZEBBjDhwh8TvPzw5e//f1KCfPiVAQQYAGqD6SyKz14dAAAAAElFTkSuQmCC) no-repeat 8px center; color: #5694b1; border-color: #9ac9df; background-color: #d8ecf5; padding: 10px 10px 10px 40px;', "Some of these cookies are essential to make our site work and have already been set. " + (this.cookieLink != ''? "You can find out how and why we use cookies in our <a style='color: #5694b1; font-weight: bold;' href='" + this.cookieLink + "'>cookie policy</a>." : '') + "<br /><label for='cPrompt_check'>To accept cookies please tick this box</label><input type='checkbox' style='position: relative; top: 3px;' id='cPrompt_check' onclick='cPrompt.doClick(1);'>"],
+
+ ['background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAAZCAIAAACza+nDAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyBpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMC1jMDYwIDYxLjEzNDc3NywgMjAxMC8wMi8xMi0xNzozMjowMCAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9i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rNVRsxYUUHz27BAwSiNeBIQGMvZ8/vwCdD0wJyEHy4+dnJNt+f73/5AIw9jWUrIHxc/fhGSCDnZULGKrAqIOL335wAiVIgMEa5F4JjO65q3KBrtJQtgYygFHy+88vR4t4iLiDRby1cdj+EwsR2l6/fcjOyv3n328gGxh0oCjhFPj77y/QuPuPL7CxcUBsu/XgJMK2Dx+fA50BRDzcwsCUKSIkKyIoC9QGlAKmmPPXtgPTOjDdAhM90BRZSW2oNqAGVQULNUVzCVEVtODW13QFBvL3n1++//oiL6MvKiQvI64O1aYqb2ZtEoE1loAJwN0uEz3jwNMISbmbiYEsMDS0AQsCJiYWYEYkSRsjsJwEljnA0ookbQABBgCiHi0T7EeNbwAAAABJRU5ErkJggg==) no-repeat 10px center; color: #91a44d; border-color: #c2d288; background-color: #e3ebc6; padding: 10px 10px 10px 40px;', "Thank you, cookies have been accepted. You can opt out of this at any time by <a style='color: #91a44d; font-weight: bold;' href='javascript: void(0);' onclick='cPrompt.doClick(0);'>clicking here</a>."],
+
+ ['background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAUCAIAAAAY12rUAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyBpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMC1jMDYwIDYxLjEzNDc3NywgMjAxMC8wMi8xMi0xNzozMjowMCAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwO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7sQqy9Y2ARZeRSZmDmwJ1pYUmCCR/nf3x8xlfJL+wirpQspxQgpJ2BNCkB/IAwCBhuuKP//7yfUyX9/YE8Kd+b//fMZGkbAdIwryoEW/v39mYmF8/OL/VgVAE15d3u2qGYR489Ppx4cisCa6okHig4bQV5jZuGhxBQOAR2gkwECDAApyuQsTTT/JwAAAABJRU5ErkJggg==) no-repeat 8px center; color: #d9b31f; border-color: #f5dc7d; background-color: #fcf7d9; padding: 6px 10px 10px 40px;', "This site uses cookies to store information on your computer. " + (this.cookieLink != ''? "To find out how we use them please <a style='color: #d9b31f; font-weight: bold;' href='" + this.cookieLink + "'>click here</a>." : '') + "<br /><input type='checkbox' onclick='cPrompt.doClick(1);' style='position: relative; top: 3px;' id='cPrompt_check'> <label for='cPrompt_check'>I accept cookies from this site.</label>"]
+ ];
+ this.loadPrompt(this.checkCookie());
+ this.p = document.getElementById('cookie_prompt_' + this.n);
+ if(document.cookie.match(/cPrompt_hide=/)){
+ this.hidePrompt(null);
}
},
-
checkCookie: function(){
- if(document.cookie.match(/cPrompt_useCookies=1/)){
- this.cookie = true;
+ if(this.cookie === false){
+ if(!document.cookie.match(/cPrompt_useCookies=/)){
+ this.cookie = 3;
+ }else if(document.cookie.match(/cPrompt_useCookies=(\d)($|;)/)){
+ this.cookie = parseInt(RegExp.$1);
+ }
}
return this.cookie;
},
- loadPrompt: function(){
- var holder = document.createElement('div');
- holder.innerHTML = "<div style='margin: 10px;'>This site would like to place cookies on your computer to help make this website better. To find out more about cookies, visit <a href='http://en.wikipedia.org/wiki/HTTP_cookie' style='color: #FFF;'>Wikipedia</a>.<br /><input type='checkbox' onclick='cPrompt.clickEvent(this);' id='cPrompt_check'> <label for='cPrompt_check'>I accept cookies from this site.</label></div>"
- holder.style.cssText = 'background: #000; position: absolute; width: 100%; color: #FFF; font-family: verdana; font-size: 11px; opacity: 0.85';
- holder.id = 'cPrompt_Holder';
- var b = document.getElementsByTagName('body')[0];
- b.insertBefore(holder, b.firstChild);
+ loadPrompt: function(n){
+ if(n == 3){
+ this.saveCookie('useCookies', 1);
+ }
+ if(n > 3 || n < 0){
+ console.log('Error: Undefined num (' + n + ')');
+ }else{
+ this.n = n;
+ var h = document.createElement('div');
+ with(h){
+ innerHTML = this.prompts[n][1] + "<a style='float: right; font-weight: bold;' onclick='cPrompt.hidePrompt(event)'>X</a>";
+ style.cssText = 'font-family: sans-serif; font-size: 11px; border: solid 1px; border-left: solid 3px;' + this.prompts[n][0];
+ className = 'cookie_box';
+ id = 'cookie_prompt_' + n;
+ }
+ var b = document.body;
+ b.insertBefore(h, b.firstChild);
+ }
+ },
+
+ saveCookie: function(c, v){
+ document.cookie = "cPrompt_" + c + "=" + v + ";expires=" + (new Date()).toGMTString().replace(/\d{4}/, '2050');
},
- saveCookie: function(){
- document.cookie = "cPrompt_useCookies=1;expires=" + (new Date()).toGMTString().replace(/\d{4}/, '2050');
+ hidePrompt: function(e){
+ this.saveCookie('hide', 1);
+ if(e != null){
+ e.stopPropagation();
+ }
+ var h = this.p;
+ with(h){
+ style.cssText = this.prompts[this.n][0] + 'width: 0; background-position: 3px center; padding: 15px; border: 1px solid; font-family: sans-serif; font-size: 11px;';
+ innerHTML = '';
+ h.onclick = function(){
+ cPrompt.reshow();
+ }
+ }
+ document.body.appendChild(h);
},
- clickEvent: function(obj){
- if(obj.checked){
- this.saveCookie();
- document.getElementById('cPrompt_Holder').style.display = 'none';
+ reshow: function(){
+ with(this.p){
+ style.cssText = 'font-family: sans-serif; font-size: 11px; border: solid 1px; border-left: solid 3px;' + this.prompts[this.n][0];
+ innerHTML = this.prompts[this.n][1] + "<a style='float: right; font-weight: bold;' onclick='cPrompt.hidePrompt(event)'>X</a>";
}
+ },
+
+ doClick: function(type){
+ this.saveCookie('useCookies', (type == 0? 0 : 2));
+ this.p.style.display = 'none';
+ location.reload(true);
}
}
if(document.addEventListener){
@@ -49,4 +104,4 @@ if(document.addEventListener){
cPrompt.init();
}
});
-}
+};
View
2 src/cprompt.min.js
@@ -2,4 +2,4 @@
Simple Cookie Prompt
Idea: @panda_doodle - Coded: @michaelw90
**/
-var cPrompt={cookie:false,init:function(){if(!this.checkCookie()){this.loadPrompt()}},checkCookie:function(){if(document.cookie.match(/cPrompt_useCookies=1/)){this.cookie=true}return this.cookie},loadPrompt:function(){var a=document.createElement("div");a.innerHTML="<div style='margin: 10px;'>This site would like to place cookies on your computer to help make this website better. To find out more about cookies, visit <a href='http://en.wikipedia.org/wiki/HTTP_cookie' style='color: #FFF;'>Wikipedia</a>.<br /><input type='checkbox' onclick='cPrompt.clickEvent(this);' id='cPrompt_check'> <label for='cPrompt_check'>I accept cookies from this site.</label></div>";a.style.cssText="background: #000; position: absolute; width: 100%; color: #FFF; font-family: verdana; font-size: 11px; opacity: 0.85";a.id="cPrompt_Holder";var b=document.getElementsByTagName("body")[0];b.insertBefore(a,b.firstChild)},saveCookie:function(){document.cookie="cPrompt_useCookies=1;expires="+(new Date).toGMTString().replace(/\d{4}/,"2050")},clickEvent:function(a){if(a.checked){this.saveCookie();document.getElementById("cPrompt_Holder").style.display="none"}}};if(document.addEventListener){document.addEventListener("DOMContentLoaded",function(){cPrompt.init()},false)}else if(document.attachEvent){document.attachEvent("onreadystatechange",function(){if(document.readyState==="complete"){cPrompt.init()}})}
+var cPrompt={cookie:false,n:-1,cookieLink:"",prompts:[],p:null,init:function(){this.prompts=[["background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAUCAIAAAAY12rUAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyBpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMC1jMDYwIDYxLjEzNDc3NywgMjAxM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P6IM+rNsJZ6w+Hf33p9dewgb9P/5iz+rNxBIXAuXYiYFdIN+L1gMTDUE0jowKSxbic8geJQTBEBX/3/2HIdBf/+BAhLN8mfQnPj/6XNUk/78mjoLWYAFIbVtBzAg0W1esfrfkycMv/7+PXYMPdRPnv534SKTgT6Ki4CBBwxCrL5gFBRiUpJn5ODEkoemz4UnBSZElH/4iKmU2debNSOZJTaSNTEWe1LYtgNhEDDYcEb5z58wJ//AHurzFv3//AUaRr9nzcMV5UAL/3/+zMjJ+XffAexJ4fOXP7PmsRbnMf64ev1HeCzWVE884Ni8GuQ1Rl5eSkxh1tECOhkgwAA7U9lztkN0jwAAAABJRU5ErkJggg==) no-repeat 8px center; color: #f02932; background-color: #f9e5e6; padding: 6px 10px 10px 40px;","Opting out or refusing to accept cookies may cause this website to function incorrectly. <label for='cPrompt_check'>To accept cookies please tick this box</label><input type='checkbox' style='position: relative; top: 3px;' id='cPrompt_check' onclick='cPrompt.doClick(1);'>"],["background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAIAAABvFaqvAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyBpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMC1jMDYwIDYxLjEzNDc3NywgMjAxMC8wMi8xMi0xNzozMjowMCAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xL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ff/yKPymwAIMAlxwwjIwUpYCMw9cf4E9i3OxsTMCsyM/NgT1PiQnygK25/uQVHlOAJgD9Dop+DSlRrCo42FghDB6gWmZmXAapSwpD05GhkiRWFVcfvdxz8Q4wuTpoKwLdhssgI2VpRO5fefTy1ccvGUgH8qICyc4miLzmpq/Czc5KqikcrCz+ZloomVaQhzPUSg8YTcSbwsTIGGylA8/MTMjlXryDISdx7gIm92g7A3VJEZxFLTDt7bxw+xre+AbqdzdSQytYGLHWIk/efjx958ndF+8+IWUgYJpSEhcyVZEBBjDhwh8TvPzw5e//f1KCfPiVAQQYAGqD6SyKz14dAAAAAElFTkSuQmCC) no-repeat 8px center; color: #5694b1; border-color: #9ac9df; background-color: #d8ecf5; padding: 10px 10px 10px 40px;","Some of these cookies are essential to make our site work and have already been set. "+(this.cookieLink!=""?"You can find out how and why we use cookies in our <a style='color: #5694b1; font-weight: bold;' href='"+this.cookieLink+"'>cookie policy</a>.":"")+"<br /><label for='cPrompt_check'>To accept cookies please tick this box</label><input type='checkbox' style='position: relative; top: 3px;' id='cPrompt_check' onclick='cPrompt.doClick(1);'>"],["background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAAZCAIAAACza+nDAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyBpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMC1jMDYwIDYxLjEzNDc3NywgMjAxMC8wMi8xMi0xNzozMjowMCAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlw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uDYuDj5DbU8FGb2jZ1YI8kuZ6foCGV++f3z/8Zm6kiVc3NIwCBoBMN8x7zu+ACgR4Fp64/6J63eOABnPX99hYWI9c3kLMzMbRBzocxYWDoRtrCzsRMY1MxMzQhvQr06WCdqqtht2d0uIKLnbpgMZH7+8efHmnomuD1zc2zGfmZmVceISX6DrNVRsxYUUHz27BAwSiNeBIQGMvZ8/vwCdD0wJyEHy4+dnJNt+f73/5AIw9jWUrIHxc/fhGSCDnZULGKrAqIOL335wAiVIgMEa5F4JjO65q3KBrtJQtgYygFHy+88vR4t4iLiDRby1cdj+EwsR2l6/fcjOyv3n328gGxh0oCjhFPj77y/QuPuPL7CxcUBsu/XgJMK2Dx+fA50BRDzcwsCUKSIkKyIoC9QGlAKmmPPXtgPTOjDdAhM90BRZSW2oNqAGVQULNUVzCVEVtODW13QFBvL3n1++//oiL6MvKiQvI64O1aYqb2ZtEoE1loAJwN0uEz3jwNMISbmbiYEsMDS0AQsCJiYWYEYkSRsjsJwEljnA0ookbQABBgCiHi0T7EeNbwAAAABJRU5ErkJggg==) no-repeat 10px center; color: #91a44d; border-color: #c2d288; background-color: #e3ebc6; padding: 10px 10px 10px 40px;","Thank you, cookies have been accepted. You can opt out of this at any time by <a style='color: #91a44d; font-weight: bold;' href='javascript: void(0);' onclick='cPrompt.doClick(0);'>clicking here</a>."],["background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAUCAIAAAAY12rUAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyBpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMC1jMDYwIDYxLjEzNDc3NywgMjAxMC8wMi8xMi0xN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/v8lyqAPD5bhCYtfX+5+erabsEG/v7/48Ggt/iTz/t4izKSAbtC7uwuAqQa/QaCk8GAZPoPgUU4QAF39+9tTHAb9/wsKSLQQ+fYM6gpUbUBXv7k1A1mEBc76+HQ7MCDRbX648ve3Jwz/fn95fQxNCpj7vr+7wClkgOIiYOC9v7sQqy9Y2ARZeRSZmDmwJ1pYUmCCR/nf3x8xlfJL+wirpQspxQgpJ2BNCkB/IAwCBhuuKP//7yfUyX9/YE8Kd+b//fMZGkbAdIwryoEW/v39mYmF8/OL/VgVAE15d3u2qGYR489Ppx4cisCa6okHig4bQV5jZuGhxBQOAR2gkwECDAApyuQsTTT/JwAAAABJRU5ErkJggg==) no-repeat 8px center; color: #d9b31f; border-color: #f5dc7d; background-color: #fcf7d9; padding: 6px 10px 10px 40px;","This site uses cookies to store information on your computer. "+(this.cookieLink!=""?"To find out how we use them please <a style='color: #d9b31f; font-weight: bold;' href='"+this.cookieLink+"'>click here</a>.":"")+"<br /><input type='checkbox' onclick='cPrompt.doClick(1);' style='position: relative; top: 3px;' id='cPrompt_check'> <label for='cPrompt_check'>I accept cookies from this site.</label>"]];this.loadPrompt(this.checkCookie());this.p=document.getElementById("cookie_prompt_"+this.n);if(document.cookie.match(/cPrompt_hide=/)){this.hidePrompt(null)}},checkCookie:function(){if(this.cookie===false){if(!document.cookie.match(/cPrompt_useCookies=/)){this.cookie=3}else if(document.cookie.match(/cPrompt_useCookies=(\d)($|;)/)){this.cookie=parseInt(RegExp.$1)}}return this.cookie},loadPrompt:function(n){if(n==3){this.saveCookie("useCookies",1)}if(n>3||n<0){console.log("Error: Undefined num ("+n+")")}else{this.n=n;var h=document.createElement("div");with(h){innerHTML=this.prompts[n][1]+"<a style='float: right; font-weight: bold;' onclick='cPrompt.hidePrompt(event)'>X</a>";style.cssText="font-family: sans-serif; font-size: 11px; border: solid 1px; border-left: solid 3px;"+this.prompts[n][0];className="cookie_box";id="cookie_prompt_"+n}var b=document.body;b.insertBefore(h,b.firstChild)}},saveCookie:function(a,b){document.cookie="cPrompt_"+a+"="+b+";expires="+(new Date).toGMTString().replace(/\d{4}/,"2050")},hidePrompt:function(e){this.saveCookie("hide",1);if(e!=null){e.stopPropagation()}var h=this.p;with(h){style.cssText=this.prompts[this.n][0]+"width: 0; background-position: 3px center; padding: 15px; border: 1px solid; font-family: sans-serif; font-size: 11px;";innerHTML="";h.onclick=function(){cPrompt.reshow()}}document.body.appendChild(h)},reshow:function(){with(this.p){style.cssText="font-family: sans-serif; font-size: 11px; border: solid 1px; border-left: solid 3px;"+this.prompts[this.n][0];innerHTML=this.prompts[this.n][1]+"<a style='float: right; font-weight: bold;' onclick='cPrompt.hidePrompt(event)'>X</a>"}},doClick:function(a){this.saveCookie("useCookies",a==0?0:2);this.p.style.display="none";location.reload(true)}};if(document.addEventListener){document.addEventListener("DOMContentLoaded",function(){cPrompt.init()},false)}else if(document.attachEvent){document.attachEvent("onreadystatechange",function(){if(document.readyState==="complete"){cPrompt.init()}})}

0 comments on commit 296e8fd

Please sign in to comment.