Commit dd340a5b authored by Robert Lyon's avatar Robert Lyon
Browse files

Bug 1811141: upgrade cookie consent library to v3.1.0



behatnotneeded

Change-Id: Id5553a18d47d3b2d94e2b0ba7c06d5ea9715ebe0
Signed-off-by: Robert Lyon's avatarRobert Lyon <robertl@catalyst.net.nz>
(cherry picked from commit 9a827627)
parent 6525e6b3
......@@ -4,11 +4,10 @@ CookieConsent
Name : Cookie Consent
Website: https://silktide.com/tools/cookie-consent/
Author : (C) 2013 Silktide Ltd.
Source : https://github.com/silktide/cookieconsent2/
Version: 2.0.9
Source : https://github.com/insites/cookieconsent
Version: 3.1.0
Licence: MIT License (see: https://silktide.com/tools/cookie-consent/docs/license/)
Modifications:
- renamed 'dark-bottom.css' to 'cookieconsent.scss' and copied/moved it to htdocs/theme/raw/sass
- removed the url target '_blank' for security reasons
- wrapped a protocol-relative URL in cookieconsent.scss in single-quotes for better SASS compatibility
- renamed 'cookieconsent.min.css' to '_cookieconsent.scss' and copied/moved it to htdocs/theme/raw/sass/lib/
- added the styles for palette popup / button to base of '_cookieconsent.scss'
......@@ -43,23 +43,35 @@ function get_cookieconsent_code() {
}
}
$values = unserialize(get_config('cookieconsent_settings'));
// To see full list of options go to https://silktide.com/tools/cookie-consent/docs/installation/
// To see full list of options go to https://cookieconsent.insites.com/documentation/javascript-api/
// * needs the messagelink template to be able to set target=_self
// the fix for this hasnt been released yet https://github.com/insites/cookieconsent/pull/396
$initialisation = json_encode(array(
'message' => get_string('cookieconsentmessage', 'cookieconsent'),
'learnMore' => get_string('cookieconsentlearnmore', 'cookieconsent'),
'link' => get_config('wwwroot') . 'privacy.php',
'target' => '_self',
'theme' => $links['raw'],
'dismiss' => get_string('cookieconsentdismiss', 'cookieconsent'),
'theme' => 'classic',
'content' => array(
'target' => '_self',
'message' => get_string('cookieconsentmessage', 'cookieconsent'),
'href' => get_config('wwwroot') . 'legal.php',
'link' => get_string('cookieconsentlearnmore', 'cookieconsent'),
'dismiss' => get_string('cookieconsentdismiss', 'cookieconsent'),
),
'palette' => null,
'elements' => array(
'messagelink' => '<span id="cookieconsent:desc" class="cc-message">{{message}} <a tabindex="0" class="cc-link" href="{{href}}" target="_self">{{link}}</a></span>',
),
), JSON_FORCE_OBJECT);
$wwwroot = get_config('wwwroot');
return <<<CODE
<!-- Begin Cookie Consent plugin by Silktide - http://silktide.com/cookieconsent -->
<!-- Begin Cookie Consent plugin by Silktide - https://cookieconsent.insites.com/ -->
{$stylesheets}
<script type="application/javascript">
window.cookieconsent_options = {$initialisation};
<script>
jQuery(function() {
window.cookieconsent.initialise(
{$initialisation}
);
});
</script>
<script type="application/javascript" src="{$wwwroot}js/cookieconsent/cookieconsent.min.js"></script>
<script src="{$wwwroot}js/cookieconsent/cookieconsent.min.js"></script>
<!-- End Cookie Consent plugin -->
CODE;
}
\ No newline at end of file
}
/* dark-bottom.css */
.cc_banner-wrapper{z-index:9001;position:relative}.cc_container .cc_btn{cursor:pointer;text-align:center;font-size:0.6em;transition:font-size 200ms;line-height:1em}.cc_container .cc_message{font-size:0.6em;transition:font-size 200ms;margin:0;padding:0;line-height:1.5em}.cc_container .cc_logo{display:none;text-indent:-1000px;overflow:hidden;width:100px;height:22px;background-size:cover;background-image:url('//cdnjs.cloudflare.com/ajax/libs/cookieconsent2/1.0.10/logo.png');opacity:0.9;transition:opacity 200ms}.cc_container .cc_logo:hover,.cc_container .cc_logo:active{opacity:1}@media screen and (min-width: 500px){.cc_container .cc_btn{font-size:0.8em}.cc_container .cc_message{font-size:0.8em}}@media screen and (min-width: 768px){.cc_container .cc_btn{font-size:1em}.cc_container .cc_message{font-size:1em;line-height:1em}}@media screen and (min-width: 992px){.cc_container .cc_message{font-size:1em}}@media print{.cc_banner-wrapper,.cc_container{display:none}}.cc_container{position:fixed;left:0;right:0;bottom:0;overflow:hidden;padding:10px}.cc_container .cc_btn{padding:8px 10px;background-color:#f1d600;cursor:pointer;transition:font-size 200ms;text-align:center;font-size:0.6em;display:block;width:33%;margin-left:10px;float:right;max-width:120px}.cc_container .cc_message{transition:font-size 200ms;font-size:0.6em;display:block}@media screen and (min-width: 500px){.cc_container .cc_btn{font-size:0.8em}.cc_container .cc_message{margin-top:0.5em;font-size:0.8em}}@media screen and (min-width: 768px){.cc_container{padding:15px 30px 15px}.cc_container .cc_btn{font-size:1em;padding:8px 15px}.cc_container .cc_message{font-size:1em}}@media screen and (min-width: 992px){.cc_container .cc_message{font-size:1em}}.cc_container{background:#222;color:#fff;font-size:17px;font-family:"Helvetica Neue Light", "HelveticaNeue-Light", "Helvetica Neue", Calibri, Helvetica, Arial;box-sizing:border-box}.cc_container ::-moz-selection{background:#ff5e99;color:#fff;text-shadow:none}.cc_container .cc_btn,.cc_container .cc_btn:visited{color:#000;background-color:#f1d600;transition:background 200ms ease-in-out,color 200ms ease-in-out,box-shadow 200ms ease-in-out;-webkit-transition:background 200ms ease-in-out,color 200ms ease-in-out,box-shadow 200ms ease-in-out;border-radius:5px;-webkit-border-radius:5px}.cc_container .cc_btn:hover,.cc_container .cc_btn:active{background-color:#fff;color:#000}.cc_container a,.cc_container a:visited{text-decoration:none;color:#31a8f0;transition:200ms color}.cc_container a:hover,.cc_container a:active{color:#b2f7ff}@-webkit-keyframes slideUp{0%{-webkit-transform:translateY(66px);transform:translateY(66px)}100%{-webkit-transform:translateY(0);transform:translateY(0)}}@keyframes slideUp{0%{-webkit-transform:translateY(66px);-ms-transform:translateY(66px);transform:translateY(66px)}100%{-webkit-transform:translateY(0);-ms-transform:translateY(0);transform:translateY(0)}}.cc_container,.cc_message,.cc_btn{animation-duration:0.8s;-webkit-animation-duration:0.8s;-moz-animation-duration:0.8s;-o-animation-duration:0.8s;-webkit-animation-name:slideUp;animation-name:slideUp}
\ No newline at end of file
.cc-window{opacity:1;transition:opacity 1s ease}.cc-window.cc-invisible{opacity:0}.cc-animate.cc-revoke{transition:transform 1s ease}.cc-animate.cc-revoke.cc-top{transform:translateY(-2em)}.cc-animate.cc-revoke.cc-bottom{transform:translateY(2em)}.cc-animate.cc-revoke.cc-active.cc-bottom,.cc-animate.cc-revoke.cc-active.cc-top,.cc-revoke:hover{transform:translateY(0)}.cc-grower{max-height:0;overflow:hidden;transition:max-height 1s}
.cc-link,.cc-revoke:hover{text-decoration:underline}.cc-revoke,.cc-window{position:fixed;overflow:hidden;box-sizing:border-box;font-family:Helvetica,Calibri,Arial,sans-serif;font-size:16px;line-height:1.5em;display:-ms-flexbox;display:flex;-ms-flex-wrap:nowrap;flex-wrap:nowrap;z-index:9999}.cc-window.cc-static{position:static}.cc-window.cc-floating{padding:2em;max-width:24em;-ms-flex-direction:column;flex-direction:column}.cc-window.cc-banner{padding:1em 1.8em;width:100%;-ms-flex-direction:row;flex-direction:row}.cc-revoke{padding:.5em}.cc-header{font-size:18px;font-weight:700}.cc-btn,.cc-close,.cc-link,.cc-revoke{cursor:pointer}.cc-link{opacity:.8;display:inline-block;padding:.2em}.cc-link:hover{opacity:1}.cc-link:active,.cc-link:visited{color:initial}.cc-btn{display:block;padding:.4em .8em;font-size:.9em;font-weight:700;border-width:2px;border-style:solid;text-align:center;white-space:nowrap}.cc-highlight .cc-btn:first-child{background-color:transparent;border-color:transparent}.cc-highlight .cc-btn:first-child:focus,.cc-highlight .cc-btn:first-child:hover{background-color:transparent;text-decoration:underline}.cc-close{display:block;position:absolute;top:.5em;right:.5em;font-size:1.6em;opacity:.9;line-height:.75}.cc-close:focus,.cc-close:hover{opacity:1}
.cc-revoke.cc-top{top:0;left:3em;border-bottom-left-radius:.5em;border-bottom-right-radius:.5em}.cc-revoke.cc-bottom{bottom:0;left:3em;border-top-left-radius:.5em;border-top-right-radius:.5em}.cc-revoke.cc-left{left:3em;right:unset}.cc-revoke.cc-right{right:3em;left:unset}.cc-top{top:1em}.cc-left{left:1em}.cc-right{right:1em}.cc-bottom{bottom:1em}.cc-floating>.cc-link{margin-bottom:1em}.cc-floating .cc-message{display:block;margin-bottom:1em}.cc-window.cc-floating .cc-compliance{-ms-flex:1 0 auto;flex:1 0 auto}.cc-window.cc-banner{-ms-flex-align:center;align-items:center}.cc-banner.cc-top{left:0;right:0;top:0}.cc-banner.cc-bottom{left:0;right:0;bottom:0}.cc-banner .cc-message{display:block;-ms-flex:1 1 auto;flex:1 1 auto;max-width:100%;margin-right:1em}.cc-compliance{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-line-pack:justify;align-content:space-between}.cc-floating .cc-compliance>.cc-btn{-ms-flex:1;flex:1}.cc-btn+.cc-btn{margin-left:.5em}
@media print{.cc-revoke,.cc-window{display:none}}@media screen and (max-width:900px){.cc-btn{white-space:normal}}@media screen and (max-width:414px) and (orientation:portrait),screen and (max-width:736px) and (orientation:landscape){.cc-window.cc-top{top:0}.cc-window.cc-bottom{bottom:0}.cc-window.cc-banner,.cc-window.cc-floating,.cc-window.cc-left,.cc-window.cc-right{left:0;right:0}.cc-window.cc-banner{-ms-flex-direction:column;flex-direction:column}.cc-window.cc-banner .cc-compliance{-ms-flex:1 1 auto;flex:1 1 auto}.cc-window.cc-floating{max-width:none}.cc-window .cc-message{margin-bottom:1em}.cc-window.cc-banner{-ms-flex-align:unset;align-items:unset}.cc-window.cc-banner .cc-message{margin-right:0}}
.cc-floating.cc-theme-classic{padding:1.2em;border-radius:5px}.cc-floating.cc-type-info.cc-theme-classic .cc-compliance{text-align:center;display:inline;-ms-flex:none;flex:none}.cc-theme-classic .cc-btn{border-radius:5px}.cc-theme-classic .cc-btn:last-child{min-width:140px}.cc-floating.cc-type-info.cc-theme-classic .cc-btn{display:inline-block}
.cc-theme-edgeless.cc-window{padding:0}.cc-floating.cc-theme-edgeless .cc-message{margin:2em 2em 1.5em}.cc-banner.cc-theme-edgeless .cc-btn{margin:0;padding:.8em 1.8em;height:100%}.cc-banner.cc-theme-edgeless .cc-message{margin-left:1em}.cc-floating.cc-theme-edgeless .cc-btn+.cc-btn{margin-left:0}
/* Mahara theme palette style overrides */
.cc-theme-classic .cc-message{color:#fff}
.cc-theme-classic .cc-link{color:#31a8f0}
.cc-theme-classic.cc-window{color:#fff;background-color:#222}
.cc-theme-classic .cc-btn{background-color:#f1d600;border-color:transparent;color:#000}
......@@ -106,6 +106,7 @@
@import "../lib/graph";
@import "../lib/elasticsearch";
@import "../lib/print";
@import "../lib/cookieconsent";
// Keep these files last to override all other style sheets
@import "../custom";
......
......@@ -35,6 +35,7 @@ Scenario: Enable/disable external resources in mahara pages
And I press "Save"
# Add a "Text" block with an embedded external image
And I scroll to the top
And I follow "Text"
And I press "Add"
And I set the following fields to these values:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment