MDL-65770 tool_policy: Update guest policy popup
[moodle.git] / admin / tool / policy / amd / build / jquery-eu-cookie-law-popup.min.js
CommitLineData
fcdc8223 1!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);