Advertisement
Palid

Intercity main.js

Dec 17th, 2014
321
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $(document).ready(function(){
  2.     $("#type").change(function(){
  3.         var desc = $("#type option:selected").attr("title");
  4.         $("#desc").html(desc);
  5.     });
  6.    
  7.    
  8.    
  9. });
  10.  
  11.  
  12.  
  13. /******* KOMPONENTY jQuery (mniej lub bardziej uniwersalne ;-)) ***********/
  14. (function($){
  15.    
  16.    
  17.         /**
  18.          *  FAKTURY ELEKTRONICZNE
  19.          *  
  20.          *  */  
  21.         $.fn.fakturyElektroniczne = function(options) {
  22.            
  23.             // this object
  24.             var self = $(this);
  25.            
  26.             daneDoFakturyWrapper(self, options);
  27.            
  28.             self.change(function() {
  29.                
  30.                 daneDoFakturyWrapper(self, options);
  31.            
  32.           });
  33.         };
  34.        
  35.        
  36.      // prywatna funkcja dla faktur elektronicznych
  37.      var daneDoFakturyWrapper = function(checkbox, options) {
  38.              
  39.             // get dane do faktury kontener
  40.             var daneDoFaktury = $("#" + options.wrapper);
  41.                        
  42.             if($(checkbox).is(":checked")) {
  43.                 daneDoFaktury.show();                
  44.                
  45.             }else {
  46.                
  47.                 // iterujemy siê po elementach
  48.                 $(daneDoFaktury).find("input").each(function(idx, elem) {                  
  49.                    
  50.                     // czyœcimy wartoœci w inputach
  51.                    $(elem).val("");                    
  52.                 });
  53.                
  54.                 daneDoFaktury.hide();
  55.             }
  56.         };
  57.        
  58.         /********************************/
  59.        
  60.         /**
  61.          * OBSLUGA ZNIZKI -  100 % Dla dziecka do lat 4
  62.          */
  63.        
  64.          /**
  65.         * Rodzaj miejsca (id: 1,2,3)
  66.         *
  67.         * 1 - do siedzenia
  68.         * 2 - kuszetka
  69.         * 3 - sypialne
  70.         *
  71.         */
  72.        
  73.         $.fn.obslugaZnizkiDlaDziecka = function(options) {
  74.            
  75.             // this object
  76.             var self = $(this);
  77.             var kod_znizki = $("#kod_znizki");
  78.            
  79.             var klasa_wagonu;
  80.            
  81.             klasa_wagonu = $("#klasa_wagonu").html();            
  82.            
  83.             if(self.is(":checked")) {
  84.  
  85.                 var checkedOption = $("input[type='radio'].rodzaj_miejsca:checked").val();
  86.                
  87.                 // obsluga kontenerow na potrzeby biletomanii
  88.                 switchRelief(checkedOption);
  89.                
  90.                
  91.                 // ustawiamy zaznaczona opcje dla konkretnego kontenera          
  92.                 var idx;              
  93.                 if(checkedOption == 1) {              
  94.                     idx = 1;
  95.                 }else {
  96.                     idx = 2;                    
  97.                 }
  98.                
  99.                 //$("#rodzaj_ulgi_wrap_"+idx+" select").val($("#rodzaj_ulgi_wrap_"+idx+" select").val());
  100.                
  101.          
  102.                 // znizka dla dzieci (  100 % Dla dziecka do lat 4 )      
  103.                 var znizka_selected = $(".znizki_wrapper").find("option:selected");
  104.                
  105.                 if(znizka_selected.val() == 77) {
  106.                     $("#rodzaj_ulgi_wrap_"+idx+" select").val(znizka_selected.val());
  107.                    $(".tr_section").hide();                  
  108.                 }else {                    
  109.                    $(".tr_section").show();    
  110.                 }
  111.                
  112.                 komunikatSprzedazTestowaDlaZnizek(znizka_selected.attr("value"));
  113.                
  114.             }
  115.            
  116.            
  117.             self.change(function() {
  118.            
  119.                
  120.                 // pobieramy klase
  121.                 klasa_wagonu = $("#klasa_wagonu").html();
  122.            
  123.                 // usuwamy opis dla znizki
  124.                 $('#kod_znizki_opis').find('ul').remove();
  125.  
  126.                 // get id miejsca
  127.                 var id = $(this).attr("id");
  128.                  
  129.                 switchRelief(id);
  130.                  
  131.                 // obsluga znizki - 100% dla dziecka do lat 4          
  132.                 var usluga;
  133.  
  134.                 if(id == 1) { // dla siedzacych
  135.                     usluga = 1;              
  136.                 }else { // pozostale
  137.                     usluga = 2;
  138.                 }
  139.                 komunikatSprzedazTestowaDlaZnizek(0);
  140.                
  141.  
  142.                 // pobieramy zaznaczony element z konkretnego kontenera
  143.                 //var select = $("#rodzaj_ulgi_wrap_" + usluga + " select option:selected");
  144.  
  145.                 // przywracamy ustawienia domyœlne dla rodzaju ulgi, liczby osób wed³ug taryfy normalnej, ulgowej
  146.                  $("#rodzaj_ulgi_wrap_" + usluga + " select option:first").attr('selected','selected');                        
  147.                  $('#liczba_n').val($("#liczba_n option:eq(1)").val());
  148.                  $("#liczba_u option:first").attr('selected','selected');
  149.                  
  150.                  
  151.                  
  152.  
  153.  
  154.                  /*    
  155.                 if(select.val() == 77) {          
  156.                    $(".tr_section").hide();
  157.  
  158.  
  159.                    if(self.val() == 1) {
  160.                        $("#klasa_wagonu").find("option[value='1']").remove();                          
  161.                    }
  162.  
  163.  
  164.                 }else {              
  165.  
  166.                    $(".tr_section").show();    
  167.  
  168.                 }
  169.                 */
  170.                    
  171.                    
  172.                    
  173.           });
  174.          
  175.          
  176.           isCheckedValueByForm();
  177.          
  178.           self.pobierzKlase = function() {
  179.               return klasa_wagonu;
  180.           }
  181.          
  182.           return self;
  183.          
  184.         };
  185.        
  186.        
  187.         function switchRelief(id) {    
  188.    
  189.             var usluga1; // dla siedzacych
  190.             var usluga2; // dla kuszetek, sypialnych
  191.            
  192.             if(id==1) {
  193.                 usluga1 = 1;
  194.                 usluga2 = 2;
  195.             } else {
  196.                 usluga1 = 2;
  197.                 usluga2 = 1;
  198.             }
  199.  
  200.             var wrap_sel_1 =  $("#rodzaj_ulgi_wrap_" + usluga1);
  201.             var wrap_sel_2 = $("#rodzaj_ulgi_wrap_" + usluga2);
  202.  
  203.             wrap_sel_1.show();
  204.             wrap_sel_1.find('select').removeAttr('disabled');
  205.             wrap_sel_2.hide();
  206.             wrap_sel_2.find('select').attr('disabled', 'disabled');
  207.    
  208.         }
  209.        
  210.         /*********************************/
  211.        
  212.        
  213.         /**
  214.          * Obsluga ulgi
  215.          *
  216.          */
  217.         $.fn.obslugaUlgi = function(options) {
  218.            
  219.            // this obj
  220.            var self = $(this);    
  221.      
  222.            // klasa wagonu                    
  223.            var klasa_wagonu_obj =  $("#klasa_wagonu");
  224.            //var klasa_wagonu_temp_txt = $("#klasa_wagonu option:eq(0)");
  225.            var klasa_wagonu_temp_txt = options.klasa_wagonu;          
  226.            
  227.            var usluga = $(".rodzaj_miejsca"); // rodzaj miejsca          
  228.          
  229.            if(self.val() == 77) {
  230.                
  231.                if($("input[type='radio'].rodzaj_miejsca:checked").val() == 1) {                                
  232.                    
  233.                    // pozostawiamy tylko drug¹ klasê
  234.                    klasa_wagonu_obj.find("option").each(function() {
  235.                         if($(this).val() != "2") { // 2 klasa
  236.                             $(this).remove();
  237.                         }
  238.                     });
  239.                }
  240.                
  241.            }
  242.            
  243.             komunikatSprzedazTestowaDlaZnizek(self.val());
  244.            
  245.            // change method
  246.            self.change(function(){
  247.            
  248.             var desc = $(this).find("option:selected").attr("title");
  249.  
  250.             var replace ="";
  251.            
  252.             for (var i = 0, len = desc.length; i < len; i++) {
  253.  
  254.                 //var code = desc[i] +" : "+ desc[i].charCodeAt();        
  255.                 //console.log(code);
  256.  
  257.                 if(desc[i].charCodeAt() === 8222) {                
  258.                    replace += "<li>";
  259.                 }else if(desc[i].charCodeAt() === 8221) {                
  260.                      replace+= "</li>";            
  261.                 }else if(desc[i].charCodeAt() === 13) {
  262.                     replace+= "<br />";                
  263.                 }else if(desc[i].charCodeAt() === 171) {                
  264.                     replace+= "<font color=red>";
  265.                 }else if(desc[i].charCodeAt() === 187) {                
  266.                     replace+= "</font";
  267.                 }else{
  268.                     replace+=desc[i];                    
  269.                 }    
  270.              }
  271.                
  272.  
  273.             $("#kod_znizki_opis").html("<ul>"+replace+"</ul>");
  274.  
  275.             // obsluga znizki dla dzieci (  100 % Dla dziecka do lat 4 - kod znizki: 77)                    
  276.            
  277.             var checkedOption = $("input[type='radio'].rodzaj_miejsca:checked").val();
  278.            
  279.             var idx;
  280.                
  281.              if(checkedOption == 1) {                              
  282.                  idx = 1;
  283.             }else {
  284.                 idx = 2;
  285.             }
  286.                        
  287.             var id = $("#rodzaj_ulgi_wrap_"+idx+" select option:selected").val();              
  288.            
  289.             if(id == 77) {                          
  290.                 $(".tr_section").hide();    
  291.                
  292.                 if(idx == 1) {
  293.                     //klasa_wagonu_obj.find("option[value='1']").remove();
  294.                     klasa_wagonu_obj.find("option").each(function() {
  295.                         if($(this).val() != "2") { // 2 klasa
  296.                             $(this).remove();
  297.                         }
  298.                     });
  299.                 }
  300.                
  301.             }else {
  302.                
  303.                $(".tr_section").show();      
  304.              
  305.                if(klasa_wagonu_obj.find("option[value='1']").length == 0  && idx == 1) {    
  306.                    
  307.                    //klasa_wagonu_obj.prepend('<option value="1">'+klasa_wagonu_temp_txt.text()+'</option>');
  308.                    klasa_wagonu_obj.html(klasa_wagonu_temp_txt);
  309.                }                  
  310.             }
  311.            
  312.           komunikatSprzedazTestowaDlaZnizek(id);            
  313.            
  314.           isCheckedValueByForm();
  315.            
  316.        
  317.         });
  318.            
  319.  
  320.            
  321.       }
  322.      
  323.       function komunikatSprzedazTestowaDlaZnizek(id) {
  324.          
  325.            var znizka_msg = $("#znizka_msg");
  326.            
  327.           if(id == 77 || id == 40 || id == 41 || id == 42 || id == 44) {
  328.                 znizka_msg.show();                
  329.             }else {          
  330.                 znizka_msg.hide();                
  331.             }
  332.          
  333.       }
  334.      
  335.       function isCheckedValueByForm() {
  336.          
  337.           //  miejsce zajete: , wskazane miejsce
  338.           if(!$("#rezerwacja_obok_miejsca_juz_zajetego").is(":checked") && !$("#rezerwacja_miejsca_wskazanego").is(":checked")) {
  339.              
  340.               $("#tr_rezerwacja_obok_miejsca_juz_zajetego_wagon").hide();
  341.               $("#tr_rezerwacja_obok_miejsca_juz_zajetego_miejsce").hide();
  342.              
  343.           }
  344.          
  345.           // kolorowa karta
  346.           if(!$("#pokaz_kolorowa_karte").is(":checked")) {        
  347.               $("#tr_pokaz_kolorowa_karte").hide();
  348.           }
  349.            
  350.           // karta_duzej_rodziny          
  351.           if(!$("#karta_duzej_rodziny").is(":checked")) {
  352.              
  353.               $("#tr_pokaz_karte_duzej_rodziny").hide();
  354.           }
  355.    
  356.    
  357.          
  358.       }
  359.      
  360.      
  361.       /******************/
  362.      
  363.      
  364.       /**
  365.        *
  366.        * Plugin odpowiedzialny za obsluge podglad biletu.jsp
  367.        *
  368.        */
  369.      
  370.        $.fn.podgladBiletu = function(options) {
  371.            
  372.            // this object
  373.            var self = $(this);          
  374.            
  375.            var arrow_box_ext = $(".arrow_box_ext"); // strzalka do rozwijania kontentu z informacjami szczegolowymi o bilecie
  376.            var standard_data = $("#standard_data");  // box z informacjami ogolnymi o bilecie
  377.            var external_data = $("#external_data"); // box z informacjami szczegolowymi o bilecie
  378.            var price_sections = $(".price_sections"); // wrapper opakowujacy wszystkie ceny
  379.            var price_section_wrap = $(".price_section_wrap"); // box z cenami
  380.            var kup_bilet_button = $(".kup_bilet_button"); // przycisk kup bilet
  381.            var kod_ceny_input = $("[name='kodc']"); // input typu hidden, kod ceny
  382.            var submit_button = $("#submitButton"); // button submitujacy
  383.            var timer_clock = $(".timer"); // timer
  384.            var timer_delay_info = $(".timer_delay_info"); // komunikat po uplynieciu czasu
  385.            
  386.            
  387.                      
  388.            // funkcja inicjujaca plugin
  389.            self.init = function() {
  390.                // ukrywamy œrodkowa belkê z informacjami ogolnymi o bilecie po 3sek.
  391.                hideExternalData();  
  392.                
  393.                if(timer_clock.length > 0) {
  394.                
  395.                // inicjujemy timera                
  396.                var timer = new TimerIC();              
  397.                timer.init(timer_clock);              
  398.                timer.getInstance().addListener(function() {  
  399.                    
  400.                     // wy³¹czamy wszystkie ceny
  401.                     if(timer.getSecond() <= 0) {
  402.                         deactiveFunctionSection();
  403.                         timer_clock.hide();
  404.                         timer_delay_info.show();                        
  405.                     }                  
  406.                                        
  407.                 }, "visible");
  408.                
  409.                 // w przypadku przeladownia strony                
  410.                 if(timer.getSecond() <= 0) {
  411.                     deactiveFunctionSection();
  412.                     timer_clock.hide();
  413.                     timer_delay_info.show();                    
  414.                 }
  415.                
  416.                }
  417.                 if(price_sections.find(".box_shadow_inactive").length == 0) {                    
  418.                     submit_button.attr("disabled","disabled");
  419.                 }
  420.                
  421.            };
  422.                      
  423.            // obluga strzalki w ogolnej sekcji
  424.            arrow_box_ext.toggle(function() {              
  425.            
  426.                 external_data.hide('slow', function() {
  427.                    arrow_box_ext.removeClass('arrow_box_up').addClass('arrow_box_down');
  428.                });
  429.                                
  430.                
  431.            }, function() {
  432.  
  433.                 external_data.show('slow', function() {
  434.                     arrow_box_ext.removeClass('arrow_box_down').addClass('arrow_box_up');
  435.                 });
  436.  
  437.            
  438.                                
  439.            });
  440.            
  441.            // oblsuga ceny dla zdarzenia onClick
  442.            price_section_wrap.click(function() {
  443.              
  444.                // czyœcimy wszystkie aktywne przyciski
  445.                removeActivePriceSection(price_sections);
  446.                
  447.                // aktywujemy przycisk
  448.                $(this).removeClass('box_shadow_normal').addClass('box_shadow_inactive');
  449.                $(this).find('.kup_bilet_button').removeClass('blue_bg').addClass('orange_bg');
  450.                
  451.                // pobieramy kod ceny              
  452.                var kod_ceny = jQuery.trim($(this).find("#kod_c").text());
  453.              
  454.                // ustawiamy kod ceny
  455.                kod_ceny_input.val(kod_ceny);
  456.                
  457.                // aktywujemy glowny przycisk submitujacy
  458.                submit_button.removeClass('submit_input_deactive').removeAttr('disabled');
  459.              
  460.                
  461.            });
  462.          
  463.          
  464.            // ukrywamy dane szczegolowe biletu
  465.            function hideExternalData() {        
  466.              
  467.               setTimeout( function() {
  468.                  
  469.                   external_data.show('slow', function() {
  470.                       arrow_box_ext.removeClass('arrow_box_down').addClass('arrow_box_up');
  471.                   });
  472.                  
  473.              
  474.               }, 3000);
  475.            }
  476.          
  477.          
  478.            // funkcja czyszczaca wszystkie aktywne sekcje cenowe
  479.            function removeActivePriceSection(wrapper) {
  480.                
  481.                wrapper.find('.price_section_wrap').each(function( index ) {                                      
  482.                    
  483.                    $(this).removeClass('box_shadow_inactive').addClass('box_shadow_normal');                  
  484.                    $(this).find('.kup_bilet_button').removeClass('orange_bg').addClass('blue_bg');            
  485.                    
  486.                 });
  487.            }
  488.            
  489.          
  490.            function deactiveFunctionSection() {
  491.                
  492.                price_sections.find(".price_section_wrap").each(function(index) {
  493.                    
  494.                    // usuwamy akcje onClick
  495.                    $(this).unbind("click");
  496.                    
  497.                    // usuwamy kursor
  498.                    $(this).css("cursor", "auto");
  499.                    
  500.                    // usuwamy style dla sekcji
  501.                    $(this).removeClass('box_shadow_inactive box_shadow_normal').addClass('box_shadow_deactive');
  502.                    
  503.                    // ikonka info
  504.                    $(this).find('.price_info_wrap').children().removeClass('price_info_icon').addClass('price_info_icon_shadow');
  505.                    
  506.                    // cena - etykieta
  507.                    $(this).find('.price_value_wrap').children().removeClass('price_style');                                          
  508.                    
  509.                    // nazwa ceny
  510.                    $(this).find('.price_name_wrap').children().removeClass('style_type_14');                                                            
  511.                    
  512.                    
  513.                    // kup bilet - przycisk
  514.                    $(this).find('.price_button_wrap').children().remove();
  515.                    $(this).find('.price_button_wrap').append("&nbsp;");                      
  516.                    
  517.                    
  518.                });
  519.                
  520.                submit_button.attr("disabled", "disabled").addClass("submit_input_deactive") ;
  521.                
  522.                
  523.            }
  524.            
  525.            // execute init
  526.            self.init();
  527.            
  528.            
  529.            
  530.        };
  531.      
  532.      
  533.        // plugin obslugujacy widok logowanie.jsp
  534.         $.fn.logowanie = function(options) {
  535.            
  536.             // this object
  537.             var self = $(this);
  538.            
  539.             var zaloguj_sie_button = $("[name='actlogin']"); // przycisk zaloguj sie
  540.             var timer_clock = $(".timer"); // timer            
  541.             var timer_delay_info = $(".timer_delay_info"); // komunikat po uplynieciu czasu
  542.            
  543.             self.init = function() {
  544.                
  545.                 // sprawdzamy czy istnieje komponent timer-a
  546.                 if(timer_clock.length > 0) {
  547.                    
  548.                      // timer
  549.                     var timer = new TimerIC();              
  550.                     timer.init(timer_clock);
  551.  
  552.                     timer.getInstance().addListener(function() {  
  553.  
  554.                         // wy³¹czamy wszystkie ceny
  555.                         if(timer.getSecond() <= 0) {                                                    
  556.                             zaloguj_sie_button.addClass('grey_bg').attr('disabled', 'disabled');                        
  557.                             timer_clock.hide();
  558.                             timer_delay_info.show();
  559.  
  560.                         }                  
  561.  
  562.                     }, "visible");          
  563.  
  564.                     // sprawdzamy timera (przeladowanie strony)
  565.                     if(timer.getSecond() <= 0) {                        
  566.                             zaloguj_sie_button.addClass('grey_bg').attr('disabled', 'disabled');                                                
  567.                     }
  568.                    
  569.                    
  570.                    
  571.                    
  572.                 }
  573.                
  574.             };
  575.            
  576.            
  577.             // inicjujemy komponenty
  578.             self.init();
  579.  
  580.  
  581.  
  582.         };
  583.        
  584.        
  585.         // plugin obslugujacy widok rejestracja.jsp
  586.         $.fn.rejestracja = function(options) {
  587.            
  588.             // this obj
  589.             var self = $(this);            
  590.            
  591.             var dalej_button = $('[name="actlogin"]'); // przycisk dalej
  592.             var timer_clock = $(".timer"); // timer      
  593.             var timer_delay_info = $(".timer_delay_info"); // komunikat po uplynieciu czasu
  594.            
  595.            
  596.              self.init = function() {
  597.                
  598.                 if(timer_clock.length > 0) {
  599.                     // timer
  600.                     var timer = new TimerIC();              
  601.                     timer.init(timer_clock);                
  602.                     timer.getInstance().addListener(function() {  
  603.  
  604.                         // wy³¹czamy wszystkie ceny
  605.                         if(timer.getSecond() <= 0) {                        
  606.                             timer_clock.hide();
  607.                             timer_delay_info.show();
  608.                             dalej_button.addClass('grey_bg').attr('disabled', 'disabled');                        
  609.  
  610.                         }                  
  611.  
  612.                     }, "visible");
  613.                     // sprawdzamy timera (przeladowanie strony)
  614.                     if(timer.getSecond() <= 0) {                        
  615.                             dalej_button.addClass('grey_bg').attr('disabled', 'disabled');                                                
  616.                     }
  617.                 }
  618.                
  619.                
  620.                
  621.             };            
  622.            
  623.             // inicjujemy komponenty
  624.             self.init();
  625.            
  626.         };
  627.        
  628.        
  629.          // plugin obslugujacy widok rejestracja_podglad.jsp
  630.         $.fn.rejestracjaPodglad = function() {
  631.            
  632.            
  633.             // this obj
  634.             var self = $(this);            
  635.            
  636.             var dalej_button = $('[name="actlogin"]'); // przycisk dalej
  637.             var timer_clock = $(".timer"); // timer      
  638.             var timer_delay_info = $(".timer_delay_info"); // komunikat po uplynieciu czasu
  639.            
  640.            
  641.              self.init = function() {
  642.                
  643.                 if(timer_clock.length > 0) {
  644.                     // timer
  645.                     var timer = new TimerIC();              
  646.                     timer.init(timer_clock);                
  647.                     timer.getInstance().addListener(function() {  
  648.  
  649.                         // wy³¹czamy wszystkie ceny
  650.                         if(timer.getSecond() <= 0) {      
  651.                             timer_clock.hide();
  652.                             timer_delay_info.show();
  653.                             dalej_button.addClass('grey_bg').attr('disabled', 'disabled');                                                
  654.                         }                  
  655.  
  656.                     }, "visible");
  657.                     // sprawdzamy timera (przeladowanie strony)
  658.                     if(timer.getSecond() <= 0) {                        
  659.                             dalej_button.addClass('grey_bg').attr('disabled', 'disabled');                                                
  660.                     }
  661.                
  662.                 }
  663.                
  664.                
  665.                
  666.                
  667.             };            
  668.            
  669.             // inicjujemy komponenty
  670.             self.init();  
  671.         };
  672.        
  673.        
  674.         // plugin obslugujacy platnosc.jsp
  675.         $.fn.platnosc = function() {
  676.            
  677.             // this object
  678.             var self = $(this);
  679.            
  680.             var arrow_box_ext = $(".arrow_box_ext"); // arrow
  681.             var external_data = $(".external_data_platnosc"); // div z danymi rozszerzonymi
  682.            
  683.            
  684.             self.init = function() {                
  685.                hideExternalData();
  686.             };
  687.            
  688.             arrow_box_ext.toggle(function() {              
  689.            
  690.          
  691.                 $(this).parent().parent().next().hide('slow', function() {                    
  692.                      $(this).parent().find('.arrow_box_ext').removeClass('arrow_box_up').addClass('arrow_box_down');                    
  693.                });
  694.                                
  695.                
  696.            }, function() {              
  697.  
  698.                 $(this).parent().parent().next().show('slow', function() {                    
  699.                     $(this).parent().find('.arrow_box_ext').removeClass('arrow_box_down').addClass('arrow_box_up');                    
  700.                 });
  701.                                
  702.            });
  703.            
  704.            
  705.            
  706.              // ukrywamy dane szczegolowe biletu
  707.            function hideExternalData() {        
  708.              
  709.               setTimeout( function() {
  710.                  
  711.                  
  712.                   arrow_box_ext.find('external_data_platnosc').show('slow', function() {
  713.                       arrow_box_ext.removeClass('arrow_box_down').addClass('arrow_box_up');
  714.                   });
  715.                  
  716.                  
  717.                   external_data.show('slow', function() {
  718.                       arrow_box_ext.removeClass('arrow_box_down').addClass('arrow_box_up');
  719.                   });
  720.                  
  721.              
  722.               }, 3000);
  723.            }
  724.            
  725.             self.init();
  726.            
  727.         };
  728.        
  729.        
  730.         $.fn.kontoGoscRejestracja = function() {
  731.            
  732.             // self
  733.             var self = $(this);
  734.            
  735.             var dalej_button = $('[name="actlogin"]'); // przycisk dalej
  736.             var timer_clock = $(".timer"); // timer      
  737.             var timer_delay_info = $(".timer_delay_info"); // komunikat po uplynieciu czasu
  738.              
  739.             self.init = function() {
  740.                  
  741.                  if(timer_clock.length > 0) {
  742.                     // timer
  743.                     var timer = new TimerIC();              
  744.                     timer.init(timer_clock);                
  745.                     timer.getInstance().addListener(function() {  
  746.  
  747.                         // wy³¹czamy wszystkie ceny
  748.                         if(timer.getSecond() <= 0) {                        
  749.                             timer_clock.hide();
  750.                             timer_delay_info.show();
  751.                             dalej_button.addClass('grey_bg').attr('disabled', 'disabled');                                                
  752.                         }                  
  753.  
  754.                     }, "visible");
  755.                     // sprawdzamy timera (przeladowanie strony)
  756.                     if(timer.getSecond() <= 0) {                        
  757.                             dalej_button.addClass('grey_bg').attr('disabled', 'disabled');                                                
  758.                     }
  759.                
  760.                 }
  761.                  
  762.              };
  763.  
  764.            
  765.            
  766.             self.init();
  767.            
  768.         };
  769.        
  770.        
  771.            
  772.        
  773.      
  774.            
  775.            
  776.         /** Define class TimerIC  **/
  777.         var TimerIC = function () {
  778.  
  779.             // private property
  780.              var timer = '';
  781.  
  782.             this.getInstance = function() {
  783.                 return this.timer;
  784.  
  785.             },
  786.  
  787.             this.init = function(timer_obj) {
  788.  
  789.                      var option = {
  790.  
  791.                      time: {
  792.                          Days: {
  793.                              show: false            
  794.                          },
  795.                          Hours: {
  796.                              show: false            
  797.                          },
  798.                          Minutes: {
  799.                              show: true,
  800.                              text: "Minuta",
  801.                              color: "#fa7819"
  802.                          },
  803.                          Seconds: {
  804.                              show: true,
  805.                              text: "Sekundy",
  806.                              color: "#0071bc"
  807.                          }
  808.  
  809.                      },
  810.                      circle_bg_color: "#e5e6e7",
  811.                      animation_interval: "ticks",
  812.                      count_past_zero: false
  813.  
  814.                  };
  815.  
  816.                   this.timer = timer_obj.TimeCircles(option);
  817.  
  818.                   return this.timer;
  819.             },
  820.  
  821.             this.getSecond = function() {
  822.  
  823.                  var time = this.getInstance().getTime();
  824.                  var split_time = time.toString().split('.');
  825.  
  826.                  return parseInt(split_time[0]);
  827.  
  828.             };
  829.  
  830.         };
  831.  
  832.      
  833.      
  834.      
  835.      
  836.  
  837. })(jQuery);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement