PageSourceSearch

https://newwokmaster.com/assets/js/custom.js

js newwokmaster.com collected 2026-10-02 01:37:30 UTC 26,762 bytes, 684 lines download raw bytes

1(function ($) {
2    "use strict";
3    var osru = {
4        initialize: function () {
5            //this.imgLoaded();
6            this.tabHover();
7            this.navHover();
8            this.fullSkinSearch();
9            this.masonrySlide();
10            //this.toTop();
11            //this.instagram();
12            //this.newsTicker();
13            //this.blogSlide();
14            //this.accordion();
15            //this.gallery();
16            //this.popupGallery();
17            this.fixedFooter();
18            //this.parallax();
19            this.stickySidebar();
20            //this.postSlider();
21            //this.postCarousel();
22            //this.videoSlider();
23            this.pageLoader();
24            //this.imgfluidbox();
25            this.socialShare();
26            //this.youtubeVideo();
27            //this.fbLikeBox();
28        },
29// -------------------------------------------------------------------------- //
30// Page Loader Animsition
31// -------------------------------------------------------------------------- //
32        imgLoaded: function () {
33            //$('body').imagesLoaded(function () {
34                // images have loaded
35            //});
36        },
37// -------------------------------------------------------------------------- //
38// Tab Hover
39// -------------------------------------------------------------------------- //
40        tabHover: function () {
41            $(document).off('click.bs.tab.data-api', '[data-hover="tab"]');
42            $(document).on('mouseenter.bs.tab.data-api', '[data-toggle="tab"], [data-hover="tab"]', function () {
43                $(this).tab('show');
44            });
45        },
46// -------------------------------------------------------------------------- //
47// Nav Hover
48// -------------------------------------------------------------------------- //      
49        navHover: function () {
50            var b = "navFadeInUp";
51            var c;
52            var a;
53            d($(".menu-tabs a"), $(".menu-tab-content"));
54            function d(e, f, g) {
55                e.hover(function (i) {
56                    i.preventDefault();
57                    $(this).tab("show");
58                    var h = $(this).data("easein");
59                    if (c) {
60                        c.removeClass(a);
61                    }
62                    if (h) {
63                        f.find("div.active").addClass("animated " + h);
64                        a = h;
65                    } else {
66                        if (g) {
67                            f.find("div.active").addClass("animated " + g);
68                            a = g;
69                        } else {
70                            f.find("div.active").addClass("animated " + b);
71                            a = b;
72                        }
73                    }
74                    c = f.find("div.active");
75                });
76            }
77            $("a[rel=popover]")
78                    .popover()
79                    .on('click', function (f) {
80                        f.preventDefault();
81                        if ($(this).data("easein") !== undefined) {
82                            $(this)
83                                    .next()
84                                    .removeClass($(this).data("easein"))
85                                    .addClass("animated " + $(this).data("easein"));
86                        } else {
87                            $(this)
88                                    .next()
89                                    .addClass("animated " + b);
90                        }
91                    });
92        },
93// -------------------------------------------------------------------------- //
94// Full Skin Search
95// -------------------------------------------------------------------------- //
96        fullSkinSearch: function () {
97            var openCtrl1 = document.getElementById('btn-search1'),
98                    openCtrl2 = document.getElementById('btn-search22'),
99                    closeCtrl = document.getElementById('btn-search-close'),
100                    searchContainer = document.querySelector('.search'),
101                    inputSearch = searchContainer.querySelector('.search__input');
102                    
103			
104						
105            function init() {
106	            if (openCtrl1 && openCtrl2 && closeCtrl){
107               		 initEvents();
108                }
109            }
110            
111
112            function initEvents() {
113	            
114	            
115	            openCtrl1.addEventListener('click', openSearch);
116                openCtrl2.addEventListener('click', openSearch);
117                closeCtrl.addEventListener('click', closeSearch);
118                document.addEventListener('keyup', function (ev) {
119                    // escape key.
120                    if (ev.keyCode === 27) {
121                        closeSearch();
122                    }
123                });
124	           
125               
126            }
127
128            function openSearch() {
129                searchContainer.classList.add('search--open');
130                //inputSearch.focus();
131                $('#gsc-iw-id1').removeClass('gsc-input-box');
132				$('#gsc-i-id1').addClass('search__input');
133				$('#gsc-i-id1').focus();
134				$('#gsc-i-id1').attr("placeholder", "请输入关键字");
135            }
136
137            function closeSearch() {
138                searchContainer.classList.remove('search--open');
139                //inputSearch.blur();
140                //inputSearch.value = '';
141            }
142
143            init();
144        },
145// -------------------------------------------------------------------------- //
146// Masonry Slide
147// -------------------------------------------------------------------------- //  
148        masonrySlide: function () {
149            $(".masonry-slide1").owlCarousel({
150                autoPlay: 4000, //Set AutoPlay
151                navigation: false, // Show next and prev buttons
152                slideSpeed: 300,
153                paginationSpeed: 400,
154                singleItem: true
155            });
156            $(".masonry-slide2").owlCarousel({
157                autoPlay: 4500, //Set AutoPlay
158                navigation: false, // Show next and prev buttons
159                slideSpeed: 300,
160                paginationSpeed: 400,
161                singleItem: true
162            });
163            $(".masonry-slide3").owlCarousel({
164                autoPlay: 5000, //Set AutoPlay
165                navigation: false, // Show next and prev buttons
166                slideSpeed: 300,
167                paginationSpeed: 400,
168                singleItem: true
169            });
170            $(".masonry-slide4").owlCarousel({
171                autoPlay: 5500, //Set AutoPlay
172                navigation: false, // Show next and prev buttons
173                slideSpeed: 300,
174                paginationSpeed: 400,
175                singleItem: true
176            });
177        },
178// -------------------------------------------------------------------------- //
179// Back to top
180// -------------------------------------------------------------------------- //  
181        toTop: function () {
182            $('body').append('<div id="toTop" class="btn btn-top btn-lg"><span class="ti-arrow-up"></span></div>');
183            $(window).scroll(function () {
184                if ($(this).scrollTop() !== 0) {
185                    $('#toTop').fadeIn();
186                } else {
187                    $('#toTop').fadeOut();
188                }
189            });
190            $('#toTop').on('click', function () {
191                $("html, body").animate({scrollTop: 0}, 100);
192                return false;
193            });
194        },
195// -------------------------------------------------------------------------- //
196// Instagram
197// -------------------------------------------------------------------------- //
198        instagram: function () {
199            $('#ri-grid').gridrotator({
200                rows: 1,
201                columns: 8,
202                animType: 'fadeInOut',
203                animSpeed: 1000,
204                step: 1,
205                w1024: {
206                    rows: 1,
207                    columns: 7
208                },
209                w768: {
210                    rows: 1,
211                    columns: 5
212                },
213                w480: {
214                    rows: 2,
215                    columns: 3
216                },
217                w320: {
218                    rows: 2,
219                    columns: 3
220                },
221                w240: {
222                    rows: 2,
223                    columns: 3
224                }
225            });
226        },
227// -------------------------------------------------------------------------- //
228// NewsTicker
229// -------------------------------------------------------------------------- //
230        newsTicker: function () {
231            var owl = $("#newsTicker");
232            owl.owlCarousel({
233                autoPlay: 5000, //Set AutoPlay to 5 seconds
234                singleItem: true,
235                transitionStyle: "goDown",
236                pagination: false,
237                navigation: true,
238                navigationText: [
239                    "<i class='fa fa-angle-left'></i>",
240                    "<i class='fa fa-angle-right'></i>"
241                ]
242            });
243        },
244// -------------------------------------------------------------------------- //
245// Blog Slide
246// -------------------------------------------------------------------------- //
247        blogSlide: function () {
248            var time = 7; // time in seconds
249            var $progressBar,
250                    $bar,
251                    $elem,
252                    isPause,
253                    tick,
254                    percentTime;
255
256            //Init the carousel
257            $("#blog-slide").owlCarousel({
258                slideSpeed: 500,
259                paginationSpeed: 500,
260                singleItem: true,
261                transitionStyle: "fade",
262                pagination: false,
263                dots: false,
264                navigation: true,
265                navigationText: [
266                    "<i class='ti-angle-left'></i>",
267                    "<i class='ti-angle-right'></i>"
268                ],
269                afterInit: progressBar,
270                afterMove: moved,
271                startDragging: pauseOnDragging
272            });
273            //Init progressBar where elem is $("#owl-demo")
274            function progressBar(elem) {
275                $elem = elem;
276                //build progress bar elements
277                buildProgressBar();
278                //start counting
279                start();
280            }
281            //create div#progressBar and div#bar then prepend to $("#owl-demo")
282            function buildProgressBar() {
283                $progressBar = $("<div>", {
284                    id: "progressBar"
285                });
286                $bar = $("<div>", {
287                    id: "bar"
288                });
289                $progressBar.append($bar).prependTo($elem);
290            }
291            function start() {
292                //reset timer
293                percentTime = 0;
294                isPause = false;
295                //run interval every 0.01 second
296                tick = setInterval(interval, 10);
297            }
298            function interval() {
299                if (isPause === false) {
300                    percentTime += 1 / time;
301                    $bar.css({
302                        width: percentTime + "%"
303                    });
304                    //if percentTime is equal or greater than 100
305                    if (percentTime >= 100) {
306                        //slide to next item 
307                        $elem.trigger('owl.next');
308                    }
309                }
310            }
311            //pause while dragging 
312            function pauseOnDragging() {
313                isPause = true;
314            }
315            //moved callback
316            function moved() {
317                //clear interval
318                clearTimeout(tick);
319                //start again
320                start();
321            }
322        },
323// -------------------------------------------------------------------------- //
324// Accordion
325// -------------------------------------------------------------------------- //   
326        accordion: function () {
327            $('.accordion > li:eq(0) a').addClass('active').next().slideDown();
328            $('.accordion a').on('click', function (j) {
329                var dropDown = $(this).closest('li').find('p');
330
331                $(this).closest('.accordion').find('p').not(dropDown).slideUp();
332
333                if ($(this).hasClass('active')) {
334                    $(this).removeClass('active');
335                } else {
336                    $(this).closest('.accordion').find('a.active').removeClass('active');
337                    $(this).addClass('active');
338                }
339
340                dropDown.stop(false, true).slideToggle();
341
342                j.preventDefault();
343            });
344        },
345// -------------------------------------------------------------------------- //
346// Gallery
347// -------------------------------------------------------------------------- //
348        gallery: function () {
349            var sync1 = $("#sync1");
350            var sync2 = $("#sync2");
351            sync1.owlCarousel({
352                singleItem: true,
353                slideSpeed: 1000,
354                navigation: false,
355                pagination: false,
356                afterAction: syncPosition,
357                responsiveRefreshRate: 200
358            });
359            sync2.owlCarousel({
360                items: 5,
361                itemsDesktop: [1199, 5],
362                itemsDesktopSmall: [979, 5],
363                itemsTablet: [768, 5],
364                itemsMobile: [479, 4],
365                pagination: false,
366                responsiveRefreshRate: 100,
367                afterInit: function (el) {
368                    el.find(".owl-item").eq(0).addClass("synced");
369                }
370            });
371            function syncPosition(el) {
372                var current = this.currentItem;
373                $("#sync2")
374                        .find(".owl-item")
375                        .removeClass("synced")
376                        .eq(current)
377                        .addClass("synced");
378                if ($("#sync2").data("owlCarousel") !== undefined) {
379                    center(current);
380                }
381            }
382            $("#sync2").on("click", ".owl-item", function (e) {
383                e.preventDefault();
384                var number = $(this).data("owlItem");
385                sync1.trigger("owl.goTo", number);
386            });
387            function center(number) {
388                var sync2visible = sync2.data("owlCarousel").owl.visibleItems;
389                var num = number;
390                var found = false;
391                for (var i in sync2visible) {
392                    if (num === sync2visible[i]) {
393                        var found = true;
394                    }
395                }
396
397                if (found === false) {
398                    if (num > sync2visible[sync2visible.length - 1]) {
399                        sync2.trigger("owl.goTo", num - sync2visible.length + 2);
400                    } else {
401                        if (num - 1 === -1) {
402                            num = 0;
403                        }
404                        sync2.trigger("owl.goTo", num);
405                    }
406                } else if (num === sync2visible[sync2visible.length - 1]) {
407                    sync2.trigger("owl.goTo", sync2visible[1]);
408                } else if (num === sync2visible[0]) {
409                    sync2.trigger("owl.goTo", num - 1);
410                }
411            }
412        },
413// -------------------------------------------------------------------------- //
414// Zoom Gallery
415// -------------------------------------------------------------------------- //    
416        popupGallery: function () {
417            $('.popup-gallery').magnificPopup({
418                delegate: 'a',
419                type: 'image',
420                tLoading: 'Loading image #%curr%...',
421                mainClass: 'mfp-img-mobile',
422                gallery: {
423                    enabled: true,
424                    navigateByImgClick: true,
425                    preload: [0, 1] // Will preload 0 - before current, and 1 after the current image
426                }
427            });
428        },
429// -------------------------------------------------------------------------- //
430// Fixed Footer
431// -------------------------------------------------------------------------- //
432        fixedFooter: function () {
433            $('.footer-fixed').css('height', 'auto');
434            var footerHeight = $('.footer-fixed').outerHeight();
435            $('body').css('padding-bottom', footerHeight);
436            $('.footer-fixed').css('height', footerHeight);
437        },
438// -------------------------------------------------------------------------- //
439// Parallax Header
440// -------------------------------------------------------------------------- //
441        parallax: function () {
442            $('.parallax').parallaxBackground();
443        },
444// -------------------------------------------------------------------------- //
445// Sticky Sidebar
446// -------------------------------------------------------------------------- //
447        stickySidebar: function () {
448            $('.leftSidebar, .content, .rightSidebar, .stickyshare, .stickydetails').theiaStickySidebar({
449                additionalMarginTop: 60
450            });
451        },
452// -------------------------------------------------------------------------- //
453// Post Slider
454// -------------------------------------------------------------------------- //
455        postSlider: function () {
456            $("#post-slide").owlCarousel({
457                // autoPlay: 5000, //Set AutoPlay to 5 seconds
458                items: 3,
459                itemsDesktop: [1199, 3],
460                itemsDesktopSmall: [980, 2],
461                itemsTablet: [768, 1],
462                itemsTabletSmall: false,
463                itemsMobile: [479, 1],
464                pagination: false,
465                navigation: true,
466                navigationText: [
467                    "<i class='fa fa-angle-left'></i>",
468                    "<i class='fa fa-angle-right'></i>"
469                ]
470            });
471        },
472// -------------------------------------------------------------------------- //
473// Post Carousel
474// -------------------------------------------------------------------------- //
475        postCarousel: function () {
476            $(".post-carousel").owlCarousel({
477                autoPlay: 5000, //Set AutoPlay to 5 seconds
478                items: 5,
479                itemsDesktop: [1199, 2],
480                itemsDesktopSmall: [980, 2],
481                itemsTablet: [768, 2],
482                itemsTabletSmall: false,
483                itemsMobile: [479, 1],
484                lazyLoad: true,
485                navigation: true,
486                navigationText: [
487                    "<i class='fa fa-angle-left'></i>",
488                    "<i class='fa fa-angle-right'></i>"
489                ]
490            });
491        },
492// -------------------------------------------------------------------------- //
493// Video Slider
494// -------------------------------------------------------------------------- //
495        videoSlider: function () {
496            $("#video_slide").owlCarousel({
497                autoPlay: 5000, //Set AutoPlay to 5 seconds
498                items: 1,
499                itemsDesktop: [1199, 1],
500                itemsDesktopSmall: [980, 1],
501                itemsTablet: [768, 1],
502                itemsTabletSmall: false,
503                itemsMobile: [479, 1],
504                navigation: false,
505                singleItem: true,
506                transitionStyle: "fade"
507            });
508        },
509// -------------------------------------------------------------------------- //
510// Page Loader Animsition
511// -------------------------------------------------------------------------- //
512        pageLoader: function () {
513            //$('.animsition').animsition();
514        },
515// -------------------------------------------------------------------------- //
516// Image Fluid Box
517// -------------------------------------------------------------------------- //
518        imgfluidbox: function () {
519            $('.fluidbox_img').fluidbox();
520        },
521// -------------------------------------------------------------------------- //
522// Social Share
523// -------------------------------------------------------------------------- //
524        socialShare: function () {
525            $('.boxed_icon').simpleSocialShare();
526        },
527// -------------------------------------------------------------------------- //
528// Facebook Like Box
529// -------------------------------------------------------------------------- //
530        fbLikeBox: function () {
531            (function (d, s, id) {
532                var js, fjs = d.getElementsByTagName(s)[0];
533                if (d.getElementById(id))
534                    return;
535                js = d.createElement(s);
536                js.id = id;
537                js.src = 'https://connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.12';
538                fjs.parentNode.insertBefore(js, fjs);
539            }(document, 'script', 'facebook-jssdk'));
540        },
541// -------------------------------------------------------------------------- //
542// Youtube video
543// -------------------------------------------------------------------------- //    
544        youtubeVideo: function () {
545            // poster frame click event
546            $(document).on("click", ".js-videoPoster", function (ev) {
547                ev.preventDefault();
548                var $poster = $(this);
549                var $wrapper = $poster.closest(".js-videoWrapper");
550                videoPlay($wrapper);
551            });
552            // play the targeted video (and hide the poster frame)
553            function videoPlay($wrapper) {
554                var $iframe = $wrapper.find(".js-videoIframe");
555                var src = $iframe.data("src");
556                // hide poster
557                $wrapper.addClass("videoWrapperActive");
558                // add iframe src in, starting the video
559                $iframe.attr("src", src);
560            }
561
562            // stop the targeted/all videos (and re-instate the poster frames)
563            function videoStop($wrapper) {
564                // if we're stopping all videos on page
565                if (!$wrapper) {
566                    var $wrapper = $(".js-videoWrapper");
567                    var $iframe = $(".js-videoIframe");
568                    // if we're stopping a particular video
569                } else {
570                    var $iframe = $wrapper.find(".js-videoIframe");
571                }
572                // reveal poster
573                $wrapper.removeClass("videoWrapperActive");
574                // remove youtube link, stopping the video from playing in the background
575                $iframe.attr("src", "");
576            }
577
578        }
579    };
580// -------------------------------------------------------------------------- //
581// Filter portfolio
582// -------------------------------------------------------------------------- // 
583    var shuffleme = (function ($) {
584        'use strict';
585        var $grid = $('#grid'), //locate what we want to sort 
586                $filterOptions = $('.portfolio-sorting li'), //locate the filter categories
587                $sizer = $grid.find('.shuffle_sizer'), //sizer stores the size of the items
588
589                init = function () {
590
591                    // None of these need to be executed synchronously
592                    setTimeout(function () {
593                        listen();
594                        setupFilters();
595                    }, 100);
596
597                    // instantiate the plugin
598                    $grid.shuffle({
599                        itemSelector: '[class*="col-"]',
600                        sizer: $sizer
601                    });
602                },
603                // Set up button clicks
604                setupFilters = function () {
605                    var $btns = $filterOptions.children();
606                    $btns.on('click', function (e) {
607                        e.preventDefault();
608                        var $this = $(this),
609                                isActive = $this.hasClass('active'),
610                                group = isActive ? 'all' : $this.data('group');
611
612                        // Hide current label, show current label in title
613                        if (!isActive) {
614                            $('.portfolio-sorting li a').removeClass('active');
615                        }
616
617                        $this.toggleClass('active');
618
619                        // Filter elements
620                        $grid.shuffle('shuffle', group);
621                    });
622
623                    $btns = null;
624                },
625                // Re layout shuffle when images load. This is only needed
626                // below 768 pixels because the .picture-item height is auto and therefore
627                // the height of the picture-item is dependent on the image
628                // I recommend using imagesloaded to determine when an image is loaded
629                // but that doesn't support IE7
630                listen = function () {
631                    var debouncedLayout = $.throttle(300, function () {
632                        $grid.shuffle('update');
633                    });
634
635                    // Get all images inside shuffle
636                    $grid.find('img').each(function () {
637                        var proxyImage;
638
639                        // Image already loaded
640                        if (this.complete && this.naturalWidth !== undefined) {
641                            return;
642                        }
643
644                        // If none of the checks above matched, simulate loading on detached element.
645                        proxyImage = new Image();
646                        $(proxyImage).on('load', function () {
647                            $(this).off('load');
648                            debouncedLayout();
649                        });
650
651                        proxyImage.src = this.src;
652                    });
653
654                    // Because this method doesn't seem to be perfect.
655                    setTimeout(function () {
656                        debouncedLayout();
657                    }, 500);
658                };
659
660        return {
661            init: init
662        };
663
664    }(jQuery));
665	
666	
667	osru.initialize();
668	
669    // Initialize  cookies footer
670    $(document).ready(function () {
671        
672        //shuffleme.init(); //Filter Portfolio
673        osru.initialize();
674        //Reading Time
675        //$('.post_details').readingTime({
676        //    readingTimeTarget: $(this).find('.eta'),
677        //    wordCountTarget: $(this).find('.words')
678        //});
679    });
680    // Reset on resize
681    $(window).on("resize", function () {
682        osru.fixedFooter();
683    });
684}(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.