This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //declineWord | |
| function declineWord(number, titles){ | |
| const numberOfEnding = [2, 0, 1, 1, 1, 2]; | |
| const isLastEnding = number % 100 > 4 && number % 100 < 20; | |
| const correctEnding = (number % 10 < 5) ? number % 10 : 5; | |
| return titles[isLastEnding ? 2 : numberOfEnding[correctEnding]]; | |
| //use: | |
| //declineWord(count, ['гость', 'гостя', 'гостей']); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <div class="rate-star"> | |
| <div class="rate-star__stars-wrapper"> | |
| <input type="hidden" class="rate-star__input" value="3.5" readonly="" /> | |
| <span class="rate-star__star" data-number-star="5"></span> | |
| <span class="rate-star__star" data-number-star="4"></span> | |
| <span class="rate-star__star" data-number-star="3"></span> | |
| <span class="rate-star__star" data-number-star="2"></span> | |
| <span class="rate-star__star" data-number-star="1"></span> | |
| </div> | |
| </div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <h2 class="bg-warning p-4 mb-4">Иконки</h2> | |
| <div class="row mx-n2 pb-5"> | |
| <?php | |
| $path_to_file = BASE . 'styles/images/icons' . DS; | |
| $scanned_directory = array_values(array_diff(scandir($path_to_file), array('..', '.'))); | |
| ?> | |
| <?php for($i = 0; $i < count($scanned_directory); $i++):?> | |
| <div class="col-auto px-2"> | |
| <img src="<?=SITE. 'styles/images/icons/' . $scanned_directory[$i];?>"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $('.dotdotdot').each(function(){ | |
| $(this).dotdotdot({ | |
| keep: '.dotdotdot__toggle-collapse', | |
| callback: function(isTruncated){ | |
| if( isTruncated ){ | |
| $(this).find('.dotdotdot__more').css('display', 'block'); | |
| } | |
| $(this).find('.dotdotdot__less').css('display', 'none'); | |
| } | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| jQuery.event.special.touchstart = { | |
| setup: function( _, ns, handle ){ | |
| if ( ns.includes("noPreventDefault") ) { | |
| this.addEventListener("touchstart", handle, { passive: false }); | |
| this.addEventListener("touchmove", handle, { passive: false }); | |
| this.addEventListener("scroll", handle, { passive: false }); | |
| } else { | |
| this.addEventListener("touchstart", handle, { passive: true }); | |
| this.addEventListener("touchmove", handle, { passive: true }); | |
| this.addEventListener("scroll", handle, { passive: true }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| reverseCoords: function($partItem){ | |
| $items = $('.point-coords__items-js', $partItem); | |
| $items.children().each(function (i, li) { | |
| $items.prepend(li); | |
| }); | |
| this.rewriteSerialNumberPoints($items); | |
| }, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $.fn.owlCarouselStart = function(){ | |
| var options = { | |
| loop: false, | |
| nav: false, | |
| dots: false, | |
| autoplay: false, | |
| margin: GUTTER, | |
| }; | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var passiveSupported = false; | |
| try { | |
| window.addEventListener( | |
| "test", | |
| null, | |
| Object.defineProperty({}, "passive", { get: function() { passiveSupported = true; } })); | |
| // console.log('passiveSupported == ' + passiveSupported); | |
| } catch(err) {} | |
| document.addEventListener('scroll', function(){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $('body').on('click', '.clipboard', function(event){ | |
| event.preventDefault(); | |
| var text_source = $(this).attr('data-source'); | |
| var text = $(text_source).text(); | |
| var $temp = $("<input>"); | |
| $("body").append($temp); | |
| $temp.css({ | |
| position: 'absolute', | |
| zIndex: '-1000' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function lazy_owl(){ | |
| var wh = $(window).height(); | |
| var scrollTop_body = $('html, body').scrollTop() || $(document).scrollTop() || $(window).scrollTop(); | |
| $('.carousel.carousel_lazyload', 'body').each(function(){ | |
| var current_carousel = $(this); | |
| if( !current_carousel.hasClass('owl-loaded') && !current_carousel.find('.owl-loaded').length ) | |
| { | |
| if( (current_carousel.hasClass('owl-carousel') && current_carousel.parent().is(':visible')) ) |
NewerOlder