PageSourceSearch

https://teeech.it/wp-content/themes/admag/js/script_ver-20130115.js

js teeech.it collected 2026-10-08 16:46:55 UTC 16,905 bytes, 529 lines download raw bytes

1/* --------------------------------------
2 =========================================
3 ADMAG - Responsive Blog & Magazine Wordpress Template
4 Version: 1.0
5 Designed by: DigitalTheme.co
6 =========================================
7
8 1. Bootstrap tooltip
9 2. Bootstrap Select First Tab
10 3. Tabs hover effect
11 4. Menu hover effect
12 5. Fade effect on Menu and Tab
13 6. Slider
14 7. Image popup
15 8. Sticky Sidebar
16 9. Mobile Menu
17 10. Mobile Menu Scrollbar
18 11. Responsive video
19 12. Sticky Header
20 13. Fixed Sidebar Scrollbar
21 14. Go to Top Button
22 15. Count up share counter
23 16. Google Map
24 -----------------------------------------*/
25
26jQuery(function ($) {
27    "use strict";
28
29    $(document).ready( function(){
30
31        var $_html = $("html");
32        var $_body = $("body");
33        var $_header_room = $('.sticky-headroom #header');
34        var $_header_menu = $('.sticky-header #header');
35        var $_stickyScrollbar = $('.sticky-scroll');
36        var $_sidebar = $("#sticky-sidebar");
37        var $_goTop = $('#go-top-button');
38        var $_header_topoffset = 0;
39        var $_offset = 133;
40
41        // 1. Bootstrap tooltip
42        var $_tooltip = $('[data-toggle="tooltip"]');
43        if ( $_tooltip.length ) {
44            $_tooltip.tooltip();
45        }
46
47        // 2. Bootstrap Select First Tab
48        var $_tab1 = $('#widget-tab a:first');
49        if( $_tab1.length ){
50            $_tab1.tab('show');
51        }
52
53        // 3. Tabs hover effect
54        $('.tab-hover .nav-tabs > li > a').hover(function(){
55            $(this).tab('show');
56        });
57
58        // 4. Menu hover effect
59        $('.dropdown-toggle').dropdownHover();
60
61        // 5. Mega menu
62        $('a[data-href]').each(function() {
63            $(this).on('click', function(e){
64                e.preventDefault();
65                window.location.href = $(this).attr('data-href');
66            });
67        });
68
69        // First mega menu tab show
70        var $_megatab = $('.tab-hover .nav-tabs > li > a');
71
72        if( $_megatab.length ){
73            // On tab show event
74            $_megatab.on("show.bs.tab", function(e){
75                var $_tabcontent = $( $(this).attr("href") );
76
77                if( $_tabcontent.length ){
78                    // if tab content is empty
79                    if( $_tabcontent.is(':empty') ){
80                        // ajax call
81                        $_tabcontent.addClass("loading");
82
83                        var data = {
84                            'action': 'dt_tabbed_mega_blocks',
85                            category: $(this).attr('data-mega-cat')
86                        };
87
88                        $.post(ajaxurl, data, function(response) {
89                            $_tabcontent.html(response);
90                            $_tabcontent.removeClass("loading");
91                        });
92                    }
93                }
94
95            });
96        }
97
98        $("#main-nav .mega-menu3>a").on("hover", function () {
99            var $_id = $(this).attr('data-mega-cat');
100            $_id = $("#nav-href" + $_id);
101
102            if( $_id.length ){
103                $_id.tab('show');
104            }
105        });
106
107        //$("#main-nav .mega-menu2").append('<ul class="dropdown-menu fullwidth"><li><div class="mega-menu-wrapper"></div></li></ul>');
108
109        // Full mega menu
110        // var dt_link_wrapper = $("#main-nav .mega-menu2>.dropdown-toggle");
111
112        // dt_link_wrapper.on("hover", function () {
113
114        //   var wrapper = $(this).parent().find('.mega-menu-wrapper');
115
116        //   if( wrapper.is(':empty') ){
117        //     // Full Mega Menu
118        //     wrapper.addClass("loading");
119        //     var data = {
120        //       'action': 'dt_mega_blocks',
121        //       category: $(this).attr('data-mega-cat')
122        //     };
123
124        //       $.post(ajaxurl, data, function(response) {
125        //         wrapper.html(response);
126        //         wrapper.removeClass("loading");
127        //       });
128        //   }
129
130        // });
131
132        // 5. Fade effect on Menu and Tab
133        $('.nav .dropdown-menu').addClass('animated fadeIn');
134        $('.tab-pane').addClass('animated fadeIn');
135
136        if( $_html.hasClass("no-touch") ){
137            $('.navbar .dropdown > a').on("click", function(){
138                location.href = this.href;
139            });
140        }
141
142        // 6. Slider
143        var mySwiper = new Swiper ('.swiper-container', {
144            // Optional parameters
145            loop: true,
146            nextButton: '.swiper-button-next',
147            prevButton: '.swiper-button-prev',
148            autoplay: 3000,
149        });
150
151        // 7. Image popup 
152        /*$('a[href*=".jpg"], a[href*=".jpeg"], a[href*=".png"], a[href*=".gif"]').each(function(){
153            if ($(this).parents('.gallery').length == 0) {
154                $(this).magnificPopup({
155                    type:'image',
156                    mainClass: 'mfp-with-zoom', // this class is for CSS animation below
157                    closeOnContentClick: true,
158                    zoom: {
159                        enabled: true, // By default it's false, so don't forget to enable it
160
161                        duration: 200, // duration of the effect, in milliseconds
162                        easing: 'ease-in-out', // CSS transition easing function
163
164                        opener: function(openerElement) {
165                            return openerElement.is('img') ? openerElement : openerElement.find('img');
166                        }
167                    }
168                });
169            }
170        });
171        $('.gallery').each(function() {
172            $(this).magnificPopup({
173                delegate: 'a',
174                type: 'image',
175                gallery: {enabled: true}
176            });
177        });*/
178
179
180        // 8. Sticky Sidebar
181        $('.dt_content, .dt_sidebar').theiaStickySidebar({
182            // Settings
183            additionalMarginTop: 60
184        });
185
186        // 9. Mobile Menu
187        var $_mob_nav = $('#mobile-nav');
188        if( $_mob_nav.length ){
189            $_mob_nav.mmenu({
190                slidingSubmenus: false,
191                extensions: ["theme-dark"]
192            }, {
193
194            });
195        }
196
197        // 10. Mobile Menu Scrollbar
198        var $_mob = $('.mm-panels > .mm-panel');
199        if( $_mob.length ){
200            $_mob.perfectScrollbar({
201                wheelSpeed: 1,
202                suppressScrollX: true
203            });
204        }
205
206        $('#fixed-button').on("click", function(event){
207            event.preventDefault();
208            $_html.toggleClass("ad-opened");
209        });
210
211        $('#mobile-overlay').on("click", function(event){
212            event.preventDefault();
213            $_html.toggleClass("ad-opened");
214        });
215
216        // Set total share
217        var $_countup = $('#countUp');
218        if( $_countup.length ){
219            dt_get_total_share_count();
220        }
221
222        // Get total share count by url
223        function dt_get_total_share_count(){
224            var url = encodeURIComponent ( $(location).attr('href') );
225            var total = 0;
226
227            // Facebook Shares Count
228            $.getJSON( 'http://graph.facebook.com/?id=' + url, function( fbdata ) {
229                if( typeof(fbdata.share) != "undefined" && fbdata.share !== null ){
230                    if(isNumeric(linkdindata.count)){
231                        total += fbdata.share.share_count;
232                    }
233                }
234            });
235
236            // LinkIn Shares Count
237            $.getJSON( 'http://www.linkedin.com/countserv/count/share?url=' + url + '&callback=?', function( linkdindata ) {
238                if( isNumeric(linkdindata.count) ){
239                    total = total + linkdindata.count;
240                }
241                $_countup.attr( 'data-count', total );
242                dt_countUp();
243            });
244        }
245
246        // 11. Responsive video
247        $(".image-overlay").fitVids();
248
249        // 12. Sticky Header
250        if( !$_body.hasClass('fixed-sidebar') ){
251            // Sticky menu hide
252            $_header_room.headroom({
253                "offset": 500,
254                "tolerance": 0,
255                "classes": {
256                    "initial": "animated",
257                    "pinned": "slideDown",
258                    "unpinned": "slideUp"
259                }
260            });
261        }
262
263        if($_header_menu.length){
264            $_header_topoffset = $_header_menu.offset().top;
265        }
266
267        // Change scrollbar height when load
268        change_height();
269
270        // 13. Fixed Sidebar Scrollbar
271        $_stickyScrollbar.each(function(){
272            $(this).perfectScrollbar({
273                wheelSpeed: 1,
274                suppressScrollX: true
275            });
276        });
277
278        // Change scrollbar height when resize
279        $(window).on("resize", function() {
280            change_height();
281        });
282
283        var dt_index, dt_len, $_var, $_cont, $_selector, dt_args, $_inf_cont;
284        for (dt_index = 0, dt_len = dt_paginated_blocks.length; dt_index < dt_len; ++dt_index) {
285            $_var = dt_paginated_blocks[dt_index];
286            $_cont = '#' + $_var;
287            $_selector = '.block';
288            $_selector = '.' + dt_paginated_blocks_items[dt_index];
289
290            dt_args = {
291                navSelector  : '#nav' + $_var,    // selector for the paged navigation
292                nextSelector : '#nav' + $_var + ' a:last',  // selector for the NEXT link (to page 2)
293                itemSelector : $_selector,
294                bufferPx: 100,
295                loading: {
296                    finished: function(){ $('.infscr-loading').each(function(){ $(this).hide(); }); },
297                    finishedMsg: "<em>Empty</em>",
298                    img: dt_path + '/img/loader.gif',
299                    msg: null,
300                    msgText: "",
301                    selector: null,
302                    speed: 'fast',
303                    start: undefined
304                },
305            };
306
307            $_inf_cont = $( $_cont );
308
309            if( dt_paginated_blocks_type[dt_index] != undefined && dt_paginated_blocks_type[dt_index] == 'load-more' ){
310                dt_args['behavior'] = "twitter";
311            }
312
313            $_inf_cont.infinitescroll( dt_args );
314
315            jQuery(document).ajaxError(function (e, xhr, opt) { if (xhr.status == 404) $('#nav' + $_var).remove(); });
316        }
317
318        change_header(0);
319        $(window).scroll(function(){
320            var $_scrolltop = $(this).scrollTop();
321            // Go to top button
322            if ( $_scrolltop > 100) {
323                $_goTop.css({ bottom: '20px' });
324            }
325            else {
326                $_goTop.css({ bottom: '-100px' });
327            }
328
329            change_header($_scrolltop);
330        });
331
332        function change_header( scrolltop ){
333            // Fixed header
334            if ( scrolltop >= $_header_topoffset) {
335                $_header_menu.addClass("set-fixed");
336                $_sidebar.addClass("set-sidebar");
337                $_sidebar.css('top', 50);
338                change_height();
339            }
340            else {
341                $_header_menu.removeClass("set-fixed");
342                $_sidebar.removeClass("set-sidebar");
343                var $_top_marg = $_header_topoffset + 50 - scrolltop;
344                $_sidebar.css('top', $_top_marg);
345                change_height();
346            }
347        }
348
349        // Change scrollbar height
350        function change_height(){
351            var windowHeight = $(window).height();
352
353            if( $_sidebar.length ){
354                $_offset = $_sidebar.position().top + 80;
355
356                var setHeight = windowHeight - $_offset;
357                $_stickyScrollbar.each(function(){
358                    $(this).height(setHeight);
359                    $(this).perfectScrollbar('update');  // Update
360                });
361            }
362
363            // Mobile menu scroll
364            change_mobile_height();
365        }
366
367        $('.mm-next').on('click', function(){
368            change_mobile_height();
369        })
370
371        function change_mobile_height(){
372            var windowHeight = $(window).height();
373            $_mob.height(windowHeight);
374            $_mob.perfectScrollbar('update');  // Update
375        }
376
377        // 14. Go to Top Button
378        $_goTop.on("click", function(){
379            $('html, body').animate({scrollTop : 0},700);
380            return false;
381        });
382
383        function initSlideMenu() {
384            var mainNavElem = "#menu-top-menu";
385            $(mainNavElem).scrollLeft(0);
386            var menuScreenWidth = $(mainNavElem).width();
387            var middleScreen = menuScreenWidth / 2;
388            var widthActiveItem = $('.mega-menu .navbar-nav>li.active').width();
389            if (widthActiveItem) {
390                var middlePosActiveItem = $('.mega-menu .navbar-nav>li.active').position().left + (widthActiveItem / 2);
391                var center = middlePosActiveItem - middleScreen;
392                $(mainNavElem).scrollLeft(center);
393            }
394        }
395        initSlideMenu();
396    });
397
398});
399/*
400 * End Jquery
401 */
402
403// 15. Count up share counter
404function dt_countUp(){
405    if(document.getElementById("countUp")){
406        var count = document.getElementById("countUp");
407
408        var number = 0;
409
410        if(count.hasAttribute("data-count")){
411            number = count.getAttribute("data-count");
412            if( !isNumeric (number) ){
413                number = 0;
414            }
415        }
416
417        var options = {
418            useEasing : true,
419            useGrouping : true,
420            separator : '',
421            decimal : '.',
422            prefix : '',
423            suffix : ''
424        };
425
426        var counter = new countUp("countUp", 0, number, 0, 2.5, options);
427
428        var waypoint = new Waypoint({
429            element: count,
430            handler: function(direction) {
431                counter.start();
432            },
433            offset: window.innerHeight-110
434        });
435    }
436}
437function isNumeric(n) {
438    return !isNaN(parseFloat(n)) && isFinite(n);
439}
440
441// 16. Header Search Button
442if(document.getElementById("sb-search")){
443    new UISearch( document.getElementById( "sb-search" ) );
444}
445
446// 17. Google Map
447var map_canvas =  document.getElementById('map-canvas');
448if (typeof(map_canvas) != 'undefined' && map_canvas != null)
449{
450    // Contact page Google map
451    function initialize() {
452        var myLatlng = new google.maps.LatLng(-25.363882,131.044922);
453        var mapOptions = {
454            zoom: 4,
455            center: myLatlng
456        }
457        var map = new google.maps.Map(document.getElementById('map-canvas'), mapOptions);
458
459        var marker = new google.maps.Marker({
460            position: myLatlng,
461            map: map,
462            title: 'Hello World!'
463        });
464    }
465
466    google.maps.event.addDomListener(window, 'load', initialize);
467}
468
469// Share buttons
470function dt_share(type, title, descr) {
471    var winWidth  = 575,
472        winHeight = 420,
473        url = window.location.href;
474
475    var winTop = (screen.height / 2) - (winHeight / 2);
476    var winLeft = (screen.width / 2) - (winWidth / 2);
477    var link = "";
478
479    switch(type){
480        case "fb":
481            link = dt_get_fburl(title, descr, url);
482            break;
483        case "tw":
484            link = dt_get_twurl(title, url);
485            break;
486
487        case "gp":
488            link = dt_get_gpurl(url);
489            break;
490
491        case "ln":
492            link = dt_get_lnurl(title, url);
493            break;
494    }
495    window.open(link, 'sharer', 'top=' + winTop + ',left=' + winLeft + ',toolbar=0,status=0,width='+winWidth+',height='+winHeight);
496}
497
498function dt_get_fburl(title, descr, url){
499    return 'http://www.facebook.com/share.php?u=' +encodeURIComponent(url)+ '&title=' + encodeURIComponent(title);
500}
501
502function dt_get_twurl(title, url){
503    return 'http://twitter.com/home?status=' + encodeURIComponent(title) + '+' + encodeURIComponent(url);
504}
505
506function dt_get_gpurl(url){
507    return 'https://plus.google.com/share?url=' + encodeURIComponent(url);
508}
509
510function dt_get_lnurl(title, url){
511    return 'http://www.linkedin.com/shareArticle?mini=true&url=' + encodeURIComponent(url) + '&title=' + encodeURIComponent(title);
512}
513
514function fixAjaxUrl(url) {
515    var pathArray = url.split('/');
516    var protocol = pathArray[0];
517    var host = pathArray[2];
518    return url.replace(protocol + "//" + host, document.location.origin);
519}
520
521function addTopProduct(pid, url, title) {
522    var nbElements = jQuery("form ol li").length + 1;
523    var html = '<li id="p'+nbElements + '_' + pid+'"> ' +
524        '<input min="1" max="10" type="number" name="ranking['+nbElements+'][pos]" value="'+nbElements+'"> ' +
525        '<button class="aps-button orange" type="button" onclick="jQuery(\"#p'+nbElements + '_' + pid+'\").remove()">Remove</button>' +
526        '<a href="'+url+'" target="_blank">'+title+'</a> ' +
527        '<input type="hidden" name="ranking['+nbElements+'][product_id]" value="'+pid+'"></li>';
528        jQuery("form ol").append(html);
529}

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.