PageSourceSearch

http://cedricbomford.com/wp-content/themes/kapena-wp/js/main.js?ver=471c8f4a1e9f37f1609c26c0f3800b0e

js cedricbomford.com collected 2026-10-05 01:13:41 UTC 7,100 bytes, 214 lines download raw bytes

1(function ($) {
2
3    "use strict";
4    var count = 1;
5    var currentPositionPosts = $(window).scrollTop();
6    fixPullquoteClass();
7
8    $(window).on('scroll', function () {
9        var scrollPosts = $(window).scrollTop();
10        if (scrollPosts > currentPositionPosts) { //Load only on scroll down
11            loadMorePostsItemsOnScroll();
12        }
13        currentPositionPosts = scrollPosts;
14    });
15
16//Fix for Default menu
17    $(".default-menu ul:first").addClass('sm sm-clean main-menu');
18
19//Set menu
20    $('.main-menu').smartmenus({
21        subMenusSubOffsetX: 1,
22        subMenusSubOffsetY: -8,
23        markCurrentTree: true
24    });
25
26    var $mainMenu = $('.main-menu').on('click', 'span.sub-arrow', function (e) {
27        var obj = $mainMenu.data('smartmenus');
28        if (obj.isCollapsible()) {
29            var $item = $(this).parent(),
30                    $sub = $item.parent().dataSM('sub');
31            $sub.dataSM('arrowClicked', true);
32        }
33    }).bind({
34        'beforeshow.smapi': function (e, menu) {
35            var obj = $mainMenu.data('smartmenus');
36            if (obj.isCollapsible()) {
37                var $menu = $(menu);
38                if (!$menu.dataSM('arrowClicked')) {
39                    return false;
40                }
41                $menu.removeDataSM('arrowClicked');
42            }
43        }
44    });
45
46    loadMoreArticleIndex();
47
48//Fix for No-Commnets
49    $("#comments").each(function () {
50        if ($.trim($(this).html()) === '')
51        {
52            $(this).remove();
53        }
54    });
55
56    $('.single-post .num-comments a, .single-portfolio .num-comments a').on('click', function (e) {
57        e.preventDefault();
58        $('html, body').animate({scrollTop: $(this.hash).offset().top}, 2000);
59        return false;
60    });
61
62//Blog show feature image
63    showFirstBlogPostFeatureImge();
64    showBlogPostFeatureImge();
65
66//Placeholder show/hide
67    $('input, textarea').on("focus", function () {
68        $(this).data('placeholder', $(this).attr('placeholder'));
69        $(this).attr('placeholder', '');
70    });
71    $('input, textarea').on("blur", function () {
72        $(this).attr('placeholder', $(this).data('placeholder'));
73    });
74
75//Fit Video
76    $(".site-wrapper").fitVids();
77
78//Show-Hide header sidebar
79    $('#toggle').on('click', multiClickFunctionStop);
80
81    $(window).on('load', function () {
82        // Animate the elemnt if is allready visible on load
83        animateElement();
84
85        //Fix for hash
86        var hash = location.hash;
87        if ((hash !== '') && ($(hash).length))
88        {
89            $('html, body').animate({scrollTop: $(hash).offset().top - 77}, 1);
90        }
91
92        $('.doc-loader').fadeOut(300);
93
94
95    });
96
97    $(window).on('scroll', function () {
98        animateElement();
99    });
100
101
102
103
104//------------------------------------------------------------------------
105//Helper Methods -->
106//------------------------------------------------------------------------
107
108
109    function animateElement(e) {
110        $(".animate").each(function (i) {
111            var top_of_object = $(this).offset().top;
112            var bottom_of_window = $(window).scrollTop() + $(window).height();
113            if ((bottom_of_window - 70) > top_of_object) {
114                $(this).addClass('show-it');
115            }
116        });
117    }
118
119
120    function multiClickFunctionStop(e) {
121        $('#toggle').off("click");
122        $('#toggle, .toggle-holder, body').toggleClass("on");
123        if ($('#toggle').hasClass("on"))
124        {
125            $('.menu-holder').addClass('show');
126            $('#toggle').on("click", multiClickFunctionStop);
127        } else
128        {
129            $('.menu-holder').removeClass('show');
130            $('#toggle').on("click", multiClickFunctionStop);
131        }
132    }
133
134    function loadMoreArticleIndex() {
135        if (parseInt(ajax_var.posts_per_page_index) < parseInt(ajax_var.total_index)) {
136            $('.more-posts').css('visibility', 'visible');
137            $('.more-posts').animate({opacity: 1}, 1500);
138        } else {
139            $('.more-posts').css('display', 'none');
140        }
141
142        $('.more-posts:visible').on('click', function () {
143            $('.more-posts').css('display', 'none');
144            $('.more-posts-loading').css('display', 'inline-block');
145            count++;
146            loadArticleIndex(count);
147        });
148    }
149
150    function loadArticleIndex(pageNumber) {
151        $.ajax({
152            url: ajax_var.url,
153            type: 'POST',
154            data: "action=infinite_scroll_index&page_no_index=" + pageNumber + '&loop_file_index=loop-index&security=' + ajax_var.nonce,
155            success: function (html) {
156                $('.blog-holder').imagesLoaded(function () {
157                    $(".blog-holder").append(html);
158                    setTimeout(function () {
159                        animateElement();
160                        showBlogPostFeatureImge();
161                        if (count == ajax_var.num_pages_index)
162                        {
163                            $('.more-posts').css('display', 'none');
164                            $('.more-posts-loading').css('display', 'none');
165                            $('.no-more-posts').css('display', 'inline-block');
166                        } else
167                        {
168                            $('.more-posts').css('display', 'inline-block');
169                            $('.more-posts-loading').css('display', 'none');
170                            $(".more-posts-index-holder").removeClass('stop-loading');
171                        }
172                    }, 100);
173                });
174            }
175        });
176        return false;
177    }
178
179    function loadMorePostsItemsOnScroll(e) {
180        $(".more-posts-index-holder.scroll").not('.stop-loading').each(function (i) {
181            var top_of_object = $(this).offset().top;
182            var bottom_of_window = $(window).scrollTop() + $(window).height();
183            if ((bottom_of_window - 170) > top_of_object) {
184                $(this).addClass('stop-loading');
185                count++;
186                loadArticleIndex(count);
187                if (count <= ajax_var.num_pages_index)
188                {
189                    $('.more-posts-loading').css('display', 'inline-block');
190                }
191            }
192        });
193    }
194
195    function showFirstBlogPostFeatureImge() {
196        $(".blog-item-holder .entry-holder").first().addClass('active-post');
197    }
198
199    function showBlogPostFeatureImge() {
200        $(".blog-item-holder .entry-holder").on('mouseover', function () {
201            $(".blog-item-holder .entry-holder").removeClass('active-post');
202            $(this).addClass('active-post');
203        });
204    }
205
206    function fixPullquoteClass() {
207        $("figure.wp-block-pullquote").find('blockquote').first().addClass('cocobasic-block-pullquote');
208    }
209
210    function is_touch_device() {
211        return !!('ontouchstart' in window);
212    }
213
214})(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.