1(function ($) { 2 "use strict"; 3 4 $(document).ready(function () { 5 resizeVideo(); 6 CustomWoocommerceJS(); 7 MobileNav(); 8 WooMenu(); 9 Headline(); 10 Ritsearch('#activesearch', '#topsearch-block'); 11 $('select').selectric(); 12 var val; 13 $('.newsletter-email').focus(function () { 14 val = $(this).attr('value'); 15 $(this).attr('value', ''); 16 }) 17 $('.newsletter-email').focusout(function () { 18 var newval = $(this).attr('value'); 19 if (newval == '') { 20 $(this).attr('value', val); 21 } 22 }); 23 $('#respond').ShowFormCmt(); 24 toogleSocail(); 25 }); 26// 27 function toogleSocail(){ 28 $(window).resize(function(){ 29 if($('.rit-socail-share-counter')[0]) { 30 $('.wrapper-socail-share').width($('.rit-socail-share-counter').width()-$('.total-share').outerWidth()-5); 31 } 32 $('.rit-share-counter').width($('.wrapper-socail-share').width()-40); 33 }).resize(); 34 $('.wrapper-socail-share .expand').on('click',function(){ 35 var target=$(this).parent('.wrapper-socail-share'); 36 if(target.hasClass('active')){ 37 target.find('.rit-share-counter').width($('.wrapper-socail-share').width()-40); 38 target.removeClass('active'); 39 $(this).find('i.fa-minus').removeClass('fa-minus').addClass('fa-plus'); 40 } 41 else{ 42 target.find('.rit-share-counter').width('auto'); 43 target.addClass('active'); 44 $(this).find('i.fa-plus').removeClass('fa-plus').addClass('fa-minus'); 45 } 46 }); 47 } 48 // Run when all load done 49 $(window).load(function () { 50 stickySingle(); 51 BacktoTop(); 52 $('.sticky-wrapper').Stickyfix(); 53 if($('.wrapper-mobile-nav')[0]){ 54 $('.wrapper-mobile-nav').niceScroll(); 55 } 56 stickysidebar(); 57 }); 58 59 //Function 60 $.fn.extend({ 61 //Fix sticky wp-admin bar 62 Stickyfix: function () { 63 if ($(this)[0]) { 64 if ($('#wpadminbar')[0]) { 65 $(window).on('resize', function () { 66 if ($(window).width() > 600) { 67 var lastCroll = 0; 68 jQuery(window).bind("scroll", function () { 69 var scroll = jQuery(this).scrollTop(); 70 if (scroll > lastCroll) { 71 $('#wpadminbar').css('transform', 'translateY(-50px)'); 72 73 } 74 else { 75 $('#wpadminbar').css('transform', 'translateY(0px)'); 76 } 77 lastCroll = scroll; 78 }) 79 } 80 }).resize(); 81 } 82 } 83 }, 84 //Show Comment form 85 ShowFormCmt: function () { 86 if ($(this)[0]) { 87 var $this = $(this); 88 var height = $this.outerHeight(); 89 $this.height(height).addClass('hiddenform'); 90 $('#reply-title span, .comment-reply-link, .add-cmt').on('click', function () { 91 $this.removeClass('hiddenform'); 92 }); 93 $('#cancel-comment-reply-link').on('click', function () { 94 $this.addClass('hiddenform'); 95 }); 96 } 97 } 98 }) 99 function stickysidebar() { 100 if ($('.sidebar-fixed')[0]) { 101 $('.sidebar-fixed').wrapInner('<div class="sidebar-fixed-block"></div>'); 102 jQuery(window).resize(function () { 103 if (jQuery(window).width() > 980) { 104 var wrappH, itemH, maxMove, item; 105 $('.wrapper-sidebar-fixed').each(function () { 106 wrappH = $(this).height(); 107 itemH = $(this).find('.sidebar-fixed').height(); 108 item = $(this).find('.sidebar-fixed-block'); 109 maxMove = wrappH - itemH; 110 item.data('maxMove', maxMove); 111 }) 112 jQuery(window).bind("scroll", function () { 113 $('.wrapper-sidebar-fixed').each(function () {
114 var toTop; 115 if ($(this).find('.sidebar-fixed')[0]) { 116 var wrapptoTop = $(this).find('.sidebar-fixed').offset().top; 117 item = $(this).find('.sidebar-fixed-block'); 118 maxMove = item.data('maxMove'); 119 toTop = $(window).scrollTop() - wrapptoTop; 120 if (toTop > 0 && toTop <= maxMove) { 121 item.css('padding-top', toTop + 'px'); 122 } 123 if ($(window).scrollTop() < wrapptoTop) { 124 item.css('padding-top', 0 + 'px'); 125 } 126 if (toTop > maxMove) { 127 item.css('padding-top', maxMove + 'px'); 128 } 129 } 130 }) 131 }); 132 } 133 }).resize(); 134 } 135 } 136 137 //sticky single 138 function stickySingle() { 139 if ($('.single-post .site-main')[0]) { 140 var footerTop = $('#rit-footer').offset().top - $(window).height(); 141 //Check Scroll down 142 jQuery(window).bind("scroll", function () { 143 var checkactive = $('.single-post .site-main').offset().top; 144 var scroll = jQuery(this).scrollTop(); 145 if (checkactive < jQuery(window).scrollTop() && footerTop >= scroll) { 146 $('#sticky-single').addClass('active'); 147 } 148 else { 149 $('#sticky-single').removeClass('active'); 150 } 151 }) 152 } 153 } 154 155 //Resize Video 156 function resizeVideo() { 157 // Find all YouTube videos 158 var allVideos = jQuery(".wrapper-video iframe, .wrapper-video embed"); 159// Figure out and save aspect ratio for each video 160 allVideos.each(function () { 161 jQuery(this).data('aspectRatio', this.height / this.width) 162 // and remove the hard coded width/height 163 .removeAttr('height') 164 .removeAttr('width'); 165 }); 166// When the window is resized 167 jQuery(window).resize(function () { 168 var newWidth = jQuery(".wrapper-video").width(); 169 // Resize all videos according to their own aspect ratio 170 allVideos.each(function () { 171 var el = jQuery(this); 172 el 173 .width(newWidth) 174 .height(newWidth * el.data('aspectRatio')); 175 176 }); 177// Kick off one resize to fix all videos on page load 178 }).resize(); 179 } 180 181 /*------Accordion menu-------*/ 182 function WooMenu() { 183 if ($('.product-categories li.cat-parent')[0]) { 184 $('.product-categories li.cat-parent>a').after('<span class="triggernav"><i class="expand-icon"></i></span>'); 185 toggleMobileNav('.triggernav', '.widget_product_categories .product-categories li ul'); 186 } 187 } 188 189 /*--------For mobile nav-------*/ 190 function MobileNav() { 191 var windowH = $(window).height(); 192 if ($('.mobile-header-2')[0]) { 193 $('body').append('<div id="mask-nav"></div>'); 194 $('#mobile-nav-block').prepend($('#logo').clone()); 195 jQuery('#mobile-nav-block').append('<span id="close-nav"></span>'); 196 $('#mobile-nav-block').addClass('vertical'); 197 $('.mobile-header-2').width($(window).width()); 198 var blockH = windowH; 199 if ($('#mobile-nav-block #logo')[0]) { 200 blockH = blockH - $('#mobile-nav-block #logo').outerHeight(true); 201 } 202 if ($('#mobile-nav-block .rit-socail-page')[0]) { 203 blockH = blockH - $('#mobile-nav-block .rit-socail-page').outerHeight(true); 204 } 205 $('.wrapper-mobile-nav').css('max-height', blockH + 'px'); 206 } 207 jQuery('#mobile-nav-block li:has("ul")>a').after('<span class="triggernav"><i class="fa fa-angle-down"></i></span>'); 208 toggleMobileNav('.triggernav', '#mobile-nav-block ul li ul'); 209 jQuery('.mobile-nav:not(.active)').on("click", function () { 210 if ($('.mobile-header-2')[0]) { 211 $('body').addClass('nav-active'); 212 } 213 jQuery('#mobile-nav-block').toggleClass('active'); 214 if ($('#mask-nav')[0]) { 215 $('#mask-nav').addClass('active'); 216 $('.wrapper-body').addClass('active'); 217 } 218 if ($('.mobile-header-2').length == 0) { 219 var top = $('#rit-header-page').height(); 220 jQuery(this).toggleClass('active'); 221 $('.wrapper-mobile-nav').css('top', top + 'px'); 222 var blockH = windowH - top; 223 if ($('#mobile-nav-block #logo')[0]) { 224 blockH = blockH - $('#mobile-nav-block #logo').outerHeight(true); 225 } 226 if ($('#mobile-nav-block .rit-socail-page')[0]) { 227 blockH = blockH - $('#mobile-nav-block .rit-socail-page').outerHeight(true); 228 } 229 $('.wrapper-mobile-nav').css('max-height', blockH + 'px'); 230 } 231 }); 232 jQuery('#close-nav, .mobile-nav.active').on("click", function () { 233 $('body').removeClass('nav-active'); 234 $('.mobile-nav.active').toggleClass('active'); 235 jQuery('#mobile-nav-block').removeClass('active'); 236 if ($('#mask-nav')[0]) { 237 $('#mask-nav').removeClass('active'); 238 $('.wrapper-body').removeClass('active'); 239 } 240 }); 241 jQuery('#mask-nav').on("click", function () { 242 $('body').removeClass('nav-active'); 243 $(this).removeClass('active'); 244 jQuery('#mobile-nav-block').removeClass('active'); 245 $('.wrapper-body').removeClass('active'); 246 }) 247 } 248 249 function toggleMobileNav(trigger, target) { 250 jQuery(target).each(function () { 251 jQuery(this).attr('data-h', jQuery(this).outerHeight()); 252 }); 253 jQuery(target).addClass('unvisible'); 254 var h; 255 jQuery(trigger).on("click", function () { 256 h = 0; 257 jQuery(this).prev('a').toggleClass('active'); 258 jQuery(this).toggleClass('active'); 259 jQuery.this = jQuery(this).next(target); 260 if (jQuery.this.hasClass('unvisible')) { 261 //Get height of this item 262 if (jQuery.this.has("ul").length > 0) {
263 h = parseInt(jQuery.this.attr('data-h')) - parseInt(jQuery.this.find(target).attr('data-h')); 264 } 265 else { 266 h = parseInt(jQuery.this.attr('data-h')); 267 } 268 //resize for parent 269 jQuery.this.parents(target).each(function () { 270 jQuery(this).css('height', jQuery(this).outerHeight() + h); 271 }) 272 //set height for this item 273 jQuery.this.css('height', h + "px"); 274 } 275 else { 276 jQuery.this.find(target).not(':has(.unvisible)').addClass('unvisible'); 277 //resize for parent when this item hide 278 h = jQuery.this.outerHeight(); 279 jQuery.this.parents(target).each(function () { 280 jQuery(this).css('height', jQuery(this).outerHeight() - h); 281 }) 282 } 283 jQuery.this.toggleClass('unvisible'); 284 //if(jQuery(trigger).parents('#mobile-menu')[0]){ 285 $('.wrapper-mobile-nav').getNiceScroll().resize(); 286 //} 287 }); 288 } 289 290//===============Woo js======================// 291 function CustomWoocommerceJS() { 292 setTimeout(function () { 293 jQuery('.woocommerce-message').css('right', '0'); 294 }, 500); 295 setTimeout(function () { 296 jQuery('.woocommerce-message').removeAttr('style'); 297 }, 3000); 298//Set cookie for change product layout 299 jQuery('.pageviewitem').not('.active').on("click", function () { 300 if (jQuery.cookie('product-view') != '') { 301 jQuery.cookie('product-view', jQuery(this).attr('data-view')); 302 document.location.reload(); 303 } 304 }); 305 } 306 307//======================Back to top====================// 308 function BacktoTop() { 309 var checkScroll = 0; 310 jQuery(window).scroll(function () { 311 var st = jQuery(this).scrollTop(); 312 if (jQuery(this).scrollTop() > 100 && checkScroll > st) { 313 jQuery('#back-to-top').addClass('show'); 314 } else { 315 jQuery('#back-to-top').removeClass('show'); 316 } 317 checkScroll = st; 318 }); 319 jQuery('#back-to-top').on("click", function () { 320 jQuery('body,html').animate({ 321 scrollTop: 0 322 }, 800); 323 return false; 324 }); 325 } 326 327//================Headline js===================// 328 function Headline() { 329 $(window).resize(function () { 330 if ($(window).width() > 600) { 331 if ($('.headline-widgets.fade')[0]) { 332 if (jQuery('.headline-widgets li.active').length == 0) { 333 jQuery('.headline-widgets li:first-child').addClass('active'); 334 } 335 var loop = setInterval(function () { 336 Nextheadline() 337 }, 3000); 338 jQuery('.headline-widgets li, .rit-control-headline span').on('hover', function () { 339 clearInterval(loop); 340 }, function () { 341 loop = setInterval(function () { 342 Nextheadline() 343 }, 3000); 344 } 345 ) 346 jQuery('.rit-control-headline .next').click(function () { 347 Nextheadline(); 348 }); 349 jQuery('.rit-control-headline .prev').click(function () { 350 Prevheadline(); 351 }); 352 } else if ($('.headline-widgets.slide')[0]) { 353 var widthHL = 0; 354 $('.headline-widgets li').each(function () { 355 widthHL = widthHL + $(this).outerWidth(); 356 }); 357 $('.headline-widgets').width(widthHL); 358 slidepost('.headline-widgets li:first-child'); 359 $('.headline-widgets').on('mouseover', function () { 360 $('.headline-widgets li:first-child').stop(); 361 }); 362 $('.headline-widgets').on('mouseout', function () { 363 slidepost('.headline-widgets li:first-child') 364 }) 365 } 366 } 367 }).resize(); 368 } 369 370 var time; 371 var width; 372 var toLeft; 373 374 function slidepost(id) { 375 width = $(id).outerWidth(); 376 time = width * 30; 377 toLeft = $('.headline-widgets').offset().left - $(id).offset().left; 378 if (toLeft <= 0) { 379 time = width * 30; 380 } 381 else { 382 time = (width - toLeft) * 30; 383 } 384 $(id).animate({'margin-left': -width}, time, 'linear', function () { 385 var clone_item = jQuery(id).clone(); 386 clone_item.css({'margin-left': '0'}); 387 $('.headline-widgets').append(clone_item); 388 jQuery(id).remove(); 389 setTimeout(slidepost('.headline-widgets li:first-child'), 100); 390 }); 391 } 392 393 function Nextheadline() { 394 if (jQuery('.headline-widgets li.active').next('li').length > 0) { 395 jQuery('.headline-widgets li.active').removeClass('active').next().addClass('active'); 396 } 397 else { 398 jQuery('.headline-widgets li.active').removeClass('active'); 399 jQuery('.headline-widgets li:first-child').addClass('active'); 400 } 401 } 402 403 function Prevheadline() { 404 if (jQuery('.headline-widgets li.active').prev('li').length > 0) { 405 jQuery('.headline-widgets li.active').removeClass('active').prev().addClass('active'); 406 } 407 else { 408 jQuery('.headline-widgets li.active').removeClass('active'); 409 jQuery('.headline-widgets li:last-child').addClass('active'); 410 } 411 } 412 413//===============End head line js====================// 414//For search 415 function Ritsearch(trigger, id) { 416 (function ($) { 417 "use strict"; 418 $(trigger).on("click", function () { 419 $(id).removeClass('hidesearch'); 420 $(id).find('input').focus; 421 }) 422 $('#close-search').on("click", function () { 423 $(id).addClass('hidesearch'); 424 }); 425 })(jQuery) 426 } 427})(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.