Advertisement
Guest User

Untitled

a guest
Jul 1st, 2014
307
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. $.fn.equals = function(compareTo) {
  3.   if (!compareTo || this.length != compareTo.length) {
  4.     return false;
  5.   }
  6.   for (var i = 0; i < this.length; ++i) {
  7.     if (this[i] !== compareTo[i]) {
  8.       return false;
  9.     }
  10.   }
  11.   return true;
  12. };
  13. ys_ms_ajax_page = 1;
  14. function ys_ms_JSInit(ajax_page, site_id, red_url){
  15. $(document).ready(function () {
  16.  
  17.     var __this__ = $('#ys-ms-slider');
  18.         __this__.speed = 200
  19.         __this__.ajax_page = ajax_page
  20.         __this__.site_id = site_id
  21.         __this__.red_url = red_url
  22.  
  23.     __this__.check_nav = function(th)
  24.     {
  25.         var button_left = th.find('.button7')
  26.         var button_right = th.find('.button8')
  27.        
  28.         if(th.find('li.showed:first').prev().length!=1)
  29.             button_left.addClass('disabled')
  30.         else
  31.             button_left.removeClass('disabled')
  32.        
  33.         if(th.find('li.showed:last').next().length!=1)
  34.             button_right.addClass('disabled')
  35.         else
  36.             button_right.removeClass('disabled')
  37.            
  38.     }
  39.        
  40.  
  41.      var currentCount;
  42.      var currentShow;
  43.     __this__.check_count = function(th)
  44.     {
  45.         var slw = th.parent().width();
  46.         var count = Math.floor(slw / 240);
  47.         var now_count = th.find('ul li.showed').length;
  48.         if(now_count != count)
  49.             if(now_count > count){
  50.                 var now = th.find('ul li.showed:last')
  51.                 for(var i=0;i<now_count-count;i++){
  52.                     now.removeClass('showed');
  53.                     now = now.prev()
  54.                 }
  55.             }else{
  56.                 var now = th.find('ul li.showed:last')
  57.                 if(now.length!=1){
  58.                     th.find('ul li:lt(' + count + ')').addClass('showed');
  59.                 }else{
  60.                     for(var i=0;i<count-now_count;i++){
  61.                         now = now.next()
  62.                         now.addClass('showed').css('left','0').css('opacity', '1');
  63.                     }
  64.                     now_count = th.find('ul li.showed').length;
  65.                     if(now_count != count){
  66.                         now = th.find('ul li.showed:first')
  67.                         for(var i=0;i<count-now_count;i++){
  68.                             now = now.prev()
  69.                             now.addClass('showed').css('left','0').css('opacity', '1');
  70.                         }
  71.                     }
  72.                 }
  73.             }
  74.         __this__.check_nav(th)
  75.         currentShow = now_count;
  76.         //console.log ("currentShow "+currentShow);
  77.     }
  78.    
  79.     __this__.bind_li = function(th)
  80.     {
  81.         th.find('ul li').unbind('hover').hover(function () {
  82.             $(this).find('.item-popup').show();
  83.             $(this).css({'z-index': 50});
  84.             $(this).find('.item-popup').addClass('item-hover');
  85.         }, function () {
  86.             var openedMenu = $(this).find('.selectBox-menuShowing')
  87.             if (openedMenu.length != 1) {
  88.                 $(this).find('.item-popup').fadeOut();
  89.                 $(this).css({'z-index': 1});
  90.                 $(this).find('.item-popup').removeClass('item-hover');
  91.             }
  92.         });
  93.     }
  94.    
  95.     __this__.ajax_loader_params = {
  96.         loaderSymbols: ['0', '1', '2', '3', '4', '5', '6', '7'],
  97.         loaderRate: 30
  98.     }
  99.    
  100.     __this__.ajax_loader = function(obj)
  101.     {
  102.         obj.addClass("loader");
  103.         obj.WAIT_STATUS = true;
  104.         obj.WAIT_PARAM = __this__.ajax_loader_params;
  105.         obj.WAIT_INDEX = 0;
  106.         obj.WAIT_FUNC = function(){
  107.             if(!obj) return;
  108.             if(obj.WAIT_STATUS)
  109.             {
  110.                 obj.html(obj.WAIT_PARAM.loaderSymbols[obj.WAIT_INDEX]);
  111.                 obj.WAIT_INDEX = obj.WAIT_INDEX < obj.WAIT_PARAM.loaderSymbols.length - 1 ? obj.WAIT_INDEX + 1 : 0;
  112.                 setTimeout(obj.WAIT_FUNC, obj.WAIT_PARAM.loaderRate);
  113.             }
  114.             else
  115.                 obj.removeClass("loader");
  116.         };
  117.         obj.WAIT_FUNC();
  118.     }
  119.  
  120.     __this__.ajax_loader_stop = function(obj)
  121.     {
  122.         obj.WAIT_STATUS = false;
  123.     }  
  124.    
  125.     __this__.ajax_li_check = function(th, name, now_page)
  126.     {
  127.         var pp = th.parent().parent()
  128.         var count = 0
  129.         if(pp.hasClass('blc_special'))
  130.             count = parseInt(pp.find('.tit .count').html());
  131.         else
  132.             count = parseInt(__this__.find('.slider_cat #tab_'+name+' a.count').html());
  133.            
  134.         if(count/10 > now_page)
  135.                 return true;
  136.  
  137.         //console.log("count"+count);  
  138.         return false;
  139.     }
  140.    
  141.     __this__.ajax_li = function(th, orientation)
  142.     {
  143.         var button_left = th.find('.button7')
  144.         var button_right = th.find('.button8')
  145.  
  146.         if(orientation == "right")
  147.         {
  148.             var elem = th.find('li:last').not(".loader");
  149.        
  150.             if(!th.find('li.showed:last').equals(elem))
  151.                 return;
  152.  
  153.             var now_page = parseInt(elem.find('hidden[name="iNumPage"]').attr('data-page'));
  154.             var name = th.attr('id').replace('block_', '');
  155.            
  156.             if(!__this__.ajax_li_check(th, name, now_page))
  157.                 return;
  158.                 var new_page = now_page+1;
  159.             var ajax_elem = elem
  160.             .clone()
  161.             .removeClass('showed')
  162.            
  163.             elem.after(ajax_elem)
  164.            
  165.             button_right.old_text = button_right.html()
  166.             __this__.ajax_loader(button_right)
  167.         }else if(orientation == "left"){
  168.             var elem = th.find('li:first').not(".loader");
  169.        
  170.             if(!th.find('li.showed:first').equals(elem))
  171.                 return;
  172.  
  173.             var now_page = parseInt(elem.find('hidden[name="iNumPage"]').attr('data-page'));
  174.             var name = th.attr('id').replace('block_', '');
  175.  
  176.             if(now_page <= 1) return;
  177.                 var new_page = now_page-1;
  178.             var ajax_elem = elem
  179.             .clone()
  180.             .removeClass('showed')
  181.            
  182.             elem.before(ajax_elem)
  183.            
  184.             button_left.old_text = button_left.html()
  185.             __this__.ajax_loader(button_left)  
  186.  
  187.         }else   return;
  188.  
  189.         __this__.ajax_loader(ajax_elem)
  190.        
  191.         $.post(__this__.ajax_page, {
  192.             'ys_ms_ajax_call':'y',
  193.             'iNumPage':new_page,
  194.             'tab_block':name,
  195.             'red_url':__this__.red_url,
  196.             'site_id':__this__.site_id,
  197.         }, function(data) {
  198.  
  199.             var appends = $(data).find('.ms_tab_block ul li')
  200.  
  201.             if(orientation == "right")
  202.             {          
  203.                 elem.after(appends)
  204.                 var new_li = th.find('li.showed:last').next()
  205.                 th.find('li hidden[data-page=\"'+(new_page-2)+'\"]').parent().remove()
  206.                 __this__.ajax_loader_stop(button_right)
  207.                 button_right.html(button_right.old_text)
  208.             }else if(orientation == "left"){
  209.                 elem.before(appends)
  210.                 var new_li = th.find('li.showed:first').prev()
  211.                 th.find('li hidden[data-page=\"'+(new_page+2)+'\"]').parent().remove()
  212.                 __this__.ajax_loader_stop(button_left)
  213.                 button_left.html(button_left.old_text)                 
  214.             }else   return;
  215.            
  216.             if(new_li.length==1){
  217.                 //if(ajax_elem.hasClass('showed')){
  218.                     new_li.addClass('showed').css('opacity', '0')
  219.                     new_li.animate(
  220.                         {
  221.                             'opacity': '1'
  222.                         },
  223.                         __this__.speed,
  224.                         function(){__this__.normalize($(this))}
  225.                     );
  226.                 //}
  227.             }
  228.             __this__.ajax_loader_stop(ajax_elem)
  229.             ajax_elem.remove();
  230.            
  231.             appends.find("select").selectBox();
  232.             __this__.check_nav(th)
  233.             __this__.bind_li(th)
  234.             __this__.add2basket_events(th)
  235.             __this__.check_count(th);
  236.         });
  237.        
  238.         __this__.check_nav(th)
  239.  
  240.     }
  241.  
  242.     __this__.normalize = function(li)
  243.     {
  244.         li.css('opacity', '1').css('left','0')
  245.     }  
  246.    
  247.  
  248.  
  249.  
  250.             //var   thisParent= ms_tab_block;
  251.         var Maxrange;
  252.         var lastSlideValue = 0;
  253.         var internalSlideCalling = false;
  254.         var value =0;
  255.         var startValue;
  256.         var stopValue;
  257.     $( ".slider1" ).slider({
  258.  
  259.                                 animate: true,
  260.                                 //range: "min",
  261.                                 value: 0,
  262.                                 min: 0,
  263.                                 max: 100,
  264.  
  265.                                 step: 10,
  266.                              
  267.                                 //Получаем значение и выводим его на странице
  268.                                
  269.                                 slide: function( event, ui ) {
  270.                                         $( "#slider-result" ).html( ui.value );
  271.                                        
  272.  
  273.                                     var trueoffset =parseInt($("#ys-ms-slider .ui-slider-handle").css('left') )/ $("#ys-ms-slider .ui-slider-handle").parent().width() * 100;
  274.                                         console.log("trueoffset"+trueoffset);
  275.                                         console.log(".position().left"+$("#ys-ms-slider .ui-slider-handle").position().left);
  276.  
  277.                                 },
  278.                                    
  279.  
  280.                                     create: function(event, ui){
  281.                                         Maxrange=( $(".slider1").parent('.ms_tab_block').find("li").size() - $(".slider1").parent('.ms_tab_block').find("li.showed").size()+1 )*10;
  282.                                                     $( ".slider1" ).slider( "option", "max", Maxrange);
  283.                                                     console.log("Maxrange "+Maxrange);
  284.                                                      sliderValueOld = $(this).slider('value');
  285.                                                    
  286.                                                     if ( $("#ys-ms-slider .ui-slider-handle").position().left==0  ) $("#ys-ms-slider .ui-slider-handle").css('margin-left', "0");
  287.                                     },
  288.                                     start: function(event, ui){
  289.                                          //liderValueOld = $(this).slider('value');
  290.                                        
  291.                                     },
  292.  
  293.                                     stop: function (event, ui){
  294.                                        
  295.                                     },
  296.  
  297.                                     //Обновляем скрытое поле формы, так что можно передать данные с помощью формы
  298.                                     change: function(event, ui) {
  299.                                     $('#hidden').attr('value', ui.value);
  300.                                     //__this__.check_count(th);
  301.  
  302.                                     $( "#slider-result" ).html( ui.value );
  303.                                         //event.stopPropagation();
  304.                                        var Slideval = $(this).slider('value');
  305.  
  306.                                    /*     if (!internalSlideCalling)
  307.                                         {
  308.                                             if (Slideval>lastSlideValue && lastSlideValue < $(this).slider('option','max'))
  309.                                             {
  310.                                                 Slideval = lastSlideValue+10;
  311.                                             }
  312.                                             else if (lastSlideValue > $(this).slider('option','min'))
  313.                                             {
  314.                                                 Slideval = lastSlideValue-10;                
  315.                                             }
  316.                                             lastSlideValue = Slideval;
  317.                                         }
  318.  
  319.                                         console.log(Slideval, value)
  320.  
  321.                                         if(value < Slideval) {
  322.                                           console.log("incremented")
  323.                                         } else if(value > Slideval){
  324.                                           console.log("decremented")
  325.                                         }
  326.                                         value = Slideval;
  327.  
  328.                                         if (!internalSlideCalling){
  329.                                             internalSlideCalling = true;
  330.                                             $(this).slider('value',Slideval);
  331.                                         }
  332.                                         else
  333.                                             internalSlideCalling = false;*/
  334.                                                                    
  335.                                                                 }
  336.                    
  337.                                         });
  338.                
  339.                    
  340.             function handleSliderChange(e, ui){
  341.                   var maxScroll = $("#content-scroll").attr("scrollWidth") - $("#content-scroll").width();
  342.                   $("#content-scroll").animate({scrollLeft: ui.value * (maxScroll / 100) }, 1000);
  343.                 }
  344.  
  345.             function handleSliderSlide(e, ui){
  346.                       var maxScroll = $("#content-scroll").attr("scrollWidth") - $("#content-scroll").width();
  347.                       $("#content-scroll").attr({scrollLeft: ui.value * (maxScroll / 100) });
  348.                     }
  349.  
  350.     __this__.bind_nav = function(th)
  351.     {
  352.         var button_left = th.find('.button7')
  353.         var button_right = th.find('.button8')
  354.    
  355.         button_left.unbind("click").click(function(){
  356.             th.find('li').stop(true, true)
  357.             var next_li = th.find('li.showed:first').prev()
  358.             if(next_li.length!=1)
  359.                 return;
  360.             var last_li = th.find('li.showed:last')
  361.             var left = $(last_li).width()+20
  362.             var all_li = th.find('li.showed:not(:last)')
  363.             next_li.addClass('showed').css('opacity', '0').css('left','-'+left+'px')
  364.             all_li.css('left','-'+left+'px')
  365.             last_li.css('left','-'+left+'px')
  366.             last_li.animate(
  367.                 {
  368.                     'left': 0+'px',
  369.                     'opacity': '0'
  370.                 },
  371.                 __this__.speed,
  372.                 function(){
  373.                     __this__.normalize($(this))
  374.                     $(this).removeClass('showed');
  375.                     __this__.check_nav(th)
  376.                     __this__.check_count(th);
  377.                 }
  378.             );
  379.             all_li.animate(
  380.                 {
  381.                     'left': 0+'px'
  382.                 },
  383.                 __this__.speed,
  384.                 function(){ __this__.normalize($(this))}
  385.             );
  386.             next_li.animate(
  387.                 {
  388.                     'left': 0+'px',
  389.                     'opacity': '1'
  390.                 },
  391.                 __this__.speed,
  392.                 function(){ __this__.normalize($(this))}
  393.             );
  394.             __this__.ajax_li(th, "left")
  395.                                     //PUSH BACK
  396.                                     $( ".slider1" ).slider("value", $( ".slider1" ).slider("value") - 10);
  397.                                      totalCountinThisLoad= th.find("li").size();
  398.                                      if (totalCountinThisLoad > newcount) newcount += totalCountinThisLoad-newcount;
  399.                                      totalCountShow=th.find("li.showed").size();
  400.                                      totalCountLeft=totalCountinThisLoad-totalCountShow;
  401.                                     // if (totalCountShow>5) totalCountShow = 5;
  402.                                      totalCountLeft=totalCountinThisLoad-totalCountShow;
  403.                                    
  404.                                    
  405.  
  406.                                     //console.log("Maxrange "+Maxrange);
  407.                                     //console.log("totalCountinThisLoad "+totalCountinThisLoad);
  408.                                     //console.log("totalCountShow "+totalCountShow);
  409.                                     //console.log("totalCountLeft "+totalCountLeft);
  410.                                      Maxrange=(totalCountinThisLoad-totalCountShow+1)*10;
  411.                                       $( ".slider1" ).slider( "option", "max", Maxrange);
  412.                                          Prevli = th.find('li.showed:first').prevAll("li").size();
  413.                                                  if ( ( $( ".slider1" ).slider("value") == 0 ) && ( th.find('li.showed:first').prevAll("li").size()>0 ) ) {
  414.                                                                 $( ".slider1" ).slider("value", $( ".slider1" ).slider("value") + Prevli*10);
  415.                                             }
  416.         });
  417.         var newcount1;
  418.         button_right.unbind("click").click(function(){
  419.             th.find('li').stop(true, true)
  420.             var next_li = th.find('li.showed:last').next()
  421.             if(next_li.length!=1)
  422.                 return;
  423.             var all_li = th.find('li.showed:not(:first)')
  424.            
  425.             var first_li = th.find('li.showed:first');
  426.             var additionalCollection = th.find('li.showed:first');
  427.             for ( var i = 0; i < 5; i++ ) {
  428.                  additionalCollection = additionalCollection.add(th.find('li.showed').eq(i));
  429.                
  430.             }
  431.             //additionalCollection.css('background','red');
  432.             //th.find('li.showed').eq(0).css('background','red');
  433.             //console.log("additionalCollection "+additionalCollection);
  434.             //additionalCollection.css('background','red');
  435.             next_li.addClass('showed').css('opacity', '0')
  436.             var left = $(first_li).width()+20
  437.             first_li.animate(
  438.                 {
  439.                     'left': '-'+left+'px',
  440.                     'opacity': '0'
  441.                 },
  442.                  __this__.speed,
  443.                 function(){
  444.                     __this__.normalize($(this))
  445.                     $(this).removeClass('showed');
  446.                     __this__.check_nav(th)
  447.                     __this__.check_count(th);
  448.                 }
  449.             );
  450.             all_li.animate(
  451.                 {
  452.                     'left': '-'+left+'px'
  453.                 },
  454.                  __this__.speed,
  455.                 function(){ __this__.normalize($(this)) }
  456.             );
  457.             next_li.animate(
  458.                 {
  459.                     'left': '-'+left+'px',
  460.                     'opacity': '1'
  461.                 },
  462.                  __this__.speed,
  463.                 function(){ __this__.normalize($(this)) }
  464.             );
  465.             __this__.ajax_li(th, "right")
  466.                                     //PUSH BACK
  467.                                     totalCountinThisLoad= th.find("li").size();
  468.                                      if (totalCountinThisLoad > newcount1) newcount1 += totalCountinThisLoad-newcount;
  469.                                      totalCountShow=th.find("li.showed").size();
  470.                                      totalCountLeft=totalCountinThisLoad-totalCountShow;
  471.                                     // if (totalCountShow>5) totalCountShow = 5;
  472.                                      totalCountLeft=totalCountinThisLoad-totalCountShow;
  473.                                    
  474.                                    
  475.  
  476.                                     console.log("Maxrange "+Maxrange);
  477.                                     console.log("totalCountinThisLoad "+totalCountinThisLoad);
  478.                                     console.log("totalCountShow "+totalCountShow);
  479.                                     console.log("totalCountLeft "+totalCountLeft);
  480.                                      Maxrange=(totalCountinThisLoad-totalCountShow+1)*10;
  481.                                       $( ".slider1" ).slider( "option", "max", Maxrange);
  482.             $( ".slider1" ).slider("value", $( ".slider1" ).slider("value") + 10);
  483.  
  484.  
  485.  
  486.             if ( ( $( ".slider1" ).slider("value") == Maxrange ) && ( th.find('li.showed:last').nextAll("li").size()>0) ) {
  487.                                                         var remain = th.find('li.showed:last').nextAll("li").size();
  488.                                                         $( ".slider1" ).slider("value", $( ".slider1" ).slider("value") - remain*10 );
  489.                                                 }
  490.                                
  491.  
  492.  
  493.  
  494.         });
  495.  
  496.  
  497.                             var totalCountinThisLoad;
  498.                             var totalCountShow;
  499.                             var totalCountLeft;
  500.                             var Maxrange;
  501.                             var sliderValueOld=th.find(".slider1").slider("value");
  502.                             var max = $( ".slider1" ).slider( "option", "max" );
  503.                             var min = $( ".slider1" ).slider( "option", "min" );
  504.                             var newcount = 0;
  505.                           //    console.log("th "+th);
  506.                             //__this__.check_count(th);
  507.                             th.bind('mousewheel DOMMouseScroll ', function(e, ui) {
  508.  
  509.                                 sliderValueOld =th.find(".slider1").slider("value");
  510.                                 console.log("sliderValueOld "+sliderValueOld);
  511.                                        
  512.                                          
  513.                                 var o = e.originalEvent;
  514.                                 var delta = o && (o.wheelDelta || (o.detail && -o.detail));
  515.  
  516.                                 if ( delta ) {
  517.                                
  518.                                 e.preventDefault();
  519.  
  520.                                 var step = th.find(".slider1").slider("option", "step");
  521.                                     //console.log("delta"+delta);
  522.                                     step *= delta < 0 ? -1 : 1;
  523.  
  524.                                     //console.log("step"+step);
  525.  
  526.                                    
  527.                                
  528.                                 var sliderValueNew;
  529.  
  530.                                 var Prevli;
  531.                                 th.find( ".slider1" ).slider("value", $( ".slider1" ).slider("value") + step);
  532.                                         sliderValueNew=$( ".slider1" ).slider("value");
  533.                                         //th.find(".slider1").css({"background": "red"});
  534.                                         //console.log("sliderValueNew"+sliderValueNew);
  535.  
  536.  
  537.  
  538.                                                 console.log("VPEREDI MNOGO: "+ th.find('li.showed:last').nextAll("li").size());
  539.                                                /*  
  540.                                                  
  541.                                                 if ( ( $( ".slider1" ).slider("value") == Maxrange ) && ( th.find('li.showed:last').next("li").size()==1) ) {
  542.                                                         var remain = th.find('li.showed:last').nextAll("li").size();
  543.                                                         $( ".slider1" ).slider("value", $( ".slider1" ).slider("value") - 10 );
  544.                                                 }
  545.                                                  
  546.  
  547.  
  548.                                                                     */
  549.  
  550.                                        
  551.                                          
  552.  
  553.  
  554.  
  555.                                 if (  (th.find(".slider1").slider("value") ==min ) &&  th.find('li.showed:first').prevAll("li").size()==0 )  {
  556.                                                              return;
  557.                                                     }
  558.  
  559.  
  560.  
  561.                                         /*  if (  ($( ".slider1" ).slider("value") ==Maxrange ) &&  th.find('li.showed:last').nextAll("li").size()==0 )  {
  562.                                                              return;
  563.                                                     }*/
  564.  
  565.                                         /* var Sliderval =  $( ".slider1" ).slider("value");
  566.  
  567.                                         var deltaSlide = ui.value - sliderValueNew;
  568.                                         console.log("deltaSlide "+deltaSlide);
  569.                                         if (deltaSlide>10)   { $( ".slider1" ).slider("value", $(this).slider("value") +10)
  570.                                                 return;
  571.                                         };
  572.                                         if (deltaSlide<10) {   $( ".slider1" ).slider("value", $(this).slider("value") - 10)
  573.                                             return;
  574.                                         };*/
  575.  
  576.                                         if (sliderValueNew>sliderValueOld){
  577.  
  578.                                         //  if (sliderValueNew == max){
  579.                                             //  console.log("STOP!")
  580.                                             //  return false;
  581.                                                 //event.preventDefault();
  582.                                                
  583.                                         //  }
  584.                                         //  else {
  585.                                                 //console.log("step"+step);
  586.                                                 //console.log("Its scroll down")
  587.                                            
  588.  
  589.                                                 th.find('li').stop(true, true)
  590.                                                 var next_li = th.find('li.showed:last').next()
  591.                                                 if(next_li.length!=1)
  592.                                                     return;
  593.                                                 var all_li = th.find('li.showed:not(:first)')
  594.                                                 var first_li = th.find('li.showed:first')
  595.                                                 next_li.addClass('showed').css('opacity', '0')
  596.                                                 var left = $(first_li).width()+20
  597.                                                 first_li.animate(
  598.                                                     {
  599.                                                         'left': '-'+left+'px',
  600.                                                         'opacity': '0'
  601.                                                     },
  602.                                                      __this__.speed,
  603.                                                     function(){
  604.                                                         __this__.normalize($(this))
  605.                                                         $(this).removeClass('showed');
  606.                                                         __this__.check_nav(th)
  607.                                                         __this__.check_count(th);
  608.                                                     }
  609.                                                 );
  610.                                                 all_li.animate(
  611.                                                     {
  612.                                                         'left': '-'+left+'px'
  613.                                                     },
  614.                                                      __this__.speed,
  615.                                                     function(){ __this__.normalize($(this)) }
  616.                                                 );
  617.                                                 next_li.animate(
  618.                                                     {
  619.                                                         'left': '-'+left+'px',
  620.                                                         'opacity': '1'
  621.                                                     },
  622.                                                      __this__.speed,
  623.                                                     function(){ __this__.normalize($(this)) }
  624.                                                 );
  625.                                                 __this__.ajax_li(th, "right")
  626.                                                 //}
  627.                                                         totalCountinThisLoad= th.find("li").size();
  628.                                                              if (totalCountinThisLoad > newcount1) newcount1 += totalCountinThisLoad-newcount;
  629.                                                              totalCountShow=th.find("li.showed").size();
  630.                                                              totalCountLeft=totalCountinThisLoad-totalCountShow;
  631.                                                             // if (totalCountShow>5) totalCountShow = 5;
  632.                                                              totalCountLeft=totalCountinThisLoad-totalCountShow;
  633.                                                            
  634.                                                            
  635.  
  636.                                                             console.log("Maxrange "+Maxrange);
  637.                                                             console.log("totalCountinThisLoad "+totalCountinThisLoad);
  638.                                                             console.log("totalCountShow "+totalCountShow);
  639.                                                             console.log("totalCountLeft "+totalCountLeft);
  640.                                                             Maxrange=(totalCountinThisLoad-totalCountShow+1)*10;
  641.                                                             th.find(".slider1").slider( "option", "max", Maxrange);
  642.                                                             th.find(".slider1").slider("value", $( ".slider1" ).slider("value") + 10);
  643.  
  644.  
  645.  
  646.                                                             if ( ( th.find(".slider1").slider("value") == Maxrange ) && ( th.find('li.showed:last').nextAll("li").size()>0) ) {
  647.                                                                         var remain = th.find('li.showed:last').nextAll("li").size();
  648.                                                                         th.find(".slider1").slider("value", th.find(".slider1").slider("value") - remain*10 );
  649.                                                                     }
  650.  
  651.                                                    
  652.                                           }    
  653.  
  654.                                        
  655.  
  656.  
  657.                                          if ( ( th.find(".slider1").slider("value") == 0 ) && ( th.find('li.showed:first').prevAll("li").size()==0 ) ) {
  658.                                                                 return;
  659.                                             }
  660.  
  661.                                     if (sliderValueNew<sliderValueOld){
  662.  
  663.  
  664.                                             //if (sliderValueNew==min) {
  665.                                                 //  console.log("STOP!")
  666.                                             //  return false;
  667.                                                    
  668.                                             //} else {
  669.  
  670.  
  671.                                                 //console.log("Its scroll up")
  672.                                                
  673.                                                 th.find('li').stop(true, true)
  674.                                                     var next_li = th.find('li.showed:first').prev()
  675.                                                     if(next_li.length!=1)
  676.                                                         return;
  677.                                                     var last_li = th.find('li.showed:last')
  678.                                                     var left = $(last_li).width()+20
  679.                                                     var all_li = th.find('li.showed:not(:last)')
  680.                                                     next_li.addClass('showed').css('opacity', '0').css('left','-'+left+'px')
  681.                                                     all_li.css('left','-'+left+'px')
  682.                                                     last_li.css('left','-'+left+'px')
  683.                                                     last_li.animate(
  684.                                                         {
  685.                                                             'left': 0+'px',
  686.                                                             'opacity': '0'
  687.                                                         },
  688.                                                         __this__.speed,
  689.                                                         function(){
  690.                                                             __this__.normalize($(this))
  691.                                                             $(this).removeClass('showed');
  692.                                                             __this__.check_nav(th)
  693.                                                             __this__.check_count(th);
  694.                                                         }
  695.                                                     );
  696.                                                     all_li.animate(
  697.                                                         {
  698.                                                             'left': 0+'px'
  699.                                                         },
  700.                                                         __this__.speed,
  701.                                                         function(){ __this__.normalize($(this))}
  702.                                                     );
  703.                                                     next_li.animate(
  704.                                                         {
  705.                                                             'left': 0+'px',
  706.                                                             'opacity': '1'
  707.                                                         },
  708.                                                         __this__.speed,
  709.                                                         function(){ __this__.normalize($(this))}
  710.                                                     );
  711.                                                     __this__.ajax_li(th, "left")
  712.                                                     th.find(".slider1").slider("value", $( ".slider1" ).slider("value") - 10);
  713.                                                      totalCountinThisLoad= th.find("li").size();
  714.                                                      if (totalCountinThisLoad > newcount) newcount += totalCountinThisLoad-newcount;
  715.                                                      totalCountShow=th.find("li.showed").size();
  716.                                                      totalCountLeft=totalCountinThisLoad-totalCountShow;
  717.                                                     // if (totalCountShow>5) totalCountShow = 5;
  718.                                                      totalCountLeft=totalCountinThisLoad-totalCountShow;
  719.                                                    
  720.                                                    
  721.  
  722.                                                     /*console.log("Maxrange "+Maxrange);
  723.                                                     console.log("totalCountinThisLoad "+totalCountinThisLoad);
  724.                                                     console.log("totalCountShow "+totalCountShow);
  725.                                                     console.log("totalCountLeft "+totalCountLeft);*/
  726.                                                      Maxrange=(totalCountinThisLoad-totalCountShow+1)*10;
  727.                                                       th.find(".slider1").slider( "option", "max", Maxrange);
  728.                                                          Prevli = th.find('li.showed:first').prevAll("li").size();
  729.                                                                  if ( ( th.find(".slider1").slider("value") == 0 ) && ( th.find('li.showed:first').prevAll("li").size()>0 ) ) {
  730.                                                                                 th.find(".slider1").slider("value", th.find(".slider1").slider("value") + Prevli*10);
  731.                                                     }
  732.                                                 //}
  733.                                            
  734.                                                
  735.                                             }
  736.  
  737.                                                 //Prevli = th.find('li.showed:first').prevAll("li").size();
  738.                                                 //console.log("Prevli "+Prevli);
  739.  
  740.                                             /*if ( ( $( ".slider1" ).slider("value") == 0 ) && ( th.find('li.showed:first').prevAll("li").size()>0 ) ) {
  741.                                                                 $( ".slider1" ).slider("value", $( ".slider1" ).slider("value") + Prevli*10);
  742.                                             }*/
  743.  
  744.                                            
  745.  
  746.  
  747.  
  748.                                
  749.  
  750.                             }
  751.  
  752.                            // return false;
  753.  
  754.                            
  755.  
  756.                            
  757.                         });
  758.                        
  759.  
  760.                         var ValueOldOnSlide=$( ".slider1" ).slider("value");
  761.                         var ValueNewOnSlide;
  762.                         //$( ".slider1" ).slider({
  763.  
  764.             $( ".slider1" ).bind( "slidechange", function(event, ui){
  765.                         //Maxrange= $(".slider1").parent('.ms_tab_block').find("li").size();
  766.                                     ValueOldOnSlide=ui.value;
  767.                                    
  768.  
  769.                     });
  770.                                
  771.             var newcount2 =0;
  772.             var remain;
  773.  
  774.                                                
  775.             var totalCountinThisLoadOLD= $(".slider1").parent('.ms_tab_block').find("li").size();
  776.  
  777.             var deltaValue;
  778.  
  779.  
  780.  
  781.  
  782. var ScrollToright=  function (Steps){
  783.  
  784.             console.log ("Steps!!!!!!!!! "+Steps);     
  785.             th.find('li').stop(true, true)
  786.             var next_li = th.find('li.showed:last').next()
  787.             if(next_li.length!=1)
  788.                 return;
  789.             var all_li = th.find('li.showed:not(:first)')
  790.        
  791.             var first_li = th.find('li.showed:first');
  792.             var additionalCollection = th.find('li.showed:first');
  793.             var trueIndexli = th.find('li.showed:first').index()-1;
  794.             var next_li_add;
  795.             console.log ("trueIndexli "+trueIndexli);
  796.             /*for ( var i = 0; i < Steps; i++ ) {
  797.                  additionalCollection = additionalCollection.add(th.find('li.showed').eq(i));
  798.  
  799.                
  800.             }*/
  801.        
  802.                 for ( var i = 0; i < Steps; i++ ) {
  803.                 trueIndexli= trueIndexli+i;
  804.                  additionalCollection = additionalCollection.add(th.find('li').eq(trueIndexli));
  805.                
  806.                 }
  807.  
  808.  
  809.            
  810.  
  811.             //additionalCollection.css('background','red');
  812.             //th.find('li.showed').eq(0).css('background','red');
  813.             //console.log("additionalCollection "+additionalCollection);
  814.             //additionalCollection.css('background','red');
  815.             if (Steps>1){
  816.                 first_li = additionalCollection;
  817.                
  818.                 all_li = th.find('li').not(additionalCollection);
  819.                  next_li_add = additionalCollection.last().next();
  820.                 next_li = next_li_add;
  821.             }
  822.             if (Steps>4) {
  823.                 all_li = additionalCollection.nextAll();
  824.             }
  825.             next_li.addClass('showed').css('opacity', '0')
  826.             var left = $(first_li).width()+20
  827.             first_li.animate(
  828.                 {
  829.                     'left': '-'+left+'px',
  830.                     'opacity': '0'
  831.                 },
  832.                  __this__.speed,
  833.                 function(){
  834.                     __this__.normalize($(this))
  835.                     $(this).removeClass('showed');
  836.                     __this__.check_nav(th)
  837.                     __this__.check_count(th);
  838.                 }
  839.             );
  840.             all_li.animate(
  841.                 {
  842.                     'left': '-'+left+'px'
  843.                 },
  844.                  __this__.speed,
  845.                 function(){ __this__.normalize($(this)) }
  846.             );
  847.             next_li.animate(
  848.                 {
  849.                     'left': '-'+left+'px',
  850.                     'opacity': '1'
  851.                 },
  852.                  __this__.speed,
  853.                 function(){ __this__.normalize($(this)) }
  854.             );
  855.             __this__.ajax_li(th, "right")
  856.                                     //PUSH BACK
  857.                                     totalCountinThisLoad= th.find("li").size();
  858.                                      if (totalCountinThisLoad > newcount1) newcount1 += totalCountinThisLoad-newcount;
  859.                                      totalCountShow=th.find("li.showed").size();
  860.                                      totalCountLeft=totalCountinThisLoad-totalCountShow;
  861.                                     // if (totalCountShow>5) totalCountShow = 5;
  862.                                      totalCountLeft=totalCountinThisLoad-totalCountShow;
  863.                                    
  864.                                    
  865.  
  866.                                     Maxrange=(totalCountinThisLoad-totalCountShow+1)*10;
  867.                                     $( ".slider1" ).slider( "option", "max", Maxrange);
  868.                                     $( ".slider1" ).slider("value", $( ".slider1" ).slider("value") + Steps);
  869.  
  870.  
  871.  
  872.                                     if ( ( $( ".slider1" ).slider("value") ==   $( ".slider1" ).slider( "option", "max") ) && ( th.find('li.showed:last').nextAll("li").size()>0) ) {
  873.                                                         var remain = th.find('li.showed:last').nextAll("li").size();
  874.                                                         $( ".slider1" ).slider("value", $( ".slider1" ).slider("value") - (remain*10) );
  875.                                                 }
  876.                                
  877.  
  878. }
  879.  
  880. var ScrollToLeft = function(Steps) {
  881.             var stepback = Math.abs(Steps);
  882.             console.log ("Steps!!!!!!!!! "+stepback);
  883.  
  884.             th.find('li').stop(true, true)
  885.             var next_li = th.find('li.showed:first').prev()
  886.             if(next_li.length!=1)
  887.                 return;
  888.             var last_li = th.find('li.showed:last')
  889.             var additionalCollection = th.find('li.showed:last');
  890.             var trueindex = last_li.index();
  891.             var totalShowed = th.find('li.showed').length-1;
  892.  
  893.             //th.find('li.showed').eq(totalShowed).css('background','black');
  894.             console.log("totalShowed "+totalShowed);
  895.             console.log("trueindex "+trueindex);
  896.             for ( var i = 0; i <stepback; i++ ) {
  897.                 if (i<=4){
  898.                  totalShowed = totalShowed-i;
  899.                  additionalCollection = additionalCollection.add(th.find('li.showed').eq(totalShowed));
  900.                 }
  901.             }
  902.             if (stepback>1) last_li = additionalCollection;
  903.             //additionalCollection.css('background','green');
  904.  
  905.  
  906.  
  907.             var left = $(last_li).width()+20
  908.             var all_li = th.find('li.showed:not(:last)')
  909.             next_li.addClass('showed').css('opacity', '0').css('left','-'+left+'px')
  910.             all_li.css('left','-'+left+'px')
  911.             last_li.css('left','-'+left+'px')
  912.             last_li.animate(
  913.                 {
  914.                     'left': 0+'px',
  915.                     'opacity': '0'
  916.                 },
  917.                 __this__.speed,
  918.                 function(){
  919.                     __this__.normalize($(this))
  920.                     $(this).removeClass('showed');
  921.                     __this__.check_nav(th)
  922.                     __this__.check_count(th);
  923.                 }
  924.             );
  925.             all_li.animate(
  926.                 {
  927.                     'left': 0+'px'
  928.                 },
  929.                 __this__.speed,
  930.                 function(){ __this__.normalize($(this))}
  931.             );
  932.             next_li.animate(
  933.                 {
  934.                     'left': 0+'px',
  935.                     'opacity': '1'
  936.                 },
  937.                 __this__.speed,
  938.                 function(){ __this__.normalize($(this))}
  939.             );
  940.             __this__.ajax_li(th, "left")
  941.  
  942.  
  943.                                     //PUSH BACK
  944.                                     $( ".slider1" ).slider("value", $( ".slider1" ).slider("value") - 10);
  945.                                      totalCountinThisLoad= th.find("li").size();
  946.                                      if (totalCountinThisLoad > newcount) newcount += totalCountinThisLoad-newcount;
  947.                                      totalCountShow=th.find("li.showed").size();
  948.                                      totalCountLeft=totalCountinThisLoad-totalCountShow;
  949.                                      totalCountLeft=totalCountinThisLoad-totalCountShow;
  950.                                    
  951.                                    
  952.  
  953.                                       $( ".slider1" ).slider( "option", "max", Maxrange);
  954.                                          Prevli = th.find('li.showed:first').prevAll("li").size();
  955.                                                  if ( ( $( ".slider1" ).slider("value") == 0 ) && ( th.find('li.showed:first').prevAll("li").size()>0 ) ) {
  956.                                                                 $( ".slider1" ).slider("value", $( ".slider1" ).slider("value") + Prevli*10);
  957.                                             }
  958.  
  959. }
  960.  
  961.  
  962. th.find( ".slider1" ).bind( "slide", function(event, ui){
  963.                                                        
  964.  
  965.                                      totalCountinThisLoad= th.find("li").size();
  966.                                      if (totalCountinThisLoad > newcount) newcount += totalCountinThisLoad-newcount;
  967.                                      totalCountShow=th.find("li.showed").size();
  968.                                      totalCountLeft=totalCountinThisLoad-totalCountShow;
  969.                                     totalCountLeft=totalCountinThisLoad-totalCountShow;
  970.                                     Maxrange=(totalCountinThisLoad-totalCountShow+1)*10;
  971.                                  $( ".slider1" ).slider( "option", "max", Maxrange);
  972.                                
  973.                        
  974.  
  975.                                 deltaValueStep = (ui.value-ValueOldOnSlide)/10;
  976.                                 //console.log("deltaValueSte "+deltaValueStep);
  977.  
  978.                                 if ( ui.value>ValueOldOnSlide){
  979.                                             //  console.log("step"+step);
  980.                                             //console.log("Its scroll down")
  981.                                             ScrollToright(deltaValueStep);
  982.                                            
  983.                                           }    
  984.  
  985.                                     if ( ui.value<ValueOldOnSlide){
  986.                                                 //console.log("Its scroll up")
  987.                                                 ScrollToLeft(deltaValueStep);
  988.                                                
  989.                                     }
  990.  
  991.  
  992.                                 });
  993.                            
  994.  
  995.                            
  996.  
  997.                                
  998.                     //  });
  999.  
  1000.  
  1001.  
  1002.  
  1003.        
  1004.        
  1005.     }
  1006.  
  1007.     __this__.add2basket_events = function(th)
  1008.     {
  1009.         th.find(".add2basket").attr('onclick','ys_ms_ajax_add2basket(this);return false;');
  1010.     }
  1011.    
  1012.     __this__.init = function(th)
  1013.     {
  1014.         if(!th)
  1015.             return;
  1016.         __this__.check_count(th);
  1017.         __this__.bind_nav(th);
  1018.         __this__.bind_li(th);
  1019.         __this__.add2basket_events(th);
  1020.         th.find("select").selectBox();
  1021.         $(window).resize(function(){
  1022.             __this__.check_count(th);
  1023.         });
  1024.     }
  1025.    
  1026.  
  1027.     __this__.ajax_block = function(name)
  1028.     {
  1029.         var loader_parent = __this__.find('.slider_cat li span#tab_'+name);
  1030.         var loader = loader_parent.find('.notloader');
  1031.         if(loader.hasClass('loader'))
  1032.             return;
  1033.        
  1034.         var loader_big = __this__.find('.ms_tab_block#loader');
  1035.         loader_big.find('ul').html('')
  1036.        
  1037.         var count = 0
  1038.         if(count = parseInt(loader_parent.find('.count').html())){
  1039.             if(count>10)
  1040.                 count = 10;
  1041.             for ( i = 0; i < count; i++ )
  1042.                 loader_big.find('ul').append($('<li></li>'));
  1043.         }
  1044.  
  1045.         __this__.check_count(loader_big)
  1046.         loader_big.find('li').each(function(){
  1047.             __this__.ajax_loader($(this))
  1048.         })
  1049.         loader_big.show()
  1050.        
  1051.         __this__.ajax_loader(loader)
  1052.         loader_parent.find('.tab_main').css('opacity', '0')
  1053.         loader_parent.find('.count').css('opacity', '0')
  1054.  
  1055.         $.post(__this__.ajax_page, {
  1056.             'ys_ms_ajax_call':'y',
  1057.             'tab_block':name,
  1058.             'red_url':__this__.red_url,
  1059.             'site_id':__this__.site_id,
  1060.         }, function(data) {
  1061.        
  1062.             loader_big.find('li').each(function(){
  1063.                 __this__.ajax_loader_stop($(this))
  1064.                 $(this).remove()
  1065.             })
  1066.        
  1067.             loader_parent.find('.tab_main').css('opacity', '1')
  1068.             loader_parent.find('.count').css('opacity', '1')
  1069.             __this__.ajax_loader_stop(loader)
  1070.            
  1071.            
  1072.             __this__.find('.ms_tab_block').hide();
  1073.             var append = $(data).find('.ms_tab_block#block_'+name)
  1074.             append.appendTo(__this__.find('.sl_wrapper'))
  1075.             __this__.init(append)
  1076.            
  1077.             __this__.find('.slider_cat li')
  1078.                     .removeClass('active')
  1079.                     .find('span#tab_'+name)
  1080.                     .parent()
  1081.                     .addClass('active')
  1082.                    
  1083.         });
  1084.  
  1085.     }
  1086.    
  1087.     __this__.find('.slider_cat li').unbind('click').click(function(){
  1088.         if(!$(this).hasClass('active'))
  1089.         {
  1090.             var val = $(this).find('span').attr('id');
  1091.             val = val.replace('tab_', '');
  1092.             var block = __this__.find('.ms_tab_block#block_'+val)
  1093.             __this__.find('.slider_cat li')
  1094.                     .removeClass('active')
  1095.                     .find('span#tab_'+val)
  1096.                     .parent()
  1097.                     .addClass('active')
  1098.             __this__.find('.ms_tab_block').hide();
  1099.             if(block.length>0){
  1100.                 block.show();
  1101.             }
  1102.             else
  1103.                 __this__.ajax_block(val)
  1104.         }
  1105.     })
  1106.    
  1107.    
  1108.     __this__.find('.ms_tab_block#loader').hide()
  1109.     __this__.find('.ms_tab_block').each(function(){
  1110.         __this__.init($(this))
  1111.     });
  1112.  
  1113.  
  1114.  
  1115.  
  1116. });
  1117.  
  1118. }
  1119.  
  1120.  
  1121. /**
  1122. * Add params to add_url
  1123. *
  1124. * @param {Object} select object
  1125. */
  1126. function ys_ms_onSelectChange(select) {
  1127.     var a = $(select).parent().parent().parent().parent().find('div a.button2'),
  1128.         href,
  1129.         params,
  1130.         i = 0,
  1131.         flag = 0,
  1132.         val = select.name + '=' + select.value;
  1133.        
  1134.     $(select).next().find('span.selectBox-label').css('color', 'black');
  1135.    
  1136.     if (a.attr('href') === 'javascript:void(0);') {
  1137.         a.attr('href', a.attr('rev'));
  1138.     }
  1139.    
  1140.     href = a.attr('href');
  1141.  
  1142.     href = decodeURI(href);
  1143.     params = href.split('&');
  1144.  
  1145.     for (; i < params.length; i += 1) {
  1146.         if (params[i].indexOf(select.name) != -1) {
  1147.             if (select.value == 0) {
  1148.                 params.splice(i, 1);
  1149.             } else {
  1150.                 params[i] = val;
  1151.                 flag = 1;
  1152.             }
  1153.         }
  1154.     }
  1155.    
  1156.     if ( select.value != 0 && !flag ) {
  1157.         params.push(val);
  1158.     }
  1159.  
  1160.     href = params.join('&');
  1161.     a.attr('href', href);
  1162.    
  1163.     a.removeClass('button_in_basket');
  1164.     $(select).parent().parent().find('select').each(function(){
  1165.         if(this.value == 0 ){
  1166.             a.addClass('button_in_basket');
  1167.             return false;
  1168.         }
  1169.     });
  1170.    
  1171. }
  1172.  
  1173.  
  1174.  
  1175. $(document).ready(function () {
  1176. $('.catalog .add2basket').unbind('click');
  1177. $('.catalog').on('click', '.add2basket', function(){
  1178.     if(!$(this).hasClass('button_in_basket'))
  1179.     {
  1180.        
  1181.         var button = $(this)
  1182.         var id = button.attr('id').replace('ys-ms-','');
  1183.         var splitData = id.split('-');
  1184.         var iblock_id = splitData[0];
  1185.         var element_id = splitData[1];
  1186.  
  1187.         var href = $(this).attr('href') ;
  1188.         var action_add2b = $('#action_add2b').attr('value') ;
  1189.        
  1190.         var ob_post_params = JSON.parse('{"'+href.substr(href.indexOf('?')+1).split('&').join('","').split('=').join('":"')+'", "iblock_id":"'+iblock_id+'","sessid":"'+BX.message.bitrix_sessid+'", "action_add2b":"'+action_add2b+'", "main_page":"Y"}');
  1191.         var url = SITE_TEMPLATE_PATH+'/ajax/add2basket.php';
  1192.         if($('.yen-bs-box').length > 0 &&  typeof SITE_TEMPLATE_PATH != "undefined" && typeof yenisite_bs_flyObjectTo != "undefined"){
  1193.             $.post(url, ob_post_params, function(data) {
  1194.                 button.addClass("button_in_basket")
  1195.                 var pic_src = $('#product_photo_'+element_id).attr('src');
  1196.                 if($('#action_add2b').attr('value') == 'popup_window')
  1197.                 {
  1198.                     var arData = data.split('<!-- add2basket -->');
  1199.                     $('.yen-bs-box').html(arData[0]);
  1200.                     $('#add_2b_popup').html(arData[1]);
  1201.                     $('#add_2b_popup').fadeIn('300');
  1202.                     $('#mask').fadeIn('300');
  1203.                 }
  1204.                 else
  1205.                 {
  1206.                     var what = '#ys-ms-'+id+'-photo';
  1207.                     var to = '.yen-bs-box';
  1208.                     yenisite_bs_flyObjectTo(what, to);
  1209.                     $('.yen-bs-box').html(data);
  1210.                 }
  1211.             });
  1212.             return false;
  1213.         }
  1214.     }
  1215. });
  1216. })
  1217.  
  1218.  
  1219. function ys_ms_ajax_add2basket(self){
  1220.     if(!$(self).hasClass('button_in_basket')){
  1221.         var button = $(self)
  1222.         var id = button.attr('id').replace('ys-ms-','');
  1223.         var splitData = id.split('-');
  1224.         var iblock_id = splitData[0];
  1225.         var element_id = splitData[1];
  1226.         var href = button.attr('href');
  1227.         if($('.yen-bs-box').length > 0 &&  typeof SITE_TEMPLATE_PATH != "undefined" && typeof yenisite_bs_flyObjectTo != "undefined"){
  1228.             var action_add2b = $('#action_add2b').attr('value') ;
  1229.             var ob_post_params = JSON.parse('{"'+href.substr(href.indexOf('?')+1).split('&').join('","').split('=').join('":"')+'", "action":"ADD2BASKET", "id":"'+element_id+'", "iblock_id":"'+iblock_id+'","sessid":"'+BX.message.bitrix_sessid+'", "action_add2b":"'+action_add2b+'", "main_page":"Y"}');
  1230.             var url = SITE_TEMPLATE_PATH+'/ajax/add2basket.php';
  1231.             $.post(url, ob_post_params, function(data) {
  1232.                 button.addClass("button_in_basket")
  1233.                 var pic_src = $('#product_photo_'+element_id).attr('src');
  1234.                 if($('#action_add2b').attr('value') == 'popup_window')
  1235.                 {
  1236.                     var arData = data.split('<!-- add2basket -->');
  1237.                     $('.yen-bs-box').html(arData[0]);
  1238.                     $('#add_2b_popup').html(arData[1]);
  1239.                     $('#add_2b_popup').fadeIn('300');
  1240.                     $('#mask').fadeIn('300');
  1241.                 }
  1242.                 else
  1243.                 {
  1244.                     var what = '#ys-ms-'+id+'-photo';
  1245.                     var to = '.yen-bs-box';
  1246.                     yenisite_bs_flyObjectTo(what, to);
  1247.                     $('.yen-bs-box').html(data);
  1248.                 }
  1249.             });
  1250.         }else{
  1251.             throw "stop";
  1252.         }
  1253.        
  1254.     }
  1255. }
  1256.  
  1257.  
  1258.  
  1259.  
  1260. $(document).ready(function() {
  1261. /* var loghandle = function(event, delta) {
  1262.                     var o = '', id = event.currentTarget.id || event.currentTarget.nodeName;
  1263.  
  1264.                     o = '#' + id + ':';
  1265.  
  1266.                     if (delta > 0)
  1267.                         o += ' up (' + delta + ')';
  1268.                     else if (delta < 0)
  1269.                         o += ' down (' + delta + ')';
  1270.  
  1271.                     if (event.deltaY > 0)
  1272.                         o += ' north (' + event.deltaY + ')';
  1273.                     else if (event.deltaY < 0)
  1274.                         o += ' south (' + event.deltaY + ')';
  1275.  
  1276.                     if (event.deltaX > 0)
  1277.                         o += ' east (' + event.deltaX + ')';
  1278.                     else if (event.deltaX < 0)
  1279.                         o += ' west (' + event.deltaX + ')';
  1280.  
  1281.                     o += ' deltaFactor (' + event.deltaFactor + ')';
  1282.  
  1283.                   //  log( o );
  1284.                 };
  1285.  
  1286.    
  1287.  
  1288. */
  1289.  
  1290. $("#ys-ms-slider").hover(function() {
  1291.     //console.log("test");
  1292. });
  1293.  
  1294.  
  1295.  
  1296.  
  1297.  
  1298. // get handle to the scrollable DIV
  1299. /*var scroll = $("#scroll");
  1300.  
  1301. // initialize rangeinput
  1302. $(":range").rangeinput({
  1303.  
  1304.     // slide the DIV along with the range using jQuery's css() method
  1305.     onSlide: function(ev, step)  {
  1306.         scroll.css({left: -step});
  1307.     },
  1308.  
  1309.     // display progressbar
  1310.     progress: false,
  1311.  
  1312.     // initial value. also sets the DIV's initial scroll position
  1313.     value: 50,
  1314.  
  1315.     // this is called when the slider is clicked. we animate the DIV
  1316.     change: function(e, i) {
  1317.         scroll.animate({left: -i}, "fast");
  1318.     },
  1319.  
  1320.      css: {
  1321.         input: 'range',       /* class name for the generated text input field */
  1322.    //     slider: 'slider1',     /* class name for rangeinput */
  1323.      //   progress: 'progress', /* class name for progress bar  */
  1324.        // handle: 'handle'      /* class name for drag handle */
  1325.         //},
  1326.  
  1327.     // disable drag handle animation when when slider is clicked
  1328.     //speed: 0
  1329.  
  1330. //});*/
  1331.  
  1332.  
  1333. /*
  1334.     var currentValue=  $("input:range").val();  
  1335.         console.log("currentValue "+currentValue);
  1336.  
  1337.         $("input:range").change(function() {
  1338.                 currentValue=  $("input:range").val();
  1339.                 console.log("currentValue "+currentValue);
  1340.         });
  1341. */
  1342.  
  1343.  
  1344.  
  1345.  
  1346. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement