$(document).ready(function(){ if (typeof x13googlemerchant_bo_url !== 'undefined') { $('#desc-module-back').attr('href', x13googlemerchant_bo_url); } if (!x13googlemerchant_15) { $('.shipment-exclude').parents('.form-group').addClass('shipment-exclude-block'); $('.country-shipping-price').parents('.form-group').addClass('country-shipping-price-block'); $('.shipment-country-include').parents('.form-group').addClass('shipment-country-include-block'); } customTitleFormat(); $('select[name="X13_GOOGLEMERCHANT_TITLE_TYPE"]').on('change', customTitleFormat); function customTitleFormat() { var $element = $('.custom_title_format'); $element.hide(); $val = $('select[name="X13_GOOGLEMERCHANT_TITLE_TYPE"]').val(); if (parseInt($val, 10) === 3) { $element.show(); } else { $element.hide(); } } addingCombinationNameToElements(); $('select[name="X13_GOOGLEMERCHANT_SKIP_ATTR"]').on('change', addingCombinationNameToElements); function addingCombinationNameToElements() { var $element = $('.adding_combination_name'); $element.hide(); $val = $('select[name="X13_GOOGLEMERCHANT_SKIP_ATTR"]').val(); if (parseInt($val, 10) === 0 || parseInt($val, 10) === 2) { $element.show(); } else { $element.hide(); } } shipmentBehaviorChange($('#shipment_behavior').val()); $('#shipment_behavior').on('change', function() { shipmentBehaviorChange($(this).val()); }); function shipmentBehaviorChange(val) { if (val == 1) { $('.country-shipping-price-block').show(); $('.shipment-exclude-block').hide(); $('.shipment-country-include-block').hide(); } else { $('.country-shipping-price-block').hide(); $('.shipment-exclude-block').show(); $('.shipment-country-include-block').show(); } } $('.process-icon-downloadxml').bind('click', function(e){ e.preventDefault(); $('#x13googlemerchant-generate-form').slideToggle('fast'); }); $('.change_status a, #top_container .x13googlemerchant > tbody > tr > td.center > a').bind('click', function(e){ e.preventDefault(); var _t = $(this); var post_obj = { 'data' : { 'method' : 'setGoogleStatus', 'data' : { 'id_shop' : x13googlemerchant_shop, 'id_lang' : x13googlemerchant_lang, 'active' : (_t.hasClass('action-disabled') || (_t.children('img').attr('src') == '../img/admin/disabled.gif')) ? 1 : 0, 'param' : _t.attr('href') } } }; $.post(x13googlemerchant_path + 'ajax.php', post_obj, function(d){ if(d == 'ok1') { _t.removeClass('action-disabled').addClass('action-enabled'); _t.blur().children('i').toggleClass('hidden'); //1.5 _t.attr('title', 'Włączone').children('img').attr('src', '../img/admin/enabled.gif'); } else if(d == 'ok0') { _t.removeClass('action-enabled').addClass('action-disabled'); _t.blur().children('i').toggleClass('hidden'); //1.5 _t.attr('title', 'Wyłączone').children('img').attr('src', '../img/admin/disabled.gif'); } else { alert(d); } }); }); $('.google_name').each(function(){ if($(this).val() != '') $(this).addClass('has-cat').attr('title', $(this).val()); }); $('body') .delegate('.google_name', 'focusin', function(){ var _t = $(this); _t.data('old', $(this).val()); var i, j = 0; var ab = ''; var thisLang = _t.data('lang'); ab += '
'+google_categories[thisLang][i]+'
'; if(++j > 50) break; } } ab += ''+google_categories[thisLang][i]+'
'; if(++j > 50) break; } } if(_p != '') _ab.empty().html(_p).show(); else _ab.hide(); } } }); $('body') .delegate('.htmnet-autocomplete p', 'mouseenter', function(){ $(this).addClass('active').siblings('active').removeClass('active'); }) .delegate('.htmnet-autocomplete p', 'mouseleave', function(){ $(this).removeClass('active').siblings('active').removeClass('active'); }) .delegate('.htmnet-autocomplete p', 'click', function(e){ e.preventDefault(); var text = $(this).text(); $(this).parent().siblings('.google_name').addClass('has-cat').val(text).attr('title', text); $(this).parent().remove(); }); if($('.setMassTaxonomy').length > 0) { var mass_quantity_trigger = $('.setMassTaxonomy').parent(); } else if($('[name="submitBulksetMassTaxonomyx13googlemerchant"]').length > 0) { var mass_quantity_trigger = $('[name="submitBulksetMassTaxonomyx13googlemerchant"]'); } else { var mass_quantity_trigger = false; } if(mass_quantity_trigger) { mass_quantity_trigger.removeAttr('onclick'); mass_quantity_trigger.bind('click', function(e){ e.preventDefault(); var ids = '0'; $('[name="x13googlemerchantBox\[]\"]:checked').each(function(){ ids += ',' + $(this).val(); }); var langOptions = ''; x13languages.forEach(function(el, i) { langOptions += ''; }); var content = '' ; $.fancybox(content, {'autoDimensions': false, 'autoSize': false, 'width': 500, 'height': '370px', 'openEffect': 'fadeIn', 'closeEffect': 'fadeOut'} ); }); } }); function changeMassLanguage(id) { $('.fancybox-overlay input#mass_taxonomy').data('lang', parseInt(id)).attr('data-lang', parseInt(id)); } if (typeof hideOtherLanguage === 'undefined') { function hideOtherLanguage(id) { $('.translatable-field').hide(); $('.lang-' + id).show(); } }