PageSourceSearch

https://lapressclub.org/wp-content/themes/supermag/assets/js/supermag-custom.js?ver=1.4.0

js lapressclub.org collected 2026-10-02 06:49:48 UTC 18,524 bytes, 536 lines download raw bytes

1/*slick nav start*/
2/*!
3 SlickNav Responsive Mobile Menu v1.0.0.1
4 (c) 2014 Josh Cope
5 licensed under MIT
6 */
7;(function ($, document, window) {
8    var
9    // default settings object.
10        defaults = {
11            label: 'MENU',
12            duplicate: true,
13            duration: 10,
14            easingOpen: 'swing',
15            easingClose: 'swing',
16            closedSymbol: '►',
17            openedSymbol: '▼',
18            prependTo: 'body',
19            parentTag: 'a',
20            closeOnClick: false,
21            allowParentLinks: false,
22            nestedParentLinks: true,
23            showChildren: false,
24            init: function () {},
25            open: function () {},
26            close: function () {}
27        },
28        mobileMenu = 'slicknav',
29        prefix = 'slicknav';
30
31    function Plugin(element, options) {
32        this.element = element;
33
34        // jQuery has an extend method which merges the contents of two or
35        // more objects, storing the result in the first object. The first object
36        // is generally empty as we don't want to alter the default options for
37        // future instances of the plugin
38        this.settings = $.extend({}, defaults, options);
39
40        this._defaults = defaults;
41        this._name = mobileMenu;
42
43        this.init();
44    }
45
46    Plugin.prototype.init = function () {
47        var $this = this,
48            menu = $(this.element),
49            settings = this.settings,
50            iconClass,
51            menuBar;
52
53        // clone menu if needed
54        if (settings.duplicate) {
55            $this.mobileNav = menu.clone();
56            //remove ids from clone to prevent css issues
57            $this.mobileNav.removeAttr('id');
58            $this.mobileNav.find('*').each(function (i, e) {
59                $(e).removeAttr('id');
60            });
61        } else {
62            $this.mobileNav = menu;
63        }
64
65        // styling class for the button
66        iconClass = prefix + '_icon';
67
68        if (settings.label === '') {
69            iconClass += ' ' + prefix + '_no-text';
70        }
71
72        if (settings.parentTag == 'a') {
73            settings.parentTag = 'a href="#"';
74        }
75
76        // create menu bar
77        $this.mobileNav.attr('class', prefix + '_nav');
78        menuBar = $('<div class="' + prefix + '_menu"></div>');
79        $this.btn = $(
80            ['<' + settings.parentTag + ' aria-haspopup="true" tabindex="0" class="' + prefix + '_btn ' + prefix + '_collapsed">',
81                '<span class="' + prefix + '_menutxt">' + settings.label + '</span>',
82                '<span class="' + iconClass + '">',
83                '<span class="' + prefix + '_icon-bar"></span>',
84                '<span class="' + prefix + '_icon-bar"></span>',
85                '<span class="' + prefix + '_icon-bar"></span>',
86                '</span>',
87                '</' + settings.parentTag + '>'
88            ].join('')
89        );
90        $(menuBar).append($this.btn);
91        $(settings.prependTo).prepend(menuBar);
92        menuBar.append($this.mobileNav);
93
94        // iterate over structure adding additional structure
95        var items = $this.mobileNav.find('li');
96        $(items).each(function () {
97            var item = $(this),
98                data = {};
99            data.children = item.children('ul').attr('role', 'menu');
100            item.data('menu', data);
101
102            // if a list item has a nested menu
103            if (data.children.length > 0) {
104
105                // select all text before the child menu
106                // check for anchors
107
108                var a = item.contents(),
109                    containsAnchor = false;
110                nodes = [];
111
112                $(a).each(function () {
113                    if (!$(this).is('ul')) {
114                        nodes.push(this);
115                    } else {
116                        return false;
117                    }
118
119                    if($(this).is("a")) {
120                        containsAnchor = true;
121                    }
122                });
123
124                var wrapElement = $(
125                    '<' + settings.parentTag + ' role="menuitem" aria-haspopup="true" tabindex="-1" class="' + prefix + '_item"/>'
126                );
127
128                // wrap item text with tag and add classes unless we are separating parent links
129                if ((!settings.allowParentLinks || settings.nestedParentLinks) || !containsAnchor) {
130                    var $wrap = $(nodes).wrapAll(wrapElement).parent();
131                    $wrap.addClass(prefix+'_row');
132                } else
133                    $(nodes).wrapAll('<span class="'+prefix+'_parent-link '+prefix+'_row"/>').parent();
134
135                item.addClass(prefix+'_collapsed');
136                item.addClass(prefix+'_parent');
137
138                // create parent arrow. wrap with link if parent links and separating
139                var arrowElement = $('<span class="'+prefix+'_arrow">'+settings.closedSymbol+'</span>');
140
vendor: 4,401 bytes, lines 141-269
141                if (settings.allowParentLinks && !settings.nestedParentLinks && containsAnchor)
142                    arrowElement = arrowElement.wrap(wrapElement).parent();
143
144                //append arrow
145                $(nodes).last().after(arrowElement);
146
147
148            } else if ( item.children().length === 0) {
149                item.addClass(prefix+'_txtnode');
150            }
151
152            // accessibility for links
153            item.children('a').attr('role', 'menuitem').click(function(event){
154                //Ensure that it's not a parent
155                if (settings.closeOnClick && !$(event.target).parent().closest('li').hasClass(prefix+'_parent')) {
156                    //Emulate menu close if set
157                    $($this.btn).click();
158                }
159            });
160
161            //also close on click if parent links are set
162            if (settings.closeOnClick && settings.allowParentLinks) {
163                item.children('a').children('a').click(function (event) {
164                    //Emulate menu close
165                    $($this.btn).click();
166                });
167
168                item.find('.'+prefix+'_parent-link a:not(.'+prefix+'_item)').click(function(event){
169                    //Emulate menu close
170                    $($this.btn).click();
171                });
172            }
173        });
174
175        // structure is in place, now hide appropriate items
176        $(items).each(function () {
177            var data = $(this).data('menu');
178            if (!settings.showChildren){
179                $this._visibilityToggle(data.children, null, false, null, true);
180            }
181        });
182
183        // finally toggle entire menu
184        $this._visibilityToggle($this.mobileNav, null, false, 'init', true);
185
186        // accessibility for menu button
187        $this.mobileNav.attr('role','menu');
188
189        // outline prevention when using mouse
190        $(document).mousedown(function(){
191            $this._outlines(false);
192        });
193
194        $(document).keyup(function(){
195            $this._outlines(true);
196        });
197
198        // menu button click
199        $($this.btn).click(function (e) {
200            e.preventDefault();
201            $this._menuToggle();
202        });
203
204        // click on menu parent
205        $this.mobileNav.on('click', '.' + prefix + '_item', function (e) {
206            e.preventDefault();
207            $this._itemClick($(this));
208        });
209
210        // check for enter key on menu button and menu parents
211        $($this.btn).keydown(function (e) {
212            var ev = e || event;
213            if(ev.keyCode == 13) {
214                e.preventDefault();
215                $this._menuToggle();
216            }
217        });
218
219        $this.mobileNav.on('keydown', '.'+prefix+'_item', function(e) {
220            var ev = e || event;
221            if(ev.keyCode == 13) {
222                e.preventDefault();
223                $this._itemClick($(e.target));
224            }
225        });
226
227        // allow links clickable within parent tags if set
228        if (settings.allowParentLinks && settings.nestedParentLinks) {
229            $('.'+prefix+'_item a').click(function(e){
230                e.stopImmediatePropagation();
231            });
232        }
233    };
234
235    //toggle menu
236    Plugin.prototype._menuToggle = function (el) {
237        var $this = this;
238        var btn = $this.btn;
239        var mobileNav = $this.mobileNav;
240
241        if (btn.hasClass(prefix+'_collapsed')) {
242            btn.removeClass(prefix+'_collapsed');
243            btn.addClass(prefix+'_open');
244        } else {
245            btn.removeClass(prefix+'_open');
246            btn.addClass(prefix+'_collapsed');
247        }
248        btn.addClass(prefix+'_animating');
249        $this._visibilityToggle(mobileNav, btn.parent(), true, btn);
250    };
251
252    // toggle clicked items
253    Plugin.prototype._itemClick = function (el) {
254        var $this = this;
255        var settings = $this.settings;
256        var data = el.data('menu');
257        if (!data) {
258            data = {};
259            data.arrow = el.children('.'+prefix+'_arrow');
260            data.ul = el.next('ul');
261            data.parent = el.parent();
262            //Separated parent link structure
263            if (data.parent.hasClass(prefix+'_parent-link')) {
264                data.parent = el.parent().parent();
265                data.ul = el.parent().next('ul');
266            }
267            el.data('menu', data);
268        }
269        if (data.parent.hasClass(prefix+'_collapsed')) {
270            data.arrow.html(settings.openedSymbol);
271            data.parent.removeClass(prefix+'_collapsed');
272            data.parent.addClass(prefix+'_open');
273            data.parent.addClass(prefix+'_animating');
274            $this._visibilityToggle(data.ul, data.parent, true, el);
275        } else {
276            data.arrow.html(settings.closedSymbol);
277            data.parent.addClass(prefix+'_collapsed');
278            data.parent.removeClass(prefix+'_open');
279            data.parent.addClass(prefix+'_animating');
280            $this._visibilityToggle(data.ul, data.parent, true, el);
281        }
282    };
283
284    // toggle actual visibility and accessibility tags
285    Plugin.prototype._visibilityToggle = function(el, parent, animate, trigger, init) {
286        var $this = this;
287        var settings = $this.settings;
288        var items = $this._getActionItems(el);
289        var duration = 0;
290        if (animate) {
291            duration = settings.duration;
292        }
293
294        if (el.hasClass(prefix+'_hidden')) {
295            el.removeClass(prefix+'_hidden');
296            el.slideDown(duration, settings.easingOpen, function(){
297
298                $(trigger).removeClass(prefix+'_animating');
299                $(parent).removeClass(prefix+'_animating');
300
301                //Fire open callback
302                if (!init) {
303                    settings.open(trigger);
304                }
305            });
306            el.attr('aria-hidden','false');
307            items.attr('tabindex', '0');
308            $this._setVisAttr(el, false);
309        } else {
310            el.addClass(prefix+'_hidden');
311            el.slideUp(duration, this.settings.easingClose, function() {
312                el.attr('aria-hidden','true');
313                items.attr('tabindex', '-1');
314                $this._setVisAttr(el, true);
315                el.hide(); //jQuery 1.7 bug fix
316
317                $(trigger).removeClass(prefix+'_animating');
318                $(parent).removeClass(prefix+'_animating');
319
320                //Fire init or close callback
321                if (!init){
322                    settings.close(trigger);
323                }
324                else if (trigger == 'init'){
325                    settings.init();
326                }
327            });
328        }
329    };
330
331    // set attributes of element and children based on visibility
332    Plugin.prototype._setVisAttr = function(el, hidden) {
333        var $this = this;
334
335        // select all parents that aren't hidden
336        var nonHidden = el.children('li').children('ul').not('.'+prefix+'_hidden');
337
338        // iterate over all items setting appropriate tags
339        if (!hidden) {
340            nonHidden.each(function(){
341                var ul = $(this);
342                ul.attr('aria-hidden','false');
343                var items = $this._getActionItems(ul);
344                items.attr('tabindex', '0');
345                $this._setVisAttr(ul, hidden);
346            });
347        } else {
348            nonHidden.each(function(){
349                var ul = $(this);
350                ul.attr('aria-hidden','true');
351                var items = $this._getActionItems(ul);
352                items.attr('tabindex', '-1');
353                $this._setVisAttr(ul, hidden);
354            });
355        }
356    };
357
358    // get all 1st level items that are clickable
359    Plugin.prototype._getActionItems = function(el) {
360        var data = el.data("menu");
361        if (!data) {
362            data = {};
363            var items = el.children('li');
364            var anchors = items.find('a');
365            data.links = anchors.add(items.find('.'+prefix+'_item'));
366            el.data('menu', data);
367        }
368        return data.links;
369    };
370
371    Plugin.prototype._outlines = function(state) {
372        if (!state) {
373            $('.'+prefix+'_item, .'+prefix+'_btn').css('outline','none');
374        } else {
375            $('.'+prefix+'_item, .'+prefix+'_btn').css('outline','');
376        }
377    };
378
379    Plugin.prototype.toggle = function(){
380        var $this = this;
381        $this._menuToggle();
382    };
383
384    Plugin.prototype.open = function(){
385        var $this = this;
386        if ($this.btn.hasClass(prefix+'_collapsed')) {
387            $this._menuToggle();
388        }
389    };
390
391    Plugin.prototype.close = function(){
392        var $this = this;
393        if ($this.btn.hasClass(prefix+'_open')) {
394            $this._menuToggle();
395        }
396    };
397
398    $.fn[mobileMenu] = function ( options ) {
399        var args = arguments;
400
401        // Is the first parameter an object (options), or was omitted, instantiate a new instance
402        if (options === undefined || typeof options === 'object') {
403            return this.each(function () {
404
405                // Only allow the plugin to be instantiated once due to methods
406                if (!$.data(this, 'plugin_' + mobileMenu)) {
407
408                    // if it has no instance, create a new one, pass options to our plugin constructor,
409                    // and store the plugin instance in the elements jQuery data object.
410                    $.data(this, 'plugin_' + mobileMenu, new Plugin( this, options ));
411                }
412            });
413
414            // If is a string and doesn't start with an underscore or 'init' function, treat this as a call to a public method.
415        } else if (typeof options === 'string' && options[0] !== '_' && options !== 'init') {
416
417            // Cache the method call to make it possible to return a value
418            var returns;
419
420            this.each(function () {
421                var instance = $.data(this, 'plugin_' + mobileMenu);
422
423                // Tests that there's already a plugin-instance and checks that the requested public method exists
424                if (instance instanceof Plugin && typeof instance[options] === 'function') {
425
426                    // Call the method of our plugin instance, and pass it the supplied arguments.
427                    returns = instance[options].apply( instance, Array.prototype.slice.call( args, 1 ) );
428                }
429            });
430
431            // If the earlier cached method gives a value back return the value, otherwise return this to preserve chainability.
432            return returns !== undefined ? returns : this;
433        }
434    };
435}(jQuery, document, window));
436
437/*slick nav end*/
438
439jQuery(document).ready(function($) {
440    //Sticky Sidebar
441    if($('body').hasClass('at-sticky-sidebar')){
442        if($('body').hasClass('both-sidebar')){
443            $('#primary-wrap, #secondary-right, #secondary-left').theiaStickySidebar();
444        }
445        else{
446            $('.secondary-sidebar, #primary').theiaStickySidebar();
447        }
448    }
449
450    $('.header-wrapper .menu').slicknav({
451        allowParentLinks :true,
452        duration: 800,
453        prependTo: '.header-wrapper .responsive-slick-menu',
454        'closedSymbol': '<i class="fa fa-angle-down"></i>',
455        'openedSymbol': '<i class="fa fa-angle-up"></i>'
456    });
457
458    /*sticky menu*/
459    var menu_sticky_height = $('#masthead').height() - $('#site-navigation').height();
460
461    function supermag_enable_sticky_menu( ) {
462        if($(this).width() > 991 ){
463            if ( $(this).scrollTop() > menu_sticky_height) {
464                var wrapper_width = $('#page').width();
465                var supermag_enable_sticky_menu = $('.supermag-enable-sticky-menu');
466                supermag_enable_sticky_menu.css({"position": "fixed", "right": "0","left": "0","top": "0","z-index":'999'});
467                supermag_enable_sticky_menu.width(wrapper_width);
468
469            }
470            else {
471                $('.supermag-enable-sticky-menu').removeAttr( 'style' );
472            }
473        }
474        else{
475            $('.supermag-enable-sticky-menu').removeAttr( 'style' );
476        }
477    }
478    supermag_enable_sticky_menu();
479    $(window).scroll(function(){
480        supermag_enable_sticky_menu();
481    });
482    $(window).resize(function(){
483        supermag_enable_sticky_menu();
484    });
485    /*featured slider*/
486    jQuery('.home-bxslider').show().bxSlider({
487        speed: 1000,
488        auto: true,
489        controls: true,
490        pager: false,
491        autoHover : true,
492        nextText: '<i class="fa fa-angle-right"></i>',
493        prevText: '<i class="fa fa-angle-left"></i>'
494    });
495    // ticker
496    $('.bn').show().bxSlider({
497        minSlides: 1,
498        maxSlides: 1,
499        slideWidth: $(this).parent().width(),
500        slideMargin: 10,
501        ticker: true,
502        tickerHover: true,
503        speed: 15000
504    });
505
506    // ticker
507    $('.duper-bn').show().bxSlider({
508        speed: 500,
509        auto: true,
510        controls: false,
511        pager: false,
512        autoHover : true,
513        mode:'fade'
514    });
515
516    //for menu
517     $('.header-wrapper #site-navigation .menu-main-menu-container').addClass('clearfix');
518
519    /*search*/
520    $('.search-icon-menu').click(function(e){
521        e.preventDefault();
522        $('.menu-search-toggle').fadeToggle();
523    });
524    
525    jQuery('.menu-item-has-children > a').click(function(){
526        var at_this = jQuery(this);
527        if( at_this.hasClass('at-clicked')){
528            return true;
529        }
530        var at_width = jQuery(window).width();
531        if( at_width > 992 && at_width <= 1230 ){
532            at_this.addClass('at-clicked');
533            return false;
534        }
535    });
536});

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.