+ Drupal.eu_cookie_compliance.createWithdrawBanner = function (html) {
+ var $html = $('<div></div>').html(html);
+ var $banner = $('.eu-cookie-withdraw-banner', $html);
+ $html.attr('id', 'sliding-popup');
+ $html.addClass('eu-cookie-withdraw-wrapper');
+
+ if (!drupalSettings.eu_cookie_compliance.popup_use_bare_css) {
+ $banner.height(drupalSettings.eu_cookie_compliance.popup_height)
+ .width(drupalSettings.eu_cookie_compliance.popup_width);
+ }
+ $html.hide();
+ var height = 0;
+ if (drupalSettings.eu_cookie_compliance.popup_position) {
+ $html.prependTo('body');
+ height = $html.outerHeight();
+
+ $html.show()
+ .addClass('sliding-popup-top')
+ .addClass('clearfix')
+ .css({ top: -1 * height });
+ // For some reason, the tab outerHeight is -10 if we don't use a timeout
+ // function to reveal the tab.
+ setTimeout(function () {
+ var height = $html.outerHeight();
+
+ $html.animate({ top: -1 * (height) }, drupalSettings.eu_cookie_compliance.popup_delay, null, function () {
+ $html.trigger('eu_cookie_compliance_popup_open');
+ });
+ }.bind($html), 0);
+ } else {
+ if (drupalSettings.eu_cookie_compliance.better_support_for_screen_readers) {
+ $html.prependTo('body');
+ } else {
+ $html.appendTo('body');
+ }
+ height = $html.outerHeight();
+ $html.show()
+ .addClass('sliding-popup-bottom')
+ .css({ bottom: -1 * height });
+ // For some reason, the tab outerHeight is -10 if we don't use a timeout
+ // function to reveal the tab.
+ setTimeout(function () {
+ var height = $html.outerHeight();
+
+ $html.animate({ bottom: -1 * (height) }, drupalSettings.eu_cookie_compliance.popup_delay, null, function () {
+ $html.trigger('eu_cookie_compliance_popup_open');
+ });
+ }.bind($html), 0);
+ }
+ };
+
+ Drupal.eu_cookie_compliance.toggleWithdrawBanner = function () {
+ var $wrapper = $('#sliding-popup');
+ var $tab = $('.eu-cookie-withdraw-tab');
+ var $bannerIsShowing = drupalSettings.eu_cookie_compliance.popup_position ? parseInt($wrapper.css('top')) === 0 : parseInt($wrapper.css('bottom')) === 0;
+ var height = $wrapper.outerHeight();
+ if (drupalSettings.eu_cookie_compliance.popup_position) {
+ if ($bannerIsShowing) {
+ $wrapper.animate({'top' : -1 * (height)}, drupalSettings.eu_cookie_compliance.popup_delay);
+ }
+ else {
+ $wrapper.animate({'top' : 0}, drupalSettings.eu_cookie_compliance.popup_delay);
+ }
+ }
+ else {
+ if ($bannerIsShowing) {
+ $wrapper.animate({'bottom' : -1 * (height)}, drupalSettings.eu_cookie_compliance.popup_delay);
+ }
+ else {
+ $wrapper.animate({'bottom' : 0}, drupalSettings.eu_cookie_compliance.popup_delay);
+ }
+ }
+ };
+