PageSourceSearch

http://thefashionabletruth.com/wp-content/themes/valenti/library/js/cb-scripts.js?ver=3.0

js thefashionabletruth.com collected 2026-09-25 09:35:20 UTC 31,579 bytes, 954 lines download raw bytes

1/** 3.0.2 **/
2(function($){"use strict";
3
4  /**
5   * Copyright 2012, Digital Fusion
6   * Licensed under the MIT license.
7   * http://teamdf.com/jquery-plugins/license/
8   *
9   * @author Sam Sehnert
10   * @desc A small plugin that checks whether elements are within
11   *     the user visible viewport of a web browser.
12   *     only accounts for vertical position, not horizontal.
13   */
14
15  $.fn.visible = function(partial) {
16
17      var $t            = $(this),
18          $w            = $(window),
19          viewTop       = $w.scrollTop(),
20          viewBottom    = viewTop + $w.height(),
21          _top          = $t.offset().top,
22          _bottom       = _top + $t.height(),
23          compareTop    = partial === true ? _bottom : _top,
24          compareBottom = partial === true ? _top : _bottom;
25
26    return ((compareBottom <= viewBottom) && (compareTop >= viewTop));
27
28  };
29
30})(jQuery);
31
32// IE8 ployfill for GetComputed Style (for Responsive Script below)
33if (!window.getComputedStyle) {
34    window.getComputedStyle = function(el, pseudo) {"use strict";
35        this.el = el;
36        this.getPropertyValue = function(prop) {
37            var re = /(\-([a-z]){1})/g;
38            if (prop == 'float') prop = 'styleFloat';
39            if (re.test(prop)) {
40                prop = prop.replace(re, function () {
41                    return arguments[2].toUpperCase();
42                });
43            }
44            return el.currentStyle[prop] ? el.currentStyle[prop] : null;
45        };
46        return this;
47    };
48}
49
50var cbMobileTablet = !!( (navigator.userAgent.match(/IEMobile/i) === true ) || ( navigator.userAgent.match(/Android/i) === true ) || ( navigator.userAgent.match(/BlackBerry/i) === true ) || ( navigator.userAgent.match(/iPhone|iPad|iPod/i) ) || ( navigator.userAgent.match(/Motorola|DROIDX/i) ) || ( navigator.userAgent.match(/Linux/i) ) );
51
52var cbMobilePhone = !!( (navigator.userAgent.match(/IEMobile/i) === true ) || ( navigator.userAgent.match(/Android/i) === true ) || ( navigator.userAgent.match(/BlackBerry/i) === true ) || ( navigator.userAgent.match(/iPhone|iPod/i) ) || ( navigator.userAgent.match(/Motorola|DROIDX/i) ) || ( navigator.userAgent.match(/Linux/i) ) );
53
54// as the page loads, call these scripts
55jQuery(document).ready(function($) { "use strict";
56
57    var cbWindowWidth = $(window).width(),
58        cbWindowHeight = $(window).height(),
59        cbContainer = $('#cb-container'),
60        cbContent = $('#cb-content'),
61        cbNavBar = $('#cb-nav-bar');
62
63    if (cbWindowWidth >= 768) {
64
65                // Sticky Menu
66                if( !cbNavBar.hasClass('stickyoff') ) {
67
68                    var cbNavOffset = cbNavBar.offset().top,
69                        cbNavHeight = cbNavBar.height(),
70                        cbLoggedIn = 0;
71
72                    if ( $('#wpadminbar').length > 0 ) {  cbLoggedIn = 32; }
73
74                    $(window).scroll(function () {
75
76                        if($(this).scrollTop() > cbNavOffset) {
77
78                            cbNavBar.addClass('cb-stuck');
79                            $('.cb-stuck').css('margin-top' , cbLoggedIn);
80                            cbContainer.css('margin-top', cbNavHeight);
81
82                        } else {
83                            cbNavBar.css('margin-top', 0).removeClass('cb-stuck');
84                            cbContainer.css('margin-top', 0);
85                        }
86                    });
87                }
88    }
89
90    var cbWindow = $(window),
91        cbRatingBars = $('.cb-overlay').find('span'),
92        cbRatingStars = $('.cb-overlay-stars').find('span');
93
94    $.each(cbRatingBars, function(i, value) {
95
96        var cbValue = $(value);
97        if ( cbValue.visible(true) ) {
98
99            cbValue.removeClass('cb-zero-trigger');
100            cbValue.addClass('cb-bar-ani');
101
102        }
103    });
104
105    $.each(cbRatingStars, function(i, value) {
106
107        var cbValue = $(value);
108        if ( cbValue.visible(true) ) {
109
110            cbValue.removeClass('cb-zero-stars-trigger');
111            cbValue.addClass('cb-bar-ani-stars');
112
113        }
114    });
115
116    cbWindow.scroll(function(event) {
117
118        $.each(cbRatingBars, function(i, value) {
119
120            var cbValue = $(value);
121            if ( ( cbValue.visible(true) ) && ( cbValue.hasClass('cb-zero-trigger') ) ) {
122
123              cbValue.removeClass('cb-zero-trigger');
124              cbValue.addClass('cb-bar-ani');
125            }
126        });
127
128          $.each(cbRatingStars, function(i, value) {
129
130            var cbValue = $(value);
131            if ( ( cbValue.visible(true) ) && ( cbValue.hasClass('cb-zero-stars-trigger') ) ) {
132
133                cbValue.removeClass('cb-zero-stars-trigger');
134                cbValue.addClass('cb-bar-ani-stars');
135            }
136        });
137
138    });
139
140    $('.hentry').find('a').has('img').each(function () {
141
142        var cbImgTitle = $('img', this).attr( 'title' ),
143            cbAttr = $(this).attr('href');
144
145        var cbWooLightbox = $(this).attr('rel');
146
147        if (typeof cbImgTitle !== 'undefined') {
148            $(this).attr('title', cbImgTitle);
149        }
150
151        if ( ( typeof cbAttr !== 'undefined' )  && ( cbWooLightbox !== 'prettyPhoto[product-gallery]' ) ) {
152            var cbHref = cbAttr.split('.');
153            var cbHrefExt = $(cbHref)[$(cbHref).length - 1];
154
155            if ((cbHrefExt === 'jpg') || (cbHrefExt === 'jpeg') || (cbHrefExt === 'png') || (cbHrefExt === 'gif') || (cbHrefExt === 'tif')) {
156                $(this).addClass('cb-lightbox');
157            }
158        }
159
160    });
161
162    $('.tiled-gallery').find('a').attr('rel', 'tiledGallery');
163    $('.gallery').find('a').attr('rel', 'tiledGallery');
164
165    var cbMain = $('#main');
166    cbMain.find('iframe[src^="//www.yo"]').wrap('<div class="cb-video-frame"></div>');
167    cbMain.find('iframe[src^="http://www.yo"]').wrap('<div class="cb-video-frame"></div>');
168    cbMain.find('iframe[src^="//player.vimeo"]').wrap('<div class="cb-video-frame"></div>');
169    cbMain.find('iframe[src^="http://www.dailymotion"]').wrap('<div class="cb-video-frame"></div>');
170
171    // Fire up LightBox
172    if (!!$.prototype.boxer) {
173        $(".cb-lightbox").boxer({
174                duration: 350,
175                fixed: true,
176         });
177    }
178
179    // Toggle
180    $('.cb-toggler').find('.cb-toggle').click(function(e) {
181           $(this).next().stop().slideToggle();
182           $(this).prev().stop().toggle();
183           $(this).prev().prev().stop().toggle();
184           e.preventDefault();
185    });
186
187    var cbBackgroundExists = $('body > .backstretch'),
188        cbFirstGrid = cbContent.first('.cb-grid-block'),
189        cbStandardFeatured = $('#cb-standard-featured');
190
191    if ( cbBackgroundExists.length ) {
192
193        $(cbStandardFeatured).imagesLoaded( function() {
194            cbStandardFeatured.find('.cb-fi-standard').delay( 1200 ).fadeIn('slow');
195        });
196
197    } else {
198
199        $(cbStandardFeatured).imagesLoaded( function() {
200            cbStandardFeatured.find('.cb-fi-standard').fadeIn('slow');
201        });
202
203    }
204
205    $(cbFirstGrid).imagesLoaded( function() {
206        cbFirstGrid.find('.cb-grid-img').fadeIn('slow');
207    });
208
209    $(window).load(function() {
210        var cbTabber = $('.tabbernav'),
211            cb_amount = cbTabber.children().length;
212        if ( cb_amount === 4 ) { cbTabber.addClass("cb-fourtabs"); }
213        if ( cb_amount === 3 ) { cbTabber.addClass("cb-threetabs"); }
214        if ( cb_amount === 2 ) { cbTabber.addClass("cb-twotabs"); }
215        if ( cb_amount === 1 ) { cbTabber.addClass("cb-onetab"); }
216
217    });
218
219    // Clear half modules
220    $('.cb-module-half:odd').each(function(){
221        $(this).prev().addBack().wrapAll($('<div/>',{'class': 'cb-double-block clearfix'}));
222    });
223
224    // Sliders
225    $('.flexslider-widget').flexslider({
226            animation: "slide",
227            controlNav: false,
228            pauseOnAction: true
229    });
230
231    $('.flexslider-1').flexslider({
232        animation: "slide",
233        itemWidth: 210,
234        itemMargin: 3,
235        pauseOnHover: true,
236        slideshowSpeed: 5000,
237        maxItems: 3,
238        minItems: 1,
239        controlNav: false
240    });
241     $('.flexslider-1-fw').flexslider({
242        animation: "slide",
243        itemWidth: 280,
244        itemMargin: 3,
245        pauseOnHover: true,
246        slideshowSpeed: 5000,
247        maxItems: 4,
248        minItems: 1,
249        controlNav: false
250    });
251
252    $('#cb-carousel').flexslider({
253        animation: "slide",
254        controlNav: false,
255        animationLoop: false,
256        slideshow: false,
257        directionlNav: true,
258        itemWidth: 150,
259        itemMargin: 15,
260        asNavFor: '#cb-gallery'
261      });
262
263    $('#cb-gallery').flexslider({
264        animation: "slide",
265        controlNav: false,
266        directionlNav: false,
267        animationLoop: false,
268        slideshow: false,
269        sync: "#cb-carousel"
270    });
271
272    $('.flexslider-1-menu').flexslider({
273        animation: "slide",
274        itemWidth: 210,
275        itemMargin: 3,
276        slideshow: false,
277        pauseOnHover: true,
278        maxItems: 2,
279        minItems: 1,
280        controlNav: false
281    });
282     $('.flexslider-1-fw-menu').flexslider({
283        animation: "slide",
284        itemWidth: 210,
285        itemMargin: 3,
286        slideshow: false,
287        minItems: 2,
288        pauseOnHover: true,
289        maxItems: 2,
290        controlNav: false
291    });
292
293    $('.flexslider-2').flexslider({
294        animation: "slide",
295        minItems: 1,
296        pauseOnHover: true,
297        maxItems: 1,
298        slideshowSpeed: 5000,
299        controlNav: false
300    });
301     $('.flexslider-2-fw').flexslider({
302        animation: "slide",
303        pauseOnHover: true,
304        minItems: 1,
305        maxItems: 1,
306        slideshowSpeed: 5000,
307        controlNav: false
308    });
309
310    // Reset Flexslider positions on resize
311    var cbFlexFW = $('.flexslider-1-fw'),
312        cbFlexSW = $('.flexslider-1');
313    $( window ).resize(function() {
314        if ( cbFlexFW.length ) {
315              cbFlexFW.flexslider(1);
316        }
317        if ( cbFlexSW.length ) {
318                cbFlexSW.flexslider(1);
319        }
320    });
321
322    $('#messages_search').removeAttr('placeholder');
323
324    var cbMainNav = $('.main-nav li');
325
326    // Show sub menus
327    $('.main-nav > li').hoverIntent(function() {
328
329        $(this).find('.cb-big-menu').stop().slideDown('fast');
330        $(this).find('.cb-mega-menu').stop().slideDown('fast');
331        $(this).find('.cb-links-menu .cb-sub-menu').stop().fadeIn();
332
333    }, function() {
334
335       $(this).find('.cb-big-menu').slideUp('fast');
336       $(this).find('.cb-mega-menu').slideUp('fast');
337       $(this).find('.cb-links-menu .cb-sub-menu').fadeOut();
338
339    });
340
341    cbMainNav.find('.cb-big-menu .cb-sub-menu li').hoverIntent(function(){
342
343        $(this).find('> .cb-grandchild-menu').stop().slideDown('fast');
344
345    }, function() {
346
347       $(this).find('> .cb-grandchild-menu').slideUp('fast');
348
349    });
350
351    cbMainNav.find('.cb-links-menu .cb-sub-menu li').hoverIntent(function(){
352
353        $(this).children('.cb-grandchild-menu').stop().fadeIn();
354
355    }, function() {
356
357       $(this).children('.cb-grandchild-menu').fadeOut();
358
359    });
360
361    var cbParallaxMain = $('#cb-parallax-featured'),
362        cbParallaxImg = cbParallaxMain.find('.cb-image'),
363        cbParallaxBG = $('#cb-parallax-bg'),
364        cbFullWidthBg = $('.backstretch').find('#cb-media-bg'),
365        cbFullWidth = $('#cb-full-background-featured'),
366        cbFullCheck = true,
367        cbWindowHeightTwo;
368
369    if ( cbFullWidth.length === 0 ) {
370        cbFullWidth = $('#cb-full-width-featured');
371        cbFullCheck = false;
372    }
373
374    if ( cbFullWidth.length === 0 ) {
375        cbFullWidth = $('#cb-parallax-featured');
376        cbFullCheck = true;
377    }
378
379    var cbFullWidthTitle = cbFullWidth.find('.cb-title-fi'),
380        cbFullWidthTitleHeight = cbFullWidthTitle.height();
381
382    if ( ( cbParallaxImg.length !== 0 ) && ( cbMobileTablet === false ) ) {
383        var cbParallaxMainOffTop = cbParallaxMain.offset().top;
384            cbWindowHeightTwo =  (cbWindowHeight) - (cbParallaxMainOffTop) - 90;
385
386        cbParallaxImg.animate({"height": cbWindowHeight}, 750);
387        cbParallaxBG.animate({"height": cbWindowHeight}, 750);
388        cbParallaxMain.animate({"height": cbWindowHeightTwo}, 500);
389
390        $(window).scroll(function() {
391               var cbyPos = -( ($(window).scrollTop() - cbParallaxImg.offset().top) / 10),
392                   cbCoords = '49% ' + cbyPos + 'px';
393
394               cbParallaxImg.css( "background-position", cbCoords );
395
396            });
397    }
398
399    var cbClickFlag = true;
400
401    cbMediaIcon.click(function() {
402
403            var cbSCHeight = cbSoundCloudFrame.attr('height'),
404                cbMediaOverlayHeight = cbMediaOverlay.height(),
405                cbMediaOverlayWidth = cbMediaOverlay.width(),
406                cbMediaFrameHeight = ( cbMediaOverlayHeight - cbFullWidthTitleHeight ) * 0.8,
407                cbMediaFrameTop = ( cbMediaOverlayHeight - cbMediaFrameHeight - cbFullWidthTitleHeight ) / 2,
408                cbMediaFrameWidth = cbMediaFrameHeight * 560 / 315,
409                cbMediaFrameTopSC = ( cbMediaOverlayHeight - cbFullWidthTitleHeight  - 160 ) / 2,
410                cbMediaFrameMarginLeft;
411
412            if ( cbMediaFrameWidth >  cbMediaOverlay.width() ) {
413                cbMediaFrameWidth = cbMediaOverlay.width() - 20;
414                cbMediaFrameMarginLeft = 10;
415            }  else {
416                cbMediaFrameMarginLeft = ( cbMediaOverlayWidth - cbMediaFrameWidth ) / 2;
417            }
418
419            if ( cbClickFlag === true ) {
420
421                cbVimeoFrame.attr('src', (cbVimeoFrame.attr('src') + '?autoplay=1'));
422                cbSoundCloudFrame.css('height', cbSCHeight);
423                cbClickFlag = false;
424            }
425
426            cbMediaOverlay.animate({"opacity": 1});
427            $(this).fadeOut();
428
429            if ( ( cbFullWidth.length > 0 ) && ( cbFullCheck === true ) ) {
430                cbFullWidthBg.fadeIn().css("display","block");
431            }
432
433            if ( ( cbMediaFrameTop !== 'undefined'  ) && ( cbSoundCloudFrame.length === 0 ) ) {
434                cbParallaxBG.addClass('cb-parallax-media-bg');
435                cbMediaFrame.css({'top' : cbMediaFrameTop, 'height' : cbMediaFrameHeight, 'width' : cbMediaFrameWidth, 'margin-left' : cbMediaFrameMarginLeft });
436
437            } else if ( cbSoundCloudFrame.length > 0 ) {
438
439                cbMediaFrame.css({'top' : cbMediaFrameTopSC, 'max-height' : '200px'});
440            }
441
442            if ( cbParallaxImg.length > 0 ) {
443
444                cbParallaxBG.addClass( 'cb-parallax-bg-color' );
445                cbParallaxImg.fadeTo('400', 0.1);
446
447            }
448    });
449
450    cbMediaOverlay.click(function() {
451
452            var cbMediaFrame = $(this).find('#cb-media-frame');
453            cbMediaFrame.css("top", "-9999px");
454            $(this).animate({"opacity": 0});
455            cbMediaIcon.fadeIn();
456
457            if ( ( cbFullWidth.length > 0 ) && cbFullCheck === true ) {
458                cbFullWidthBg.fadeOut();
459            }
460
461            if ( cbParallaxImg.length > 0 ) {
462                cbParallaxImg.fadeTo('400', 1);
463            }
464             cbParallaxBG.removeClass('cb-parallax-media-bg');
465
466    });
467
468    // Full-Width Featured Image
469    var cbFeaturedMain = $('#cb-full-background-featured');
470    if ( cbFeaturedMain.length > 0) {
471        if ( cbMobilePhone === true ) {
472             cbWindowHeightTwo =  $(window).height() - ( cbFeaturedMain.offset().top);
473        } else {
474             cbWindowHeightTwo =  $(window).height() - ( cbFeaturedMain.offset().top) - 80;
475        }
476
477            cbFeaturedMain.animate({"height": cbWindowHeightTwo}, 500);
478    }
479
480    var hideSpan = $('.cb-accordion > span').hide();
481    $('.cb-accordion > a').click(function() {
482
483        if ( $(this).next().css('display') == 'none') {
484            hideSpan.slideUp('fast');
485            $(this).next().slideDown('fast');
486        } else {
487            $(this).next().slideUp('fast');
488        }
489        return false;
490
491    });
492
493    if ( navigator.userAgent.indexOf('Safari') != -1 && navigator.userAgent.indexOf('Chrome') == -1 ) {
494        cbParallaxMain.find('.cb-image').css( '-webkit-backface-visibility', 'hidden' );
495    }
496
497    var cbToTop = $('#cb-to-top');
498
499    $(window).scroll(function () {
500
501        if( ( $(this).scrollTop () > 750 ) &&  ( cbWindowWidth > 768 ) ) {
502             cbToTop.fadeIn(300);
503        } else {
504            cbToTop.fadeOut(300);
505        }
506    });
507
508    cbToTop.click(function(event) {
509        $('html, body').animate({scrollTop:0}, 600);
510        event.preventDefault();
511    });
512
513    $('.cb-video-frame').fitVids();
514
515    cbNavBar.find('.cb-login-modal-closer').click(function(){
516        cbNavBar.find('.cb-login-modal').fadeOut();
517    });
518
519    $( ".cb-tabs" ).find( '> ul' ).tabs( ".cb-panes .cb-tab-content" );
520
521
522
523    $('img[data-retina-src]').retinaDisplay();
524
525    /*
526     * jQuery Reveal Plugin 1.0
527     * www.ZURB.com
528     * Copyright 2010, ZURB
529     * Free to use under the MIT license.
530     * http://www.opensource.org/licenses/mit-license.php
531    */
532
533    (function($) {
534        /*---------------------------
535         Listener for data-reveal-id attributes
536        ----------------------------*/
537        $('a[data-reveal-id]').on('click', function(e) {
538            e.preventDefault();
539            var modalLocation = $(this).attr('data-reveal-id');
540
541                if ( modalLocation === 'cb-search-modal' ) {
542                    cbNavBar.find('#'+modalLocation).reveal($(this).data());
543                    if ( ( cbWindowWidth > 768 ) ) {
544                        $('#cb-search-modal').find('.cb-search-field').focus();
545                    }
546
547                } else {
548                    cbNavBar.find('.'+modalLocation).reveal($(this).data());
549                    if ( ( cbWindowWidth > 768 ) ) {
550                        cbNavBar.find('input[name="log"]').focus();
551                    }
552                }
553
554        });
555
556        /*---------------------------
557         Extend and Execute
558        ----------------------------*/
559            $.fn.reveal = function(options) {
560
561                var defaults = {
562                    animation: 'fadeAndPop',
563                    animationspeed: 300, //how fast animtions are
564                    closeonbackgroundclick: true, //if you click background will modal close?
565                    dismissmodalclass: 'cb-close-modal', //the class of a button or element that will close an open modal
566                    modalbgclass : 'cb-dark-bg'
567                };
568
569                //Extend dem' options
570                options = $.extend({}, defaults, options);
571
572                return this.each(function() {
573
574        /*---------------------------
575         Global Variables
576        ----------------------------*/
577                    var modal = $(this),
578                        topMeasure  = parseInt(modal.css('top'), 10),
579                        topOffset = ( cbWindowHeight - modal.outerHeight() ) / 2,
580                        locked = false,
581                        modalBG = $('.'+options.modalbgclass);
582
583
584        /*---------------------------
585         Create Modal BG
586        ----------------------------*/
587                    if ( modalBG.length === 0 ) {
588                        modalBG = $('<div class="'+options.modalbgclass+'" />').insertAfter(modal);
589                    } else {
590
591                        $('<div class="'+options.modalbgclass+'" />').remove();
592                    }
593
594        /*---------------------------
595         Open & Close Animations
596        ----------------------------*/
597                    //Entrance Animations
598                    modal.bind('reveal:open', function () {
599                      modalBG.unbind('click.modalEvent');
600                        $('.' + options.dismissmodalclass).unbind('click.modalEvent');
601                        if(!locked) {
602                            lockModal();
603                            if(options.animation == "fadeAndPop") {
604                                modal.css({'opacity' : 0, 'visibility' : 'visible', 'display':'block'});
605                                modalBG.fadeIn(options.animationspeed/2);
606                                modal.delay(options.animationspeed/2).animate({
607                                    "opacity" : 1
608                                }, options.animationspeed,unlockModal());
609                            }
610                        }
611                        modal.unbind('reveal:open');
612                    });
613
614                    //Closing Animation
615                    modal.bind('reveal:close', function () {
616                      if(!locked) {
617                            lockModal();
618                            if(options.animation == "fadeAndPop") {
619                                modalBG.delay(options.animationspeed).fadeOut(options.animationspeed);
620                                modal.animate({ "opacity" : 0 }, options.animationspeed/2, function() {
621                                    modal.css({'opacity' : 1, 'visibility' : 'hidden'});
622                                    unlockModal();
623                                });
624                            }
625                        }
626                        modal.unbind('reveal:close');
627                    });
628
629        /*---------------------------
630         Open and add Closing Listeners
631        ----------------------------*/
632                    //Open Modal Immediately
633                    modal.trigger('reveal:open');
634                    var cbLwaStatus = $('.lwa-status');
635                    //Close Modal Listeners
636                    var closeButton = $('.' + options.dismissmodalclass).bind('click.modalEvent', function () {
637                      modal.trigger('reveal:close');
638                      $(cbLwaStatus).delay(500).removeClass('lwa-status-invalid');
639
640                    });
641
642                    if(options.closeonbackgroundclick) {
643                        modalBG.bind('click.modalEvent', function () {
644                          modal.trigger('reveal:close');
645                          $(cbLwaStatus).delay(500).removeClass('lwa-status-invalid');
646                        });
647                    }
648                    $('body').keyup(function(e) {
649                        if(e.which===27){ modal.trigger('reveal:close'); } // 27 is the keycode for the Escape key
650                        $(cbLwaStatus).delay(500).removeClass('lwa-status-invalid');
651                    });
652
653        /*---------------------------
654         Animations Locks
655        ----------------------------*/
656                    function unlockModal() {
657                        locked = false;
658                    }
659                    function lockModal() {
660                        locked = true;
661                    }
662
663                });//each call
664        }; //orbit plugin call
665
666    })(jQuery);
667
668
669    $('.cb-breaking-news ul').totemticker({
670            row_height  :   '33px',
671            mousestop   :   true
672
673    });
674
675
676    var cbVote = $('#cb-vote').find('.cb-overlay');
677    var cbVoteStars = $('#cb-vote').find('.cb-overlay-stars');
678
679    if (cbVote.length) {
680
681        $(cbVote).on('click', function() {
682            $(cbVote).tipper({
683                direction: "bottom"
684            });
685        });
686    } else if (cbVoteStars.length) {
687        $(cbVoteStars).on('click', function() {
688            $(cbVoteStars).tipper({
689                direction: "bottom"
690            });
691        });
692    }
693
694    $(".cb-tip-bot").tipper({
695        direction: "bottom"
696    });
697
698    $(".cb-tip-top").tipper({
699        direction: "top"
700    });
701
702    $(".cb-tip-right").tipper({
703        direction: "right"
704    });
705
706    $(".cb-tip-left").tipper({
707        direction: "left"
708    });
709
710    var cbInfiniteScroll = $('#cb-blog-infinite-scroll'),
711        cbLoadHasAd = $('#main').children().first().hasClass('cb-category-top'),
712        cbReady = true;
713
714    if ( cbInfiniteScroll.length ) {
715
716        $(window).scroll(function() {
717
718            if ( cbReady === true ) {
719
720                var cbLastChild = $('#main').children().last(),
721                    cbLastChildID = cbLastChild.attr('id'),
722                    cbLastArticle = $('#main').children().last().prev();
723
724                if ( ( cbLastChildID === 'cb-blog-infinite-scroll' ) && ( cbLastArticle.visible(true) ) ) {
725
726                    cbReady = false;
727
728                    var cbCurrentPagination = $('#cb-blog-infinite-scroll').find('a').attr('href');
729                    cbMain.addClass('cb-loading');
730
731                    $.get( cbCurrentPagination, function( data ) {
732
733                        var cbExistingPosts, cbExistingPostsRaw;
734
735                        if ( cbLoadHasAd === true ) {
736
737                                cbExistingPostsRaw = $(data).filter('#cb-outer-container').find('#main');
738                                $(cbExistingPostsRaw).find('.cb-category-top').remove();
739                                cbExistingPosts = cbExistingPostsRaw.html();
740
741                        } else {
742                            cbExistingPosts = $(data).filter('#cb-outer-container').find('#main').html();
743                        }
744
745                        $('#main').children().last().remove();
746                        $('#main').append(cbExistingPosts);
747                        cbMain.removeClass('cb-loading');
748
749                    });
750
751                }
752
753            }
754
755        });
756    }
757
758    $( document ).ajaxStop(function() {
759      cbReady = true;
760    });
761
762    cbContent.on('click', '#cb-blog-infinite-load a', function( e ){
763
764        e.preventDefault();
765        var cbCurrentPagination = $(this).attr('href'),
766            cbCurrentParent = $(this).parent();
767
768        cbMain.addClass('cb-loading');
769
770        $.get( cbCurrentPagination, function( data ) {
771
772            var cbExistingPosts, cbExistingPostsRaw;
773
774            if ( cbLoadHasAd === true ) {
775
776                    cbExistingPostsRaw = $(data).filter('#cb-outer-container').find('#main');
777                    $(cbExistingPostsRaw).find('.cb-category-top').remove();
778                    cbExistingPosts = cbExistingPostsRaw.html();
779
780            } else {
781                cbExistingPosts = $(data).filter('#cb-outer-container').find('#main').html();
782            }
783
784            $('#main').append(cbExistingPosts);
785            cbMain.removeClass('cb-loading');
786            cbCurrentParent.addClass( 'cb-hidden' );
787
788        });
789
790    });
791
792}); /* end of as page load scripts */
793
794var cbMediaOverlay = jQuery('#cb-media-overlay'),
795    cbMediaFrame = cbMediaOverlay.find('#cb-media-frame'),
796    cbMediaIcon = jQuery('.cb-entry-header, #cb-standard-featured, #cb-full-width-featured').find('.cb-media-icon'),
797    cbYouTubeMediaFrame = jQuery('#cb-media-frame').find('#cbplayer'),
798    cbVimeoFrame = cbMediaFrame.find('iframe[src^="//player.vimeo"]'),
799    cbSoundCloudFrame = cbMediaFrame.find('iframe[src^="https://w.so"]'),
800    cbYouTubeVideoID = jQuery('#cbplayer').text(),
801    cbYTPlayer;
802
803var tag = document.createElement('script');
804tag.src = "//www.youtube.com/iframe_api";
805var firstScriptTag = document.getElementsByTagName('script')[0];
806firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
807
808if ( cbSoundCloudFrame.length === 0 ) {
809    cbSoundCloudFrame = cbMediaFrame.find('iframe[src^="//www.mi"]');
810}
811
812function onYouTubeIframeAPIReady() {
813    cbYTPlayer = new YT.Player('cbplayer', {
814        height: '390',
815        width: '640',
816        videoId: cbYouTubeVideoID
817    });
818}
819
820function cbPlayYTVideo() {
821    cbYTPlayer.playVideo();
822};
823
824function cbPauseYTVideo() {
825    cbYTPlayer.pauseVideo();
826};
827
828if ( ( cbMobileTablet === false ) ) {
829
830    if ( cbYouTubeMediaFrame.length > 0 ) {
831
832        cbMediaIcon.on('click', cbPlayYTVideo);
833        cbMediaOverlay.on('click', cbPauseYTVideo);
834    }
835}
836
837var cbWindow = jQuery(window),
838    cbWindowWidth = cbWindow.width(),
839    cbTapDetect = jQuery('#cb-tap-detect'),
840    cbOuterContainer = jQuery('#cb-outer-container'),
841    cbSmallMenuEl = jQuery('#cb-small-menu.cb-sm-on'),
842    cbMenuOut = false,
843    cbHamburger = false;
844
845jQuery(function ($) {"use strict";
846
847    $.event.special.swipe.horizontalDistanceThreshold = Math.min( cbWindowWidth * 0.5, 160 );
848
849    if ( ( cbWindowWidth < 768 ) ) {
850            cbOuterContainer.addClass('cb-small-menu');
851
852            jQuery('#cb-small-menu-trigger').on( 'click tap', cbTapHamburger );
853            jQuery('#cb-small-menu-close').on( 'click tap', cbSwipeTapOffHandle );
854
855            if ( cbSmallMenuEl.length > 0 ) {
856                cbWindow.on( 'swiperight', cbSwipeRightHandle );
857                cbTapDetect.on( 'tap swipeleft touchend touchstart touchMove', cbSwipeTapOffHandle );
858            }
859
860    }
861
862    cbWindow.resize(function() {
863        if ( ( $( window ).width() < 768 ) ) {
864
865            cbOuterContainer.addClass('cb-small-menu');
866
867            jQuery('#cb-small-menu-trigger').on( 'click tap', cbTapHamburger );
868            jQuery('#cb-small-menu-close').on( 'click tap', cbSwipeTapOffHandle );
869
870            if ( cbSmallMenuEl.length > 0 ) {
871                cbWindow.on( 'swiperight', cbSwipeRightHandle );
872                cbTapDetect.on( 'tap swipeleft touchend touchstart touchMove', cbSwipeTapOffHandle );
873            }
874
875        } else {
876
877            cbOuterContainer.removeClass('cb-small-menu');
878
879        }
880
881    });
882
883});
884
885function cbSwipeRightHandle( event ){
886    cbTapDetect.show();
887    cbOuterContainer.attr('class','cb-small-menu cb-main-nav-on');
888    event.preventDefault();
889    cbMenuOut = true;
890}
891
892function cbTapHamburger( event ){
893    cbTapDetect.show();
894    cbOuterContainer.attr('class','cb-small-menu cb-main-nav-on');
895    event.preventDefault();
896    cbMenuOut = true;
897    cbHamburger = true;
898}
899
900function cbSwipeTapOffHandle( event ){
901    if ( ( cbMenuOut === true ) && ( cbHamburger === false ) ) {
902        cbTapDetect.hide();
903        cbOuterContainer.attr('class','cb-small-menu cb-main-nav-off').delay( 600 ).queue( function(){
904            jQuery(this).toggleClass('cb-repaint');
905            jQuery.dequeue( this );
906        });
907        event.preventDefault();
908        cbMenuOut = false;
909    }
910    cbHamburger = false;
911}
912
913/*! A fix for the iOS orientationchange zoom bug.
914 Script by @scottjehl, rebound by @wilto.
915 MIT License.
916*/
917(function(w){ "use strict";
918    // This fix addresses an iOS bug, so return early if the UA claims it's something else.
919    if( !( /iPhone|iPad|iPod/.test( navigator.platform ) && navigator.userAgent.indexOf( "AppleWebKit" ) > -1 ) ){ return; }
920    var doc = w.document;
921    if( !doc.querySelector ){ return; }
922    var meta = doc.querySelector( "meta[name=viewport]" ),
923        initialContent = meta && meta.getAttribute( "content" ),
924        disabledZoom = initialContent + ",maximum-scale=1",
925        enabledZoom = initialContent + ",maximum-scale=10",
926        enabled = true,
927        x, y, z, aig;
928    if( !meta ){ return; }
929    function restoreZoom(){
930        meta.setAttribute( "content", enabledZoom );
931        enabled = true; }
932    function disableZoom(){
933        meta.setAttribute( "content", disabledZoom );
934        enabled = false; }
935    function checkTilt( e ){
936        aig = e.accelerationIncludingGravity;
937        x = Math.abs( aig.x );
938        y = Math.abs( aig.y );
939        z = Math.abs( aig.z );
940        // If portrait orientation and in one of the danger zones
941        if( !w.orientation && ( x > 7 || ( ( z > 6 && y < 8 || z < 8 && y > 6 ) && x > 5 ) ) ){
942            if( enabled ){ disableZoom(); } }
943        else if( !enabled ){ restoreZoom(); } }
944    w.addEventListener( "orientationchange", restoreZoom, false );
945    w.addEventListener( "devicemotion", checkTilt, false );
946})( this );
947
948jQuery( window ).load( function() {
949
950    var cbBody = jQuery( 'body' );
951
952    cbBody.css('display', 'block');
953
954});

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.