PageSourceSearch

https://www.gpp.pt/templates/shaper_newedge/js/main.js

js gpp.pt collected 2026-10-02 04:09:38 UTC 8,169 bytes, 250 lines download raw bytes

1/**
2 * @package Helix3 Framework
3 * @author JoomShaper http://www.joomshaper.com
4 * @copyright Copyright (c) 2010 - 2015 JoomShaper
5 * @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 or later
6 */
7jQuery(function($) {
8
9    $('#offcanvas-toggler').on('click', function(event) {
10        event.preventDefault();
11        $('body').addClass('offcanvas');
12    });
13
14    $('<div class="offcanvas-overlay"></div>').insertBefore('.body-innerwrapper > .offcanvas-menu');
15
16    //$('.offcanvas-menu').append( '<div class="offcanvas-overlay"></div>' );
17
18    $('.close-offcanvas, .offcanvas-overlay').on('click', function(event) {
19        event.preventDefault();
20        $('body').removeClass('offcanvas');
21    });
22
23    // sticky menu move in responsive
24    //Sticky Menu
25    var windowWidth = $(window).width();
26    if (windowWidth < 992) {
27        $("#sp-logo").prependTo("#sp-main-menu .row");
28    }
29
30    // nanoscroller
31    (function() {
32        if ($(".nano").length) {
33            $(".nano").nanoScroller({
34                flash: true
35            });
36        }
37    }).call(this);
38
39    //Mega Menu
40    $('.sp-megamenu-wrapper').parent().parent().css('position', 'static').parent().css('position', 'relative');
41    $('.sp-menu-full').each(function() {
42        $(this).parent().addClass('menu-justify');
43    });
44    //Sticky Menu
45    $(document).ready(function() {
46        $("body.sticky-header").find('#sp-main-menu').sticky({ topSpacing: 0 })
47    });
48
49    //Search
50    $(".icon-search.top-icon").on('click', function() {
51        $(".searchwrapper").fadeIn(200);
52    });
53
54    $("#search_close").on('click', function() {
55        $(".searchwrapper").fadeOut(200);
56    });
57
58
59    // Has carousel category page
60    if ($("#art-leading-carousel").length) {
61
62        // Get carousel id
63        var $artLeadCarousel = $("#art-leading-carousel");
64        // carrousel
65        $artLeadCarousel.carousel();
66        // Prev
67        $(".left.art-control").click(function() {
68            $artLeadCarousel.carousel('prev');
69        });
70
71        // Prev
72        $(".right.art-control").click(function() {
73            $artLeadCarousel.carousel('next');
74        });
75    }
76
77    // Has carousel home and text variation page gellary
78    if ($('#carousel').is('.flexslider')) {
79
80        // Thumb Gallery
81        var $sppbTgOptions = $('.sppb-tg-slider');
82
83        // Autoplay
84        var $autoplay = $sppbTgOptions.data('sppb-tg-autoplay');
85        //if ($autoplay == 'true') { var $autoplay = true; } else { var $autoplay = false};
86
87        // arrows
88        var $arrows = $sppbTgOptions.data('sppb-tg-arrows');
89        //if ($arrows == 'true') { var $arrows = true; } else { var $arrows = false};
90
91        $(window).load(function() {
92            $('#carousel').flexslider({
93                animation: 'slide',
94                controlNav: false,
95                directionNav: $arrows,
96                animationLoop: false,
97                slideshow: $autoplay,
98                minItems: 5,
99                move: 1,
100                itemWidth: 129,
101                itemMargin: 15,
102                asNavFor: '#slider'
103            });
104
105            $('#slider').flexslider({
106                animation: "fade",
107                controlNav: false,
108                directionNav: $arrows,
109                animationLoop: false,
110                slideshow: $autoplay,
111                sync: "#carousel"
112            });
113        });
114
115    }; // END:: has carousel
116
117    // has social share
118    if ($(".sppb-post-share-social").length || $(".newedge-social-share-icon").length) {
119        // social share
120        $('.prettySocial').prettySocial();
121    };
122
123
124    $(document).ready(function() {
125        var shareUrl = 'http://joomshaper.com';
126        $.getJSON('http://share-count.appspot.com/?url=' + encodeURIComponent(shareUrl) + "&callback=?", function(data) {
127            shares = data.shares;
128            $(".count").each(function(index, el) {
129                service = $(el).parents(".share-btn").attr("data-service");
130                count = shares[service];
131                if (count > 1000) {
132                    count = (count / 1000).toFixed(1);
133                    if (count > 1000) count = (count / 1000).toFixed(1) + "M";
134                    else count = count + "k";
135                }
136                $(el).html(count);
137            });
138        });
139    });
140
141
142    //Tooltip
143    $('[data-toggle="tooltip"]').tooltip();
144
145    $(document).on('click', '.sp-rating .star', function(event) {
146        event.preventDefault();
147
148        var data = {
149            'action': 'voting',
150            'user_rating': $(this).data('number'),
151            'id': $(this).closest('.post_rating').attr('id')
152        };
153
154        var request = {
155            'option': 'com_ajax',
156            'plugin': 'helix3',
157            'data': data,
158            'format': 'json'
159        };
160
161        $.ajax({
162            type: 'POST',
163            data: request,
164            beforeSend: function() {
165                $('.post_rating .ajax-loader').show();
166            },
167            success: function(response) {
168                var data = $.parseJSON(response.data);
169
170                $('.post_rating .ajax-loader').hide();
171
172                if (data.status == 'invalid') {
173                    $('.post_rating .voting-result').text('You have already rated this entry!').fadeIn('fast');
174                } else if (data.status == 'false') {
175                    $('.post_rating .voting-result').text('Somethings wrong here, try again!').fadeIn('fast');
176                } else if (data.status == 'true') {
177                    var rate = data.action;
178                    $('.voting-symbol').find('.star').each(function(i) {
179                        if (i < rate) {
180                            $(".star").eq(-(i + 1)).addClass('active');
181                        }
182                    });
183
184                    $('.post_rating .voting-result').text('Thank You!').fadeIn('fast');
185                }
186
187            },
188            error: function() {
189                $('.post_rating .ajax-loader').hide();
190                $('.post_rating .voting-result').text('Failed to rate, try again!').fadeIn('fast');
191            }
192        });
193    });
194
195    var observer = new MutationObserver(function(mutations) {
196        mutations.forEach(function(mutation) {
197            var newNodes = mutation.addedNodes;
198            if (newNodes !== null) {
199                var $nodes = $(newNodes);
200
201                $nodes.each(function() {
202                    var $node = $(this);
203                    $node.find('#carousel.flexslider').each(function() {
204                        // Thumb Gallery
205                        var $sppbTgOptions = $('.sppb-tg-slider');
206
207                        // Autoplay
208                        var $autoplay = $sppbTgOptions.data('sppb-tg-autoplay');
209                        //if ($autoplay == 'true') { var $autoplay = true; } else { var $autoplay = false};
210
211                        // arrows
212                        var $arrows = $sppbTgOptions.data('sppb-tg-arrows');
213
214                        $('#carousel').flexslider({
215                            animation: 'slide',
216                            controlNav: false,
217                            directionNav: $arrows,
218                            animationLoop: false,
219                            slideshow: $autoplay,
220                            minItems: 5,
221                            move: 1,
222                            itemWidth: 129,
223                            itemMargin: 15,
224                            asNavFor: '#slider'
225                        });
226
227                        $('#slider').flexslider({
228                            animation: "fade",
229                            controlNav: false,
230                            directionNav: $arrows,
231                            animationLoop: false,
232                            slideshow: $autoplay,
233                            sync: "#carousel"
234                        });
235
236                    });
237                });
238            }
239        });
240    });
241
242    var config = {
243        childList: true,
244        subtree: true
245    };
246
247    // Pass in the target node, as well as the observer options
248    observer.observe(document.body, config);
249
250});

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.