MDL-65770 tool_policy: Update guest policy popup

This commit is contained in:
Mathew May 2019-06-13 11:52:14 +08:00
parent f3507273e9
commit fcdc822350
3 changed files with 32 additions and 19 deletions

View File

@ -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&nbsp;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='<div class="eupopup-container eupopup-container-'+b.params.popupPosition+(b.params.compactStyle?" eupopup-style-compact":"")+" eupopup-color-"+b.params.colorStyle+'"><div class="eupopup-head">'+b.params.popupTitle+'</div><div class="eupopup-body">'+b.params.popupText+'</div><div class="eupopup-buttons"><a href="#" class="eupopup-button eupopup-button_1">'+b.params.buttonContinueTitle+'</a><a href="'+b.params.cookiePolicyUrl+'"'+(b.params.buttonLearnmoreOpenInNewWindow?" target=_blank ":"")+' class="eupopup-button eupopup-button_2">'+b.params.buttonLearnmoreTitle+'</a><div class="clearfix"></div></div><a href="#" class="eupopup-closebutton">x</a></div>';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;d<c.length;d++){var e=c[d].trim();0==e.indexOf(b.vars.COOKIE_NAME)&&(a=e.substring(b.vars.COOKIE_NAME.length+1,e.length))}return a},g=function(){a(".eupopup-container").animate({opacity:0,height:0},200,function(){a(".eupopup-container").hide(0)})},h={init:function(h){c(a(".eupopup").first(),a(".eupopup-markup").html(),h),f()||b.vars.INITIALISED||(b.vars.INITIALISED=!0,b.vars.HTML_MARKUP=d(),a(".eupopup-block").length>0?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}});
!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&nbsp;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='<div class="eupopup-container eupopup-container-'+b.params.popupPosition+(b.params.compactStyle?" eupopup-style-compact":"")+" eupopup-color-"+b.params.colorStyle+'"><div class="eupopup-head">'+b.params.popupTitle+'</div><div class="eupopup-body">'+b.params.popupText+'</div><div class="eupopup-buttons"><a href="#" class="eupopup-button eupopup-button_1">'+b.params.buttonContinueTitle+'</a><a href="'+b.params.cookiePolicyUrl+'"'+(b.params.buttonLearnmoreOpenInNewWindow?" target=_blank ":"")+' class="eupopup-button eupopup-button_2">'+b.params.buttonLearnmoreTitle+'</a><div class="clearfix"></div></div><a href="#" class="eupopup-closebutton">x</a></div>';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;d<c.length;d++){var e=c[d].trim();0==e.indexOf(b.vars.COOKIE_NAME)&&(a=e.substring(b.vars.COOKIE_NAME.length+1,e.length))}return a},g=function(){a(".eupopup-container").animate({opacity:0,height:0},200,function(){a(".eupopup-container").hide(0)})},h={init:function(h){return c(a(".eupopup").first(),a(".eupopup-markup").html(),h),f()?void a(document).trigger("user_cookie_already_accepted",{consent:!0}):void(b.vars.INITIALISED||(b.vars.INITIALISED=!0,b.vars.HTML_MARKUP=d(),a(".eupopup-block").length>0?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);

View File

@ -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 =
'<div class="eupopup-container' +
' eupopup-container-' + _self.params.popupPosition +
(_self.params.compactStyle ? ' eupopup-style-compact' : '') +
var html =
'<div class="eupopup-container' +
' eupopup-container-' + _self.params.popupPosition +
(_self.params.compactStyle ? ' eupopup-style-compact' : '') +
' eupopup-color-' + _self.params.colorStyle + '">' +
'<div class="eupopup-head">' + _self.params.popupTitle + '</div>' +
'<div class="eupopup-body">' + _self.params.popupText + '</div>' +
@ -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));

View File

@ -4,7 +4,7 @@
<location>amd/src/jquery-eu-cookie-law-popup.js</location>
<name>jQuery EU Cookie Law popups</name>
<license>MIT</license>
<version>1.0.1</version>
<version>1.1.2</version>
<licenseversion></licenseversion>
</library>
</libraries>