From fcdc822350c478ae4b15ebb6b20e8f702ebf1c63 Mon Sep 17 00:00:00 2001 From: Mathew May Date: Thu, 13 Jun 2019 11:52:14 +0800 Subject: [PATCH] MDL-65770 tool_policy: Update guest policy popup --- .../build/jquery-eu-cookie-law-popup.min.js | 2 +- .../amd/src/jquery-eu-cookie-law-popup.js | 47 ++++++++++++------- admin/tool/policy/thirdpartylibs.xml | 2 +- 3 files changed, 32 insertions(+), 19 deletions(-) diff --git a/admin/tool/policy/amd/build/jquery-eu-cookie-law-popup.min.js b/admin/tool/policy/amd/build/jquery-eu-cookie-law-popup.min.js index 8ea0109b419..041f9cc3d59 100644 --- a/admin/tool/policy/amd/build/jquery-eu-cookie-law-popup.min.js +++ b/admin/tool/policy/amd/build/jquery-eu-cookie-law-popup.min.js @@ -1 +1 @@ -define(["jquery"],function(a){window.console||(window.console={}),window.console.log||(window.console.log=function(){}),a.fn.euCookieLawPopup=function(){var b=this;b.params={cookiePolicyUrl:"http://www.wimagguc.com/?cookie-policy",popupPosition:"top",colorStyle:"default",compactStyle:!1,popupTitle:"This website is using cookies",popupText:"We use cookies to ensure that we give you the best experience on our website. If you continue without changing your settings, we'll assume that you are happy to receive all cookies on this website.",buttonContinueTitle:"Continue",buttonLearnmoreTitle:"Learn more",buttonLearnmoreOpenInNewWindow:!0,agreementExpiresInDays:30,autoAcceptCookiePolicy:!1,htmlMarkup:null},b.vars={INITIALISED:!1,HTML_MARKUP:null,COOKIE_NAME:"EU_COOKIE_LAW_CONSENT"};var c=function(c,d,e){if(c){var f=a(c).attr("class")?a(c).attr("class"):"";f.indexOf("eupopup-top")>-1?b.params.popupPosition="top":f.indexOf("eupopup-fixedtop")>-1?b.params.popupPosition="fixedtop":f.indexOf("eupopup-bottomright")>-1?b.params.popupPosition="bottomright":f.indexOf("eupopup-bottomleft")>-1?b.params.popupPosition="bottomleft":f.indexOf("eupopup-bottom")>-1?b.params.popupPosition="bottom":f.indexOf("eupopup-block")>-1&&(b.params.popupPosition="block"),f.indexOf("eupopup-color-default")>-1?b.params.colorStyle="default":f.indexOf("eupopup-color-inverse")>-1&&(b.params.colorStyle="inverse"),f.indexOf("eupopup-style-compact")>-1&&(b.params.compactStyle=!0)}d&&(b.params.htmlMarkup=d),e&&("undefined"!=typeof e.cookiePolicyUrl&&(b.params.cookiePolicyUrl=e.cookiePolicyUrl),"undefined"!=typeof e.popupPosition&&(b.params.popupPosition=e.popupPosition),"undefined"!=typeof e.colorStyle&&(b.params.colorStyle=e.colorStyle),"undefined"!=typeof e.popupTitle&&(b.params.popupTitle=e.popupTitle),"undefined"!=typeof e.popupText&&(b.params.popupText=e.popupText),"undefined"!=typeof e.buttonContinueTitle&&(b.params.buttonContinueTitle=e.buttonContinueTitle),"undefined"!=typeof e.buttonLearnmoreTitle&&(b.params.buttonLearnmoreTitle=e.buttonLearnmoreTitle),"undefined"!=typeof e.buttonLearnmoreOpenInNewWindow&&(b.params.buttonLearnmoreOpenInNewWindow=e.buttonLearnmoreOpenInNewWindow),"undefined"!=typeof e.agreementExpiresInDays&&(b.params.agreementExpiresInDays=e.agreementExpiresInDays),"undefined"!=typeof e.autoAcceptCookiePolicy&&(b.params.autoAcceptCookiePolicy=e.autoAcceptCookiePolicy),"undefined"!=typeof e.htmlMarkup&&(b.params.htmlMarkup=e.htmlMarkup))},d=function(){if(b.params.htmlMarkup)return b.params.htmlMarkup;var a='
'+b.params.popupTitle+'
'+b.params.popupText+'
x
';return a},e=function(c){var d=new Date,e=24*b.params.agreementExpiresInDays*60*60*1e3;d.setTime(d.getTime()+e);var f="expires="+d.toGMTString();document.cookie=b.vars.COOKIE_NAME+"="+c+"; "+f+";path=/",a(document).trigger("user_cookie_consent_changed",{consent:c})},f=function(){for(var a=!1,c=document.cookie.split(";"),d=0;d0?a(".eupopup-block").append(b.vars.HTML_MARKUP):a("BODY").append(b.vars.HTML_MARKUP),a(".eupopup-button_1").click(function(){return e(!0),g(),!1}),a(".eupopup-closebutton").click(function(){return e(!0),g(),!1}),a(".eupopup-container").show(),b.params.autoAcceptCookiePolicy&&e(!0))}};return h}}); \ No newline at end of file +!function(a){window.console||(window.console={}),window.console.log||(window.console.log=function(){}),a.fn.euCookieLawPopup=function(){var b=this;b.params={cookiePolicyUrl:"/?cookie-policy",popupPosition:"top",colorStyle:"default",compactStyle:!1,popupTitle:"This website is using cookies",popupText:"We use cookies to ensure that we give you the best experience on our website. If you continue without changing your settings, we'll assume that you are happy to receive all cookies on this website.",buttonContinueTitle:"Continue",buttonLearnmoreTitle:"Learn more",buttonLearnmoreOpenInNewWindow:!0,agreementExpiresInDays:30,autoAcceptCookiePolicy:!1,htmlMarkup:null},b.vars={INITIALISED:!1,HTML_MARKUP:null,COOKIE_NAME:"EU_COOKIE_LAW_CONSENT"};var c=function(c,d,e){if(c){var f=a(c).attr("class")?a(c).attr("class"):"";f.indexOf("eupopup-top")>-1?b.params.popupPosition="top":f.indexOf("eupopup-fixedtop")>-1?b.params.popupPosition="fixedtop":f.indexOf("eupopup-bottomright")>-1?b.params.popupPosition="bottomright":f.indexOf("eupopup-bottomleft")>-1?b.params.popupPosition="bottomleft":f.indexOf("eupopup-bottom")>-1?b.params.popupPosition="bottom":f.indexOf("eupopup-block")>-1&&(b.params.popupPosition="block"),f.indexOf("eupopup-color-default")>-1?b.params.colorStyle="default":f.indexOf("eupopup-color-inverse")>-1&&(b.params.colorStyle="inverse"),f.indexOf("eupopup-style-compact")>-1&&(b.params.compactStyle=!0)}d&&(b.params.htmlMarkup=d),e&&("undefined"!=typeof e.cookiePolicyUrl&&(b.params.cookiePolicyUrl=e.cookiePolicyUrl),"undefined"!=typeof e.popupPosition&&(b.params.popupPosition=e.popupPosition),"undefined"!=typeof e.colorStyle&&(b.params.colorStyle=e.colorStyle),"undefined"!=typeof e.popupTitle&&(b.params.popupTitle=e.popupTitle),"undefined"!=typeof e.popupText&&(b.params.popupText=e.popupText),"undefined"!=typeof e.buttonContinueTitle&&(b.params.buttonContinueTitle=e.buttonContinueTitle),"undefined"!=typeof e.buttonLearnmoreTitle&&(b.params.buttonLearnmoreTitle=e.buttonLearnmoreTitle),"undefined"!=typeof e.buttonLearnmoreOpenInNewWindow&&(b.params.buttonLearnmoreOpenInNewWindow=e.buttonLearnmoreOpenInNewWindow),"undefined"!=typeof e.agreementExpiresInDays&&(b.params.agreementExpiresInDays=e.agreementExpiresInDays),"undefined"!=typeof e.autoAcceptCookiePolicy&&(b.params.autoAcceptCookiePolicy=e.autoAcceptCookiePolicy),"undefined"!=typeof e.htmlMarkup&&(b.params.htmlMarkup=e.htmlMarkup))},d=function(){if(b.params.htmlMarkup)return b.params.htmlMarkup;var a='
'+b.params.popupTitle+'
'+b.params.popupText+'
x
';return a},e=function(c){var d=new Date,e=24*b.params.agreementExpiresInDays*60*60*1e3;d.setTime(d.getTime()+e);var f="expires="+d.toGMTString();document.cookie=b.vars.COOKIE_NAME+"="+c+"; "+f+";path=/",a(document).trigger("user_cookie_consent_changed",{consent:c})},f=function(){for(var a=!1,c=document.cookie.split(";"),d=0;d0?a(".eupopup-block").append(b.vars.HTML_MARKUP):a("BODY").append(b.vars.HTML_MARKUP),a(".eupopup-button_1").click(function(){return e(!0),g(),!1}),a(".eupopup-closebutton").click(function(){return e(!0),g(),!1}),a(".eupopup-container").show(),b.params.autoAcceptCookiePolicy&&e(!0)))}};return h},a(document).ready(function(){a(".eupopup").length>0&&a(document).euCookieLawPopup().init({info:"YOU_CAN_ADD_MORE_SETTINGS_HERE",popupTitle:"This website is using cookies. ",popupText:"We use them to give you the best experience. If you continue using our website, we'll assume that you are happy to receive all cookies on this website."})}),a(document).bind("user_cookie_consent_changed",function(b,c){console.log("User cookie consent changed: "+a(c).attr("consent"))})}(jQuery); \ No newline at end of file diff --git a/admin/tool/policy/amd/src/jquery-eu-cookie-law-popup.js b/admin/tool/policy/amd/src/jquery-eu-cookie-law-popup.js index 22688c57d5a..682fb7e74c3 100644 --- a/admin/tool/policy/amd/src/jquery-eu-cookie-law-popup.js +++ b/admin/tool/policy/amd/src/jquery-eu-cookie-law-popup.js @@ -1,22 +1,20 @@ /** - * + * * JQUERY EU COOKIE LAW POPUPS - * version 1.0.1 - * + * version 1.1.1 + * * Code on Github: * https://github.com/wimagguc/jquery-eu-cookie-law-popup - * + * * To see a live demo, go to: - * http://www.wimagguc.com/2015/03/jquery-eu-cookie-law-popup/ - * + * http://www.wimagguc.com/2018/05/gdpr-compliance-with-the-jquery-eu-cookie-law-plugin/ + * * by Richard Dancsi * http://www.wimagguc.com/ - * + * */ -define( -['jquery'], -function($) { +(function($) { // for ie9 doesn't support debug console >>> if (!window.console) window.console = {}; @@ -30,7 +28,7 @@ $.fn.euCookieLawPopup = (function() { /////////////////////////////////////////////////////////////////////////////////////////////// // PARAMETERS (MODIFY THIS PART) ////////////////////////////////////////////////////////////// _self.params = { - cookiePolicyUrl : 'http://www.wimagguc.com/?cookie-policy', + cookiePolicyUrl : '/?cookie-policy', popupPosition : 'top', colorStyle : 'default', compactStyle : false, @@ -137,10 +135,10 @@ $.fn.euCookieLawPopup = (function() { return _self.params.htmlMarkup; } - var html = - '
' + '
' + _self.params.popupTitle + '
' + '
' + _self.params.popupText + '
' + @@ -181,7 +179,7 @@ $.fn.euCookieLawPopup = (function() { return userAcceptedCookies; }; - + var hideContainer = function() { // $('.eupopup-container').slideUp(200); $('.eupopup-container').animate({ @@ -206,6 +204,7 @@ $.fn.euCookieLawPopup = (function() { // No need to display this if user already accepted the policy if (userAlreadyAcceptedCookies()) { + $(document).trigger("user_cookie_already_accepted", {'consent': true}); return; } @@ -239,7 +238,7 @@ $.fn.euCookieLawPopup = (function() { // Ready to start! $('.eupopup-container').show(); - // In case it's alright to just display the message once + // In case it's alright to just display the message once if (_self.params.autoAcceptCookiePolicy) { setUserAcceptsCookies(true); } @@ -251,4 +250,18 @@ $.fn.euCookieLawPopup = (function() { return publicfunc; }); +$(document).ready( function() { + if ($(".eupopup").length > 0) { + $(document).euCookieLawPopup().init({ + 'info' : 'YOU_CAN_ADD_MORE_SETTINGS_HERE', + 'popupTitle' : 'This website is using cookies. ', + 'popupText' : 'We use them to give you the best experience. If you continue using our website, we\'ll assume that you are happy to receive all cookies on this website.' + }); + } }); + +$(document).bind("user_cookie_consent_changed", function(event, object) { + console.log("User cookie consent changed: " + $(object).attr('consent') ); +}); + +}(jQuery)); diff --git a/admin/tool/policy/thirdpartylibs.xml b/admin/tool/policy/thirdpartylibs.xml index 151961be012..9d7a636b808 100644 --- a/admin/tool/policy/thirdpartylibs.xml +++ b/admin/tool/policy/thirdpartylibs.xml @@ -4,7 +4,7 @@ amd/src/jquery-eu-cookie-law-popup.js jQuery EU Cookie Law popups MIT - 1.0.1 + 1.1.2