1(function($) { 2 "use strict"; 3 4 UNCODE.onePage = function(isMobile) { 5 var current = 0, 6 last = 0, 7 lastScrollTop = 0, 8 forceScroll = false, 9 lastScrolled = 0, 10 isSectionscroller = ($('.main-onepage').length) ? true : false, 11 isOnePage = false, 12 getOffset = function () { 13 var calculateOffset = (($('.menu-sticky .menu-container:not(.menu-hide):not(.vmenu-container)').length && ($(window).width() > UNCODE.mediaQuery)) ? $('.menu-sticky .menu-container:not(.menu-hide):not(.vmenu-container').outerHeight() : 0); 14 return calculateOffset; 15 } 16 17 isMobile = SiteParameters.uncode_force_onepage_dots ? false : isMobile; 18 19 // if ( UNCODE.isFullPage || UNCODE.isFullPageSnap ) 20 // return false; 21 22 function init_onepage() { 23 if (isSectionscroller && !isMobile && !$('body').hasClass('uncode-scroll-no-dots') && !UNCODE.isFullPageSnap) { 24 $("<ul class='onepage-pagination'></ul>").prependTo("body"); 25 } 26 last = $('.onepage-pagination li').last().find('a').data('index'); 27 $.each($('div[data-parent="true"]'), function(index, val) { 28 $(this).attr('data-section', index); 29 if (isMobile) return; 30 if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) { 31 return; 32 } 33 var sectionDown = new Waypoint({ 34 context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window, 35 element: val, 36 handler: function(direction) { 37 if (direction == 'down') { 38 changeMenuActive(this.element, index); 39 } 40 }, 41 offset: function() { 42 return 5 + getOffset() 43 } 44 }); 45 var sectionUp = new Waypoint({ 46 context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window, 47 element: val, 48 handler: function(direction) { 49 if (direction == 'up') { 50 changeMenuActive(this.element, index); 51 } 52 }, 53 offset: function() { 54 return -5 - getOffset() 55 } 56 }); 57 58 if (isSectionscroller) { 59 var label; 60 if ($(this).attr('data-label') != undefined) label = $(this).attr('data-label'); 61 else label = ''; 62 var getName = $(this).attr('data-name'); 63 if (getName == undefined) getName = index; 64 if (label != '') { 65 isOnePage = true; 66 label = '<span class="cd-label style-accent-bg border-accent-color">' + label + '</span>'; 67 $('ul.onepage-pagination').append("<li><a class='one-dot-link' aria-label='" + label + "' data-index='" + (index) + "' href='#" + (getName) + "'><span class='cd-dot-cont'><span class='cd-dot'></span></span>"+label+"</a></li>"); 68 } 69 } 70 }); 71 72 if (isSectionscroller) { 73 $.each($('ul.onepage-pagination li'), function(index, val) { 74 var $this = $(val), 75 $a = ('a', $this); 76 $a.on('click', function(evt) { 77 if ( $('.is-selected', $this).length || UNCODE.scrolling ) { 78 return false; 79 } 80 if ( $('body').hasClass('uncode-scroll-no-history') ) { 81 evt.preventDefault(); 82 } 83 Waypoint.refreshAll(); 84 var el = $('a', evt.currentTarget); 85 current = lastScrolled = parseInt(el.attr('data-index')); 86 lastScrolled += 1; 87 scrollBody(current); 88 }); 89 }); 90 } 91 92 var goToSection = parseInt((window.location.hash).replace(/[^\d.]/g, '')); 93 if (isNaN(goToSection) && window.location.hash != undefined && window.location.hash != '' ) { 94 goToSection = String(window.location.hash).replace(/^#/, ""); 95 goToSection = Number($('[data-name="' + goToSection + '"]').attr('data-section')); 96 } 97 98 if (typeof goToSection === 'number' && !isNaN(goToSection) && !$('body').hasClass('uncode-no-hash-scroll') ) { 99 current = lastScrolled = goToSection; 100 $(window).on('load', function(){ 101 if ( $('.owl-carousel').length ) { 102 requestTimeout(function(){ 103 scrollBody(goToSection); 104 }, 400); 105 } else { 106 scrollBody(goToSection); 107 } 108 }); 109 } 110 111 } 112 113 function changeMenuActive(section, index) { 114 current = lastScrolled = parseInt($(section).attr('data-section')); 115 if (isOnePage) { 116 var newSection = $('.onepage-pagination li a[data-index="' + index + '"]'); 117 if (newSection.length) { 118 $('ul.onepage-pagination li a').removeClass('is-selected'); 119 newSection.addClass('is-selected'); 120 } 121 var getName = $('[data-section="' + index + '"]').attr('data-name'); 122 if (getName != undefined && getName !== '') { 123 $.each($('.menu-container .menu-item > a, .widget_nav_menu .menu-smart .menu-item > a'), function(i, val) { 124 var get_href = $(val).attr('href'); 125 if (get_href != undefined && get_href.substring(get_href.indexOf('#')+1) == getName) { 126 $(val).closest('.menu-smart').find('.active').removeClass('active'); 127 $(val).parent().addClass('active'); 128 } 129 }); 130 } 131 } 132 } 133 134 if (isOnePage) { 135 $(window).on('scroll', function() { 136 var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop']; 137 if (bodyTop == 0) { 138 $('ul.onepage-pagination li a').removeClass('is-selected'); 139 $('.onepage-pagination li a[data-index="0"]').addClass('is-selected'); 140 var getName = $('[data-section=0]').attr('data-name'); 141 if (getName != undefined && getName !== '') { 142 $.each($('.menu-container .menu-item > a'), function(i, val) { 143 var get_href = $(val).attr('href'); 144 if (get_href != undefined && get_href.substring(get_href.indexOf('#')+1) == getName) { 145 $(val).closest('ul').find('.active').removeClass('active'); 146 $(val).parent().addClass('active'); 147 } 148 }); 149 } 150 } else if ((window.innerHeight + bodyTop) >= $('.box-container').height()) { 151 var lastSection = $('.onepage-pagination li a[data-index="' + last +'"]'); 152 if (lastSection.length) { 153 $('ul.onepage-pagination li a').removeClass('is-selected'); 154 lastSection.addClass('is-selected'); 155 } 156 } 157 }); 158 } 159 160 var scrollBody = function(index) { 161 $('ul.onepage-pagination li a').removeClass('is-selected'); 162 $('.onepage-pagination li a[data-index="' + index + '"]').addClass('is-selected'); 163 164 var getSection = $('[data-section=' + index + ']'), 165 scrollTo; 166 167 if (getSection == undefined) return; 168 169 var body = $("html, body"), 170 bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'], 171 delta = bodyTop - ($('[data-section="' + index + '"]').length ? $('[data-section="' + index + '"]').offset().top : 0), 172 getOffset = UNCODE.get_scroll_offset(index); 173 if ( typeof getSection.offset() === 'undefined' ) 174 return; 175 scrollTo = getSection.offset().top; 176
177 // if ( !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) && !( $('.menu-mobile-transparent').length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) ) { 178 if ( !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) ) { 179 var shrink = typeof $('.navbar-brand').data('padding-shrink') !== 'undefined' ? $('.navbar-brand').data('padding-shrink')*2 : 36; 180 if ( $('.menu-sticky .menu-container:not(.menu-hide)').length && $('.menu-shrink').length ) { 181 scrollTo += UNCODE.menuHeight - ( $('.navbar-brand').data('minheight') + shrink ); 182 } 183 184 if ( $('.menu-sticky .menu-container:not(.menu-hide)').length && ! $('.menu-shrink').length && $('.body').hasClass('vmenu') ) { 185 if ( index === 0 ) { 186 scrollTo = 0; 187 } else { 188 scrollTo -= $('.menu-sticky .menu-container').outerHeight(); 189 } 190 } else { 191 scrollTo -= getOffset; 192 } 193 } 194 195 var scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed; 196 if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000; 197 198 if (index != 0) { 199 UNCODE.scrolling = true; 200 } 201 202 if (scrollSpeed == 0) { 203 body.scrollTop((delta > 0) ? scrollTo - 0.1 : scrollTo); 204 UNCODE.scrolling = false; 205 } else { 206 body.on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){ 207 $(this).stop(); 208 }).animate({ 209 scrollTop: (delta > 0) ? scrollTo - 0.1 : scrollTo 210 }, scrollSpeed, 'easeInOutCubic', function() { 211 $(this).off("scroll wheel DOMMouseScroll mousewheel touchmove"); 212 UNCODE.scrolling = false; 213 if ( ( scrollTo != UNCODE.get_scroll_offset(index) && !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) && !( $('.menu-mobile-transparent').length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) ) 214 || 215 $('.menu-hided').length ) { 216 scrollTo = getSection.offset().top; 217 getOffset = UNCODE.get_scroll_offset(index); 218 scrollTo -= getOffset; 219 body.on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){ 220 $(this).stop(); 221 }).animate({ 222 scrollTop: (delta > 0) ? scrollTo - 0.1 : scrollTo 223 }, scrollSpeed, 'easeInOutCubic', function() { 224 $(this).off("scroll wheel DOMMouseScroll mousewheel touchmove"); 225 UNCODE.scrolling = false; 226 } 227 ); 228 } 229 }); 230 } 231 232 }; 233 234 init_onepage(); 235}; 236 237 238})(jQuery);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.