Заявка на уведомление о поступлении отправлена.
'); }else{ alert(html); } } ); }, add_to_favorites: function(id){ var url='/?show=basket&mode=ajax&act=favorites&id='+id; $.get(url, function (html){ var arr = html.split('|||'); eval(arr[1]); html=arr[0]; if(alltrades_shop.show_prev){ alltrades_shop.show_dialog(html); } } ); }, remove_from_favorites: function(id){ var url='/?show=basket&mode=ajax&act=remove_from_favorites&id='+id; $.get(url, function (html){ var arr = html.split('|||'); eval(arr[1]); html=arr[0]; if(alltrades_shop.show_prev){ alltrades_shop.show_dialog(html); } } ); }, update_favorites_html: function(){ var el; for(k in alltrades_shop.favorites){ el=$('#'+k).get(0); if(el!=undefined){ if(el.tagName=='INPUT'){ el.value=alltrades_shop.favorites[k]; }else if($('#'+k+' span').length>0){ el=$('#'+k+' span').html(alltrades_shop.favorites[k]); }else{ el=$('#'+k+'').html(alltrades_shop.favorites[k]); } } } }, add_to_compare: function(id){ var url='/?show=basket&mode=ajax&act=compare&id='+id; $.get(url, function (html){ var arr = html.split('|||'); eval(arr[1]); html=arr[0]; if(alltrades_shop.show_prev){ alltrades_shop.show_dialog(html); } } ); }, remove_from_compare: function(id){ var url='/?show=basket&mode=ajax&act=remove_from_compare&id='+id; $.get(url, function (html){ var arr = html.split('|||'); eval(arr[1]); html=arr[0]; if(alltrades_shop.show_prev){ alltrades_shop.show_dialog(html); } } ); }, update_compare_html: function(){ var el; for(k in alltrades_shop.compare){ el=$('#'+k).get(0); if(el!=undefined){ if(el.tagName=='INPUT'){ el.value=alltrades_shop.compare[k]; }else if($('#'+k+' span').length>0){ el=$('#'+k+' span').html(alltrades_shop.compare[k]); }else{ el=$('#'+k+'').html(alltrades_shop.compare[k]); } } } } } var alltrades_delivery = { field_id: 0, address_field: null, method: '', status: 0, current_key: '', counting_key: '', timer: false, keyupEvent: null, init: function(delivery_method, field_id) { this.field_id = field_id; this.method = delivery_method; $('#' + this.method + '_results').html('').hide(); this.delivery_block = $('#' + this.method + '_block.delivery_' + field_id); this.addresses_list = this.delivery_block.find('.delivery_addresses_list'); this.address_field = this.delivery_block.find('[name=address]'); this.address_field.val('').unbind('keyup'); this.address_field.on('keyup', (e) => { this.onEditAddressKeyUp(e); } ); this.delivery_block.show(); }, onEditAddressKeyUp: function(e) { alltrades_delivery.keyupEvent = e; switch(e.keyCode) { case 13: var selected = alltrades_delivery.addresses_list.find('p.selected a'); alltrades_delivery.set_address(selected.attr('address'), selected.attr('coords')); e.preventDefault(); e.stopPropagation(); return false; case 38: var prev = alltrades_delivery.addresses_list.find('p.selected').prev(); if( prev.length > 0) { alltrades_delivery.addresses_list.find('p.selected').removeClass('selected'); prev.addClass('selected'); } else { alltrades_delivery.addresses_list.find('p.selected').removeClass('selected'); alltrades_delivery.addresses_list.find('p:eq(-1)').addClass('selected'); } return false; case 40: var next = alltrades_delivery.addresses_list.find('p.selected').next(); if(next.length > 0) { alltrades_delivery.addresses_list.find('p.selected').removeClass('selected'); next.addClass('selected'); } else { alltrades_delivery.addresses_list.find('p.selected').removeClass('selected'); alltrades_delivery.addresses_list.find('p:eq(0)').addClass('selected'); } return false; } var key = alltrades_delivery.address_field.val(); if(key == alltrades_delivery.current_key) { return false; } alltrades_delivery.current_key = key; if(key.length > 1 && alltrades_delivery.status == 0) { alltrades_delivery.status = 1; alltrades_delivery.counting_key = alltrades_delivery.current_key; alltrades_delivery.timer = setTimeout( function() { $.post(alltrades_shop.lang_prefix + '/?show=delivery_module&act=get_addresses&mode=ajax&field_id=' + alltrades_delivery.field_id + '&type=' + alltrades_delivery.method, {'key': key}, (html) => { alltrades_delivery.status = 0; if(alltrades_delivery.counting_key == alltrades_delivery.current_key) { if(html.length > 5) { alltrades_delivery.addresses_list.show().html(html); } else { alltrades_delivery.addresses_list.html('').hide(); } } else { alltrades_delivery.current_key = alltrades_delivery.counting_key; alltrades_delivery.onEditAddressKeyUp(alltrades_delivery.keyupEvent); } } ); }, 200 ); } }, set_address: function(link) { $('#' + this.method + '_address [name=address]').val($(link).attr('address')); $('#' + this.method + '_address_coords').val($(link).attr('coords')); this.address = { address : $(link).attr('address'), city : $(link).attr('city'), coords : $(link).attr('coords'), zip : $(link).attr('zip'), kladr : $(link).attr('kladr'), }; this.addresses_list.hide(); this.calc(this.address); }, calc: function(address) { eval(this.method + '_calc(\'' + this.field_id + '\', address);'); }, }; alltrades_shop.init_basket(); function search_update_form(fields) { if(fields==''){ $('div[id^="search-field"]').show(); }else{ $('div[id^="search-field"]').each(function(){ if(fields.indexOf(','+this.id.substr(13)+',')==-1){ $(this).hide(); }else{ $(this).show(); } }); } } $().ready(function(){ // ToTop $(window).scroll(function() { if($(this).scrollTop() != 0 && $(window).width() < 900) { $('#toTop').fadeIn(); } else { $('#toTop').fadeOut(); } }); $('#toTop').click(function() { $('body,html').animate({scrollTop:0},800); }); }); //================================= var alltrades_comments = { obj_id: '', key: 0, mark: 0, type: 0, parent_id: 0, parent_comment_id: 0, load_form: function (el_id, type, parent_id) { if(typeof el_id != 'undefined'){ this.obj_id='#'+el_id; } if(typeof type != 'undefined'){ this.type=type; } if(typeof parent_id != 'undefined'){ this.parent_id=parent_id; } this.key=Math.random(); $(this.obj_id).load('/?show=comments&mode=ajax&act=get_form&type='+this.type+'&parent_id='+this.parent_id+'&parent_comment_id='+this.parent_comment_id+'&rand='+this.key, function(){ $('.star-mark').bind('click', function(){ $('input[name=mark]').val($(this).attr('mark')); alltrades_comments.show_stars($(this).attr('mark')); }); }); $('#comments_add_main_comment_link').hide(); }, show_stars: function(mark){ $(this.obj_id+' input[name=mark]').val(mark); for(var i=1; i<=5; i++){ if(mark>=i){ $(this.obj_id).find('.mark'+i).removeClass('rank-star-empty').addClass('rank-star'); }else{ $(this.obj_id).find('.mark'+i).removeClass('rank-star').addClass('rank-star-empty'); } } }, send: function(){ var ret=''; $(this.obj_id+' [num]').each(function(){ ret+=$(this).attr('num')+':'; }); ret+=this.key; $.post('/?show=comments&mode=ajax&act=send&key='+hex_md5(ret)+'&rand='+this.key, $(this.obj_id+' form').serialize(), function(html){ $(alltrades_comments.obj_id).html(html); $(alltrades_comments.obj_id+' .star-mark').bind('click', function(){ $(alltrades_comments.obj_id+' input[name=mark]').val($(this).attr('mark')); alltrades_comments.show_stars($(this).attr('mark')); }); }); }, add_answer: function(id){ this.parent_comment_id=id; $('#comment_'+id+' > .comment-answers').show().prepend($(this.obj_id)); this.load_form(); $('#comments_add_main_comment_link').show(); }, add_comment: function(){ this.parent_comment_id=0; $(this.obj_id).appendTo('#comments_form_wr').show(); this.load_form(); }, tree: function(){ $('[data_parent_id]').each(function(){ $(this).appendTo('#comment_'+$(this).attr('data_parent_id')+' > .comment-answers'); $('#comment_'+$(this).attr('data_parent_id')+' > .comment-answers').show(); }); $('.comment-mark').each(function(){ var mark=$(this).attr('data_mark'); for(var i=1;i<=mark;i++){ $(this).append(''); } for(var i=mark;i<5;i++){ $(this).append(''); } }); } }