- var FooterControls = function()
- {
- return {
- DOM:{
- control:'ul.footer-item li.footer-item-header'
- },
- init:function()
- {
- var self = this;
- $(self.DOM.control).click(
- function()
- {
- $(this).parent().find('li.footer-item-content').toggle();
- }
- );
- }
- }
- }
- var SizesPopup = function()
- {
- return {
- DOM:{
- control:'a.footer-item-content-sizes',
- modal: 'div.modal'
- },
- init_popup_sizes:function(obj)
- {
- var self = this;
- $(obj.content).find('li.size-icon-item').click(
- function()
- {
- var control = this;
- var tab = $(this).data('tab');
- $(control).closest('ul.sizes-form').find('ul.size-tab').hide();
- $(control).closest('ul.sizes-form').find('ul.' + tab).show();
- }
- );
- },
- init:function()
- {
- var self = this;
- $(self.DOM.control).click(
- function()
- {
- $(self.DOM.modal).modal();
- $(self.DOM.modal).css('height', 'auto');
- $(self.DOM.modal).find('li.loading').show();
- $(self.DOM.modal).find('li.content').html('');
- let show_tab = $(this).data('tab');
- $.ajax({
- url: AJAX_URL,
- type: 'POST',
- data: JSON.stringify({action:'getsizesform'})
- }).
- done(
- function(response)
- {
- var res = JSON.parse(response);
- $(self.DOM.modal).find('li.content').show();
- $(self.DOM.modal).find('li.loading').hide();
- $(self.DOM.modal).find('li.content').html(res.data);
- $(self.DOM.modal).find('li.content').find('ul.' + show_tab).show();
- self.init_popup_sizes({content:$(self.DOM.modal).find('li.content')});
- }
- );
- // if ($(window).width() > $(window).height())
- // {
- // // console.log($(this).data('landscape'));
- // $(self.DOM.modal).find('li.content').html($(this).data('landscape'));
- // }
- // else
- // {
- // // console.log($(this).data('portraite'));
- // $(self.DOM.modal).find('li.content').html($(this).data('portraite'));
- // }
- return false;
- }
- );
- }
- }
- }
- let GDPR = function()
- {
- return {
- DOM:{
- control: 'div.gdpr button'
- },
- init:function()
- {
- let self = this;
- $(self.DOM.control).click(
- function()
- {
- $.ajax({
- url: AJAX_URL,
- type: 'POST',
- data: JSON.stringify({action:'gdpraccept', accept:1})
- }).
- done(
- function(response)
- {
- var res = JSON.parse(response);
- if (res.status)
- {
- $(self.DOM.control).parent().hide();
- }
- }
- );
- }
- );
- }
- }
- }
- $(document).ready(
- function()
- {
- var footerControls = new FooterControls();
- footerControls.init();
- var sizesPopup = new SizesPopup();
- sizesPopup.init();
- let gdpr = new GDPR();
- gdpr.init();
- }
- );
Raw Paste