main.js 9.6 KB

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