jumbo-jekyll-theme 5.6.9.4 → 5.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/LICENSE.txt +202 -21
- data/README.md +10 -10
- data/_config.yml +146 -213
- data/_data/footer.yml +31 -33
- data/_data/nav.yml +73 -17
- data/_data/picture.yml +136 -0
- data/_data/settings.yml +97 -103
- data/_data/tags.yml +11 -11
- data/_data/universal_nav.yml +22 -0
- data/_includes/blog/authors_posts.html +37 -0
- data/_includes/blog/blog_filler_element.html +21 -0
- data/_includes/blog/display_blog_posts.html +126 -0
- data/_includes/{disqus-comments.html → blog/disqus_comments.html} +0 -0
- data/_includes/{latest-posts.html → blog/latest_posts.html} +0 -0
- data/_includes/blog/pagination.html +37 -0
- data/_includes/{post-series.html → blog/post_series.html} +0 -0
- data/_includes/blog/post_sidebar.html +81 -0
- data/_includes/{post-tags.html → blog/post_tags.html} +0 -0
- data/_includes/{read_time.html → blog/read_time.html} +0 -0
- data/_includes/components/breadcrumb.html +40 -0
- data/_includes/{carousel-header.html → components/carousel_header.html} +0 -0
- data/_includes/components/cookie_manager.html +80 -0
- data/_includes/components/css.html +8 -0
- data/_includes/{github-edit.html → components/github_edit.html} +0 -0
- data/_includes/components/head.html +60 -0
- data/_includes/components/http2.html +57 -0
- data/_includes/components/javascript.html +10 -0
- data/_includes/components/jumbotron.html +80 -0
- data/_includes/{linaro-404.html → components/linaro_404.html} +16 -19
- data/_includes/{schema.html → components/schema.html} +43 -43
- data/_includes/{sidebar.html → components/sidebar.html} +0 -0
- data/_includes/examples/custom_include.html +10 -0
- data/_includes/{custom_include_row.html → examples/custom_include_row.html} +562 -562
- data/_includes/flow/blocks.html +44 -0
- data/_includes/{core → flow}/button.html +5 -5
- data/_includes/flow/buttons.html +5 -0
- data/_includes/{core → flow}/call-to-action-banner.html +0 -0
- data/_includes/flow/container_row.html +11 -0
- data/_includes/flow/feature_block.html +41 -0
- data/_includes/flow/flow_inner.html +25 -0
- data/_includes/{core → flow}/full_width_row.html +5 -5
- data/_includes/{core → flow}/members-section.html +24 -32
- data/_includes/{core → flow}/slider.html +25 -33
- data/_includes/flow/slider_row.html +3 -0
- data/_includes/flow/tabbed_content.html +21 -0
- data/_includes/flow/text.html +3 -0
- data/_includes/flow/title.html +3 -0
- data/_includes/footer/footer.html +73 -0
- data/_includes/image.html +5 -6
- data/_includes/js_bundles/app.html +5 -0
- data/_includes/js_bundles/vendor.html +13 -0
- data/_includes/nav/brand.html +3 -0
- data/_includes/nav/nav.html +133 -0
- data/_includes/nav/universal_nav.html +36 -0
- data/_includes/{social-media-icons.html → social_media_icons.html} +0 -0
- data/_includes/youtube.html +74 -6
- data/_layouts/author.html +62 -6
- data/_layouts/base.html +6 -8
- data/_layouts/default.html +3 -3
- data/_layouts/error.html +25 -25
- data/_layouts/flow.html +33 -36
- data/_layouts/post-index.html +17 -16
- data/_layouts/post.html +55 -39
- data/_sass/app/blog.scss +0 -22
- data/_sass/app/overrides.scss +121 -66
- data/_sass/app/search.scss +51 -51
- data/_sass/blog.scss +1 -1
- data/_sass/bootstrap/_alert.scss +51 -0
- data/_sass/bootstrap/_badge.scss +47 -0
- data/_sass/bootstrap/_breadcrumb.scss +41 -0
- data/_sass/bootstrap/_button-group.scss +172 -0
- data/_sass/bootstrap/_buttons.scss +75 -100
- data/_sass/bootstrap/_card.scss +301 -0
- data/_sass/bootstrap/_carousel.scss +161 -195
- data/_sass/bootstrap/_close.scss +15 -16
- data/_sass/bootstrap/_code.scss +15 -36
- data/_sass/bootstrap/_custom-forms.scss +433 -0
- data/_sass/bootstrap/_dropdown.scss +166 -0
- data/_sass/bootstrap/_forms.scss +213 -497
- data/_sass/bootstrap/_functions.scss +86 -0
- data/_sass/bootstrap/_grid.scss +29 -61
- data/_sass/bootstrap/_images.scss +42 -0
- data/_sass/bootstrap/_input-group.scss +173 -0
- data/_sass/bootstrap/_jumbotron.scss +9 -47
- data/_sass/bootstrap/_list-group.scss +64 -79
- data/_sass/bootstrap/_media.scss +3 -61
- data/_sass/bootstrap/_mixins.scss +19 -18
- data/_sass/bootstrap/_modal.scss +180 -0
- data/_sass/bootstrap/_nav.scss +118 -0
- data/_sass/bootstrap/_navbar.scss +192 -555
- data/_sass/bootstrap/_pagination.scss +59 -70
- data/_sass/bootstrap/_popover.scss +183 -0
- data/_sass/bootstrap/_print.scss +89 -49
- data/_sass/bootstrap/_progress.scss +34 -0
- data/_sass/bootstrap/_reboot.scss +483 -0
- data/_sass/bootstrap/_root.scss +19 -0
- data/_sass/bootstrap/_tables.scss +119 -166
- data/_sass/bootstrap/_tooltip.scss +93 -79
- data/_sass/bootstrap/_transitions.scss +22 -0
- data/_sass/bootstrap/_type.scss +66 -239
- data/_sass/bootstrap/_utilities.scss +15 -55
- data/_sass/bootstrap/_variables.scss +952 -932
- data/_sass/bootstrap/bootstrap-grid.scss +32 -0
- data/_sass/bootstrap/bootstrap-reboot.scss +12 -0
- data/_sass/bootstrap/bootstrap.scss +42 -0
- data/_sass/bootstrap/mixins/_alert.scss +13 -0
- data/_sass/bootstrap/mixins/_background-variant.scss +14 -5
- data/_sass/bootstrap/mixins/_badge.scss +12 -0
- data/_sass/bootstrap/mixins/_border-radius.scss +25 -8
- data/_sass/bootstrap/mixins/_box-shadow.scss +5 -0
- data/_sass/bootstrap/mixins/_breakpoints.scss +123 -0
- data/_sass/bootstrap/mixins/_buttons.scss +84 -40
- data/_sass/bootstrap/mixins/_caret.scss +66 -0
- data/_sass/bootstrap/mixins/_clearfix.scss +3 -18
- data/_sass/bootstrap/mixins/_float.scss +11 -0
- data/_sass/bootstrap/mixins/_forms.scss +125 -66
- data/_sass/bootstrap/mixins/_gradients.scss +17 -30
- data/_sass/bootstrap/mixins/_grid-framework.scss +52 -66
- data/_sass/bootstrap/mixins/_grid.scss +37 -107
- data/_sass/bootstrap/mixins/_hover.scss +37 -0
- data/_sass/bootstrap/mixins/_image.scss +18 -15
- data/_sass/bootstrap/mixins/_list-group.scss +10 -21
- data/_sass/bootstrap/mixins/_lists.scss +7 -0
- data/_sass/bootstrap/mixins/_nav-divider.scss +4 -4
- data/_sass/bootstrap/mixins/_pagination.scss +10 -12
- data/_sass/bootstrap/mixins/_reset-text.scss +7 -8
- data/_sass/bootstrap/mixins/_resize.scss +1 -1
- data/_sass/bootstrap/mixins/_screen-reader.scss +33 -0
- data/_sass/bootstrap/mixins/_size.scss +1 -5
- data/_sass/bootstrap/mixins/_table-row.scss +16 -14
- data/_sass/bootstrap/mixins/_text-emphasis.scss +7 -5
- data/_sass/bootstrap/mixins/_text-hide.scss +13 -0
- data/_sass/bootstrap/mixins/{_text-overflow.scss → _text-truncate.scss} +2 -2
- data/_sass/bootstrap/mixins/_transition.scss +13 -0
- data/_sass/bootstrap/mixins/_visibility.scss +7 -0
- data/_sass/bootstrap/utilities/_align.scss +8 -0
- data/_sass/bootstrap/utilities/_background.scss +19 -0
- data/_sass/bootstrap/utilities/_borders.scss +59 -0
- data/_sass/bootstrap/utilities/_clearfix.scss +3 -0
- data/_sass/bootstrap/utilities/_display.scss +38 -0
- data/_sass/bootstrap/{_responsive-embed.scss → utilities/_embed.scss} +26 -9
- data/_sass/bootstrap/utilities/_flex.scss +51 -0
- data/_sass/bootstrap/utilities/_float.scss +9 -0
- data/_sass/bootstrap/utilities/_position.scss +37 -0
- data/_sass/bootstrap/utilities/_screenreaders.scss +11 -0
- data/_sass/bootstrap/utilities/_shadows.scss +6 -0
- data/_sass/bootstrap/utilities/_sizing.scss +12 -0
- data/_sass/bootstrap/utilities/_spacing.scss +51 -0
- data/_sass/bootstrap/utilities/_text.scss +58 -0
- data/_sass/bootstrap/utilities/_visibility.scss +11 -0
- data/_sass/core.scss +15 -20
- data/_sass/core/blog.scss +126 -426
- data/_sass/core/breadcrumb.scss +16 -96
- data/_sass/core/carousel-header.scss +91 -91
- data/_sass/core/carousel.scss +7 -8
- data/_sass/core/cookies.scss +194 -0
- data/_sass/core/error.scss +190 -190
- data/_sass/core/flow.scss +71 -186
- data/_sass/core/fontello.scss +156 -0
- data/_sass/core/footer.scss +69 -142
- data/_sass/core/jumbotron.scss +90 -279
- data/_sass/core/navbar.scss +233 -0
- data/_sass/core/normalize.scss +357 -357
- data/_sass/core/theme.scss +40 -918
- data/assets/css/main-blog.scss +15 -14
- data/assets/css/main-error.scss +14 -13
- data/assets/css/main-search.scss +4 -3
- data/assets/css/main.scss +12 -11
- data/assets/fonts/fontello/fontello.eot +0 -0
- data/assets/fonts/fontello/fontello.svg +82 -0
- data/assets/fonts/fontello/fontello.ttf +0 -0
- data/assets/fonts/fontello/fontello.woff +0 -0
- data/assets/fonts/fontello/fontello.woff2 +0 -0
- data/assets/fonts/{lato-regular → lato}/LICENSE.txt +0 -0
- data/assets/fonts/{lato-regular → lato}/Lato-regular.eot +0 -0
- data/assets/fonts/{lato-regular → lato}/Lato-regular.svg +0 -0
- data/assets/fonts/{lato-regular → lato}/Lato-regular.ttf +0 -0
- data/assets/fonts/{lato-regular → lato}/Lato-regular.woff +0 -0
- data/assets/fonts/{lato-regular → lato}/Lato-regular.woff2 +0 -0
- data/assets/images/clipboard.svg +3 -0
- data/assets/js/app/main.js +298 -261
- data/assets/js/app/scroll-to-anchors.js +10 -9
- data/assets/js/app/sticky-tab-bar.js +67 -69
- data/assets/js/bootstrap.js.map +1 -0
- data/assets/js/popper.min.js.map +1 -0
- data/assets/js/vendor/_popper.js +5 -0
- data/assets/js/vendor/bootstrap.js +5 -2376
- data/assets/js/vendor/fess-ss.min.js +24 -24
- data/assets/js/vendor/jquery.cookie.js +120 -0
- data/assets/js/vendor/jquery.ihavecookies.js +263 -0
- data/assets/js/vendor/jquery.slim.js +8842 -0
- data/robots.txt +9 -9
- metadata +157 -377
- data/_data/example-carousel-data-source.yml +0 -36
- data/_data/members-section-example.yml +0 -0
- data/_data/universal-nav.yml +0 -7
- data/_includes/authors-posts.html +0 -18
- data/_includes/blog-filler-element.html +0 -24
- data/_includes/breadcrumb.html +0 -97
- data/_includes/core/blocks.html +0 -30
- data/_includes/core/buttons.html +0 -5
- data/_includes/core/container_row.html +0 -7
- data/_includes/core/feature_block.html +0 -43
- data/_includes/core/slider_row.html +0 -3
- data/_includes/core/text.html +0 -3
- data/_includes/core/title.html +0 -3
- data/_includes/core/youtube_video_embed.html +0 -11
- data/_includes/css.html +0 -9
- data/_includes/custom_include.html +0 -13
- data/_includes/display-blog-posts.html +0 -154
- data/_includes/flow_inner.html +0 -19
- data/_includes/footer.html +0 -68
- data/_includes/google-analytics.html +0 -16
- data/_includes/head.html +0 -19
- data/_includes/http2.html +0 -102
- data/_includes/javascript.html +0 -10
- data/_includes/jumbotron.html +0 -115
- data/_includes/linaro-svg.html +0 -1
- data/_includes/nav.html +0 -153
- data/_includes/pagination.html +0 -39
- data/_includes/post-sidebar.html +0 -182
- data/_includes/responsive-image.html +0 -6
- data/_includes/thumb-image.html +0 -31
- data/_includes/thumb.html +0 -2
- data/_includes/thumbnail_image.html +0 -10
- data/_includes/universal-nav.html +0 -30
- data/_layouts/jumbotron-container.html +0 -19
- data/_layouts/jumbotron.html +0 -12
- data/_layouts/redirect.html +0 -11
- data/_sass/_bootstrap-compass.scss +0 -9
- data/_sass/_bootstrap-mincer.scss +0 -19
- data/_sass/_bootstrap-sprockets.scss +0 -9
- data/_sass/_bootstrap.scss +0 -56
- data/_sass/app-package.scss +0 -11
- data/_sass/app/contact.scss +0 -3
- data/_sass/app/custom.scss +0 -1
- data/_sass/bootstrap/_alerts.scss +0 -73
- data/_sass/bootstrap/_badges.scss +0 -68
- data/_sass/bootstrap/_breadcrumbs.scss +0 -28
- data/_sass/bootstrap/_button-groups.scss +0 -244
- data/_sass/bootstrap/_component-animations.scss +0 -37
- data/_sass/bootstrap/_dropdowns.scss +0 -216
- data/_sass/bootstrap/_glyphicons.scss +0 -307
- data/_sass/bootstrap/_input-groups.scss +0 -171
- data/_sass/bootstrap/_labels.scss +0 -66
- data/_sass/bootstrap/_modals.scss +0 -150
- data/_sass/bootstrap/_navs.scss +0 -242
- data/_sass/bootstrap/_normalize.scss +0 -424
- data/_sass/bootstrap/_pager.scss +0 -54
- data/_sass/bootstrap/_panels.scss +0 -271
- data/_sass/bootstrap/_popovers.scss +0 -131
- data/_sass/bootstrap/_progress-bars.scss +0 -87
- data/_sass/bootstrap/_responsive-utilities.scss +0 -179
- data/_sass/bootstrap/_scaffolding.scss +0 -161
- data/_sass/bootstrap/_theme.scss +0 -291
- data/_sass/bootstrap/_thumbnails.scss +0 -38
- data/_sass/bootstrap/_wells.scss +0 -29
- data/_sass/bootstrap/mixins/_alerts.scss +0 -14
- data/_sass/bootstrap/mixins/_center-block.scss +0 -7
- data/_sass/bootstrap/mixins/_hide-text.scss +0 -21
- data/_sass/bootstrap/mixins/_labels.scss +0 -12
- data/_sass/bootstrap/mixins/_nav-vertical-align.scss +0 -9
- data/_sass/bootstrap/mixins/_opacity.scss +0 -8
- data/_sass/bootstrap/mixins/_panels.scss +0 -24
- data/_sass/bootstrap/mixins/_progress-bar.scss +0 -10
- data/_sass/bootstrap/mixins/_reset-filter.scss +0 -8
- data/_sass/bootstrap/mixins/_responsive-visibility.scss +0 -21
- data/_sass/bootstrap/mixins/_tab-focus.scss +0 -9
- data/_sass/bootstrap/mixins/_vendor-prefixes.scss +0 -222
- data/_sass/core/animations.scss +0 -125
- data/_sass/core/cookieconsent.scss +0 -39
- data/_sass/core/critical.scss +0 -0
- data/_sass/core/custom.scss +0 -3
- data/_sass/core/fa.scss +0 -2336
- data/_sass/core/flipclock.scss +0 -434
- data/_sass/core/fly.scss +0 -10
- data/_sass/core/font-awesome.min.scss +0 -4
- data/_sass/core/fonts.scss +0 -3
- data/_sass/core/forms.scss +0 -3
- data/_sass/core/homepage.scss +0 -19
- data/_sass/core/lightbox.scss +0 -212
- data/_sass/core/nav.scss +0 -1015
- data/_sass/core/social-media-icons.scss +0 -67
- data/_sass/core/tables.scss +0 -175
- data/_sass/core/triangle-divider.scss +0 -27
- data/_sass/core/universal-nav.scss +0 -167
- data/_sass/core/youtube-lazy.scss +0 -51
- data/_sass/core/youtube.scss +0 -65
- data/_sass/home.scss +0 -2
- data/assets/fonts/fontawesome-webfont.eot +0 -0
- data/assets/fonts/fontawesome-webfont.svg +0 -2671
- data/assets/fonts/fontawesome-webfont.ttf +0 -0
- data/assets/fonts/fontawesome-webfont.woff +0 -0
- data/assets/fonts/fontawesome-webfont.woff2 +0 -0
- data/assets/fonts/fontello.eot +0 -0
- data/assets/fonts/fontello.svg +0 -44
- data/assets/fonts/glyphicons-halflings-regular.ttf +0 -0
- data/assets/fonts/glyphicons-halflings-regular.woff +0 -0
- data/assets/fonts/glyphicons-halflings-regular.woff2 +0 -0
- data/assets/images/Linaro-Logo_light.png +0 -0
- data/assets/images/content/background-image1.jpg +0 -0
- data/assets/images/content/background-image2.png +0 -0
- data/assets/images/content/background-image3.jpg +0 -0
- data/assets/images/content/js-logo.png +0 -0
- data/assets/js/app/blog-comments.js +0 -50
- data/assets/js/app/facebook.js +0 -8
- data/assets/js/app/fly.js +0 -45
- data/assets/js/app/search.js +0 -29
- data/assets/js/app/youtube-lazy.js +0 -25
- data/assets/js/pacakge-search.js +0 -9
- data/assets/js/package-blog.js +0 -12
- data/assets/js/package-extended.js +0 -14
- data/assets/js/package-home.js +0 -14
- data/assets/js/package-main.js +0 -13
- data/assets/js/package-search.js +0 -8
- data/assets/js/vendor/cookieconsent.js +0 -1495
|
Binary file
|
|
Binary file
|
|
Binary file
|
data/assets/fonts/fontello.eot
DELETED
|
Binary file
|
data/assets/fonts/fontello.svg
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" standalone="no"?>
|
|
2
|
-
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
|
3
|
-
<svg xmlns="http://www.w3.org/2000/svg">
|
|
4
|
-
<metadata>Copyright (C) 2017 by original authors @ fontello.com</metadata>
|
|
5
|
-
<defs>
|
|
6
|
-
<font id="fontello" horiz-adv-x="1000" >
|
|
7
|
-
<font-face font-family="fontello" font-weight="400" font-stretch="normal" units-per-em="1000" ascent="850" descent="-150" />
|
|
8
|
-
<missing-glyph horiz-adv-x="1000" />
|
|
9
|
-
<glyph glyph-name="retweet" unicode="" d="M714 11q0-7-5-13t-13-5h-535q-5 0-8 1t-5 4-3 4-2 7 0 6v335h-107q-15 0-25 11t-11 25q0 13 8 23l179 214q11 12 27 12t28-12l178-214q9-10 9-23 0-15-11-25t-25-11h-107v-214h321q9 0 14-6l89-108q4-5 4-11z m357 232q0-13-8-23l-178-214q-12-13-28-13t-27 13l-179 214q-8 10-8 23 0 14 11 25t25 11h107v214h-322q-9 0-14 7l-89 107q-4 5-4 11 0 7 5 12t13 6h536q4 0 7-1t5-4 3-5 2-6 1-7v-334h107q14 0 25-11t10-25z" horiz-adv-x="1071.4" />
|
|
10
|
-
|
|
11
|
-
<glyph glyph-name="twitter" unicode="" d="M904 622q-37-54-90-93 0-8 0-23 0-73-21-145t-64-139-103-117-144-82-181-30q-151 0-276 81 19-2 43-2 126 0 224 77-59 1-105 36t-64 89q19-3 34-3 24 0 48 6-63 13-104 62t-41 115v2q38-21 82-23-37 25-59 64t-22 86q0 49 25 91 68-83 164-133t208-55q-5 21-5 41 0 75 53 127t127 53q79 0 132-57 61 12 115 44-21-64-80-100 52 6 104 28z" horiz-adv-x="928.6" />
|
|
12
|
-
|
|
13
|
-
<glyph glyph-name="facebook" unicode="" d="M535 843v-147h-87q-48 0-65-20t-17-60v-106h164l-22-165h-142v-424h-171v424h-142v165h142v122q0 104 58 161t155 57q82 0 127-7z" horiz-adv-x="571.4" />
|
|
14
|
-
|
|
15
|
-
<glyph glyph-name="github-circled" unicode="" d="M429 779q116 0 215-58t156-156 57-215q0-140-82-252t-211-155q-15-3-22 4t-7 17q0 1 0 43t0 75q0 54-29 79 32 3 57 10t53 22 45 37 30 58 11 84q0 67-44 115 21 51-4 114-16 5-46-6t-51-25l-21-13q-52 15-107 15t-108-15q-8 6-23 15t-47 22-47 7q-25-63-5-114-44-48-44-115 0-47 12-83t29-59 45-37 52-22 57-10q-21-20-27-58-12-5-25-8t-32-3-36 12-31 35q-11 18-27 29t-28 14l-11 1q-12 0-16-2t-3-7 5-8 7-6l4-3q12-6 24-21t18-29l6-13q7-21 24-34t37-17 39-3 31 1l13 3q0-22 0-50t1-30q0-10-8-17t-22-4q-129 43-211 155t-82 252q0 117 58 215t155 156 216 58z m-267-616q2 4-3 7-6 1-8-1-1-4 4-7 5-3 7 1z m18-19q4 3-1 9-6 5-9 2-4-3 1-9 5-6 9-2z m16-25q6 4 0 11-4 7-9 3-5-3 0-10t9-4z m24-23q4 4-2 10-7 7-11 2-5-5 2-11 6-6 11-1z m32-14q1 6-8 9-8 2-10-4t7-9q8-3 11 4z m35-3q0 7-10 6-9 0-9-6 0-7 10-6 9 0 9 6z m32 5q-1 7-10 5-9-1-8-8t10-4 8 7z" horiz-adv-x="857.1" />
|
|
16
|
-
|
|
17
|
-
<glyph glyph-name="gplus-squared" unicode="" d="M512 345q0 15-4 36h-202v-74h122q-2-13-10-28t-21-29-37-25-54-10q-55 0-94 40t-39 95 39 95 94 40q52 0 86-33l58 57q-60 55-144 55-89 0-151-62t-63-152 63-151 151-63q92 0 149 58t57 151z m192-26h61v62h-61v61h-61v-61h-61v-62h61v-61h61v61z m153 299v-536q0-66-47-113t-114-48h-535q-67 0-114 48t-47 113v536q0 66 47 113t114 48h535q67 0 114-48t47-113z" horiz-adv-x="857.1" />
|
|
18
|
-
|
|
19
|
-
<glyph glyph-name="gplus" unicode="" d="M802 341q0-117-49-207t-138-142-206-51q-83 0-159 32t-131 87-87 131-32 159 32 159 87 131 131 87 159 32q160 0 274-107l-111-107q-65 63-163 63-69 0-127-34t-92-94-34-130 34-130 92-94 127-34q46 0 85 13t64 32 44 43 27 47 12 41h-232v141h386q7-36 7-68z m484 68v-118h-117v-116h-117v116h-117v118h117v116h117v-116h117z" horiz-adv-x="1285.7" />
|
|
20
|
-
|
|
21
|
-
<glyph glyph-name="linkedin" unicode="" d="M195 501v-553h-184v553h184z m12 171q0-41-29-68t-75-27h-1q-46 0-74 27t-28 68q0 41 29 68t75 27 74-27 29-68z m650-407v-317h-183v296q0 59-23 92t-71 33q-35 0-58-19t-36-48q-6-17-6-45v-309h-184q1 223 1 361t0 165l-1 27h184v-80h-1q11 18 23 31t31 29 49 24 64 9q95 0 153-63t58-186z" horiz-adv-x="857.1" />
|
|
22
|
-
|
|
23
|
-
<glyph glyph-name="github" unicode="" d="M357 171q0-22-7-45t-24-43-40-19-41 19-24 43-7 45 7 46 24 43 41 19 40-19 24-43 7-46z m357 0q0-22-7-45t-24-43-40-19-41 19-24 43-7 45 7 46 24 43 41 19 40-19 24-43 7-46z m90 0q0 67-39 114t-104 47q-23 0-109-12-40-6-88-6t-87 6q-85 12-109 12-66 0-104-47t-39-114q0-49 18-85t45-58 68-33 78-17 83-4h94q46 0 83 4t78 17 69 33 45 58 18 85z m125 99q0-116-34-185-22-43-59-74t-79-48-95-27-96-12-93-3q-43 0-79 2t-82 7-85 17-77 29-67 45-48 64q-35 69-35 185 0 132 76 221-15 45-15 95 0 64 28 121 61 0 106-22t106-69q82 20 172 20 83 0 157-18 58 46 104 67t105 22q29-57 29-121 0-49-15-94 76-89 76-222z" horiz-adv-x="928.6" />
|
|
24
|
-
|
|
25
|
-
<glyph glyph-name="youtube-squared" unicode="" d="M513 123v88q0 27-16 27-10 0-19-8v-125q9-9 19-9 16 0 16 27z m103 68h36v19q0 28-18 28t-18-28v-19z m-319 148v-39h-45v-236h-41v236h-44v39h130z m112-70v-205h-37v23q-22-25-43-25-18 0-23 15-3 10-3 30v162h36v-151q0-13 1-14 0-8 8-8 11 0 24 17v156h37z m141-62v-81q0-29-4-41-7-23-30-23-19 0-38 22v-20h-37v275h37v-89q18 22 38 22 23 0 30-24 4-11 4-41z m140-72v-5q0-16-1-24-2-12-9-22-15-22-44-22-29 0-46 21-11 15-11 48v72q0 33 11 48 16 21 45 21t43-21q12-16 12-48v-43h-74v-36q0-28 19-28 13 0 16 14 0 1 1 4t0 9v12h38z m-252 460v-87q0-28-18-28t-18 28v87q0 29 18 29t18-29z m298-398q0 99-11 145-6 25-24 41t-42 20q-76 8-230 8-154 0-230-8-24-3-42-20t-24-41q-11-48-11-145 0-98 11-145 5-24 24-41t42-19q76-9 230-9t230 9q24 2 42 19t23 41q12 47 12 145z m-422 363l50 166h-41l-29-109-29 109h-44q4-13 13-39l13-38q20-58 26-89v-112h41v112z m161-45v73q0 32-11 48-16 22-44 22-28 0-43-22-12-16-12-48v-73q0-32 12-48 15-22 43-22 28 0 44 22 11 15 11 48z m102-67h37v207h-37v-158q-13-17-24-17-8 0-9 8 0 2 0 15v152h-38v-164q0-20 4-30 6-16 24-16 20 0 43 26v-23z m280 170v-536q0-66-47-113t-114-48h-535q-67 0-114 48t-47 113v536q0 66 47 113t114 48h535q67 0 114-48t47-113z" horiz-adv-x="857.1" />
|
|
26
|
-
|
|
27
|
-
<glyph glyph-name="youtube" unicode="" d="M542 156v-118q0-37-22-37-13 0-25 12v168q12 12 25 12 22 0 22-37z m189-1v-25h-51v25q0 38 25 38t26-38z m-540 122h60v52h-174v-52h59v-318h55v318z m161-318h50v276h-50v-211q-17-23-32-23-10 0-11 11-1 2-1 20v203h-50v-218q0-28 5-41 7-21 32-21 27 0 57 34v-30z m240 83v110q0 41-5 55-10 31-40 31-28 0-52-30v121h-50v-370h50v27q25-31 52-31 30 0 40 31 5 15 5 56z m188 6v7h-51q0-29-1-34-4-20-22-20-26 0-26 38v49h100v57q0 44-15 65-22 28-59 28-38 0-60-28-15-21-15-65v-96q0-44 16-65 22-29 60-29 40 0 60 30 10 15 12 30 1 5 1 33z m-339 509v117q0 39-24 39t-24-39v-117q0-39 24-39t24 39z m401-419q0-131-14-195-8-33-33-56t-57-25q-102-12-309-12t-310 12q-32 3-57 25t-32 56q-15 62-15 195 0 131 15 195 7 33 32 56t57 26q103 11 310 11t309-11q33-4 58-26t32-56q14-62 14-195z m-557 712h57l-67-223v-151h-56v151q-8 42-34 119-21 57-37 104h60l39-147z m207-186v-97q0-46-16-66-21-29-59-29-37 0-59 29-15 21-15 66v97q0 45 15 66 22 28 59 28 38 0 59-28 16-21 16-66z m187 91v-279h-51v31q-30-35-58-35-25 0-33 21-4 13-4 42v220h51v-205q0-19 0-20 2-12 12-12 15 0 32 24v213h51z" horiz-adv-x="857.1" />
|
|
28
|
-
|
|
29
|
-
<glyph glyph-name="youtube-play" unicode="" d="M397 221l270 139-270 141v-280z m103 481q94 0 181-3t128-5l41-2q0 0 9-1t13-2 13-2 16-5 16-7 17-11 16-15q4-3 9-10t16-33 15-56q4-36 7-76t3-64v-98q1-81-10-162-4-30-14-55t-18-35l-8-9q-7-8-16-15t-17-10-16-7-16-5-13-2-13-2-9-1q-140-11-350-11-115 2-201 4t-111 4l-28 3-20 2q-20 3-30 5t-29 12-31 23q-4 3-9 10t-16 33-15 56q-4 36-7 76t-3 64v98q-1 81 10 162 4 31 14 55t18 35l8 9q8 9 16 15t17 11 16 7 16 5 13 2 13 2 9 1q140 10 350 10z" horiz-adv-x="1000" />
|
|
30
|
-
|
|
31
|
-
<glyph glyph-name="google" unicode="" d="M429 411h404q7-37 7-71 0-121-51-216t-145-149-215-54q-88 0-167 34t-137 91-91 137-34 167 34 167 91 137 137 91 167 34q167 0 287-113l-117-112q-68 67-170 67-72 0-133-37t-97-98-36-136 36-136 97-98 133-37q48 0 89 14t67 33 46 46 28 49 13 43h-243v147z" horiz-adv-x="857.1" />
|
|
32
|
-
|
|
33
|
-
<glyph glyph-name="facebook-official" unicode="" d="M810 779q19 0 33-14t14-34v-762q0-20-14-34t-33-14h-218v333h111l16 129h-127v83q0 31 13 46t51 16l68 1v115q-35 5-100 5-75 0-121-44t-45-127v-95h-112v-129h112v-333h-411q-19 0-33 14t-14 34v762q0 20 14 34t33 14h763z" horiz-adv-x="857.1" />
|
|
34
|
-
|
|
35
|
-
<glyph glyph-name="github-squared" unicode="" d="M290 180q2 4-2 8-5 4-8 1-2-4 2-7 5-4 8-2z m-16 23q-3 4-7 3-3-3 0-7 4-5 7-3 3 2 0 7z m-23 23q1 2-3 4-4 1-4-1-2-3 2-5 5-1 5 2z m12-13q1 0 1 2t-2 3q-4 4-6 2t1-6q3-3 6-1z m48-42q1 4-5 6-5 2-7-2-2-4 5-6 5-2 7 2z m23-2q0 5-6 5-6 0-6-5t6-4 6 4z m22 4q-1 4-7 3t-5-5q1-5 6-3t6 5z m358 177q0 118-83 202t-202 84-202-84-84-202q0-93 55-168t140-103q10-2 15 3t5 11q0 29-1 53-3-1-8-2t-20-1-27 3-24 11-17 23q-13 33-32 41-1 1-2 2l-5 5t-3 5 2 4 11 2q3 0 8-1t17-9 18-20q9-15 21-23t24-8 22 2 16 5q4 27 19 39-28 3-48 10t-41 22-31 42-11 67q0 44 30 77-14 34 3 75 10 4 30-4t34-16l14-9q33 9 72 9t71-9q6 4 16 10t31 14 32 5q16-41 3-75 29-33 29-77 0-32-8-56t-20-39-29-25-35-14-38-7q19-17 19-53 0-22 0-50t-1-28q0-7 5-11t15-3q86 29 141 103t54 168z m143 268v-536q0-66-47-113t-114-48h-535q-67 0-114 48t-47 113v536q0 66 47 113t114 48h535q67 0 114-48t47-113z" horiz-adv-x="857.1" />
|
|
36
|
-
|
|
37
|
-
<glyph glyph-name="twitter-squared" unicode="" d="M714 510q-31-14-67-19 38 22 52 65-37-21-75-28-34 36-85 36-49 0-83-34t-35-83q0-16 3-27-72 4-135 37t-107 86q-16-28-16-59 0-64 51-98-27 1-56 15v-1q0-42 28-75t68-40q-16-5-28-5-7 0-22 3 12-36 42-59t67-23q-64-50-145-50-15 0-28 2 82-53 180-53 62 0 117 20t94 53 67 76 42 91 13 94q0 10 0 15 35 25 58 61z m143 108v-536q0-66-47-113t-114-48h-535q-67 0-114 48t-47 113v536q0 66 47 113t114 48h535q67 0 114-48t47-113z" horiz-adv-x="857.1" />
|
|
38
|
-
|
|
39
|
-
<glyph glyph-name="facebook-squared" unicode="" d="M696 779q67 0 114-48t47-113v-536q0-66-47-113t-114-48h-104v333h111l16 129h-127v83q0 31 13 46t51 16l68 1v115q-35 5-100 5-75 0-121-44t-45-127v-95h-112v-129h112v-333h-297q-67 0-114 48t-47 113v536q0 66 47 113t114 48h535z" horiz-adv-x="857.1" />
|
|
40
|
-
|
|
41
|
-
<glyph glyph-name="linkedin-squared" unicode="" d="M132 61h129v387h-129v-387z m138 507q-1 29-21 48t-51 19-53-19-21-48q0-29 20-48t52-19h0q33 0 53 19t21 48z m326-507h129v222q0 86-41 130t-107 44q-76 0-117-65h1v56h-129q2-37 0-387h129v217q0 21 4 31 8 19 25 33t41 14q65 0 65-88v-207z m261 557v-536q0-66-47-113t-114-48h-535q-67 0-114 48t-47 113v536q0 66 47 113t114 48h535q67 0 114-48t47-113z" horiz-adv-x="857.1" />
|
|
42
|
-
</font>
|
|
43
|
-
</defs>
|
|
44
|
-
</svg>
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
$(document).ready(function(){
|
|
2
|
-
var options =
|
|
3
|
-
{
|
|
4
|
-
scriptUrl: '//96Boards.disqus.com/embed.js',
|
|
5
|
-
/*
|
|
6
|
-
@type: string (url)
|
|
7
|
-
@default: none
|
|
8
|
-
@required
|
|
9
|
-
URL of Disqus' executive JS file. The value is memorized on the first function call
|
|
10
|
-
and ignored otherwise because Disqus allows only one instance per page at the time.
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
laziness: 1,
|
|
14
|
-
/*
|
|
15
|
-
@type: int (>=0)
|
|
16
|
-
@default: 1
|
|
17
|
-
Sets the laziness of loading the widget: (viewport height) * laziness . For example:
|
|
18
|
-
0 - widget load starts when at the least a tiny part of it gets in the viewport;
|
|
19
|
-
1 - widget load starts when the distance between the widget zone and the viewport is no more than the height of the viewport;
|
|
20
|
-
2 - 2x viewports, etc.
|
|
21
|
-
*/
|
|
22
|
-
|
|
23
|
-
throttle: 250,
|
|
24
|
-
/*
|
|
25
|
-
@type: int (milliseconds)
|
|
26
|
-
@default: 250
|
|
27
|
-
Defines how often the plugin should make calculations during the
|
|
28
|
-
processes such as resize of a browser's window or viewport scroll.
|
|
29
|
-
250 = 4 times in a second.
|
|
30
|
-
*/
|
|
31
|
-
|
|
32
|
-
/*
|
|
33
|
-
@type: function
|
|
34
|
-
@default: none
|
|
35
|
-
Disqus-native options. Check Disqus' manual for more information.
|
|
36
|
-
*/
|
|
37
|
-
disqusConfig: function()
|
|
38
|
-
{
|
|
39
|
-
this.page.title = 'Page Title';
|
|
40
|
-
this.page.url = 'Page URL';
|
|
41
|
-
this.page.identifier = 'Identifier';
|
|
42
|
-
this.callbacks.onReady = [function()
|
|
43
|
-
{
|
|
44
|
-
$( '.disqus-placeholder' ).addClass( 'is-hidden' );
|
|
45
|
-
}];
|
|
46
|
-
}
|
|
47
|
-
};
|
|
48
|
-
// jQuery
|
|
49
|
-
$.disqusLoader( '.disqus', options);
|
|
50
|
-
});
|
data/assets/js/app/facebook.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
<!-- <div id="fb-root"></div>
|
|
2
|
-
<script>(function(d, s, id) {
|
|
3
|
-
var js, fjs = d.getElementsByTagName(s)[0];
|
|
4
|
-
if (d.getElementById(id)) return;
|
|
5
|
-
js = d.createElement(s); js.id = id;
|
|
6
|
-
js.src = "//connect.facebook.net/en_GB/sdk.js#xfbml=1&version=v2.9&appId=155006367915796";
|
|
7
|
-
fjs.parentNode.insertBefore(js, fjs);
|
|
8
|
-
}(document, 'script', 'facebook-jssdk'));</script> -->
|
data/assets/js/app/fly.js
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
$(document).ready(function(){
|
|
2
|
-
|
|
3
|
-
// Recheck function to
|
|
4
|
-
var timer = 0;
|
|
5
|
-
function recheck() {
|
|
6
|
-
var window_top = $(this).scrollTop();
|
|
7
|
-
var window_height = $(this).height();
|
|
8
|
-
var view_port_s = window_top;
|
|
9
|
-
var view_port_e = window_top + window_height;
|
|
10
|
-
|
|
11
|
-
if (timer) {
|
|
12
|
-
clearTimeout(timer);
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
$('.fly').each(function () {
|
|
16
|
-
var block = $(this);
|
|
17
|
-
var block_top = block.offset().top;
|
|
18
|
-
var block_height = block.height();
|
|
19
|
-
|
|
20
|
-
if (block_top < view_port_e) {
|
|
21
|
-
timer = setTimeout(function () {
|
|
22
|
-
block.addClass('show-block');
|
|
23
|
-
}, 100);
|
|
24
|
-
} else {
|
|
25
|
-
timer = setTimeout(function () {
|
|
26
|
-
block.removeClass('show-block');
|
|
27
|
-
}, 100);
|
|
28
|
-
}
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
// Check if the windows is scrolled or resized
|
|
33
|
-
// and if so then recheck for elements that are visible.
|
|
34
|
-
$(function () {
|
|
35
|
-
$(window).scroll(function () {
|
|
36
|
-
recheck();
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
$(window).resize(function () {
|
|
40
|
-
recheck();
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
recheck();
|
|
44
|
-
});
|
|
45
|
-
});
|
data/assets/js/app/search.js
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
// JS file for main search bar
|
|
2
|
-
$(document).ready(function(){
|
|
3
|
-
var search_bar = $("div#search_bar");
|
|
4
|
-
var search_icon = $("a#search_icon");
|
|
5
|
-
var search_close = $("button#search_close");
|
|
6
|
-
var search_search = $("button#search_search");
|
|
7
|
-
var search_form = $("form#search_form");
|
|
8
|
-
var search_hidden_input = $("div#search_bar input[type='hidden']");
|
|
9
|
-
|
|
10
|
-
var nav_light = $('nav.nav-light');
|
|
11
|
-
|
|
12
|
-
$("a#search_icon").click(function() {
|
|
13
|
-
search_bar.css('display','block');
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
$("button#search_close").click(function() {
|
|
17
|
-
search_form.trigger('reset');
|
|
18
|
-
search_bar.css('display','none');
|
|
19
|
-
});
|
|
20
|
-
});
|
|
21
|
-
$(document).mouseup(function(e)
|
|
22
|
-
{
|
|
23
|
-
var search_container = $("div#search_bar");
|
|
24
|
-
// if the target of the click isn't the container nor a descendant of the container
|
|
25
|
-
if (!search_container.is(e.target) && search_container.has(e.target).length === 0)
|
|
26
|
-
{
|
|
27
|
-
search_container.hide();
|
|
28
|
-
}
|
|
29
|
-
});
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
// Lazy load YouTube videos
|
|
2
|
-
$(document).ready(function() {
|
|
3
|
-
var youtube = document.querySelectorAll( ".youtube" );
|
|
4
|
-
for (var i = 0; i < youtube.length; i++) {
|
|
5
|
-
var source = "https://img.youtube.com/vi/"+ youtube[i].dataset.embed +"/sddefault.jpg";
|
|
6
|
-
var image = new Image();
|
|
7
|
-
image.src = source;
|
|
8
|
-
image.addEventListener( "load", function() {
|
|
9
|
-
youtube[ i ].appendChild( image );
|
|
10
|
-
}( i ) );
|
|
11
|
-
|
|
12
|
-
youtube[i].addEventListener( "click", function() {
|
|
13
|
-
|
|
14
|
-
var iframe = document.createElement( "iframe" );
|
|
15
|
-
|
|
16
|
-
iframe.setAttribute( "frameborder", "0" );
|
|
17
|
-
iframe.setAttribute( "allowfullscreen", "" );
|
|
18
|
-
iframe.setAttribute( "src", "https://www.youtube.com/embed/"+ this.dataset.embed +"?rel=0&showinfo=0&autoplay=1" );
|
|
19
|
-
|
|
20
|
-
this.innerHTML = "";
|
|
21
|
-
this.appendChild( iframe );
|
|
22
|
-
} );
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
});
|
data/assets/js/pacakge-search.js
DELETED
data/assets/js/package-blog.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
//= require vendor/jquery
|
|
2
|
-
//= require vendor/bootstrap
|
|
3
|
-
//= require vendor/cookieconsent
|
|
4
|
-
//= require vendor/lazysizes
|
|
5
|
-
//= require vendor/ls.unveilhooks
|
|
6
|
-
//= require vendor/jquery.doubleScroll
|
|
7
|
-
//= require vendor/featherlight
|
|
8
|
-
//= require vendor/clipboard.min
|
|
9
|
-
|
|
10
|
-
//= require app/main
|
|
11
|
-
//= require app/search
|
|
12
|
-
//= require app/custom
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
//= require vendor/jquery
|
|
2
|
-
//= require vendor/bootstrap
|
|
3
|
-
//= require vendor/cookieconsent
|
|
4
|
-
//= require vendor/owl.carousel
|
|
5
|
-
//= require vendor/lazysizes
|
|
6
|
-
//= require vendor/ls.unveilhooks
|
|
7
|
-
//= require vendor/jquery.doubleScroll
|
|
8
|
-
//= require vendor/featherlight
|
|
9
|
-
//= require app/sticky-tab-bar
|
|
10
|
-
|
|
11
|
-
//= require app/main
|
|
12
|
-
//= require app/search
|
|
13
|
-
//= require app/tables
|
|
14
|
-
//= require app/custom
|
data/assets/js/package-home.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
//= require vendor/jquery
|
|
2
|
-
//= require vendor/bootstrap
|
|
3
|
-
//= require vendor/cookieconsent
|
|
4
|
-
//= require vendor/lazysizes
|
|
5
|
-
//= require vendor/owl.carousel
|
|
6
|
-
//= require vendor/jquery.doubleScroll
|
|
7
|
-
//= require vendor/featherlight
|
|
8
|
-
|
|
9
|
-
//= require app/main
|
|
10
|
-
//= require app/tables
|
|
11
|
-
//= require app/search
|
|
12
|
-
//= require app/sticky-tab-bar
|
|
13
|
-
//= require app/custom
|
|
14
|
-
//= require app/home
|
data/assets/js/package-main.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
//= require vendor/jquery
|
|
2
|
-
//= require vendor/bootstrap
|
|
3
|
-
//= require vendor/cookieconsent
|
|
4
|
-
//= require vendor/lazysizes
|
|
5
|
-
//= require vendor/owl.carousel
|
|
6
|
-
//= require vendor/ls.unveilhooks
|
|
7
|
-
//= require vendor/jquery.doubleScroll
|
|
8
|
-
//= require vendor/featherlight
|
|
9
|
-
|
|
10
|
-
//= require app/main
|
|
11
|
-
//= require app/search
|
|
12
|
-
//= require app/sticky-tab-bar
|
|
13
|
-
//= require app/custom
|
data/assets/js/package-search.js
DELETED
|
@@ -1,1495 +0,0 @@
|
|
|
1
|
-
(function(cc) {
|
|
2
|
-
// stop from running again, if accidently included more than once.
|
|
3
|
-
if (cc.hasInitialised) return;
|
|
4
|
-
|
|
5
|
-
var util = {
|
|
6
|
-
// http://stackoverflow.com/questions/3446170/escape-string-for-use-in-javascript-regex
|
|
7
|
-
escapeRegExp: function(str) {
|
|
8
|
-
return str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, '\\$&');
|
|
9
|
-
},
|
|
10
|
-
|
|
11
|
-
hasClass: function(element, selector) {
|
|
12
|
-
var s = ' ';
|
|
13
|
-
return element.nodeType === 1 &&
|
|
14
|
-
(s + element.className + s).replace(/[\n\t]/g, s).indexOf(s + selector + s) >= 0;
|
|
15
|
-
},
|
|
16
|
-
|
|
17
|
-
addClass: function(element, className) {
|
|
18
|
-
element.className += ' ' + className;
|
|
19
|
-
},
|
|
20
|
-
|
|
21
|
-
removeClass: function(element, className) {
|
|
22
|
-
var regex = new RegExp('\\b' + this.escapeRegExp(className) + '\\b');
|
|
23
|
-
element.className = element.className.replace(regex, '');
|
|
24
|
-
},
|
|
25
|
-
|
|
26
|
-
interpolateString: function(str, callback) {
|
|
27
|
-
var marker = /{{([a-z][a-z0-9\-_]*)}}/ig;
|
|
28
|
-
return str.replace(marker, function(matches) {
|
|
29
|
-
return callback(arguments[1]) || '';
|
|
30
|
-
})
|
|
31
|
-
},
|
|
32
|
-
|
|
33
|
-
getCookie: function(name) {
|
|
34
|
-
var value = '; ' + document.cookie;
|
|
35
|
-
var parts = value.split('; ' + name + '=');
|
|
36
|
-
return parts.length != 2 ?
|
|
37
|
-
undefined : parts.pop().split(';').shift();
|
|
38
|
-
},
|
|
39
|
-
|
|
40
|
-
setCookie: function(name, value, expiryDays, domain, path) {
|
|
41
|
-
var exdate = new Date();
|
|
42
|
-
exdate.setDate(exdate.getDate() + (expiryDays || 365));
|
|
43
|
-
|
|
44
|
-
var cookie = [
|
|
45
|
-
name + '=' + value,
|
|
46
|
-
'expires=' + exdate.toUTCString(),
|
|
47
|
-
'path=' + (path || '/')
|
|
48
|
-
];
|
|
49
|
-
|
|
50
|
-
if (domain) {
|
|
51
|
-
cookie.push('domain=' + domain);
|
|
52
|
-
}
|
|
53
|
-
document.cookie = cookie.join(';');
|
|
54
|
-
},
|
|
55
|
-
|
|
56
|
-
// only used for extending the initial options
|
|
57
|
-
deepExtend: function(target, source) {
|
|
58
|
-
for (var prop in source) {
|
|
59
|
-
if (source.hasOwnProperty(prop)) {
|
|
60
|
-
if (prop in target && this.isPlainObject(target[prop]) && this.isPlainObject(source[prop])) {
|
|
61
|
-
this.deepExtend(target[prop], source[prop]);
|
|
62
|
-
} else {
|
|
63
|
-
target[prop] = source[prop];
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
return target;
|
|
68
|
-
},
|
|
69
|
-
|
|
70
|
-
// only used for throttling the 'mousemove' event (used for animating the revoke button when `animateRevokable` is true)
|
|
71
|
-
throttle: function(callback, limit) {
|
|
72
|
-
var wait = false;
|
|
73
|
-
return function() {
|
|
74
|
-
if (!wait) {
|
|
75
|
-
callback.apply(this, arguments);
|
|
76
|
-
wait = true;
|
|
77
|
-
setTimeout(function() {
|
|
78
|
-
wait = false;
|
|
79
|
-
}, limit);
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
},
|
|
83
|
-
|
|
84
|
-
// only used for hashing json objects (used for hash mapping palette objects, used when custom colours are passed through JavaScript)
|
|
85
|
-
hash: function(str) {
|
|
86
|
-
var hash = 0,
|
|
87
|
-
i, chr, len;
|
|
88
|
-
if (str.length === 0) return hash;
|
|
89
|
-
for (i = 0, len = str.length; i < len; ++i) {
|
|
90
|
-
chr = str.charCodeAt(i);
|
|
91
|
-
hash = ((hash << 5) - hash) + chr;
|
|
92
|
-
hash |= 0;
|
|
93
|
-
}
|
|
94
|
-
return hash;
|
|
95
|
-
},
|
|
96
|
-
|
|
97
|
-
normaliseHex: function(hex) {
|
|
98
|
-
if (hex[0] == '#') {
|
|
99
|
-
hex = hex.substr(1);
|
|
100
|
-
}
|
|
101
|
-
if (hex.length == 3) {
|
|
102
|
-
hex = hex[0] + hex[0] + hex[1] + hex[1] + hex[2] + hex[2];
|
|
103
|
-
}
|
|
104
|
-
return hex;
|
|
105
|
-
},
|
|
106
|
-
|
|
107
|
-
// used to get text colors if not set
|
|
108
|
-
getContrast: function(hex) {
|
|
109
|
-
hex = this.normaliseHex(hex);
|
|
110
|
-
var r = parseInt(hex.substr(0, 2), 16);
|
|
111
|
-
var g = parseInt(hex.substr(2, 2), 16);
|
|
112
|
-
var b = parseInt(hex.substr(4, 2), 16);
|
|
113
|
-
var yiq = ((r * 299) + (g * 587) + (b * 114)) / 1000;
|
|
114
|
-
return (yiq >= 128) ? '#000' : '#fff';
|
|
115
|
-
},
|
|
116
|
-
|
|
117
|
-
// used to change color on highlight
|
|
118
|
-
getLuminance: function(hex) {
|
|
119
|
-
var num = parseInt(this.normaliseHex(hex), 16),
|
|
120
|
-
amt = 38,
|
|
121
|
-
R = (num >> 16) + amt,
|
|
122
|
-
B = (num >> 8 & 0x00FF) + amt,
|
|
123
|
-
G = (num & 0x0000FF) + amt;
|
|
124
|
-
var newColour = (0x1000000 + (R<255?R<1?0:R:255)*0x10000 + (B<255?B<1?0:B:255)*0x100 + (G<255?G<1?0:G:255)).toString(16).slice(1);
|
|
125
|
-
return '#'+newColour;
|
|
126
|
-
},
|
|
127
|
-
|
|
128
|
-
isMobile: function() {
|
|
129
|
-
return /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);
|
|
130
|
-
},
|
|
131
|
-
|
|
132
|
-
isPlainObject: function(obj) {
|
|
133
|
-
// The code "typeof obj === 'object' && obj !== null" allows Array objects
|
|
134
|
-
return typeof obj === 'object' && obj !== null && obj.constructor == Object;
|
|
135
|
-
},
|
|
136
|
-
};
|
|
137
|
-
|
|
138
|
-
// valid cookie values
|
|
139
|
-
cc.status = {
|
|
140
|
-
deny: 'deny',
|
|
141
|
-
allow: 'allow',
|
|
142
|
-
dismiss: 'dismiss'
|
|
143
|
-
};
|
|
144
|
-
|
|
145
|
-
// detects the `transitionend` event name
|
|
146
|
-
cc.transitionEnd = (function() {
|
|
147
|
-
var el = document.createElement('div');
|
|
148
|
-
var trans = {
|
|
149
|
-
t: "transitionend",
|
|
150
|
-
OT: "oTransitionEnd",
|
|
151
|
-
msT: "MSTransitionEnd",
|
|
152
|
-
MozT: "transitionend",
|
|
153
|
-
WebkitT: "webkitTransitionEnd",
|
|
154
|
-
};
|
|
155
|
-
|
|
156
|
-
for (var prefix in trans) {
|
|
157
|
-
if (trans.hasOwnProperty(prefix) && typeof el.style[prefix + 'ransition'] != 'undefined') {
|
|
158
|
-
return trans[prefix];
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
return '';
|
|
162
|
-
}());
|
|
163
|
-
|
|
164
|
-
cc.hasTransition = !!cc.transitionEnd;
|
|
165
|
-
|
|
166
|
-
// array of valid regexp escaped statuses
|
|
167
|
-
var __allowedStatuses = Object.keys(cc.status).map(util.escapeRegExp);
|
|
168
|
-
|
|
169
|
-
// contains references to the custom <style> tags
|
|
170
|
-
cc.customStyles = {};
|
|
171
|
-
|
|
172
|
-
cc.Popup = (function() {
|
|
173
|
-
|
|
174
|
-
var defaultOptions = {
|
|
175
|
-
|
|
176
|
-
// if false, this prevents the popup from showing (useful for giving to control to another piece of code)
|
|
177
|
-
enabled: true,
|
|
178
|
-
|
|
179
|
-
// optional (expecting a HTML element) if passed, the popup is appended to this element. default is `document.body`
|
|
180
|
-
container: null,
|
|
181
|
-
|
|
182
|
-
// defaults cookie options - it is RECOMMENDED to set these values to correspond with your server
|
|
183
|
-
cookie: {
|
|
184
|
-
// This is the name of this cookie - you can ignore this
|
|
185
|
-
name: 'cookieconsent_status',
|
|
186
|
-
|
|
187
|
-
// This is the url path that the cookie 'name' belongs to. The cookie can only be read at this location
|
|
188
|
-
path: '/',
|
|
189
|
-
|
|
190
|
-
// This is the domain that the cookie 'name' belongs to. The cookie can only be read on this domain.
|
|
191
|
-
// - Guide to cookie domains - http://erik.io/blog/2014/03/04/definitive-guide-to-cookie-domains/
|
|
192
|
-
domain: '',
|
|
193
|
-
|
|
194
|
-
// The cookies expire date, specified in days (specify -1 for no expiry)
|
|
195
|
-
expiryDays: 365,
|
|
196
|
-
},
|
|
197
|
-
|
|
198
|
-
// these callback hooks are called at certain points in the program execution
|
|
199
|
-
onPopupOpen: function() {},
|
|
200
|
-
onPopupClose: function() {},
|
|
201
|
-
onInitialise: function(status) {},
|
|
202
|
-
onStatusChange: function(status, chosenBefore) {},
|
|
203
|
-
onRevokeChoice: function() {},
|
|
204
|
-
|
|
205
|
-
// each item defines the inner text for the element that it references
|
|
206
|
-
content: {
|
|
207
|
-
header: 'Cookies used on the website!',
|
|
208
|
-
message: 'This website uses cookies to ensure you get the best experience on our website.',
|
|
209
|
-
dismiss: 'Got it!',
|
|
210
|
-
allow: 'Allow cookies',
|
|
211
|
-
deny: 'Decline',
|
|
212
|
-
link: 'Learn more',
|
|
213
|
-
href: 'http://cookiesandyou.com',
|
|
214
|
-
close: '❌',
|
|
215
|
-
},
|
|
216
|
-
|
|
217
|
-
// This is the HTML for the elements above. The string {{header}} will be replaced with the equivalent text below.
|
|
218
|
-
// You can remove "{{header}}" and write the content directly inside the HTML if you want.
|
|
219
|
-
//
|
|
220
|
-
// - ARIA rules suggest to ensure controls are tabbable (so the browser can find the first control),
|
|
221
|
-
// and to set the focus to the first interactive control (http://w3c.github.io/aria-in-html/)
|
|
222
|
-
elements: {
|
|
223
|
-
header: '<span class="cc-header">{{header}}</span> ',
|
|
224
|
-
message: '<span id="cookieconsent:desc" class="cc-message">{{message}}</span>',
|
|
225
|
-
messagelink: '<span id="cookieconsent:desc" class="cc-message">{{message}} <a aria-label="learn more about cookies" role=button tabindex="0" class="cc-link" href="{{href}}" rel="noopener noreferrer nofollow" target="_blank">{{link}}</a></span>',
|
|
226
|
-
dismiss: '<a aria-label="dismiss cookie message" role=button tabindex="0" class="cc-btn cc-dismiss">{{dismiss}}</a>',
|
|
227
|
-
allow: '<a aria-label="allow cookies" role=button tabindex="0" class="cc-btn cc-allow">{{allow}}</a>',
|
|
228
|
-
deny: '<a aria-label="deny cookies" role=button tabindex="0" class="cc-btn cc-deny">{{deny}}</a>',
|
|
229
|
-
link: '<a aria-label="learn more about cookies" role=button tabindex="0" class="cc-link" href="{{href}}" target="_blank">{{link}}</a>',
|
|
230
|
-
close: '<span aria-label="dismiss cookie message" role=button tabindex="0" class="cc-close">{{close}}</span>',
|
|
231
|
-
|
|
232
|
-
//compliance: compliance is also an element, but it is generated by the application, depending on `type` below
|
|
233
|
-
},
|
|
234
|
-
|
|
235
|
-
// The placeholders {{classes}} and {{children}} both get replaced during initialisation:
|
|
236
|
-
// - {{classes}} is where additional classes get added
|
|
237
|
-
// - {{children}} is where the HTML children are placed
|
|
238
|
-
window: '<div role="dialog" aria-live="polite" aria-label="cookieconsent" aria-describedby="cookieconsent:desc" class="cc-window {{classes}}"><!--googleoff: all-->{{children}}<!--googleon: all--></div>',
|
|
239
|
-
|
|
240
|
-
// This is the html for the revoke button. This only shows up after the user has selected their level of consent
|
|
241
|
-
// It can be enabled of disabled using the `revokable` option
|
|
242
|
-
revokeBtn: '<div class="cc-revoke {{classes}}">Cookie Policy</div>',
|
|
243
|
-
|
|
244
|
-
// define types of 'compliance' here. '{{value}}' strings in here are linked to `elements`
|
|
245
|
-
compliance: {
|
|
246
|
-
'info': '<div class="cc-compliance">{{dismiss}}</div>',
|
|
247
|
-
'opt-in': '<div class="cc-compliance cc-highlight">{{dismiss}}{{allow}}</div>',
|
|
248
|
-
'opt-out': '<div class="cc-compliance cc-highlight">{{deny}}{{dismiss}}</div>',
|
|
249
|
-
},
|
|
250
|
-
|
|
251
|
-
// select your type of popup here
|
|
252
|
-
type: 'info', // refers to `compliance` (in other words, the buttons that are displayed)
|
|
253
|
-
|
|
254
|
-
// define layout layouts here
|
|
255
|
-
layouts: {
|
|
256
|
-
// the 'block' layout tend to be for square floating popups
|
|
257
|
-
'basic': '{{messagelink}}{{compliance}}',
|
|
258
|
-
'basic-close': '{{messagelink}}{{compliance}}{{close}}',
|
|
259
|
-
'basic-header': '{{header}}{{message}}{{link}}{{compliance}}',
|
|
260
|
-
|
|
261
|
-
// add a custom layout here, then add some new css with the class '.cc-layout-my-cool-layout'
|
|
262
|
-
//'my-cool-layout': '<div class="my-special-layout">{{message}}{{compliance}}</div>{{close}}',
|
|
263
|
-
},
|
|
264
|
-
|
|
265
|
-
// default layout (see above)
|
|
266
|
-
layout: 'basic',
|
|
267
|
-
|
|
268
|
-
// this refers to the popup windows position. we currently support:
|
|
269
|
-
// - banner positions: top, bottom
|
|
270
|
-
// - floating positions: top-left, top-right, bottom-left, bottom-right
|
|
271
|
-
//
|
|
272
|
-
// adds a class `cc-floating` or `cc-banner` which helps when styling
|
|
273
|
-
position: 'bottom', // default position is 'bottom'
|
|
274
|
-
|
|
275
|
-
// Available styles
|
|
276
|
-
// -block (default, no extra classes)
|
|
277
|
-
// -edgeless
|
|
278
|
-
// -classic
|
|
279
|
-
// use your own style name and use `.cc-theme-STYLENAME` class in CSS to edit.
|
|
280
|
-
// Note: style "wire" is used for the configurator, but has no CSS styles of its own, only palette is used.
|
|
281
|
-
theme: 'block',
|
|
282
|
-
|
|
283
|
-
// The popup is `fixed` by default, but if you want it to be static (inline with the page content), set this to false
|
|
284
|
-
// Note: by default, we animate the height of the popup from 0 to full size
|
|
285
|
-
static: false,
|
|
286
|
-
|
|
287
|
-
// if you want custom colours, pass them in here. this object should look like this.
|
|
288
|
-
// ideally, any custom colours/themes should be created in a separate style sheet, as this is more efficient.
|
|
289
|
-
// {
|
|
290
|
-
// popup: {background: '#000000', text: '#fff', link: '#fff'},
|
|
291
|
-
// button: {background: 'transparent', border: '#f8e71c', text: '#f8e71c'},
|
|
292
|
-
// highlight: {background: '#f8e71c', border: '#f8e71c', text: '#000000'},
|
|
293
|
-
// }
|
|
294
|
-
// `highlight` is optional and extends `button`. if it exists, it will apply to the first button
|
|
295
|
-
// only background needs to be defined for every element. if not set, other colors can be calculated from it
|
|
296
|
-
palette: null,
|
|
297
|
-
|
|
298
|
-
// Some countries REQUIRE that a user can change their mind. You can configure this yourself.
|
|
299
|
-
// Most of the time this should be false, but the `cookieconsent.law` can change this to `true` if it detects that it should
|
|
300
|
-
revokable: false,
|
|
301
|
-
|
|
302
|
-
// if true, the revokable button will tranlate in and out
|
|
303
|
-
animateRevokable: true,
|
|
304
|
-
|
|
305
|
-
// used to disable link on existing layouts
|
|
306
|
-
// replaces element messagelink with message and removes content of link
|
|
307
|
-
showLink: true,
|
|
308
|
-
|
|
309
|
-
// set value as scroll range to enable
|
|
310
|
-
dismissOnScroll: false,
|
|
311
|
-
|
|
312
|
-
// set value as time in milliseconds to autodismiss after set time
|
|
313
|
-
dismissOnTimeout: false,
|
|
314
|
-
|
|
315
|
-
// The application automatically decide whether the popup should open.
|
|
316
|
-
// Set this to false to prevent this from happening and to allow you to control the behaviour yourself
|
|
317
|
-
autoOpen: true,
|
|
318
|
-
|
|
319
|
-
// By default the created HTML is automatically appended to the container (which defaults to <body>). You can prevent this behaviour
|
|
320
|
-
// by setting this to false, but if you do, you must attach the `element` yourself, which is a public property of the popup instance:
|
|
321
|
-
//
|
|
322
|
-
// var instance = cookieconsent.factory(options);
|
|
323
|
-
// document.body.appendChild(instance.element);
|
|
324
|
-
//
|
|
325
|
-
autoAttach: true,
|
|
326
|
-
|
|
327
|
-
// simple whitelist/blacklist for pages. specify page by:
|
|
328
|
-
// - using a string : '/index.html' (matches '/index.html' exactly) OR
|
|
329
|
-
// - using RegExp : /\/page_[\d]+\.html/ (matched '/page_1.html' and '/page_2.html' etc)
|
|
330
|
-
whitelistPage: [],
|
|
331
|
-
blacklistPage: [],
|
|
332
|
-
|
|
333
|
-
// If this is defined, then it is used as the inner html instead of layout. This allows for ultimate customisation.
|
|
334
|
-
// Be sure to use the classes `cc-btn` and `cc-allow`, `cc-deny` or `cc-dismiss`. They enable the app to register click
|
|
335
|
-
// handlers. You can use other pre-existing classes too. See `src/styles` folder.
|
|
336
|
-
overrideHTML: null,
|
|
337
|
-
};
|
|
338
|
-
|
|
339
|
-
function CookiePopup() {
|
|
340
|
-
this.initialise.apply(this, arguments);
|
|
341
|
-
}
|
|
342
|
-
|
|
343
|
-
CookiePopup.prototype.initialise = function(options) {
|
|
344
|
-
if (this.options) {
|
|
345
|
-
this.destroy(); // already rendered
|
|
346
|
-
}
|
|
347
|
-
|
|
348
|
-
// set options back to default options
|
|
349
|
-
util.deepExtend(this.options = {}, defaultOptions);
|
|
350
|
-
|
|
351
|
-
// merge in user options
|
|
352
|
-
if (util.isPlainObject(options)) {
|
|
353
|
-
util.deepExtend(this.options, options);
|
|
354
|
-
}
|
|
355
|
-
|
|
356
|
-
// returns true if `onComplete` was called
|
|
357
|
-
if (checkCallbackHooks.call(this)) {
|
|
358
|
-
// user has already answered
|
|
359
|
-
this.options.enabled = false;
|
|
360
|
-
}
|
|
361
|
-
|
|
362
|
-
// apply blacklist / whitelist
|
|
363
|
-
if (arrayContainsMatches(this.options.blacklistPage, location.pathname)) {
|
|
364
|
-
this.options.enabled = false;
|
|
365
|
-
}
|
|
366
|
-
if (arrayContainsMatches(this.options.whitelistPage, location.pathname)) {
|
|
367
|
-
this.options.enabled = true;
|
|
368
|
-
}
|
|
369
|
-
|
|
370
|
-
// the full markup either contains the wrapper or it does not (for multiple instances)
|
|
371
|
-
var cookiePopup = this.options.window
|
|
372
|
-
.replace('{{classes}}', getPopupClasses.call(this).join(' '))
|
|
373
|
-
.replace('{{children}}', getPopupInnerMarkup.call(this));
|
|
374
|
-
|
|
375
|
-
// if user passes html, use it instead
|
|
376
|
-
var customHTML = this.options.overrideHTML;
|
|
377
|
-
if (typeof customHTML == 'string' && customHTML.length) {
|
|
378
|
-
cookiePopup = customHTML;
|
|
379
|
-
}
|
|
380
|
-
|
|
381
|
-
// if static, we need to grow the element from 0 height so it doesn't jump the page
|
|
382
|
-
// content. we wrap an element around it which will mask the hidden content
|
|
383
|
-
if (this.options.static) {
|
|
384
|
-
// `grower` is a wrapper div with a hidden overflow whose height is animated
|
|
385
|
-
var wrapper = appendMarkup.call(this, '<div class="cc-grower">' + cookiePopup + '</div>');
|
|
386
|
-
|
|
387
|
-
wrapper.style.display = ''; // set it to visible (because appendMarkup hides it)
|
|
388
|
-
this.element = wrapper.firstChild; // get the `element` reference from the wrapper
|
|
389
|
-
this.element.style.display = 'none';
|
|
390
|
-
util.addClass(this.element, 'cc-invisible');
|
|
391
|
-
} else {
|
|
392
|
-
this.element = appendMarkup.call(this, cookiePopup);
|
|
393
|
-
}
|
|
394
|
-
|
|
395
|
-
applyAutoDismiss.call(this);
|
|
396
|
-
|
|
397
|
-
applyRevokeButton.call(this);
|
|
398
|
-
|
|
399
|
-
if (this.options.autoOpen) {
|
|
400
|
-
this.autoOpen();
|
|
401
|
-
}
|
|
402
|
-
};
|
|
403
|
-
|
|
404
|
-
CookiePopup.prototype.destroy = function() {
|
|
405
|
-
if (this.onButtonClick && this.element) {
|
|
406
|
-
this.element.removeEventListener('click', this.onButtonClick);
|
|
407
|
-
this.onButtonClick = null;
|
|
408
|
-
}
|
|
409
|
-
|
|
410
|
-
if (this.dismissTimeout) {
|
|
411
|
-
clearTimeout(this.dismissTimeout);
|
|
412
|
-
this.dismissTimeout = null;
|
|
413
|
-
}
|
|
414
|
-
|
|
415
|
-
if (this.onWindowScroll) {
|
|
416
|
-
window.removeEventListener('scroll', this.onWindowScroll);
|
|
417
|
-
this.onWindowScroll = null;
|
|
418
|
-
}
|
|
419
|
-
|
|
420
|
-
if (this.onMouseMove) {
|
|
421
|
-
window.removeEventListener('mousemove', this.onMouseMove);
|
|
422
|
-
this.onMouseMove = null;
|
|
423
|
-
}
|
|
424
|
-
|
|
425
|
-
if (this.element && this.element.parentNode) {
|
|
426
|
-
this.element.parentNode.removeChild(this.element);
|
|
427
|
-
}
|
|
428
|
-
this.element = null;
|
|
429
|
-
|
|
430
|
-
if (this.revokeBtn && this.revokeBtn.parentNode) {
|
|
431
|
-
this.revokeBtn.parentNode.removeChild(this.revokeBtn);
|
|
432
|
-
}
|
|
433
|
-
this.revokeBtn = null;
|
|
434
|
-
|
|
435
|
-
removeCustomStyle(this.options.palette);
|
|
436
|
-
this.options = null;
|
|
437
|
-
};
|
|
438
|
-
|
|
439
|
-
CookiePopup.prototype.open = function(callback) {
|
|
440
|
-
if (!this.element) return;
|
|
441
|
-
|
|
442
|
-
if (!this.isOpen()) {
|
|
443
|
-
if (cc.hasTransition) {
|
|
444
|
-
this.fadeIn();
|
|
445
|
-
} else {
|
|
446
|
-
this.element.style.display = '';
|
|
447
|
-
}
|
|
448
|
-
|
|
449
|
-
if (this.options.revokable) {
|
|
450
|
-
this.toggleRevokeButton();
|
|
451
|
-
}
|
|
452
|
-
this.options.onPopupOpen.call(this);
|
|
453
|
-
}
|
|
454
|
-
|
|
455
|
-
return this;
|
|
456
|
-
};
|
|
457
|
-
|
|
458
|
-
CookiePopup.prototype.close = function(showRevoke) {
|
|
459
|
-
if (!this.element) return;
|
|
460
|
-
|
|
461
|
-
if (this.isOpen()) {
|
|
462
|
-
if (cc.hasTransition) {
|
|
463
|
-
this.fadeOut();
|
|
464
|
-
} else {
|
|
465
|
-
this.element.style.display = 'none';
|
|
466
|
-
}
|
|
467
|
-
|
|
468
|
-
if (showRevoke && this.options.revokable) {
|
|
469
|
-
this.toggleRevokeButton(true);
|
|
470
|
-
}
|
|
471
|
-
this.options.onPopupClose.call(this);
|
|
472
|
-
}
|
|
473
|
-
|
|
474
|
-
return this;
|
|
475
|
-
};
|
|
476
|
-
|
|
477
|
-
CookiePopup.prototype.fadeIn = function() {
|
|
478
|
-
var el = this.element;
|
|
479
|
-
|
|
480
|
-
if (!cc.hasTransition || !el)
|
|
481
|
-
return;
|
|
482
|
-
|
|
483
|
-
// This should always be called AFTER fadeOut (which is governed by the 'transitionend' event).
|
|
484
|
-
// 'transitionend' isn't all that reliable, so, if we try and fadeIn before 'transitionend' has
|
|
485
|
-
// has a chance to run, then we run it ourselves
|
|
486
|
-
if (this.afterTransition) {
|
|
487
|
-
afterFadeOut.call(this, el)
|
|
488
|
-
}
|
|
489
|
-
|
|
490
|
-
if (util.hasClass(el, 'cc-invisible')) {
|
|
491
|
-
el.style.display = '';
|
|
492
|
-
|
|
493
|
-
if (this.options.static) {
|
|
494
|
-
var height = this.element.clientHeight;
|
|
495
|
-
this.element.parentNode.style.maxHeight = height + 'px';
|
|
496
|
-
}
|
|
497
|
-
|
|
498
|
-
var fadeInTimeout = 20; // (ms) DO NOT MAKE THIS VALUE SMALLER. See below
|
|
499
|
-
|
|
500
|
-
// Although most browsers can handle values less than 20ms, it should remain above this value.
|
|
501
|
-
// This is because we are waiting for a "browser redraw" before we remove the 'cc-invisible' class.
|
|
502
|
-
// If the class is remvoed before a redraw could happen, then the fadeIn effect WILL NOT work, and
|
|
503
|
-
// the popup will appear from nothing. Therefore we MUST allow enough time for the browser to do
|
|
504
|
-
// its thing. The actually difference between using 0 and 20 in a set timeout is neglegible anyway
|
|
505
|
-
this.openingTimeout = setTimeout(afterFadeIn.bind(this, el), fadeInTimeout);
|
|
506
|
-
}
|
|
507
|
-
};
|
|
508
|
-
|
|
509
|
-
CookiePopup.prototype.fadeOut = function() {
|
|
510
|
-
var el = this.element;
|
|
511
|
-
|
|
512
|
-
if (!cc.hasTransition || !el)
|
|
513
|
-
return;
|
|
514
|
-
|
|
515
|
-
if (this.openingTimeout) {
|
|
516
|
-
clearTimeout(this.openingTimeout);
|
|
517
|
-
afterFadeIn.bind(this, el);
|
|
518
|
-
}
|
|
519
|
-
|
|
520
|
-
if (!util.hasClass(el, 'cc-invisible')) {
|
|
521
|
-
if (this.options.static) {
|
|
522
|
-
this.element.parentNode.style.maxHeight = '';
|
|
523
|
-
}
|
|
524
|
-
|
|
525
|
-
this.afterTransition = afterFadeOut.bind(this, el);
|
|
526
|
-
el.addEventListener(cc.transitionEnd, this.afterTransition);
|
|
527
|
-
|
|
528
|
-
util.addClass(el, 'cc-invisible');
|
|
529
|
-
}
|
|
530
|
-
};
|
|
531
|
-
|
|
532
|
-
CookiePopup.prototype.isOpen = function() {
|
|
533
|
-
return this.element && this.element.style.display == '' && (cc.hasTransition ? !util.hasClass(this.element, 'cc-invisible') : true);
|
|
534
|
-
};
|
|
535
|
-
|
|
536
|
-
CookiePopup.prototype.toggleRevokeButton = function(show) {
|
|
537
|
-
if (this.revokeBtn) this.revokeBtn.style.display = show ? '' : 'none';
|
|
538
|
-
};
|
|
539
|
-
|
|
540
|
-
CookiePopup.prototype.revokeChoice = function(preventOpen) {
|
|
541
|
-
this.options.enabled = true;
|
|
542
|
-
this.clearStatus();
|
|
543
|
-
|
|
544
|
-
this.options.onRevokeChoice.call(this);
|
|
545
|
-
|
|
546
|
-
if (!preventOpen) {
|
|
547
|
-
this.autoOpen();
|
|
548
|
-
}
|
|
549
|
-
};
|
|
550
|
-
|
|
551
|
-
// returns true if the cookie has a valid value
|
|
552
|
-
CookiePopup.prototype.hasAnswered = function(options) {
|
|
553
|
-
return Object.keys(cc.status).indexOf(this.getStatus()) >= 0;
|
|
554
|
-
};
|
|
555
|
-
|
|
556
|
-
// returns true if the cookie indicates that consent has been given
|
|
557
|
-
CookiePopup.prototype.hasConsented = function(options) {
|
|
558
|
-
var val = this.getStatus();
|
|
559
|
-
return val == cc.status.allow || val == cc.status.dismiss;
|
|
560
|
-
};
|
|
561
|
-
|
|
562
|
-
// opens the popup if no answer has been given
|
|
563
|
-
CookiePopup.prototype.autoOpen = function(options) {
|
|
564
|
-
!this.hasAnswered() && this.options.enabled && this.open();
|
|
565
|
-
};
|
|
566
|
-
|
|
567
|
-
CookiePopup.prototype.setStatus = function(status) {
|
|
568
|
-
var c = this.options.cookie;
|
|
569
|
-
var value = util.getCookie(c.name);
|
|
570
|
-
var chosenBefore = Object.keys(cc.status).indexOf(value) >= 0;
|
|
571
|
-
|
|
572
|
-
// if `status` is valid
|
|
573
|
-
if (Object.keys(cc.status).indexOf(status) >= 0) {
|
|
574
|
-
util.setCookie(c.name, status, c.expiryDays, c.domain, c.path);
|
|
575
|
-
|
|
576
|
-
this.options.onStatusChange.call(this, status, chosenBefore);
|
|
577
|
-
} else {
|
|
578
|
-
this.clearStatus();
|
|
579
|
-
}
|
|
580
|
-
};
|
|
581
|
-
|
|
582
|
-
CookiePopup.prototype.getStatus = function() {
|
|
583
|
-
return util.getCookie(this.options.cookie.name);
|
|
584
|
-
};
|
|
585
|
-
|
|
586
|
-
CookiePopup.prototype.clearStatus = function() {
|
|
587
|
-
var c = this.options.cookie;
|
|
588
|
-
util.setCookie(c.name, '', -1, c.domain, c.path);
|
|
589
|
-
};
|
|
590
|
-
|
|
591
|
-
// This needs to be called after 'fadeIn'. This is the code that actually causes the fadeIn to work
|
|
592
|
-
// There is a good reason why it's called in a timeout. Read 'fadeIn';
|
|
593
|
-
function afterFadeIn(el) {
|
|
594
|
-
this.openingTimeout = null;
|
|
595
|
-
util.removeClass(el, 'cc-invisible');
|
|
596
|
-
}
|
|
597
|
-
|
|
598
|
-
// This is called on 'transitionend' (only on the transition of the fadeOut). That's because after we've faded out, we need to
|
|
599
|
-
// set the display to 'none' (so there aren't annoying invisible popups all over the page). If for whenever reason this function
|
|
600
|
-
// is not called (lack of support), the open/close mechanism will still work.
|
|
601
|
-
function afterFadeOut(el) {
|
|
602
|
-
el.style.display = 'none'; // after close and before open, the display should be none
|
|
603
|
-
el.removeEventListener(cc.transitionEnd, this.afterTransition);
|
|
604
|
-
this.afterTransition = null;
|
|
605
|
-
}
|
|
606
|
-
|
|
607
|
-
// this function calls the `onComplete` hook and returns true (if needed) and returns false otherwise
|
|
608
|
-
function checkCallbackHooks() {
|
|
609
|
-
var complete = this.options.onInitialise.bind(this);
|
|
610
|
-
|
|
611
|
-
if (!window.navigator.cookieEnabled) {
|
|
612
|
-
complete(cc.status.deny);
|
|
613
|
-
return true;
|
|
614
|
-
}
|
|
615
|
-
|
|
616
|
-
if (window.CookiesOK || window.navigator.CookiesOK) {
|
|
617
|
-
complete(cc.status.allow);
|
|
618
|
-
return true;
|
|
619
|
-
}
|
|
620
|
-
|
|
621
|
-
var allowed = Object.keys(cc.status);
|
|
622
|
-
var answer = this.getStatus();
|
|
623
|
-
var match = allowed.indexOf(answer) >= 0;
|
|
624
|
-
|
|
625
|
-
if (match) {
|
|
626
|
-
complete(answer);
|
|
627
|
-
}
|
|
628
|
-
return match;
|
|
629
|
-
}
|
|
630
|
-
|
|
631
|
-
function getPositionClasses() {
|
|
632
|
-
var positions = this.options.position.split('-'); // top, bottom, left, right
|
|
633
|
-
var classes = [];
|
|
634
|
-
|
|
635
|
-
// top, left, right, bottom
|
|
636
|
-
positions.forEach(function(cur) {
|
|
637
|
-
classes.push('cc-' + cur);
|
|
638
|
-
});
|
|
639
|
-
|
|
640
|
-
return classes;
|
|
641
|
-
}
|
|
642
|
-
|
|
643
|
-
function getPopupClasses() {
|
|
644
|
-
var opts = this.options;
|
|
645
|
-
var positionStyle = (opts.position == 'top' || opts.position == 'bottom') ? 'banner' : 'floating';
|
|
646
|
-
|
|
647
|
-
if (util.isMobile()) {
|
|
648
|
-
positionStyle = 'floating';
|
|
649
|
-
}
|
|
650
|
-
|
|
651
|
-
var classes = [
|
|
652
|
-
'cc-' + positionStyle, // floating or banner
|
|
653
|
-
'cc-type-' + opts.type, // add the compliance type
|
|
654
|
-
'cc-theme-' + opts.theme, // add the theme
|
|
655
|
-
];
|
|
656
|
-
|
|
657
|
-
if (opts.static) {
|
|
658
|
-
classes.push('cc-static');
|
|
659
|
-
}
|
|
660
|
-
|
|
661
|
-
classes.push.apply(classes, getPositionClasses.call(this));
|
|
662
|
-
|
|
663
|
-
// we only add extra styles if `palette` has been set to a valid value
|
|
664
|
-
var didAttach = attachCustomPalette.call(this, this.options.palette);
|
|
665
|
-
|
|
666
|
-
// if we override the palette, add the class that enables this
|
|
667
|
-
if (this.customStyleSelector) {
|
|
668
|
-
classes.push(this.customStyleSelector);
|
|
669
|
-
}
|
|
670
|
-
|
|
671
|
-
return classes;
|
|
672
|
-
}
|
|
673
|
-
|
|
674
|
-
function getPopupInnerMarkup() {
|
|
675
|
-
var interpolated = {};
|
|
676
|
-
var opts = this.options;
|
|
677
|
-
|
|
678
|
-
// removes link if showLink is false
|
|
679
|
-
if (!opts.showLink) {
|
|
680
|
-
opts.elements.link = '';
|
|
681
|
-
opts.elements.messagelink = opts.elements.message;
|
|
682
|
-
}
|
|
683
|
-
|
|
684
|
-
Object.keys(opts.elements).forEach(function(prop) {
|
|
685
|
-
interpolated[prop] = util.interpolateString(opts.elements[prop], function(name) {
|
|
686
|
-
var str = opts.content[name];
|
|
687
|
-
return (name && typeof str == 'string' && str.length) ? str : '';
|
|
688
|
-
})
|
|
689
|
-
});
|
|
690
|
-
|
|
691
|
-
// checks if the type is valid and defaults to info if it's not
|
|
692
|
-
var complianceType = opts.compliance[opts.type];
|
|
693
|
-
if (!complianceType) {
|
|
694
|
-
complianceType = opts.compliance.info;
|
|
695
|
-
}
|
|
696
|
-
|
|
697
|
-
// build the compliance types from the already interpolated `elements`
|
|
698
|
-
interpolated.compliance = util.interpolateString(complianceType, function(name) {
|
|
699
|
-
return interpolated[name];
|
|
700
|
-
});
|
|
701
|
-
|
|
702
|
-
// checks if the layout is valid and defaults to basic if it's not
|
|
703
|
-
var layout = opts.layouts[opts.layout];
|
|
704
|
-
if (!layout) {
|
|
705
|
-
layout = opts.layouts.basic;
|
|
706
|
-
}
|
|
707
|
-
|
|
708
|
-
return util.interpolateString(layout, function(match) {
|
|
709
|
-
return interpolated[match];
|
|
710
|
-
});
|
|
711
|
-
}
|
|
712
|
-
|
|
713
|
-
function appendMarkup(markup) {
|
|
714
|
-
var opts = this.options;
|
|
715
|
-
var div = document.createElement('div');
|
|
716
|
-
var cont = (opts.container && opts.container.nodeType === 1) ? opts.container : document.body;
|
|
717
|
-
|
|
718
|
-
div.innerHTML = markup;
|
|
719
|
-
|
|
720
|
-
var el = div.children[0];
|
|
721
|
-
|
|
722
|
-
el.style.display = 'none';
|
|
723
|
-
|
|
724
|
-
if (util.hasClass(el, 'cc-window') && cc.hasTransition) {
|
|
725
|
-
util.addClass(el, 'cc-invisible');
|
|
726
|
-
}
|
|
727
|
-
|
|
728
|
-
// save ref to the function handle so we can unbind it later
|
|
729
|
-
this.onButtonClick = handleButtonClick.bind(this);
|
|
730
|
-
|
|
731
|
-
el.addEventListener('click', this.onButtonClick);
|
|
732
|
-
|
|
733
|
-
if (opts.autoAttach) {
|
|
734
|
-
if (!cont.firstChild) {
|
|
735
|
-
cont.appendChild(el);
|
|
736
|
-
} else {
|
|
737
|
-
cont.insertBefore(el, cont.firstChild)
|
|
738
|
-
}
|
|
739
|
-
}
|
|
740
|
-
|
|
741
|
-
return el;
|
|
742
|
-
}
|
|
743
|
-
|
|
744
|
-
function handleButtonClick(event) {
|
|
745
|
-
var targ = event.target;
|
|
746
|
-
if (util.hasClass(targ, 'cc-btn')) {
|
|
747
|
-
|
|
748
|
-
var matches = targ.className.match(new RegExp("\\bcc-(" + __allowedStatuses.join('|') + ")\\b"));
|
|
749
|
-
var match = (matches && matches[1]) || false;
|
|
750
|
-
|
|
751
|
-
if (match) {
|
|
752
|
-
this.setStatus(match);
|
|
753
|
-
this.close(true);
|
|
754
|
-
}
|
|
755
|
-
}
|
|
756
|
-
if (util.hasClass(targ, 'cc-close')) {
|
|
757
|
-
this.setStatus(cc.status.dismiss);
|
|
758
|
-
this.close(true);
|
|
759
|
-
}
|
|
760
|
-
if (util.hasClass(targ, 'cc-revoke')) {
|
|
761
|
-
this.revokeChoice();
|
|
762
|
-
}
|
|
763
|
-
}
|
|
764
|
-
|
|
765
|
-
// I might change this function to use inline styles. I originally chose a stylesheet because I could select many elements with a
|
|
766
|
-
// single rule (something that happened a lot), the apps has changed slightly now though, so inline styles might be more applicable.
|
|
767
|
-
function attachCustomPalette(palette) {
|
|
768
|
-
var hash = util.hash(JSON.stringify(palette));
|
|
769
|
-
var selector = 'cc-color-override-' + hash;
|
|
770
|
-
var isValid = util.isPlainObject(palette);
|
|
771
|
-
|
|
772
|
-
this.customStyleSelector = isValid ? selector : null;
|
|
773
|
-
|
|
774
|
-
if (isValid) {
|
|
775
|
-
addCustomStyle(hash, palette, '.' + selector);
|
|
776
|
-
}
|
|
777
|
-
return isValid;
|
|
778
|
-
}
|
|
779
|
-
|
|
780
|
-
function addCustomStyle(hash, palette, prefix) {
|
|
781
|
-
|
|
782
|
-
// only add this if a style like it doesn't exist
|
|
783
|
-
if (cc.customStyles[hash]) {
|
|
784
|
-
// custom style already exists, so increment the reference count
|
|
785
|
-
++cc.customStyles[hash].references;
|
|
786
|
-
return;
|
|
787
|
-
}
|
|
788
|
-
|
|
789
|
-
var colorStyles = {};
|
|
790
|
-
var popup = palette.popup;
|
|
791
|
-
var button = palette.button;
|
|
792
|
-
var highlight = palette.highlight;
|
|
793
|
-
|
|
794
|
-
// needs background colour, text and link will be set to black/white if not specified
|
|
795
|
-
if (popup) {
|
|
796
|
-
// assumes popup.background is set
|
|
797
|
-
popup.text = popup.text ? popup.text : util.getContrast(popup.background);
|
|
798
|
-
popup.link = popup.link ? popup.link : popup.text;
|
|
799
|
-
colorStyles[prefix + '.cc-window'] = [
|
|
800
|
-
'color: ' + popup.text,
|
|
801
|
-
'background-color: ' + popup.background
|
|
802
|
-
];
|
|
803
|
-
colorStyles[prefix + '.cc-revoke'] = [
|
|
804
|
-
'color: ' + popup.text,
|
|
805
|
-
'background-color: ' + popup.background
|
|
806
|
-
];
|
|
807
|
-
colorStyles[prefix + ' .cc-link,' + prefix + ' .cc-link:active,' + prefix + ' .cc-link:visited'] = [
|
|
808
|
-
'color: ' + popup.link
|
|
809
|
-
];
|
|
810
|
-
|
|
811
|
-
if (button) {
|
|
812
|
-
// assumes button.background is set
|
|
813
|
-
button.text = button.text ? button.text : util.getContrast(button.background);
|
|
814
|
-
button.border = button.border ? button.border : 'transparent';
|
|
815
|
-
colorStyles[prefix + ' .cc-btn'] = [
|
|
816
|
-
'color: ' + button.text,
|
|
817
|
-
'border-color: ' + button.border,
|
|
818
|
-
'background-color: ' + button.background
|
|
819
|
-
];
|
|
820
|
-
|
|
821
|
-
if(button.background != 'transparent')
|
|
822
|
-
colorStyles[prefix + ' .cc-btn:hover, ' + prefix + ' .cc-btn:focus'] = [
|
|
823
|
-
'background-color: ' + getHoverColour(button.background)
|
|
824
|
-
];
|
|
825
|
-
|
|
826
|
-
if (highlight) {
|
|
827
|
-
//assumes highlight.background is set
|
|
828
|
-
highlight.text = highlight.text ? highlight.text : util.getContrast(highlight.background);
|
|
829
|
-
highlight.border = highlight.border ? highlight.border : 'transparent';
|
|
830
|
-
colorStyles[prefix + ' .cc-highlight .cc-btn:first-child'] = [
|
|
831
|
-
'color: ' + highlight.text,
|
|
832
|
-
'border-color: ' + highlight.border,
|
|
833
|
-
'background-color: ' + highlight.background
|
|
834
|
-
];
|
|
835
|
-
} else {
|
|
836
|
-
// sets highlight text color to popup text. background and border are transparent by default.
|
|
837
|
-
colorStyles[prefix + ' .cc-highlight .cc-btn:first-child'] = [
|
|
838
|
-
'color: ' + popup.text
|
|
839
|
-
];
|
|
840
|
-
}
|
|
841
|
-
}
|
|
842
|
-
|
|
843
|
-
}
|
|
844
|
-
|
|
845
|
-
// this will be interpretted as CSS. the key is the selector, and each array element is a rule
|
|
846
|
-
var style = document.createElement('style');
|
|
847
|
-
document.head.appendChild(style);
|
|
848
|
-
|
|
849
|
-
// custom style doesn't exist, so we create it
|
|
850
|
-
cc.customStyles[hash] = {
|
|
851
|
-
references: 1,
|
|
852
|
-
element: style.sheet
|
|
853
|
-
};
|
|
854
|
-
|
|
855
|
-
var ruleIndex = -1;
|
|
856
|
-
for (var prop in colorStyles) {
|
|
857
|
-
if (colorStyles.hasOwnProperty(prop)) {
|
|
858
|
-
style.sheet.insertRule(prop + '{' + colorStyles[prop].join(';') + '}', ++ruleIndex);
|
|
859
|
-
}
|
|
860
|
-
}
|
|
861
|
-
}
|
|
862
|
-
|
|
863
|
-
function getHoverColour(hex) {
|
|
864
|
-
hex = util.normaliseHex(hex);
|
|
865
|
-
// for black buttons
|
|
866
|
-
if (hex == '000000') {
|
|
867
|
-
return '#222';
|
|
868
|
-
}
|
|
869
|
-
return util.getLuminance(hex);
|
|
870
|
-
}
|
|
871
|
-
|
|
872
|
-
function removeCustomStyle(palette) {
|
|
873
|
-
if (util.isPlainObject(palette)) {
|
|
874
|
-
var hash = util.hash(JSON.stringify(palette));
|
|
875
|
-
var customStyle = cc.customStyles[hash];
|
|
876
|
-
if (customStyle && !--customStyle.references) {
|
|
877
|
-
var styleNode = customStyle.element.ownerNode;
|
|
878
|
-
if (styleNode && styleNode.parentNode) {
|
|
879
|
-
styleNode.parentNode.removeChild(styleNode);
|
|
880
|
-
}
|
|
881
|
-
cc.customStyles[hash] = null;
|
|
882
|
-
}
|
|
883
|
-
}
|
|
884
|
-
}
|
|
885
|
-
|
|
886
|
-
function arrayContainsMatches(array, search) {
|
|
887
|
-
for (var i = 0, l = array.length; i < l; ++i) {
|
|
888
|
-
var str = array[i];
|
|
889
|
-
// if regex matches or string is equal, return true
|
|
890
|
-
if ((str instanceof RegExp && str.test(search)) ||
|
|
891
|
-
(typeof str == 'string' && str.length && str === search)) {
|
|
892
|
-
return true;
|
|
893
|
-
}
|
|
894
|
-
}
|
|
895
|
-
return false;
|
|
896
|
-
}
|
|
897
|
-
|
|
898
|
-
function applyAutoDismiss() {
|
|
899
|
-
var setStatus = this.setStatus.bind(this);
|
|
900
|
-
|
|
901
|
-
var delay = this.options.dismissOnTimeout;
|
|
902
|
-
if (typeof delay == 'number' && delay >= 0) {
|
|
903
|
-
this.dismissTimeout = window.setTimeout(function() {
|
|
904
|
-
setStatus(cc.status.dismiss);
|
|
905
|
-
}, Math.floor(delay));
|
|
906
|
-
}
|
|
907
|
-
|
|
908
|
-
var scrollRange = this.options.dismissOnScroll;
|
|
909
|
-
if (typeof scrollRange == 'number' && scrollRange >= 0) {
|
|
910
|
-
var onWindowScroll = function(evt) {
|
|
911
|
-
if (window.pageYOffset > Math.floor(scrollRange)) {
|
|
912
|
-
setStatus(cc.status.dismiss);
|
|
913
|
-
|
|
914
|
-
window.removeEventListener('scroll', onWindowScroll);
|
|
915
|
-
this.onWindowScroll = null;
|
|
916
|
-
}
|
|
917
|
-
};
|
|
918
|
-
|
|
919
|
-
this.onWindowScroll = onWindowScroll;
|
|
920
|
-
window.addEventListener('scroll', onWindowScroll);
|
|
921
|
-
}
|
|
922
|
-
}
|
|
923
|
-
|
|
924
|
-
function applyRevokeButton() {
|
|
925
|
-
// revokable is true if advanced compliance is selected
|
|
926
|
-
if (this.options.type != 'info') this.options.revokable = true;
|
|
927
|
-
// animateRevokable false for mobile devices
|
|
928
|
-
if (util.isMobile()) this.options.animateRevokable = false;
|
|
929
|
-
|
|
930
|
-
if (this.options.revokable) {
|
|
931
|
-
var classes = getPositionClasses.call(this);
|
|
932
|
-
if (this.options.animateRevokable) {
|
|
933
|
-
classes.push('cc-animate');
|
|
934
|
-
}
|
|
935
|
-
if (this.customStyleSelector) {
|
|
936
|
-
classes.push(this.customStyleSelector)
|
|
937
|
-
}
|
|
938
|
-
var revokeBtn = this.options.revokeBtn.replace('{{classes}}', classes.join(' '));
|
|
939
|
-
this.revokeBtn = appendMarkup.call(this, revokeBtn);
|
|
940
|
-
|
|
941
|
-
var btn = this.revokeBtn;
|
|
942
|
-
if (this.options.animateRevokable) {
|
|
943
|
-
var wait = false;
|
|
944
|
-
var onMouseMove = util.throttle(function(evt) {
|
|
945
|
-
var active = false;
|
|
946
|
-
var minY = 20;
|
|
947
|
-
var maxY = (window.innerHeight - 20);
|
|
948
|
-
|
|
949
|
-
if (util.hasClass(btn, 'cc-top') && evt.clientY < minY) active = true;
|
|
950
|
-
if (util.hasClass(btn, 'cc-bottom') && evt.clientY > maxY) active = true;
|
|
951
|
-
|
|
952
|
-
if (active) {
|
|
953
|
-
if (!util.hasClass(btn, 'cc-active')) {
|
|
954
|
-
util.addClass(btn, 'cc-active');
|
|
955
|
-
}
|
|
956
|
-
} else {
|
|
957
|
-
if (util.hasClass(btn, 'cc-active')) {
|
|
958
|
-
util.removeClass(btn, 'cc-active');
|
|
959
|
-
}
|
|
960
|
-
}
|
|
961
|
-
}, 200);
|
|
962
|
-
|
|
963
|
-
this.onMouseMove = onMouseMove;
|
|
964
|
-
window.addEventListener('mousemove', onMouseMove);
|
|
965
|
-
}
|
|
966
|
-
}
|
|
967
|
-
}
|
|
968
|
-
|
|
969
|
-
return CookiePopup
|
|
970
|
-
}());
|
|
971
|
-
|
|
972
|
-
cc.Location = (function() {
|
|
973
|
-
|
|
974
|
-
// An object containing all the location services we have already set up.
|
|
975
|
-
// When using a service, it could either return a data structure in plain text (like a JSON object) or an executable script
|
|
976
|
-
// When the response needs to be executed by the browser, then `isScript` must be set to true, otherwise it won't work.
|
|
977
|
-
|
|
978
|
-
// When the service uses a script, the chances are that you'll have to use the script to make additional requests. In these
|
|
979
|
-
// cases, the services `callback` property is called with a `done` function. When performing async operations, this must be called
|
|
980
|
-
// with the data (or Error), and `cookieconsent.locate` will take care of the rest
|
|
981
|
-
var defaultOptions = {
|
|
982
|
-
|
|
983
|
-
// The default timeout is 5 seconds. This is mainly needed to catch JSONP requests that error.
|
|
984
|
-
// Otherwise there is no easy way to catch JSONP errors. That means that if a JSONP fails, the
|
|
985
|
-
// app will take `timeout` milliseconds to react to a JSONP network error.
|
|
986
|
-
timeout: 5000,
|
|
987
|
-
|
|
988
|
-
// the order that services will be attempted in
|
|
989
|
-
services: [
|
|
990
|
-
'freegeoip',
|
|
991
|
-
'ipinfo',
|
|
992
|
-
'maxmind'
|
|
993
|
-
|
|
994
|
-
/*
|
|
995
|
-
|
|
996
|
-
// 'ipinfodb' requires some options, so we define it using an object
|
|
997
|
-
// this object will be passed to the function that defines the service
|
|
998
|
-
|
|
999
|
-
{
|
|
1000
|
-
name: 'ipinfodb',
|
|
1001
|
-
interpolateUrl: {
|
|
1002
|
-
// obviously, this is a fake key
|
|
1003
|
-
api_key: 'vOgI3748dnIytIrsJcxS7qsDf6kbJkE9lN4yEDrXAqXcKUNvjjZPox3ekXqmMMld'
|
|
1004
|
-
},
|
|
1005
|
-
},
|
|
1006
|
-
|
|
1007
|
-
// as well as defining an object, you can define a function that returns an object
|
|
1008
|
-
|
|
1009
|
-
function () {
|
|
1010
|
-
return {name: 'ipinfodb'};
|
|
1011
|
-
},
|
|
1012
|
-
|
|
1013
|
-
*/
|
|
1014
|
-
],
|
|
1015
|
-
|
|
1016
|
-
serviceDefinitions: {
|
|
1017
|
-
|
|
1018
|
-
freegeoip: function() {
|
|
1019
|
-
return {
|
|
1020
|
-
// This service responds with JSON, but they do not have CORS set, so we must use JSONP and provide a callback
|
|
1021
|
-
// The `{callback}` is automatically rewritten by the tool
|
|
1022
|
-
url: '//freegeoip.net/json/?callback={callback}',
|
|
1023
|
-
isScript: true, // this is JSONP, therefore we must set it to run as a script
|
|
1024
|
-
callback: function(done, response) {
|
|
1025
|
-
try{
|
|
1026
|
-
var json = JSON.parse(response);
|
|
1027
|
-
return json.error ? toError(json) : {
|
|
1028
|
-
code: json.country_code
|
|
1029
|
-
};
|
|
1030
|
-
} catch (err) {
|
|
1031
|
-
return toError({error: 'Invalid response ('+err+')'});
|
|
1032
|
-
}
|
|
1033
|
-
}
|
|
1034
|
-
}
|
|
1035
|
-
},
|
|
1036
|
-
|
|
1037
|
-
ipinfo: function() {
|
|
1038
|
-
return {
|
|
1039
|
-
// This service responds with JSON, so we simply need to parse it and return the country code
|
|
1040
|
-
url: '//ipinfo.io',
|
|
1041
|
-
headers: ['Accept: application/json'],
|
|
1042
|
-
callback: function(done, response) {
|
|
1043
|
-
try{
|
|
1044
|
-
var json = JSON.parse(response);
|
|
1045
|
-
return json.error ? toError(json) : {
|
|
1046
|
-
code: json.country
|
|
1047
|
-
};
|
|
1048
|
-
} catch (err) {
|
|
1049
|
-
return toError({error: 'Invalid response ('+err+')'});
|
|
1050
|
-
}
|
|
1051
|
-
}
|
|
1052
|
-
}
|
|
1053
|
-
},
|
|
1054
|
-
|
|
1055
|
-
// This service requires an option to define `key`. Options are proived using objects or functions
|
|
1056
|
-
ipinfodb: function(options) {
|
|
1057
|
-
return {
|
|
1058
|
-
// This service responds with JSON, so we simply need to parse it and return the country code
|
|
1059
|
-
url: '//api.ipinfodb.com/v3/ip-country/?key={api_key}&format=json&callback={callback}',
|
|
1060
|
-
isScript: true, // this is JSONP, therefore we must set it to run as a script
|
|
1061
|
-
callback: function(done, response) {
|
|
1062
|
-
try{
|
|
1063
|
-
var json = JSON.parse(response);
|
|
1064
|
-
return json.statusCode == 'ERROR' ? toError({error: json.statusMessage}) : {
|
|
1065
|
-
code: json.countryCode
|
|
1066
|
-
};
|
|
1067
|
-
} catch (err) {
|
|
1068
|
-
return toError({error: 'Invalid response ('+err+')'});
|
|
1069
|
-
}
|
|
1070
|
-
}
|
|
1071
|
-
}
|
|
1072
|
-
},
|
|
1073
|
-
|
|
1074
|
-
maxmind: function() {
|
|
1075
|
-
return {
|
|
1076
|
-
// This service responds with a JavaScript file which defines additional functionality. Once loaded, we must
|
|
1077
|
-
// make an additional AJAX call. Therefore we provide a `done` callback that can be called asynchronously
|
|
1078
|
-
url: '//js.maxmind.com/js/apis/geoip2/v2.1/geoip2.js',
|
|
1079
|
-
isScript: true, // this service responds with a JavaScript file, so it must be run as a script
|
|
1080
|
-
callback: function(done) {
|
|
1081
|
-
// if everything went okay then `geoip2` WILL be defined
|
|
1082
|
-
if (!window.geoip2) {
|
|
1083
|
-
done(new Error('Unexpected response format. The downloaded script should have exported `geoip2` to the global scope'));
|
|
1084
|
-
return;
|
|
1085
|
-
}
|
|
1086
|
-
|
|
1087
|
-
geoip2.country(function(location) {
|
|
1088
|
-
try {
|
|
1089
|
-
done({
|
|
1090
|
-
code: location.country.iso_code
|
|
1091
|
-
});
|
|
1092
|
-
} catch (err) {
|
|
1093
|
-
done(toError(err));
|
|
1094
|
-
}
|
|
1095
|
-
}, function(err) {
|
|
1096
|
-
done(toError(err));
|
|
1097
|
-
});
|
|
1098
|
-
|
|
1099
|
-
// We can't return anything, because we need to wait for the second AJAX call to return.
|
|
1100
|
-
// Then we can 'complete' the service by passing data or an error to the `done` callback.
|
|
1101
|
-
}
|
|
1102
|
-
}
|
|
1103
|
-
},
|
|
1104
|
-
},
|
|
1105
|
-
};
|
|
1106
|
-
|
|
1107
|
-
function Location(options) {
|
|
1108
|
-
// Set up options
|
|
1109
|
-
util.deepExtend(this.options = {}, defaultOptions);
|
|
1110
|
-
|
|
1111
|
-
if (util.isPlainObject(options)) {
|
|
1112
|
-
util.deepExtend(this.options, options);
|
|
1113
|
-
}
|
|
1114
|
-
|
|
1115
|
-
this.currentServiceIndex = -1; // the index (in options) of the service we're currently using
|
|
1116
|
-
}
|
|
1117
|
-
|
|
1118
|
-
Location.prototype.getNextService = function() {
|
|
1119
|
-
var service;
|
|
1120
|
-
|
|
1121
|
-
do {
|
|
1122
|
-
service = this.getServiceByIdx(++this.currentServiceIndex);
|
|
1123
|
-
} while (this.currentServiceIndex < this.options.services.length && !service);
|
|
1124
|
-
|
|
1125
|
-
return service;
|
|
1126
|
-
};
|
|
1127
|
-
|
|
1128
|
-
Location.prototype.getServiceByIdx = function(idx) {
|
|
1129
|
-
// This can either be the name of a default locationService, or a function.
|
|
1130
|
-
var serviceOption = this.options.services[idx];
|
|
1131
|
-
|
|
1132
|
-
// If it's a string, use one of the location services.
|
|
1133
|
-
if (typeof serviceOption === 'function') {
|
|
1134
|
-
var dynamicOpts = serviceOption();
|
|
1135
|
-
if (dynamicOpts.name) {
|
|
1136
|
-
util.deepExtend(dynamicOpts, this.options.serviceDefinitions[dynamicOpts.name](dynamicOpts));
|
|
1137
|
-
}
|
|
1138
|
-
return dynamicOpts;
|
|
1139
|
-
}
|
|
1140
|
-
|
|
1141
|
-
// If it's a string, use one of the location services.
|
|
1142
|
-
if (typeof serviceOption === 'string') {
|
|
1143
|
-
return this.options.serviceDefinitions[serviceOption]();
|
|
1144
|
-
}
|
|
1145
|
-
|
|
1146
|
-
// If it's an object, assume {name: 'ipinfo', ...otherOptions}
|
|
1147
|
-
// Allows user to pass in API keys etc.
|
|
1148
|
-
if (util.isPlainObject(serviceOption)) {
|
|
1149
|
-
return this.options.serviceDefinitions[serviceOption.name](serviceOption);
|
|
1150
|
-
}
|
|
1151
|
-
|
|
1152
|
-
return null;
|
|
1153
|
-
};
|
|
1154
|
-
|
|
1155
|
-
// This runs the service located at index `currentServiceIndex`.
|
|
1156
|
-
// If the service fails, `runNextServiceOnError` will continue trying each service until all fail, or one completes successfully
|
|
1157
|
-
Location.prototype.locate = function(complete, error) {
|
|
1158
|
-
var service = this.getNextService();
|
|
1159
|
-
|
|
1160
|
-
if (!service) {
|
|
1161
|
-
error(new Error('No services to run'));
|
|
1162
|
-
return;
|
|
1163
|
-
}
|
|
1164
|
-
|
|
1165
|
-
this.callbackComplete = complete;
|
|
1166
|
-
this.callbackError = error;
|
|
1167
|
-
|
|
1168
|
-
this.runService(service, this.runNextServiceOnError.bind(this));
|
|
1169
|
-
};
|
|
1170
|
-
|
|
1171
|
-
// Potentially adds a callback to a url for jsonp.
|
|
1172
|
-
Location.prototype.setupUrl = function(service) {
|
|
1173
|
-
var serviceOpts = this.getCurrentServiceOpts();
|
|
1174
|
-
return service.url.replace(/\{(.*?)\}/g, function(_, param) {
|
|
1175
|
-
if (param === 'callback') {
|
|
1176
|
-
var tempName = 'callback' + Date.now();
|
|
1177
|
-
window[tempName] = function(res) {
|
|
1178
|
-
service.__JSONP_DATA = JSON.stringify(res);
|
|
1179
|
-
}
|
|
1180
|
-
return tempName;
|
|
1181
|
-
}
|
|
1182
|
-
if (param in serviceOpts.interpolateUrl) {
|
|
1183
|
-
return serviceOpts.interpolateUrl[param];
|
|
1184
|
-
}
|
|
1185
|
-
});
|
|
1186
|
-
};
|
|
1187
|
-
|
|
1188
|
-
// requires a `service` object that defines at least a `url` and `callback`
|
|
1189
|
-
Location.prototype.runService = function(service, complete) {
|
|
1190
|
-
var self = this;
|
|
1191
|
-
|
|
1192
|
-
// basic check to ensure it resembles a `service`
|
|
1193
|
-
if (!service || !service.url || !service.callback) {
|
|
1194
|
-
return;
|
|
1195
|
-
}
|
|
1196
|
-
|
|
1197
|
-
// we call either `getScript` or `makeAsyncRequest` depending on the type of resource
|
|
1198
|
-
var requestFunction = service.isScript ? getScript : makeAsyncRequest;
|
|
1199
|
-
|
|
1200
|
-
var url = this.setupUrl(service);
|
|
1201
|
-
|
|
1202
|
-
// both functions have similar signatures so we can pass the same arguments to both
|
|
1203
|
-
requestFunction(url, function(xhr) {
|
|
1204
|
-
// if `!xhr`, then `getScript` function was used, so there is no response text
|
|
1205
|
-
var responseText = xhr ? xhr.responseText : '';
|
|
1206
|
-
|
|
1207
|
-
// if the resource is a script, then this function is called after the script has been run.
|
|
1208
|
-
// if the script is JSONP, then a time defined function `callback_{Date.now}` has already
|
|
1209
|
-
// been called (as the JSONP callback). This callback sets the __JSONP_DATA property
|
|
1210
|
-
if (service.__JSONP_DATA) {
|
|
1211
|
-
responseText = service.__JSONP_DATA;
|
|
1212
|
-
delete service.__JSONP_DATA;
|
|
1213
|
-
}
|
|
1214
|
-
|
|
1215
|
-
// call the service callback with the response text (so it can parse the response)
|
|
1216
|
-
self.runServiceCallback.call(self, complete, service, responseText);
|
|
1217
|
-
|
|
1218
|
-
}, this.options.timeout, service.data, service.headers);
|
|
1219
|
-
|
|
1220
|
-
// `service.data` and `service.headers` are optional (they only count if `!service.isScript` anyway)
|
|
1221
|
-
};
|
|
1222
|
-
|
|
1223
|
-
// The service request has run (and possibly has a `responseText`) [no `responseText` if `isScript`]
|
|
1224
|
-
// We need to run its callback which determines if its successful or not
|
|
1225
|
-
// `complete` is called on success or failure
|
|
1226
|
-
Location.prototype.runServiceCallback = function(complete, service, responseText) {
|
|
1227
|
-
var self = this;
|
|
1228
|
-
// this is the function that is called if the service uses the async callback in its handler method
|
|
1229
|
-
var serviceResultHandler = function (asyncResult) {
|
|
1230
|
-
// if `result` is a valid value, then this function shouldn't really run
|
|
1231
|
-
// even if it is called by `service.callback`
|
|
1232
|
-
if (!result) {
|
|
1233
|
-
self.onServiceResult.call(self, complete, asyncResult)
|
|
1234
|
-
}
|
|
1235
|
-
};
|
|
1236
|
-
|
|
1237
|
-
// the function `service.callback` will either extract a country code from `responseText` and return it (in `result`)
|
|
1238
|
-
// or (if it has to make additional requests) it will call a `done` callback with the country code when it is ready
|
|
1239
|
-
var result = service.callback(serviceResultHandler, responseText);
|
|
1240
|
-
|
|
1241
|
-
if (result) {
|
|
1242
|
-
this.onServiceResult.call(this, complete, result);
|
|
1243
|
-
}
|
|
1244
|
-
};
|
|
1245
|
-
|
|
1246
|
-
// This is called with the `result` from `service.callback` regardless of how it provided that result (sync or async).
|
|
1247
|
-
// `result` will be whatever is returned from `service.callback`. A service callback should provide an object with data
|
|
1248
|
-
Location.prototype.onServiceResult = function(complete, result) {
|
|
1249
|
-
// convert result to nodejs style async callback
|
|
1250
|
-
if (result instanceof Error || (result && result.error)) {
|
|
1251
|
-
complete.call(this, result, null);
|
|
1252
|
-
} else {
|
|
1253
|
-
complete.call(this, null, result);
|
|
1254
|
-
}
|
|
1255
|
-
};
|
|
1256
|
-
|
|
1257
|
-
// if `err` is set, the next service handler is called
|
|
1258
|
-
// if `err` is null, the `onComplete` handler is called with `data`
|
|
1259
|
-
Location.prototype.runNextServiceOnError = function(err, data) {
|
|
1260
|
-
if (err) {
|
|
1261
|
-
this.logError(err);
|
|
1262
|
-
|
|
1263
|
-
var nextService = this.getNextService();
|
|
1264
|
-
|
|
1265
|
-
if (nextService) {
|
|
1266
|
-
this.runService(nextService, this.runNextServiceOnError.bind(this));
|
|
1267
|
-
} else {
|
|
1268
|
-
this.completeService.call(this, this.callbackError, new Error('All services failed'));
|
|
1269
|
-
}
|
|
1270
|
-
} else {
|
|
1271
|
-
this.completeService.call(this, this.callbackComplete, data);
|
|
1272
|
-
}
|
|
1273
|
-
};
|
|
1274
|
-
|
|
1275
|
-
Location.prototype.getCurrentServiceOpts = function() {
|
|
1276
|
-
var val = this.options.services[this.currentServiceIndex];
|
|
1277
|
-
|
|
1278
|
-
if (typeof val == 'string') {
|
|
1279
|
-
return {name: val};
|
|
1280
|
-
}
|
|
1281
|
-
|
|
1282
|
-
if (typeof val == 'function') {
|
|
1283
|
-
return val();
|
|
1284
|
-
}
|
|
1285
|
-
|
|
1286
|
-
if (util.isPlainObject(val)) {
|
|
1287
|
-
return val;
|
|
1288
|
-
}
|
|
1289
|
-
|
|
1290
|
-
return {};
|
|
1291
|
-
};
|
|
1292
|
-
|
|
1293
|
-
// calls the `onComplete` callback after resetting the `currentServiceIndex`
|
|
1294
|
-
Location.prototype.completeService = function(fn, data) {
|
|
1295
|
-
this.currentServiceIndex = -1;
|
|
1296
|
-
|
|
1297
|
-
fn && fn(data);
|
|
1298
|
-
};
|
|
1299
|
-
|
|
1300
|
-
Location.prototype.logError = function (err) {
|
|
1301
|
-
var idx = this.currentServiceIndex;
|
|
1302
|
-
var service = this.getServiceByIdx(idx);
|
|
1303
|
-
|
|
1304
|
-
console.error('The service[' + idx + '] (' + service.url + ') responded with the following error', err);
|
|
1305
|
-
};
|
|
1306
|
-
|
|
1307
|
-
function getScript(url, callback, timeout) {
|
|
1308
|
-
var timeoutIdx, s = document.createElement('script');
|
|
1309
|
-
|
|
1310
|
-
s.type = 'text/' + (url.type || 'javascript');
|
|
1311
|
-
s.src = url.src || url;
|
|
1312
|
-
s.async = false;
|
|
1313
|
-
|
|
1314
|
-
s.onreadystatechange = s.onload = function() {
|
|
1315
|
-
// this code handles two scenarios, whether called by onload or onreadystatechange
|
|
1316
|
-
var state = s.readyState;
|
|
1317
|
-
|
|
1318
|
-
clearTimeout(timeoutIdx);
|
|
1319
|
-
|
|
1320
|
-
if (!callback.done && (!state || /loaded|complete/.test(state))) {
|
|
1321
|
-
callback.done = true;
|
|
1322
|
-
callback();
|
|
1323
|
-
s.onreadystatechange = s.onload = null;
|
|
1324
|
-
}
|
|
1325
|
-
};
|
|
1326
|
-
|
|
1327
|
-
document.body.appendChild(s);
|
|
1328
|
-
|
|
1329
|
-
// You can't catch JSONP Errors, because it's handled by the script tag
|
|
1330
|
-
// one way is to use a timeout
|
|
1331
|
-
timeoutIdx = setTimeout(function () {
|
|
1332
|
-
callback.done = true;
|
|
1333
|
-
callback();
|
|
1334
|
-
s.onreadystatechange = s.onload = null;
|
|
1335
|
-
}, timeout);
|
|
1336
|
-
}
|
|
1337
|
-
|
|
1338
|
-
function makeAsyncRequest(url, onComplete, timeout, postData, requestHeaders) {
|
|
1339
|
-
var xhr = new(window.XMLHttpRequest || window.ActiveXObject)('MSXML2.XMLHTTP.3.0');
|
|
1340
|
-
|
|
1341
|
-
xhr.open(postData ? 'POST' : 'GET', url, 1);
|
|
1342
|
-
|
|
1343
|
-
xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
|
|
1344
|
-
xhr.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
|
|
1345
|
-
|
|
1346
|
-
if (Array.isArray(requestHeaders)) {
|
|
1347
|
-
for (var i = 0, l = requestHeaders.length; i < l; ++i) {
|
|
1348
|
-
var split = requestHeaders[i].split(':', 2)
|
|
1349
|
-
xhr.setRequestHeader(split[0].replace(/^\s+|\s+$/g, ''), split[1].replace(/^\s+|\s+$/g, ''));
|
|
1350
|
-
}
|
|
1351
|
-
}
|
|
1352
|
-
|
|
1353
|
-
if (typeof onComplete == 'function') {
|
|
1354
|
-
xhr.onreadystatechange = function() {
|
|
1355
|
-
if (xhr.readyState > 3) {
|
|
1356
|
-
onComplete(xhr);
|
|
1357
|
-
}
|
|
1358
|
-
};
|
|
1359
|
-
}
|
|
1360
|
-
|
|
1361
|
-
xhr.send(postData);
|
|
1362
|
-
}
|
|
1363
|
-
|
|
1364
|
-
function toError(obj) {
|
|
1365
|
-
return new Error('Error [' + (obj.code || 'UNKNOWN') + ']: ' + obj.error);
|
|
1366
|
-
}
|
|
1367
|
-
|
|
1368
|
-
return Location;
|
|
1369
|
-
}());
|
|
1370
|
-
|
|
1371
|
-
cc.Law = (function() {
|
|
1372
|
-
|
|
1373
|
-
var defaultOptions = {
|
|
1374
|
-
// Make this false if you want to disable all regional overrides for settings.
|
|
1375
|
-
// If true, options can differ by country, depending on their cookie law.
|
|
1376
|
-
// It does not affect hiding the popup for countries that do not have cookie law.
|
|
1377
|
-
regionalLaw: true,
|
|
1378
|
-
|
|
1379
|
-
// countries that enforce some version of a cookie law
|
|
1380
|
-
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'],
|
|
1381
|
-
|
|
1382
|
-
// countries that say that all cookie consent choices must be revokable (a user must be able too change their mind)
|
|
1383
|
-
revokable: ['HR', 'CY', 'DK', 'EE', 'FR', 'DE', 'LV', 'LT', 'NL', 'PT', 'ES'],
|
|
1384
|
-
|
|
1385
|
-
// countries that say that a person can only "consent" if the explicitly click on "I agree".
|
|
1386
|
-
// in these countries, consent cannot be implied via a timeout or by scrolling down the page
|
|
1387
|
-
explicitAction: ['HR', 'IT', 'ES'],
|
|
1388
|
-
};
|
|
1389
|
-
|
|
1390
|
-
function Law(options) {
|
|
1391
|
-
this.initialise.apply(this, arguments);
|
|
1392
|
-
}
|
|
1393
|
-
|
|
1394
|
-
Law.prototype.initialise = function(options) {
|
|
1395
|
-
// set options back to default options
|
|
1396
|
-
util.deepExtend(this.options = {}, defaultOptions);
|
|
1397
|
-
|
|
1398
|
-
// merge in user options
|
|
1399
|
-
if (util.isPlainObject(options)) {
|
|
1400
|
-
util.deepExtend(this.options, options);
|
|
1401
|
-
}
|
|
1402
|
-
};
|
|
1403
|
-
|
|
1404
|
-
Law.prototype.get = function(countryCode) {
|
|
1405
|
-
var opts = this.options;
|
|
1406
|
-
return {
|
|
1407
|
-
hasLaw: opts.hasLaw.indexOf(countryCode) >= 0,
|
|
1408
|
-
revokable: opts.revokable.indexOf(countryCode) >= 0,
|
|
1409
|
-
explicitAction: opts.explicitAction.indexOf(countryCode) >= 0,
|
|
1410
|
-
};
|
|
1411
|
-
};
|
|
1412
|
-
|
|
1413
|
-
Law.prototype.applyLaw = function(options, countryCode) {
|
|
1414
|
-
var country = this.get(countryCode);
|
|
1415
|
-
|
|
1416
|
-
if (!country.hasLaw) {
|
|
1417
|
-
// The country has no cookie law
|
|
1418
|
-
options.enabled = false;
|
|
1419
|
-
}
|
|
1420
|
-
|
|
1421
|
-
if (this.options.regionalLaw) {
|
|
1422
|
-
if (country.revokable) {
|
|
1423
|
-
// We must provide an option to revoke consent at a later time
|
|
1424
|
-
options.revokable = true;
|
|
1425
|
-
}
|
|
1426
|
-
|
|
1427
|
-
if (country.explicitAction) {
|
|
1428
|
-
// The user must explicitly click the consent button
|
|
1429
|
-
options.dismissOnScroll = false;
|
|
1430
|
-
options.dismissOnTimeout = false;
|
|
1431
|
-
}
|
|
1432
|
-
}
|
|
1433
|
-
return options;
|
|
1434
|
-
};
|
|
1435
|
-
|
|
1436
|
-
return Law;
|
|
1437
|
-
}());
|
|
1438
|
-
|
|
1439
|
-
// This function initialises the app by combining the use of the Popup, Locator and Law modules
|
|
1440
|
-
// You can string together these three modules yourself however you want, by writing a new function.
|
|
1441
|
-
cc.initialise = function(options, complete, error) {
|
|
1442
|
-
var law = new cc.Law(options.law);
|
|
1443
|
-
|
|
1444
|
-
if (!complete) complete = function() {};
|
|
1445
|
-
if (!error) error = function() {};
|
|
1446
|
-
|
|
1447
|
-
cc.getCountryCode(options, function(result) {
|
|
1448
|
-
// don't need the law or location options anymore
|
|
1449
|
-
delete options.law;
|
|
1450
|
-
delete options.location;
|
|
1451
|
-
|
|
1452
|
-
if (result.code) {
|
|
1453
|
-
options = law.applyLaw(options, result.code);
|
|
1454
|
-
}
|
|
1455
|
-
|
|
1456
|
-
complete(new cc.Popup(options));
|
|
1457
|
-
}, function(err) {
|
|
1458
|
-
// don't need the law or location options anymore
|
|
1459
|
-
delete options.law;
|
|
1460
|
-
delete options.location;
|
|
1461
|
-
|
|
1462
|
-
error(err, new cc.Popup(options));
|
|
1463
|
-
});
|
|
1464
|
-
};
|
|
1465
|
-
|
|
1466
|
-
// This function tries to find your current location. It either grabs it from a hardcoded option in
|
|
1467
|
-
// `options.law.countryCode`, or attempts to make a location service request. This function accepts
|
|
1468
|
-
// options (which can configure the `law` and `location` modules) and fires a callback with which
|
|
1469
|
-
// passes an object `{code: countryCode}` as the first argument (which can have undefined properties)
|
|
1470
|
-
cc.getCountryCode = function(options, complete, error) {
|
|
1471
|
-
if (options.law && options.law.countryCode) {
|
|
1472
|
-
complete({
|
|
1473
|
-
code: options.law.countryCode
|
|
1474
|
-
});
|
|
1475
|
-
return;
|
|
1476
|
-
}
|
|
1477
|
-
if (options.location) {
|
|
1478
|
-
var locator = new cc.Location(options.location);
|
|
1479
|
-
locator.locate(function(serviceResult) {
|
|
1480
|
-
complete(serviceResult || {});
|
|
1481
|
-
}, error);
|
|
1482
|
-
return;
|
|
1483
|
-
}
|
|
1484
|
-
complete({});
|
|
1485
|
-
};
|
|
1486
|
-
|
|
1487
|
-
// export utils (no point in hiding them, so we may as well expose them)
|
|
1488
|
-
cc.utils = util;
|
|
1489
|
-
|
|
1490
|
-
// prevent this code from being run twice
|
|
1491
|
-
cc.hasInitialised = true;
|
|
1492
|
-
|
|
1493
|
-
window.cookieconsent = cc;
|
|
1494
|
-
|
|
1495
|
-
}(window.cookieconsent || {}));
|