Advertisement
SocialkingPL

Untitled

Jan 30th, 2020
835
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.    var p = {
  2.         0: "10 Mb/s",
  3.         1: "11 Mb/s",
  4.         2: "12 Mb/s",
  5.         3: "13 Mb/s",
  6.         4: "14 Mb/s",
  7.         5: "15 Mb/s",
  8.         6: "16 Mb/s",
  9.         7: "17 Mb/s",
  10.         8: "18 Mb/s",
  11.         9: "19 Mb/s",
  12.         10: "20 Mb/s",
  13.         11: "21 Mb/s",
  14.         12: "22 Mb/s",
  15.         13: "23 Mb/s",
  16.         14: "24 Mb/s",
  17.         15: "25 Mb/s",
  18.         16: "26 Mb/s",
  19.         17: "27 Mb/s",
  20.         18: "28 Mb/s",
  21.         19: "29 Mb/s",
  22.         20: "30 Mb/s",
  23.     };
  24.  
  25.     var t = {
  26.         0: "44.9",
  27.         1: "46.9",
  28.         2: "48.9",
  29.         3: "50.9",
  30.         4: "52.9",
  31.         5: "54.9",
  32.         6: "56.9",
  33.         7: "58.9",
  34.         8: "60.9",
  35.         9: "62.9",
  36.         10: "64.9",
  37.         11: "66.9",
  38.         12: "68.9",
  39.         13: "70.9",
  40.         14: "72.9",
  41.         15: "74.9",
  42.         16: "76.9",
  43.         17: "78.9",
  44.         18: "80.9",
  45.         19: "82.9",
  46.         20: "84.9",
  47.     };
  48.  
  49.     var pd = {
  50.         0: "1 Mb/s",
  51.         1: "2 Mb/s",
  52.         2: "3 Mb/s",
  53.         3: "4 Mb/s",
  54.         4: "5 Mb/s",
  55.         5: "6 Mb/s",
  56.         6: "7 Mb/s",
  57.         7: "8 Mb/s",
  58.         8: "9 Mb/s",
  59.         9: "10 Mb/s",
  60.     };
  61.  
  62.  
  63.     var td = {
  64.         0: "4.0",
  65.         1: "8.0",
  66.         2: "12.0",
  67.         3: "16.0",
  68.         4: "20.0",
  69.         5: "24.0",
  70.         6: "28.0",
  71.         7: "32.0",
  72.         8: "36.0",
  73.         9: "40.0",
  74.     };
  75.  
  76.  
  77.     $(document).ready(function () {
  78.  
  79.         $("#slider_amirol").slider({
  80.             range: "min",
  81.             animate: true,
  82.             min: 0,
  83.             max: 20,
  84.             step: 1,
  85.             slide: function (event, ui) {
  86.                 update($(event.target), ui.value, p);
  87.                 calcualtePrice($("#total_end"), t, ui.value);
  88.             }
  89.         });
  90.  
  91.         update($('#slider_amirol'), 0, p);
  92.         calcualtePrice($("#total_end"), t);
  93.     });
  94.  
  95.     $(document).ready(function () {
  96.  
  97.         $("#slider_amirol_down").slider({
  98.             range: "min",
  99.             animate: true,
  100.             min: 0,
  101.             max: 9,
  102.             step: 1,
  103.             slide: function (event, ui) {
  104.                 update($(event.target), ui.value, pd);
  105.                 calcualtePrice($("#total_end"), td, ui.value);
  106.             }
  107.         });
  108.  
  109.         update($('#slider_amirol_down'), 0, pd);
  110.         calcualtePrice($("#total_end", td));
  111.     });
  112.  
  113.  
  114.     function update(slider, val = 0, speedArray) {
  115.  
  116.         var amount = speedArray[val];
  117.         const a = slider.find('a');
  118.         a.html('<label><span class="glyphicon glyphicon-chevron-left"></span> ' + amount + ' <span class="glyphicon glyphicon-chevron-right"></span></label>');
  119.     }
  120.  
  121.     function calcualtePrice(output, speedArray, val = 0) {
  122.  
  123.         var totalPrice = t[val] * 1;
  124.         var downPrivce = td[val] * 1;
  125.         var totalPricev2 = (totalPrice);
  126.  
  127.         $("#total").val(totalPrice.toFixed(2) + " PLN");
  128.         output.val(totalPricev2.toFixed(2) + " PLN");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement