main.js 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  1. (function () {
  2. if ($("*").is('#dayitime')) {
  3. function addZero(i) {
  4. if (i < 10) {
  5. i = "0" + i;
  6. }
  7. return i;
  8. };
  9. function getCurrentTime1() {
  10. var today_time, h, m;
  11. today_time = new Date(Date.now());
  12. h = today_time.getUTCHours();
  13. m = addZero(today_time.getUTCMinutes());
  14. return (h + 3) + '<span class=timeseparator>:</span>' + m;
  15. }
  16. function setTimer1() {
  17. today_time.innerHTML = getCurrentTime1();
  18. }
  19. setInterval(setTimer1, 1000);
  20. }
  21. function clock() {
  22. var d = new Date();
  23. var month_num = d.getMonth()
  24. var day = d.getDate();
  25. var hours = d.getHours();
  26. var minutes = d.getMinutes();
  27. var seconds = d.getSeconds();
  28. var weekday_num = d.getDay();
  29. var month = new Array("января", "февраля", "марта", "апреля", "мая", "июня", "июля", "августа", "сентября", "октября", "ноября", "декабря");
  30. var weekday = new Array("воскресенье", "понедельник", "вторник", "среда", "четверг", "пятница", "суббота");
  31. if (day <= 9) day = "0" + day;
  32. if (hours <= 9) hours = "0" + hours;
  33. if (minutes <= 9) minutes = "0" + minutes;
  34. if (seconds <= 9) seconds = "0" + seconds;
  35. var date_time = day + " " + month[month_num] + ", " + weekday[weekday_num] + ", ";
  36. if (document.layers) {
  37. document.layers.today_day.document.write(date_time);
  38. document.layers.today_day.document.close();
  39. }
  40. else document.getElementById("today_day").innerHTML = date_time;
  41. setTimeout(clock, 1000);
  42. }
  43. if ($("*").is('#filterservice')) {
  44. function checktoggle() {
  45. if ($("#switch_old").is(':checked')) {
  46. $('#switch_old2').addClass("filterservice__labelbig--active");
  47. $('#switch_old1').removeClass("filterservice__labelbig--active");
  48. } else {
  49. $('#switch_old1').addClass("filterservice__labelbig--active");
  50. $('#switch_old2').removeClass("filterservice__labelbig--active");
  51. }
  52. if ($("#switch_male").is(':checked')) {
  53. $('#switch_male2').addClass("filterservice__labelbig--active");
  54. $('#switch_male1').removeClass("filterservice__labelbig--active");
  55. } else {
  56. $('#switch_male1').addClass("filterservice__labelbig--active");
  57. $('#switch_male2').removeClass("filterservice__labelbig--active");
  58. }
  59. }
  60. }
  61. $(document).ready(function () {
  62. $(".region__link").click(function (e) {
  63. e.preventDefault();
  64. });
  65. setTimeout(function () {
  66. $(".shortnews__description").dotdotdot();
  67. }, 10);
  68. if ($("*").is('#filterservice')) {
  69. checktoggle();
  70. }
  71. $(".filterservice__toggle").click(function () {
  72. checktoggle();
  73. });
  74. if ($("*").is('#datefilter')) {
  75. $('#datefilter').dateRangePicker({
  76. autoClose: true,
  77. language: 'ru',
  78. duration: 500,
  79. startOfWeek: "monday",
  80. getValue: function () {
  81. return document.getElementById('datefiltertext').innerHTML;
  82. }, setValue: function (s) {
  83. document.getElementById('datefiltertext').innerHTML = s;
  84. }
  85. });
  86. }
  87. if ($("*").is('.calendinfo__calendcase')) {
  88. $('.calendinfo__calendcase').dateRangePicker({
  89. inline: true,
  90. language: 'ru',
  91. container: '#calendinfo_range',
  92. alwaysOpen: true,
  93. singleMonth: true,
  94. showTopbar: false,
  95. singleDate: true,
  96. startOfWeek: "monday",
  97. });
  98. }
  99. if ($("*").is('#calendinfo')) {
  100. clock();
  101. }
  102. $('input, textarea').focus(function () {
  103. $(this).data('placeholder', $(this).attr('placeholder'))
  104. $(this).attr('placeholder', '');
  105. });
  106. $('input, textarea').blur(function () {
  107. $(this).attr('placeholder', $(this).data('placeholder'));
  108. });
  109. $('#organization__title, #specialization__title').click(function (e) {
  110. $(this).next().toggleClass('active');
  111. $(this).find('.leftbar__arrow').toggleClass('active');
  112. e.preventDefault();
  113. });
  114. if ($("*").is('#full_news__sliderlist')) {
  115. $('#full_news__sliderlist').lightSlider({
  116. selector: '.full-news__slirderitem',
  117. item: 1,
  118. loop: true,
  119. auto: true,
  120. pause: 8000,
  121. speed: 1000,
  122. gallery: true,
  123. thumbItem: 4
  124. // controls: false,
  125. // onSliderLoad: function(el) {
  126. // el.lightGallery({
  127. // selector: '#fullnews__gallerylist .lslide'
  128. // });
  129. // },
  130. });
  131. }
  132. if ($("*").is('#mainsliderId')) {
  133. $('#mainsliderId').lightSlider({
  134. selector: '.mainslider__item',
  135. item: 1,
  136. loop: true,
  137. auto: true,
  138. pause: 8000,
  139. speed: 1000,
  140. // mode: 'fade',
  141. controls: false
  142. });
  143. }
  144. /*$('.centerbar input, .centerbar select').styler();*/
  145. if ($("*").is('#newsfilter')) {
  146. $("#newsfiltericon").click(function () {
  147. $(".newsfilter__open").toggleClass('newsfilter__open--show');
  148. });
  149. }
  150. });
  151. $(window).scroll(function () {
  152. if ($(this).scrollTop() > 750 && $('.header, .content').hasClass('loading')) {
  153. $('.header, .content').removeClass('loading').addClass('scrolling');
  154. } else if ($(this).scrollTop() <= 750 && $('.header, .content').hasClass('scrolling')) {
  155. $('.header, .content').removeClass('scrolling').addClass('loading');
  156. }
  157. });
  158. new SpecFilter.SpecFilter($('.newsfilter__specializations .newsfilter__text'));
  159. new RegionFilter.RegionFilter($('.newsfilter__regions .newsfilter__text'), {
  160. itemsContainerClass: 'regionsfilter__container',
  161. itemContainerClass: 'regionsfilter__region',
  162. itemCheckboxClass: 'regionsfilter__checkbox',
  163. itemLabelClass: 'regionsfilter__label'
  164. });
  165. })();