├── .gitignore ├── assets ├── screenshot-1.png ├── screenshot-2.png ├── screenshot-3.png ├── screenshot-4.png ├── css │ └── admin.css ├── cookie-consent │ ├── cookieconsent.min.css │ └── cookieconsent.min.js └── js │ └── scripts.js ├── cookieconsent-wpplugin.code-workspace ├── .github ├── ISSUE_TEMPLATE │ ├── feature_request.md │ └── bug_report.md └── workflows │ └── codeql-analysis.yml ├── README.md ├── readme.txt └── osano-cookie-consent.php /.gitignore: -------------------------------------------------------------------------------- 1 | #FILES 2 | .DS_Store 3 | .idea 4 | .project 5 | .strong-pm 6 | .vscode 7 | .code-workspace 8 | -------------------------------------------------------------------------------- /assets/screenshot-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/osano/cookieconsent-wpplugin/HEAD/assets/screenshot-1.png -------------------------------------------------------------------------------- /assets/screenshot-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/osano/cookieconsent-wpplugin/HEAD/assets/screenshot-2.png -------------------------------------------------------------------------------- /assets/screenshot-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/osano/cookieconsent-wpplugin/HEAD/assets/screenshot-3.png -------------------------------------------------------------------------------- /assets/screenshot-4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/osano/cookieconsent-wpplugin/HEAD/assets/screenshot-4.png -------------------------------------------------------------------------------- /cookieconsent-wpplugin.code-workspace: -------------------------------------------------------------------------------- 1 | { 2 | "folders": [ 3 | { 4 | "path": "." 5 | } 6 | ], 7 | "settings": {} 8 | } -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Is your feature request related to a problem? Please describe.** 11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 12 | 13 | **Describe the solution you'd like** 14 | A clear and concise description of what you want to happen. 15 | 16 | **Describe alternatives you've considered** 17 | A clear and concise description of any alternative solutions or features you've considered. 18 | 19 | **Additional context** 20 | Add any other context or screenshots about the feature request here. 21 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Cookie Consent is designed to make it easy for you comply with the EU Cookie Law. 2 | 3 | The official Cookie Consent WordPress plugin has all the functionality [Cookie Consent configurator](https://cookieconsent.osano.com/download/ "Cookie Consent JS plugin page") on your own site's admin panel. 4 | In addition to that you can use custom code, to access the full functionality of Cookie Consent. 5 | 6 | ## Installation 7 | 8 | 1. Upload the plugin files to the `/wp-content/plugins/osano-cookie-consent` directory, or install the plugin through the WordPress plugins screen directly. 9 | 2. Activate the plugin through the 'Plugins' screen in WordPress. 10 | 3. Use the Settings->Cookieconsent to enable and configure the cookie consent popup. 11 | 12 | ## License 13 | 14 | Code released under the [MIT licence](http://opensource.org/licenses/MIT). 15 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Describe the bug** 11 | A clear and concise description of what the bug is. 12 | 13 | **To Reproduce** 14 | Steps to reproduce the behavior: 15 | 1. Go to '...' 16 | 2. Click on '....' 17 | 3. Scroll down to '....' 18 | 4. See error 19 | 20 | **Expected behavior** 21 | A clear and concise description of what you expected to happen. 22 | 23 | **Screenshots** 24 | If applicable, add screenshots to help explain your problem. 25 | 26 | **Desktop (please complete the following information):** 27 | - OS: [e.g. iOS] 28 | - Browser [e.g. chrome, safari] 29 | - Version [e.g. 22] 30 | 31 | **Smartphone (please complete the following information):** 32 | - Device: [e.g. iPhone6] 33 | - OS: [e.g. iOS8.1] 34 | - Browser [e.g. stock browser, safari] 35 | - Version [e.g. 22] 36 | 37 | **Additional context** 38 | Add any other context about the problem here. 39 | -------------------------------------------------------------------------------- /assets/css/admin.css: -------------------------------------------------------------------------------- 1 | .form-table { 2 | max-width: 600px; 3 | margin-bottom: 40px; 4 | } 5 | 6 | .form-table td { 7 | background: white; 8 | width: 50%; 9 | font-size: 15px; 10 | padding: 20px; 11 | vertical-align: top; 12 | line-height: 2; 13 | } 14 | 15 | .form-table th { 16 | padding: 30px 5px 5px 5px; 17 | } 18 | 19 | .choose-colours input[type=radio]+label { 20 | transition: all .3s ease-in-out; 21 | padding: 3px; 22 | margin-right: 3px; 23 | } 24 | 25 | .choose-colours input[type=radio]:checked+label, 26 | .choose-colours input[type=radio]:hover+label { 27 | border-bottom: 4px solid #c0c0c0; 28 | } 29 | 30 | .theme-preview-container { 31 | display: inline-block; 32 | height: 20px; 33 | width: 35px; 34 | padding: 5px; 35 | margin-top: 10px; 36 | } 37 | 38 | .theme-preview-button { 39 | height: 10px; 40 | width: 15px; 41 | margin-top: 10px; 42 | margin-left: 20px; 43 | } 44 | .input-hidden { 45 | position: absolute; 46 | left: -9999px; 47 | } 48 | 49 | .form-table textarea, .form-table input[type=text] { 50 | width: 100%; 51 | padding: 5px 10px; 52 | } -------------------------------------------------------------------------------- /.github/workflows/codeql-analysis.yml: -------------------------------------------------------------------------------- 1 | name: "Code scanning - action" 2 | 3 | on: 4 | push: 5 | branches: [master, ] 6 | pull_request: 7 | # The branches below must be a subset of the branches above 8 | branches: [master] 9 | schedule: 10 | - cron: '0 4 * * 4' 11 | 12 | jobs: 13 | CodeQL-Build: 14 | 15 | runs-on: ubuntu-latest 16 | 17 | steps: 18 | - name: Checkout repository 19 | uses: actions/checkout@v2 20 | with: 21 | # We must fetch at least the immediate parents so that if this is 22 | # a pull request then we can checkout the head. 23 | fetch-depth: 2 24 | 25 | # If this run was triggered by a pull request event, then checkout 26 | # the head of the pull request instead of the merge commit. 27 | - run: git checkout HEAD^2 28 | if: ${{ github.event_name == 'pull_request' }} 29 | 30 | # Initializes the CodeQL tools for scanning. 31 | - name: Initialize CodeQL 32 | uses: github/codeql-action/init@v1 33 | # Override language selection by uncommenting this and choosing your languages 34 | # with: 35 | # languages: go, javascript, csharp, python, cpp, java 36 | 37 | # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). 38 | # If this step fails, then you should remove it and run the build manually (see below) 39 | - name: Autobuild 40 | uses: github/codeql-action/autobuild@v1 41 | 42 | # ℹ️ Command-line programs to run using the OS shell. 43 | # 📚 https://git.io/JvXDl 44 | 45 | # ✏️ If the Autobuild fails above, remove it and uncomment the following three lines 46 | # and modify them (or add more) to build your code if your project 47 | # uses a compiled language 48 | 49 | #- run: | 50 | # make bootstrap 51 | # make release 52 | 53 | - name: Perform CodeQL Analysis 54 | uses: github/codeql-action/analyze@v1 55 | -------------------------------------------------------------------------------- /readme.txt: -------------------------------------------------------------------------------- 1 | === Osano Cookie Consent === 2 | Contributors: piupiiu 3 | Tags: cookie, cookieconsent, cookielaw, osano, silktide, insites 4 | Requires at least: 4.0 5 | Tested up to: 4.6.1 6 | Stable tag: trunk 7 | License: MIT 8 | License URI: https://opensource.org/licenses/MIT 9 | 10 | The official Cookie Consent WordPress plugin. Alerts users about the use of cookies on your website. 11 | 12 | == Description == 13 | 14 | Cookie Consent is designed to help you easily comply with the EU Cookie Law. 15 | 16 | The official Cookie Consent WordPress plugin has all the functionality [Cookie Consent configurator](https://cookieconsent.osano.com/download/ "Cookie Consent JS plugin page") on your own site's admin panel. 17 | In addition to that you can use custom code, to access the full functionality of Cookie Consent. 18 | 19 | Why choose Osano Cookie Consent? 20 | * Cookie Consent is the most popular Cookie plugin on the planet, it is seen over 2 BILLION times every month. 21 | * Official plugin uses that the latest version of [Cookie Consent](https://cookieconsent.osano.com/ "Cookie Consent JS plugin page"). 22 | * Only shows the banner in countries where you need it. 23 | * Super configurable. Choose your own colours, styles, type of compliance, text and more with a few clicks of the mouse. 24 | * The world’s most popular. Cookie Consent is seen over 2 billion times every month, across hundreds of thousands of websites. 25 | 26 | == Installation == 27 | 28 | 1. Upload the plugin files to the `/wp-content/plugins/osano-cookie-consent` directory, or install the plugin through the WordPress plugins screen directly. 29 | 1. Activate the plugin through the 'Plugins' screen in WordPress. 30 | 1. Use the Settings->Cookieconsent to enable and configure the cookie consent popup. 31 | 32 | == Screenshots == 33 | 34 | 1. Standard informational popup 35 | 2. Opt-out style popup with custom text 36 | 3. Configuration page 37 | 4. You can use custom attributes to get even more functionality 38 | -------------------------------------------------------------------------------- /assets/cookie-consent/cookieconsent.min.css: -------------------------------------------------------------------------------- 1 | .cc-window{opacity:1;transition:opacity 1s ease}.cc-window.cc-invisible{opacity:0}.cc-animate.cc-revoke{transition:transform 1s ease}.cc-animate.cc-revoke.cc-top{transform:translateY(-2em)}.cc-animate.cc-revoke.cc-bottom{transform:translateY(2em)}.cc-animate.cc-revoke.cc-active.cc-bottom,.cc-animate.cc-revoke.cc-active.cc-top,.cc-revoke:hover{transform:translateY(0)}.cc-grower{max-height:0;overflow:hidden;transition:max-height 1s} 2 | .cc-link,.cc-revoke:hover{text-decoration:underline}.cc-revoke,.cc-window{position:fixed;overflow:hidden;box-sizing:border-box;font-family:Helvetica,Calibri,Arial,sans-serif;font-size:16px;line-height:1.5em;display:-ms-flexbox;display:flex;-ms-flex-wrap:nowrap;flex-wrap:nowrap;z-index:9999}.cc-window.cc-static{position:static}.cc-window.cc-floating{padding:2em;max-width:24em;-ms-flex-direction:column;flex-direction:column}.cc-window.cc-banner{padding:1em 1.8em;width:100%;-ms-flex-direction:row;flex-direction:row}.cc-revoke{padding:.5em}.cc-header{font-size:18px;font-weight:700}.cc-btn,.cc-close,.cc-link,.cc-revoke{cursor:pointer}.cc-link{opacity:.8;display:inline-block;padding:.2em}.cc-link:hover{opacity:1}.cc-link:active,.cc-link:visited{color:initial}.cc-btn{display:block;padding:.4em .8em;font-size:.9em;font-weight:700;border-width:2px;border-style:solid;text-align:center;white-space:nowrap}.cc-banner .cc-btn:last-child{min-width:140px}.cc-highlight .cc-btn:first-child{background-color:transparent;border-color:transparent}.cc-highlight .cc-btn:first-child:hover{background-color:transparent;text-decoration:underline}.cc-close{display:block;position:absolute;top:.5em;right:.5em;font-size:1.6em;opacity:.9;line-height:.75}.cc-close:hover{opacity:1} 3 | .cc-revoke.cc-top{top:0;left:3em;border-bottom-left-radius:.5em;border-bottom-right-radius:.5em}.cc-revoke.cc-bottom{bottom:0;left:3em;border-top-left-radius:.5em;border-top-right-radius:.5em}.cc-revoke.cc-left{left:3em;right:unset}.cc-revoke.cc-right{right:3em;left:unset}.cc-top{top:1em}.cc-left{left:1em}.cc-right{right:1em}.cc-bottom{bottom:1em}.cc-floating>.cc-link{margin-bottom:1em}.cc-floating .cc-message{display:block;margin-bottom:1em}.cc-window.cc-floating .cc-compliance{-ms-flex:1;flex:1}.cc-window.cc-banner{-ms-flex-align:center;-ms-grid-row-align:center;align-items:center}.cc-banner.cc-top{left:0;right:0;top:0}.cc-banner.cc-bottom{left:0;right:0;bottom:0}.cc-banner .cc-message{-ms-flex:1;flex:1}.cc-compliance{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-line-pack:justify;align-content:space-between}.cc-compliance>.cc-btn{-ms-flex:1;flex:1}.cc-btn+.cc-btn{margin-left:.5em} 4 | @media print{.cc-revoke,.cc-window{display:none}}@media screen and (max-width:900px){.cc-btn{white-space:normal}}@media screen and (max-width:414px) and (orientation:portrait),screen and (max-width:736px) and (orientation:landscape){.cc-window.cc-top{top:0}.cc-window.cc-bottom{bottom:0}.cc-window.cc-banner,.cc-window.cc-left,.cc-window.cc-right{left:0;right:0}.cc-window.cc-banner{-ms-flex-direction:column;flex-direction:column}.cc-window.cc-banner .cc-compliance{-ms-flex:1;flex:1}.cc-window.cc-floating{max-width:none}.cc-window .cc-message{margin-bottom:1em}.cc-window.cc-banner{-ms-flex-align:unset;-ms-grid-row-align:unset;align-items:unset}} 5 | .cc-floating.cc-theme-classic{padding:1.2em;border-radius:5px}.cc-floating.cc-type-info.cc-theme-classic .cc-compliance{text-align:center;display:inline;-ms-flex:none;flex:none}.cc-theme-classic .cc-btn{border-radius:5px}.cc-theme-classic .cc-btn:last-child{min-width:140px}.cc-floating.cc-type-info.cc-theme-classic .cc-btn{display:inline-block} 6 | .cc-theme-edgeless.cc-window{padding:0}.cc-floating.cc-theme-edgeless .cc-message{margin:2em 2em 1.5em}.cc-banner.cc-theme-edgeless .cc-btn{margin:0;padding:.8em 1.8em;height:100%}.cc-banner.cc-theme-edgeless .cc-message{margin-left:1em}.cc-floating.cc-theme-edgeless .cc-btn+.cc-btn{margin-left:0} -------------------------------------------------------------------------------- /assets/js/scripts.js: -------------------------------------------------------------------------------- 1 | jQuery(function() { 2 | 3 | var form = document.getElementById('cc-options-form'); 4 | form.onchange = function () { update(); }; 5 | 6 | loadThemeSelector(selected); 7 | 8 | function update () { 9 | setCode(getOptions(getInputs(form))); 10 | updateForm(form); 11 | } 12 | 13 | function setCode (config) { 14 | optionsField = jQuery('#icc_popup_options'); 15 | if(typeof config != 'object') { 16 | optionsField.val('{'+config+'}'); 17 | } 18 | else { 19 | var code = JSON.stringify(config); 20 | optionsField.val(code); 21 | } 22 | } 23 | 24 | function getOptions(input) { 25 | if (input.custom) return input.custom; 26 | var content = {}; 27 | var options = {}; 28 | 29 | var t = input.text; 30 | //if (t.header) content.header = t.header; 31 | if (t.message) content.message = escapeHtml(t.message); 32 | if (t.dismiss) content.dismiss = escapeHtml(t.dismiss); 33 | if (t.allow) content.allow = escapeHtml(t.allow); 34 | if (t.deny) content.deny = escapeHtml(t.deny); 35 | if (t.link) content.link = escapeHtml(t.link); 36 | 37 | options.palette = getThemes()[input.theme]; 38 | 39 | if (input.layout == 'wire') { 40 | options.palette.button.border = options.palette.button.background; 41 | options.palette.button.background = 'transparent'; 42 | options.palette.button.text = options.palette.button.border; 43 | 44 | } 45 | 46 | //remove link if user didnt fill in field 47 | if(input.policy == 'policylink') { 48 | input.href ? content.href = input.href : options.showLink = false; 49 | } 50 | 51 | // only add if not default 52 | if(input.layout != 'block' && input.layout != 'wire') options.theme = input.layout; 53 | if(input.position != 'bottom') { 54 | if(input.position == 'top-push') { 55 | options.position = 'top'; 56 | options.static = true; 57 | } 58 | else options.position = input.position; 59 | } 60 | if(input.compliance != 'info') options.type = input.compliance; 61 | 62 | //if has any content, add content 63 | for(var key in content) { 64 | if (content.hasOwnProperty(key)) { 65 | options.content = content; 66 | break; 67 | } 68 | } 69 | 70 | return options; 71 | } 72 | 73 | function getInputs (elem) { 74 | return { 75 | text: { 76 | allow: elem.querySelector('[name="allow-text"]').value, 77 | link: elem.querySelector('[name="link-text"]').value, 78 | message: elem.querySelector('[name="message-text"]').value, 79 | deny: elem.querySelector('[name="deny-text"]').value, 80 | dismiss: elem.querySelector('[name="dismiss-text"]').value, 81 | }, 82 | href: elem.querySelector('[name="link-href"]').value, 83 | policy: elem.querySelectorAll('[name="policy"]:checked').item(0).value, 84 | position: elem.querySelectorAll('[name="choose-position"]:checked').item(0).value, 85 | layout: elem.querySelectorAll('[name="choose-layout"]:checked').item(0).value, 86 | theme: elem.querySelectorAll('[name="theme-selector"]:checked').item(0).value, 87 | compliance: elem.querySelectorAll('[name="choose-cookie-compliance"]:checked').item(0).value, 88 | custom: elem.querySelector('[name="custom-attributes"]').value 89 | } 90 | } 91 | 92 | function escapeHtml(html) { 93 | // let the spec decide how to escape the html 94 | var text = document.createTextNode(html); 95 | var div = document.createElement('div'); 96 | div.appendChild(text); 97 | return div.innerHTML; 98 | } 99 | 100 | function updateForm(form) { 101 | document.getElementById('text-policylink-container').style.display = (form.querySelectorAll('[name="policy"]:checked').item(0).value == 'policylink' && form.querySelector('[name="link-href"]').value == '') ? 'none' : 'inline'; 102 | document.getElementById('text-accept-container').style.display = form.querySelectorAll('[name="choose-cookie-compliance"]:checked').item(0).value != 'opt-in' ? 'none' : 'inline'; 103 | document.getElementById('text-deny-container').style.display = form.querySelectorAll('[name="choose-cookie-compliance"]:checked').item(0).value != 'opt-out' ? 'none' : 'inline'; 104 | } 105 | 106 | function loadThemeSelector(selected) { 107 | var themes = getThemes(); 108 | var container = jQuery('#choose-colours'); 109 | var isChecked = false; 110 | for (var key in themes) { 111 | var html = ''; 112 | var checked = ''; 113 | if (selected && selected == key) isChecked = false; 114 | if (!isChecked) { 115 | checked = 'checked'; 116 | isChecked = true; 117 | } 118 | var sel = getThemes()[key]; 119 | html += ''; 120 | html += ''; 122 | container.append(html); 123 | } 124 | } 125 | 126 | function getThemes() { 127 | return { 128 | theme1: {"popup": {"background": '#000'},"button": {"background": '#f1d600'}}, 129 | theme2: {"popup": {"background": "#eaf7f7", "text":"#5c7291"},"button":{"background": "#56cbdb", "text":"#ffffff"}}, 130 | theme3: {"popup": {"background": '#252e39'},"button": {"background": '#14a7d0'}}, 131 | theme4: {"popup": {"background": '#000', "text": '#0f0'},"button": {"background": '#0f0'}}, 132 | theme5: {"popup": {"background": '#3937a3'},"button": {"background": '#e62576'}}, 133 | theme6: {"popup": {"background":"#64386b","text":"#ffcdfd"},"button": {"background":"#f8a8ff","text":"#3f0045"}}, 134 | theme7: {"popup":{"background":"#237afc"},"button":{"background":"#fff","text":"#237afc"}}, 135 | theme8: {"popup":{"background":"#aa0000","text":"#ffdddd"},"button":{"background":"#ff0000"}}, 136 | theme9: {"popup":{"background":"#383b75"},"button":{"background":"#f1d600"}}, 137 | theme10: {"popup":{"background":"#1d8a8a"},"button":{"background":"#62ffaa"}}, 138 | theme11: {"popup":{"background":"#edeff5","text":"#838391"},"button":{"background":"#4b81e8"}}, 139 | theme12: {"popup":{"background":"#343c66","text":"#cfcfe8"},"button":{"background":"#f71559"}}, 140 | theme13: {"popup":{"background":"#216942","text":"#b2d192"},"button":{"background":"#afed71"}}, 141 | theme14: {"popup":{"background":"#3c404d","text":"#d6d6d6"},"button":{"background":"#8bed4f"}}, 142 | theme15: {"popup":{"background":"#eb6c44","text":"#ffffff"},"button":{"background":"#f5d948"}}, 143 | theme16: {"popup":{"background":"#efefef","text":"#404040"},"button":{"background":"#8ec760","text":"#ffffff"}} 144 | }; 145 | } 146 | 147 | update(); 148 | 149 | }); -------------------------------------------------------------------------------- /osano-cookie-consent.php: -------------------------------------------------------------------------------- 1 | window.cookieconsent.initialise('.$config.');'; 33 | } 34 | } 35 | add_action( 'wp_footer', 'icc_create_snippet' ); 36 | 37 | function icc_menu() { 38 | $page = add_options_page( 39 | 'Cookieconsent options', 40 | 'Cookieconsent', 41 | 'manage_options', 42 | 'icc-options', 43 | 'icc_options_page' 44 | ); 45 | add_action('admin_print_scripts-' . $page, 'icc_load_admin_scripts'); 46 | } 47 | add_action( 'admin_menu', 'icc_menu' ); 48 | 49 | function icc_load_admin_scripts() { 50 | $src = plugins_url( '/assets/js/scripts.js', __FILE__ ); 51 | wp_register_script( 'cookieconsent-admin-script', $src, array(), PLUGINVERSION ); 52 | wp_enqueue_script( 'cookieconsent-admin-script' ); 53 | $src2 = plugins_url( '/assets/css/admin.css', __FILE__ ); 54 | wp_register_style( 'cookieconsent-admin-style', $src2, array(), PLUGINVERSION ); 55 | wp_enqueue_style( 'cookieconsent-admin-style' ); 56 | } 57 | 58 | function icc_register_settings() { 59 | register_setting( 'icc-options', 'icc_popup_enabled' ); 60 | register_setting( 'icc-options', 'icc_popup_options' ); 61 | register_setting( 'icc-options', 'choose-position' ); 62 | register_setting( 'icc-options', 'choose-layout' ); 63 | register_setting( 'icc-options', 'theme-selector' ); 64 | register_setting( 'icc-options', 'policy' ); 65 | register_setting( 'icc-options', 'link-href' ); 66 | register_setting( 'icc-options', 'choose-cookie-compliance' ); 67 | register_setting( 'icc-options', 'message-text' ); 68 | register_setting( 'icc-options', 'dismiss-text' ); 69 | register_setting( 'icc-options', 'allow-text' ); 70 | register_setting( 'icc-options', 'link-text' ); 71 | register_setting( 'icc-options', 'deny-text' ); 72 | register_setting( 'icc-options', 'custom-attributes' ); 73 | } 74 | add_action( 'admin_init', 'icc_register_settings' ); 75 | 76 | function icc_options_page() { 77 | echo '
'; 78 | settings_fields( 'icc-options' ); 79 | do_settings_sections( 'icc-options' ); 80 | ?> 81 |
82 |

Cookieconsent options

83 |

Enable cookieconsent

84 | 85 | 86 | 87 | 88 | 89 | 90 |
/>
91 | 92 |

Customise you Cookie Consent window

93 | 94 | 95 | 96 | 100 | 101 | 105 | 106 | 107 | 108 | 112 | 116 | 117 | 118 | 119 | 123 | 124 | 125 | 126 | 133 | 134 | 135 | 136 | 142 | 143 | 144 | 145 | 148 | 149 | 150 | 154 | 158 | 159 | 160 | 161 | 171 | 172 |
1. Position
97 |
98 | >
99 |
102 | >
103 | > 104 |
2. Layout
109 |
110 | > 111 |
113 | >
114 | > 115 |
3. Palette
120 | 121 | 122 |
4. Learn more link
127 | 128 |
129 | > 130 |
131 | 132 |
5. Compliance type
137 |
138 | >
139 | >
140 |

For more information about compliance see documentation

141 |
6. Custom text

Message

146 | 147 |
151 |

Dismiss button text


152 |

Accept button text

153 |
155 |

Policy link text


156 |

Deny button text

157 |
Advanced: Custom attributes
162 | 163 | 164 |

This overwrites all other options.

165 |

List of available attributes can be found in Cookie Consent documentation.

166 |

167 | Example:
168 | palette:{popup:{background:"#fff"},button:{background:"#aa0000"}} 169 |

170 |
173 | 174 |
175 | '; 177 | } -------------------------------------------------------------------------------- /assets/cookie-consent/cookieconsent.min.js: -------------------------------------------------------------------------------- 1 | !function(e){if(!e.hasInitialised){var t={escapeRegExp:function(e){return e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")},hasClass:function(e,t){var i=" ";return 1===e.nodeType&&(i+e.className+i).replace(/[\n\t]/g,i).indexOf(i+t+i)>=0},addClass:function(e,t){e.className+=" "+t},removeClass:function(e,t){var i=new RegExp("\\b"+this.escapeRegExp(t)+"\\b");e.className=e.className.replace(i,"")},interpolateString:function(e,t){var i=/{{([a-z][a-z0-9\-_]*)}}/gi;return e.replace(i,function(e){return t(arguments[1])||""})},getCookie:function(e){var t="; "+document.cookie,i=t.split("; "+e+"=");return 2!=i.length?void 0:i.pop().split(";").shift()},setCookie:function(e,t,i,n,o){var s=new Date;s.setDate(s.getDate()+(i||365));var r=[e+"="+t,"expires="+s.toUTCString(),"path="+(o||"/")];n&&r.push("domain="+n),document.cookie=r.join(";")},deepExtend:function(e,t){for(var i in t)t.hasOwnProperty(i)&&(i in e&&this.isPlainObject(e[i])&&this.isPlainObject(t[i])?this.deepExtend(e[i],t[i]):e[i]=t[i]);return e},throttle:function(e,t){var i=!1;return function(){i||(e.apply(this,arguments),i=!0,setTimeout(function(){i=!1},t))}},hash:function(e){var t,i,n,o=0;if(0===e.length)return o;for(t=0,n=e.length;t=128?"#000":"#fff"},getLuminance:function(e){var t=parseInt(this.normaliseHex(e),16),i=38,n=(t>>16)+i,o=(t>>8&255)+i,s=(255&t)+i,r=(16777216+65536*(n<255?n<1?0:n:255)+256*(o<255?o<1?0:o:255)+(s<255?s<1?0:s:255)).toString(16).slice(1);return"#"+r},isMobile:function(){return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)},isPlainObject:function(e){return"object"==typeof e&&null!==e&&e.constructor==Object}};e.status={deny:"deny",allow:"allow",dismiss:"dismiss"},e.transitionEnd=function(){var e=document.createElement("div"),t={t:"transitionend",OT:"oTransitionEnd",msT:"MSTransitionEnd",MozT:"transitionend",WebkitT:"webkitTransitionEnd"};for(var i in t)if(t.hasOwnProperty(i)&&"undefined"!=typeof e.style[i+"ransition"])return t[i];return""}(),e.hasTransition=!!e.transitionEnd;var i=Object.keys(e.status).map(t.escapeRegExp);e.customStyles={},e.Popup=function(){function n(){this.initialise.apply(this,arguments)}function o(e){this.openingTimeout=null,t.removeClass(e,"cc-invisible")}function s(t){t.style.display="none",t.removeEventListener(e.transitionEnd,this.afterTransition),this.afterTransition=null}function r(){var t=this.options.onInitialise.bind(this);if(!window.navigator.cookieEnabled)return t(e.status.deny),!0;if(window.CookiesOK||window.navigator.CookiesOK)return t(e.status.allow),!0;var i=Object.keys(e.status),n=this.getStatus(),o=i.indexOf(n)>=0;return o&&t(n),o}function a(){var e=this.options.position.split("-"),t=[];return e.forEach(function(e){t.push("cc-"+e)}),t}function c(){var e=this.options,i="top"==e.position||"bottom"==e.position?"banner":"floating";t.isMobile()&&(i="floating");var n=["cc-"+i,"cc-type-"+e.type,"cc-theme-"+e.theme];e["static"]&&n.push("cc-static"),n.push.apply(n,a.call(this));p.call(this,this.options.palette);return this.customStyleSelector&&n.push(this.customStyleSelector),n}function l(){var e={},i=this.options;i.showLink||(i.elements.link="",i.elements.messagelink=i.elements.message),Object.keys(i.elements).forEach(function(n){e[n]=t.interpolateString(i.elements[n],function(e){var t=i.content[e];return e&&"string"==typeof t&&t.length?t:""})});var n=i.compliance[i.type];n||(n=i.compliance.info),e.compliance=t.interpolateString(n,function(t){return e[t]});var o=i.layouts[i.layout];return o||(o=i.layouts.basic),t.interpolateString(o,function(t){return e[t]})}function u(i){var n=this.options,o=document.createElement("div"),s=n.container&&1===n.container.nodeType?n.container:document.body;o.innerHTML=i;var r=o.children[0];return r.style.display="none",t.hasClass(r,"cc-window")&&e.hasTransition&&t.addClass(r,"cc-invisible"),this.onButtonClick=h.bind(this),r.addEventListener("click",this.onButtonClick),n.autoAttach&&(s.firstChild?s.insertBefore(r,s.firstChild):s.appendChild(r)),r}function h(n){var o=n.target;if(t.hasClass(o,"cc-btn")){var s=o.className.match(new RegExp("\\bcc-("+i.join("|")+")\\b")),r=s&&s[1]||!1;r&&(this.setStatus(r),this.close(!0))}t.hasClass(o,"cc-close")&&(this.setStatus(e.status.dismiss),this.close(!0)),t.hasClass(o,"cc-revoke")&&this.revokeChoice()}function p(e){var i=t.hash(JSON.stringify(e)),n="cc-color-override-"+i,o=t.isPlainObject(e);return this.customStyleSelector=o?n:null,o&&d(i,e,"."+n),o}function d(i,n,o){if(e.customStyles[i])return void++e.customStyles[i].references;var s={},r=n.popup,a=n.button,c=n.highlight;r&&(r.text=r.text?r.text:t.getContrast(r.background),r.link=r.link?r.link:r.text,s[o+".cc-window"]=["color: "+r.text,"background-color: "+r.background],s[o+".cc-revoke"]=["color: "+r.text,"background-color: "+r.background],s[o+" .cc-link,"+o+" .cc-link:active,"+o+" .cc-link:visited"]=["color: "+r.link],a&&(a.text=a.text?a.text:t.getContrast(a.background),a.border=a.border?a.border:"transparent",s[o+" .cc-btn"]=["color: "+a.text,"border-color: "+a.border,"background-color: "+a.background],"transparent"!=a.background&&(s[o+" .cc-btn:hover"]=["background-color: "+v(a.background)]),c?(c.text=c.text?c.text:t.getContrast(c.background),c.border=c.border?c.border:"transparent",s[o+" .cc-highlight .cc-btn:first-child"]=["color: "+c.text,"border-color: "+c.border,"background-color: "+c.background]):s[o+" .cc-highlight .cc-btn:first-child"]=["color: "+r.text]));var l=document.createElement("style");document.head.appendChild(l),e.customStyles[i]={references:1,element:l.sheet};var u=-1;for(var h in s)s.hasOwnProperty(h)&&l.sheet.insertRule(h+"{"+s[h].join(";")+"}",++u)}function v(e){return e=t.normaliseHex(e),"000000"==e?"#222":t.getLuminance(e)}function f(i){if(t.isPlainObject(i)){var n=t.hash(JSON.stringify(i)),o=e.customStyles[n];if(o&&!--o.references){var s=o.element.ownerNode;s&&s.parentNode&&s.parentNode.removeChild(s),e.customStyles[n]=null}}}function m(e,t){for(var i=0,n=e.length;i=0&&(this.dismissTimeout=window.setTimeout(function(){t(e.status.dismiss)},Math.floor(i)));var n=this.options.dismissOnScroll;if("number"==typeof n&&n>=0){var o=function(i){window.pageYOffset>Math.floor(n)&&(t(e.status.dismiss),window.removeEventListener("scroll",o),this.onWindowScroll=null)};this.onWindowScroll=o,window.addEventListener("scroll",o)}}function y(){if("info"!=this.options.type&&(this.options.revokable=!0),t.isMobile()&&(this.options.animateRevokable=!1),this.options.revokable){var e=a.call(this);this.options.animateRevokable&&e.push("cc-animate"),this.customStyleSelector&&e.push(this.customStyleSelector);var i=this.options.revokeBtn.replace("{{classes}}",e.join(" "));this.revokeBtn=u.call(this,i);var n=this.revokeBtn;if(this.options.animateRevokable){var o=t.throttle(function(e){var i=!1,o=20,s=window.innerHeight-20;t.hasClass(n,"cc-top")&&e.clientYs&&(i=!0),i?t.hasClass(n,"cc-active")||t.addClass(n,"cc-active"):t.hasClass(n,"cc-active")&&t.removeClass(n,"cc-active")},200);this.onMouseMove=o,window.addEventListener("mousemove",o)}}}var g={enabled:!0,container:null,cookie:{name:"cookieconsent_status",path:"/",domain:"",expiryDays:365},onPopupOpen:function(){},onPopupClose:function(){},onInitialise:function(e){},onStatusChange:function(e,t){},onRevokeChoice:function(){},content:{header:"Cookies used on the website!",message:"This website uses cookies to ensure you get the best experience on our website.",dismiss:"Got it!",allow:"Allow cookies",deny:"Decline",link:"Learn more",href:"http://cookiesandyou.com",close:"❌"},elements:{header:'{{header}} ',message:'{{message}}',messagelink:'{{message}} {{link}}',dismiss:'{{dismiss}}',allow:'{{allow}}',deny:'{{deny}}',link:'{{link}}',close:'{{close}}'},window:'',revokeBtn:'
Cookie Policy
',compliance:{info:'
{{dismiss}}
',"opt-in":'
{{dismiss}}{{allow}}
',"opt-out":'
{{deny}}{{dismiss}}
'},type:"info",layouts:{basic:"{{messagelink}}{{compliance}}","basic-close":"{{messagelink}}{{compliance}}{{close}}","basic-header":"{{header}}{{message}}{{link}}{{compliance}}"},layout:"basic",position:"bottom",theme:"block","static":!1,palette:null,revokable:!1,animateRevokable:!0,showLink:!0,dismissOnScroll:!1,dismissOnTimeout:!1,autoOpen:!0,autoAttach:!0,whitelistPage:[],blacklistPage:[],overrideHTML:null};return n.prototype.initialise=function(e){this.options&&this.destroy(),t.deepExtend(this.options={},g),t.isPlainObject(e)&&t.deepExtend(this.options,e),r.call(this)&&(this.options.enabled=!1),m(this.options.blacklistPage,location.pathname)&&(this.options.enabled=!1),m(this.options.whitelistPage,location.pathname)&&(this.options.enabled=!0);var i=this.options.window.replace("{{classes}}",c.call(this).join(" ")).replace("{{children}}",l.call(this)),n=this.options.overrideHTML;if("string"==typeof n&&n.length&&(i=n),this.options["static"]){var o=u.call(this,'
'+i+"
");o.style.display="",this.element=o.firstChild,this.element.style.display="none",t.addClass(this.element,"cc-invisible")}else this.element=u.call(this,i);b.call(this),y.call(this),this.options.autoOpen&&this.autoOpen()},n.prototype.destroy=function(){this.onButtonClick&&this.element&&(this.element.removeEventListener("click",this.onButtonClick),this.onButtonClick=null),this.dismissTimeout&&(clearTimeout(this.dismissTimeout),this.dismissTimeout=null),this.onWindowScroll&&(window.removeEventListener("scroll",this.onWindowScroll),this.onWindowScroll=null),this.onMouseMove&&(window.removeEventListener("mousemove",this.onMouseMove),this.onMouseMove=null),this.element&&this.element.parentNode&&this.element.parentNode.removeChild(this.element),this.element=null,this.revokeBtn&&this.revokeBtn.parentNode&&this.revokeBtn.parentNode.removeChild(this.revokeBtn),this.revokeBtn=null,f(this.options.palette),this.options=null},n.prototype.open=function(t){if(this.element)return this.isOpen()||(e.hasTransition?this.fadeIn():this.element.style.display="",this.options.revokable&&this.toggleRevokeButton(),this.options.onPopupOpen.call(this)),this},n.prototype.close=function(t){if(this.element)return this.isOpen()&&(e.hasTransition?this.fadeOut():this.element.style.display="none",t&&this.options.revokable&&this.toggleRevokeButton(!0),this.options.onPopupClose.call(this)),this},n.prototype.fadeIn=function(){var i=this.element;if(e.hasTransition&&i&&(this.afterTransition&&s.call(this,i),t.hasClass(i,"cc-invisible"))){if(i.style.display="",this.options["static"]){var n=this.element.clientHeight;this.element.parentNode.style.maxHeight=n+"px"}var r=20;this.openingTimeout=setTimeout(o.bind(this,i),r)}},n.prototype.fadeOut=function(){var i=this.element;e.hasTransition&&i&&(this.openingTimeout&&(clearTimeout(this.openingTimeout),o.bind(this,i)),t.hasClass(i,"cc-invisible")||(this.options["static"]&&(this.element.parentNode.style.maxHeight=""),this.afterTransition=s.bind(this,i),i.addEventListener(e.transitionEnd,this.afterTransition),t.addClass(i,"cc-invisible")))},n.prototype.isOpen=function(){return this.element&&""==this.element.style.display&&(!e.hasTransition||!t.hasClass(this.element,"cc-invisible"))},n.prototype.toggleRevokeButton=function(e){this.revokeBtn&&(this.revokeBtn.style.display=e?"":"none")},n.prototype.revokeChoice=function(e){this.options.enabled=!0,this.clearStatus(),this.options.onRevokeChoice.call(this),e||this.autoOpen()},n.prototype.hasAnswered=function(t){return Object.keys(e.status).indexOf(this.getStatus())>=0},n.prototype.hasConsented=function(t){var i=this.getStatus();return i==e.status.allow||i==e.status.dismiss},n.prototype.autoOpen=function(e){!this.hasAnswered()&&this.options.enabled&&this.open()},n.prototype.setStatus=function(i){var n=this.options.cookie,o=t.getCookie(n.name),s=Object.keys(e.status).indexOf(o)>=0;Object.keys(e.status).indexOf(i)>=0?(t.setCookie(n.name,i,n.expiryDays,n.domain,n.path),this.options.onStatusChange.call(this,i,s)):this.clearStatus()},n.prototype.getStatus=function(){return t.getCookie(this.options.cookie.name)},n.prototype.clearStatus=function(){var e=this.options.cookie;t.setCookie(e.name,"",-1,e.domain,e.path)},n}(),e.Location=function(){function e(e){t.deepExtend(this.options={},s),t.isPlainObject(e)&&t.deepExtend(this.options,e),this.currentServiceIndex=-1}function i(e,t,i){var n,o=document.createElement("script");o.type="text/"+(e.type||"javascript"),o.src=e.src||e,o.async=!1,o.onreadystatechange=o.onload=function(){var e=o.readyState;clearTimeout(n),t.done||e&&!/loaded|complete/.test(e)||(t.done=!0,t(),o.onreadystatechange=o.onload=null)},document.body.appendChild(o),n=setTimeout(function(){t.done=!0,t(),o.onreadystatechange=o.onload=null},i)}function n(e,t,i,n,o){var s=new(window.XMLHttpRequest||window.ActiveXObject)("MSXML2.XMLHTTP.3.0");if(s.open(n?"POST":"GET",e,1),s.setRequestHeader("X-Requested-With","XMLHttpRequest"),s.setRequestHeader("Content-type","application/x-www-form-urlencoded"),Array.isArray(o))for(var r=0,a=o.length;r3&&t(s)}),s.send(n)}function o(e){return new Error("Error ["+(e.code||"UNKNOWN")+"]: "+e.error)}var s={timeout:5e3,services:["freegeoip","ipinfo","maxmind"],serviceDefinitions:{freegeoip:function(){return{url:"//freegeoip.net/json/?callback={callback}",isScript:!0,callback:function(e,t){try{var i=JSON.parse(t);return i.error?o(i):{code:i.country_code}}catch(n){return o({error:"Invalid response ("+n+")"})}}}},ipinfo:function(){return{url:"//ipinfo.io",headers:["Accept: application/json"],callback:function(e,t){try{var i=JSON.parse(t);return i.error?o(i):{code:i.country}}catch(n){return o({error:"Invalid response ("+n+")"})}}}},ipinfodb:function(e){return{url:"//api.ipinfodb.com/v3/ip-country/?key={api_key}&format=json&callback={callback}",isScript:!0,callback:function(e,t){try{var i=JSON.parse(t);return"ERROR"==i.statusCode?o({error:i.statusMessage}):{code:i.countryCode}}catch(n){return o({error:"Invalid response ("+n+")"})}}}},maxmind:function(){return{url:"//js.maxmind.com/js/apis/geoip2/v2.1/geoip2.js",isScript:!0,callback:function(e){return window.geoip2?void geoip2.country(function(t){e({code:t.country.iso_code})},function(t){e(o(t))}):void e(new Error("Unexpected response format. The downloaded script should have exported `geoip2` to the global scope"))}}}}};return e.prototype.getNextService=function(){var e;do e=this.getServiceByIdx(++this.currentServiceIndex);while(!e);return e},e.prototype.getServiceByIdx=function(e){var i=this.options.services[e];if("function"==typeof i){var n=i();return n.name&&t.deepExtend(n,this.options.serviceDefinitions[n.name](n)),n}return"string"==typeof i?this.options.serviceDefinitions[i]():t.isPlainObject(i)?this.options.serviceDefinitions[i.name](i):null},e.prototype.locate=function(e,t){var i=this.getNextService();return i?(this.callbackComplete=e,this.callbackError=t,void this.runService(i,this.runNextServiceOnError.bind(this))):void t(new Error("No services to run"))},e.prototype.setupUrl=function(e){var t=this.getCurrentServiceOpts();return e.url.replace(/\{(.*?)\}/g,function(i,n){if("callback"===n){var o="callback"+Date.now();return window[o]=function(t){e.__JSONP_DATA=JSON.stringify(t)},o}if(n in t.interpolateUrl)return t.interpolateUrl[n]})},e.prototype.runService=function(e,t){var o=this;if(e&&e.url&&e.callback){var s=e.isScript?i:n,r=this.setupUrl(e);s(r,function(i){var n=i?i.responseText:"";e.__JSONP_DATA&&(n=e.__JSONP_DATA,delete e.__JSONP_DATA),o.runServiceCallback.call(o,t,e,n)},this.options.timeout,e.data,e.headers)}},e.prototype.runServiceCallback=function(e,t,i){var n=this,o=function(t){s||n.onServiceResult.call(n,e,t)},s=t.callback(o,i);s&&this.onServiceResult.call(this,e,s)},e.prototype.onServiceResult=function(e,t){t instanceof Error||t&&t.error?e.call(this,t,null):e.call(this,null,t)},e.prototype.runNextServiceOnError=function(e,t){if(e){this.logError(e);var i=this.getNextService();i?this.runService(i,this.runNextServiceOnError.bind(this)):this.completeService.call(this,this.callbackError,new Error("All services failed"))}else this.completeService.call(this,this.callbackComplete,t)},e.prototype.getCurrentServiceOpts=function(){var e=this.options.services[this.currentServiceIndex];return"string"==typeof e?{name:e}:"function"==typeof e?e():t.isPlainObject(e)?e:{}},e.prototype.completeService=function(e,t){this.currentServiceIndex=-1,e&&e(t)},e.prototype.logError=function(e){var t=this.currentServiceIndex,i=this.getServiceByIdx(t);console.error("The service["+t+"] ("+i.url+") responded with the following error",e)},e}(),e.Law=function(){function e(e){this.initialise.apply(this,arguments)}var i={regionalLaw:!0,hasLaw:["AT","BE","BG","HR","CZ","CY","DK","EE","FI","FR","DE","EL","HU","IE","IT","LV","LT","LU","MT","NL","PL","PT","SK","SI","ES","SE","GB","UK"],revokable:["HR","CY","DK","EE","FR","DE","LV","LT","NL","PT","ES"],explicitAction:["HR","IT","ES"]};return e.prototype.initialise=function(e){t.deepExtend(this.options={},i),t.isPlainObject(e)&&t.deepExtend(this.options,e)},e.prototype.get=function(e){var t=this.options;return{hasLaw:t.hasLaw.indexOf(e)>=0,revokable:t.revokable.indexOf(e)>=0,explicitAction:t.explicitAction.indexOf(e)>=0}},e.prototype.applyLaw=function(e,t){var i=this.get(t);return i.hasLaw||(e.enabled=!1),this.options.regionalLaw&&(i.revokable&&(e.revokable=!0),i.explicitAction&&(e.dismissOnScroll=!1,e.dismissOnTimeout=!1)),e},e}(),e.initialise=function(t,i,n){var o=new e.Law(t.law);i||(i=function(){}),n||(n=function(){}),e.getCountryCode(t,function(n){delete t.law,delete t.location,n.code&&(t=o.applyLaw(t,n.code)),i(new e.Popup(t))},function(i){delete t.law,delete t.location,n(i,new e.Popup(t))})},e.getCountryCode=function(t,i,n){if(t.law&&t.law.countryCode)return void i({code:t.law.countryCode});if(t.location){var o=new e.Location(t.location);return void o.locate(function(e){i(e||{})},n)}i({})},e.utils=t,e.hasInitialised=!0,window.cookieconsent=e}}(window.cookieconsent||{}); --------------------------------------------------------------------------------