main.js 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261
  1. (function (document, window, $) {
  2. if ($('#dayitime').lenght) {
  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 ($('#filterservice').length) {
  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 ($('#filterservice').length) {
  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. }).blur(function () {
  106. $(this).attr('placeholder', $(this).data('placeholder'));
  107. });
  108. $('#organization__title, #specialization__title').click(function (e) {
  109. $(this).next().toggleClass('active');
  110. $(this).find('.leftbar__arrow').toggleClass('active');
  111. e.preventDefault();
  112. });
  113. if ($("*").is('#full_news__sliderlist')) {
  114. $('#full_news__sliderlist').lightSlider({
  115. selector: '.full-news__slirderitem',
  116. item: 1,
  117. loop: true,
  118. auto: true,
  119. pause: 8000,
  120. speed: 1000,
  121. gallery: true,
  122. thumbItem: 4
  123. // controls: false,
  124. // onSliderLoad: function(el) {
  125. // el.lightGallery({
  126. // selector: '#fullnews__gallerylist .lslide'
  127. // });
  128. // },
  129. });
  130. }
  131. if ($("*").is('#mainsliderId')) {
  132. $('#mainsliderId').lightSlider({
  133. selector: '.mainslider__item',
  134. item: 1,
  135. loop: true,
  136. auto: true,
  137. pause: 8000,
  138. speed: 1000,
  139. // mode: 'fade',
  140. controls: false
  141. });
  142. }
  143. /*$('.centerbar input, .centerbar select').styler();*/
  144. if ($('#newsfilter').length) {
  145. $("#newsfiltericon").click(function () {
  146. $(".newsfilter__open").toggleClass('newsfilter__open--show');
  147. });
  148. }
  149. });
  150. $(window).scroll(function () {
  151. if ($(this).scrollTop() > 750 && $('.header, .content').hasClass('loading')) {
  152. $('.header, .content').removeClass('loading').addClass('scrolling');
  153. } else if ($(this).scrollTop() <= 750 && $('.header, .content').hasClass('scrolling')) {
  154. $('.header, .content').removeClass('scrolling').addClass('loading');
  155. }
  156. });
  157. // isolate scope for easier moving and extension
  158. (function ($) {
  159. new SpecFilter.SpecFilter($('.newsfilter__specializations .newsfilter__text'));
  160. new RegionFilter.RegionFilter($('.newsfilter__regions .newsfilter__text'), {
  161. itemsContainerClass: 'regionsfilter__container',
  162. itemContainerClass: 'regionsfilter__region',
  163. itemCheckboxClass: 'regionsfilter__checkbox',
  164. itemLabelClass: 'regionsfilter__label'
  165. });
  166. })($);
  167. // isolate scope for easier moving and extension
  168. (function (w) {
  169. w.showFotorama = function (jQuery, fotoramaObjectClass, fotoramaPrevClass, fotoramaNextClass) {
  170. var $selector = jQuery(fotoramaObjectClass);
  171. $selector.data('navwidth', ($selector.outerWidth() - 80) + 'px');
  172. var $fotoramaDiv = $selector.fotorama();
  173. var fotorama = $fotoramaDiv.data('fotorama');
  174. jQuery(fotoramaPrevClass).click((function (e) {
  175. fotorama.show('<');
  176. }).bind(this));
  177. jQuery(fotoramaNextClass).click((function (e) {
  178. fotorama.show('>');
  179. }).bind(this));
  180. };
  181. })(window);
  182. // isolate scope for easier moving and extension
  183. (function (assetsUrl, document, $) {
  184. var n = document.getElementsByTagName('script')[0],
  185. s = document.createElement('script'),
  186. c = document.createElement('link');
  187. c.setAttribute('rel', 'stylesheet');
  188. c.href = assetsUrl.replace(/\/+$/, '') + '/css/slick.css';
  189. c.setAttribute('type', 'text/css');
  190. n.parentNode.insertBefore(c, n);
  191. s.async = true;
  192. s.onload = function () {
  193. $('.organization-media__slider').slick({
  194. infinite: true,
  195. dots: false,
  196. slidesToShow: 3,
  197. slidesToScroll: 1,
  198. prevArrow: '<div class="slick-prev"></div>',
  199. nextArrow: '<div class="slick-next"></div>'
  200. });
  201. };
  202. s.src = assetsUrl.replace(/\/+$/, '') + '/js/slick.min.js';
  203. n.parentNode.insertBefore(s, n);
  204. })(window.assetsUrl || '/', document, $);
  205. // isolate scope for easier moving and extension
  206. (function ($) {
  207. $('.organization-info__slidedown-handler').click(function (e) {
  208. e.preventDefault();
  209. var $content = $(this)
  210. .parents('.organization-info__slidedown')
  211. .find('.organization-info__slidedown-content');
  212. $content.slideToggle();
  213. });
  214. })($);
  215. // isolate scope for easier moving and extension
  216. (function ($) {
  217. $('.organization-info__description-read-more').click(function (e) {
  218. var $button;
  219. var $container;
  220. e.preventDefault();
  221. $button = $(this);
  222. $container = $button.parent().find('.organization-info__description');
  223. $container.animate({'max-height': $container.find('.organization-info__description-content').outerHeight() + 100}, 100, function () {
  224. $container.removeClass('organization-info__description--short').css('maxHeight', 'none');
  225. $button.remove();
  226. });
  227. });
  228. })($);
  229. })(window.document, window, window.jQuery);