PageSourceSearch

https://www.nusabali.com/js/custom.js

js nusabali.com collected 2026-10-02 10:03:19 UTC 17,092 bytes, 562 lines download raw bytes

1/**
2 * http://www.punicatheme.com
3 * Copyright (c) 2014 Punicatheme
4 *
5 **/
6
7/**
8 *   1- Main menu
9 *   2- Mobile menu
10 *   3- Owl Carousel
11 *   4- FlexSlider
12 *   5- EI Slider
13 *   6- Video wrapper
14 *   7- Validate form
15 *   8- Google Map
16 *   9- Search Box
17 *   10- Flickr
18 *   11- Back To Top
19 *   12- Accordion
20 *   13- Toggle Boxes
21 
22 *-----------------------------------------------------------------
23 **/
24
25function getBaseUrl() {
26   var http = location.protocol;
27   var slashes = http.concat("//");
28   var host = slashes.concat(window.location.hostname);
29
30   return host;
31}
32
33var rootpth = getBaseUrl() + '/';
34 
35"use strict";
36var punica_variable = {
37    "contact": {
38        "address": "Lorem ipsum dolor sit amet, consectetur adipiscing elit",
39        "marker": "/url image"
40    },
41    "i18n": {
42        "VIEW": "View",
43        "VIEWS": "Views",
44        "validate": {
45            "form": {
46                "SUBMIT": "Submit",
47                "SENDING": "Sending..."
48            },
49            "name": {
50                "REQUIRED": "Please enter your name",
51                "MINLENGTH": "At least {0} characters required"
52            },
53            "email": {
54                "REQUIRED": "Please enter your email",
55                "EMAIL": "Please enter a valid email"
56            },
57            "url": {
58                "REQUIRED": "Please enter your url",
59                "URL": "Please enter a valid url"
60            },
61            "message": {
62                "REQUIRED": "Please enter a message",
63                "MINLENGTH": "At least {0} characters required"
64            }
65        }
66    }
67};
68var map;
69
70/* =========================================================
711. Main Menu
72============================================================ */
73
74Modernizr.load([
75  {
76    load: rootpth + 'js/superfish.js',
77    complete: function () {
78
79        //Main menu
80        jQuery('#main-menu').superfish({
81            delay: 400,
82            speed: 'fast',
83            cssArrows: false
84        });
85
86    }
87  }
88]);
89
90
91/* =========================================================
922. Mobile Menu
93============================================================ */
94Modernizr.load([
95  {
96    load: rootpth + 'js/jquery.navgoco.js',
97    complete: function () {
98
99        jQuery('#mobile-menu').navgoco({accordion: true});
100        jQuery( "#main-nav i" ).click(function(){
101            jQuery( "#mobile-menu" ).slideToggle( "slow" );
102        });
103
104
105        jQuery('#secondary-mobile-menu').navgoco({accordion: true});
106        jQuery( "#secondary-nav .secondary-mobile-label" ).click(function(){
107            jQuery( "#secondary-mobile-menu" ).slideToggle( "slow" );
108        });
109    }
110  }
111]);
112
113
114/* =========================================================
1153. Owl Carousel
116============================================================ */
117if (jQuery('.punica-fullwidth-carousel').length > 0) {
118
119    Modernizr.load([
120      {
121        load: rootpth + 'js/owl.carousel.js',
122        complete: function () {
123            jQuery('.punica-fullwidth-carousel').owlCarousel({
124                singleItem : true,
125                stopOnHover: true,
126                lazyLoad : true,
127                navigation : false,
128                pagination: false,
129                navigationText : false,
130                autoPlay: true
131            });
132        }
133      }
134    ]);
135};
136
137if (jQuery('.punica-hotnews-carousel').length > 0) {
138
139    Modernizr.load([
140      {
141        load: rootpth + 'js/owl.carousel.js',
142        complete: function () {
143            jQuery('.punica-hotnews-carousel').owlCarousel({
144                items : 4,
145                itemsDesktop : [979,3],
146                itemsDesktopSmall : [799,2],
147                itemsTablet : [639,1],
148                lazyLoad : true,
149                navigation : true,
150                pagination: false,
151                navigationText : false,
152                addClassActive: true,
153                afterAction: function(){
154                    jQuery(".first-item-0").removeClass("first-item-0");
155                    jQuery(".punica-hotnews-carousel").find(".active").eq(0).addClass("first-item-0");
156                }
157            });
158        }
159      }
160    ]);
161};
162
163if (jQuery('.punica-daily-carousel').length > 0) {
164
165    Modernizr.load([
166      {
167        load: rootpth + 'js/owl.carousel.js',
168        complete: function () {
169            jQuery('.punica-daily-carousel').owlCarousel({
170                singleItem : true,
171                autoHeight: true,
172                lazyLoad : true,
173                navigation : true,
174                pagination: false,
175                navigationText : false
176            });
177        }
178      }
179    ]);
180};
181
182if (jQuery('.punica-carousel-1').length > 0) {
183
184    Modernizr.load([
185      {
186        load: rootpth + 'js/owl.carousel.js',
187        complete: function () {
188            jQuery('.punica-carousel-1').owlCarousel({
189                singleItem : true,
190                lazyLoad : true,
191                navigation : true,
192                pagination: false,
193                navigationText : false
194            });
195        }
196      }
197    ]);
198};
199
200if (jQuery('.punica-carousel-2').length > 0) {
201
202    Modernizr.load([
203      {
204        load: rootpth + 'js/owl.carousel.js',
205        complete: function () {
206            jQuery('.punica-carousel-2').owlCarousel({
207                items : 3,
208                itemsDesktop : [1024,3],
209                itemsDesktopSmall : [979,3],
210                itemsTablet : [799,3],
211                lazyLoad : true,
212                navigation : true,
213                pagination: false,
214                navigationText : false,
215                addClassActive: true,
216                afterAction: function(){
217                    jQuery(".center-item").removeClass("center-item");
218                    jQuery(".punica-carousel-2").find(".active").eq(1).addClass("center-item");
219                }
220            });
221        }
222      }
223    ]);
224};
225
226if (jQuery('.punica-single-post-carousel').length > 0) {
227
228    Modernizr.load([
229      {
230        load: rootpth + 'js/owl.carousel.js',
231        complete: function () {
232            jQuery('.punica-single-post-carousel').owlCarousel({
233                singleItem : true,
234                stopOnHover: true,
235                lazyLoad : true,
236                navigation : true,
237                pagination: false,
238                navigationText : false,
239                autoPlay: true
240            });
241        }
242      }
243    ]);
244};
245
246
247/* =========================================================
2484. Flex slider
249============================================================ */
250if (jQuery('.punica-flex-1-widget').length > 0) {
251
252    Modernizr.load([
253      {
254        load: rootpth + 'js/jquery.flexslider-min.js',
255        complete: function () {
256            jQuery('.punica-flex-carousel-1').flexslider({
257                animation: "slide",
258                controlNav: false,
259                directionNav: false,
260                animationLoop: false,
261                slideshow: false,
262                itemWidth: 90,
263                itemMargin: 0,
264                asNavFor: '.punica-flexslider-1'
265            });
266
267            jQuery('.punica-flexslider-1').flexslider({
268                animation: "slide",
269                controlNav: false,
270                directionNav: false,
271                animationLoop: true,
272                slideshow: false,
273                prevText: "",
274                nextText: "",
275                sync: ".punica-flex-carousel-1",
276                start: function(slider){
277                  jQuery('body').removeClass('loading');
278                }
279            });
280        }
281      }
282    ]);
283};
284
285if (jQuery('.punica-flex-2-widget').length > 0) {
286
287    Modernizr.load([
288      {
289        load: rootpth + 'js/jquery.flexslider-min.js',
290        complete: function () {
291            jQuery('.punica-flexslider-2').flexslider({
292                animation: "fade",
293                controlNav: true,
294                directionNav: false,
295                animationLoop: true,
296                slideshow: true,
297                prevText: "",
298                nextText: "",
299                after: function(slider) {
300                    jQuery('.punica-flexslider-2 .flex-caption').animate({bottom:0}, 400)
301                },
302                before: function(slider) {
303                    jQuery('.punica-flexslider-2 .flex-caption').animate({ bottom:-105}, 400)
304                }
305            });
306        }
307      }
308    ]);
309};
310
311/* =========================================================
3125. EI slider
313============================================================ */
314if (jQuery('.ei-slider').length > 0) {
315
316    Modernizr.load([
317        {
318        load: rootpth + 'js/jquery.eislideshow.js',
319            complete: function () {
320                jQuery('#ei-slider').eislideshow({
321                    animation           : 'center',
322                    autoplay            : true,
323                    slideshow_interval  : 3000,
324                    titlesFactor        : 0
325                });
326            }
327        }
328    ]);
329};
330
331/* =========================================================
3326. Video wrapper
333============================================================ */
334if (jQuery(".video-wrapper").length > 0) {
335    Modernizr.load([{
336        load: rootpth + 'js/fitvids.js',
337        complete: function () {
338            jQuery(".video-wrapper").fitVids();
339        }
340    }]);
341};
342
343
344/* =========================================================
3457. Validate form
346============================================================ */
347
348if (jQuery('.comment-form,.contact-form').length > 0) {
349    Modernizr.load([{
350        load: [rootpth + 'js/jquery.form.js', rootpth + 'js/jquery.validate.js'],
351        complete: function () {
352            jQuery('.comment-form,.contact-form').validate({
353                // Add requirements to each of the fields
354                rules: {
355                    name: {
356                        required: true,
357                        minlength: 2
358                    },
359                    email: {
360                        required: true,
361                        email: true
362                    },
363                    message: {
364                        required: true,
365                        minlength: 10
366                    }
367                },
368                // Specify what error messages to display
369                // when the user does something horrid
370                messages: {
371                    name: {
372                        required: punica_variable.i18n.validate.name.REQUIRED,
373                        minlength: jQuery.format(punica_variable.i18n.validate.name.MINLENGTH)
374                    },
375                    email: {
376                        required: punica_variable.i18n.validate.email.REQUIRED,
377                        email: punica_variable.i18n.validate.email.EMAIL
378                    },
379                    message: {
380                        required: punica_variable.i18n.validate.message.REQUIRED,
381                        minlength: jQuery.format(punica_variable.i18n.validate.message.MINLENGTH)
382                    }
383                },
384                // Use Ajax to send everything to processForm.php
385                submitHandler: function (form) {
386                    jQuery(".comment-form .input-submit,.contact-form .input-submit").attr("value", punica_variable.i18n.validate.form.SENDING);
387                    jQuery(form).ajaxSubmit({
388                        success: function (responseText, statusText, xhr, $form) {
389                            jQuery("#response").html(responseText).hide().slideDown("fast");
390                            jQuery(".comment-form .input-submit,.contact-form .input-submit").attr("value", punica_variable.i18n.validate.form.SUBMIT);
391                        }
392                    });
393                    return false;
394                }
395            });
396        }
397    }]);
398}
399
400
401
402/* =========================================================
4038. Google Map
404============================================================ */
405var map;
406
407if (jQuery('.punica-map').length > 0) {
408        var id_map = jQuery('.punica-map').attr('id');
409        var lat = parseFloat(jQuery('.punica-map').attr('data-latitude'));
410        var lng = parseFloat(jQuery('.punica-map').attr('data-longitude'));
411        var place = jQuery('.punica-map').attr('data-place');
412
413    map = new GMaps({
414        el: '#'+id_map,
415        lat: lat,
416        lng: lng,
417        zoomControl : true,
418        zoomControlOpt: {
419            style : 'SMALL',
420            position: 'TOP_LEFT'
421        },
422        panControl : false,
423        streetViewControl : false,
424        mapTypeControl: false,
425        overviewMapControl: false
426    });
427    map.addMarker({
428        lat: lat,
429        lng: lng,
430        title: place
431    });
432};
433
434
435/* =========================================================
4369. Search box
437============================================================ */
438if ($('#sb-search').length > 0) {
439    Modernizr.load([{
440        load: [rootpth + 'js/uisearch.js', rootpth + 'js/classie.js'],
441        complete: function() {
442            new UISearch(document.getElementById('sb-search'));
443        }
444    }]);
445};
446
447/* =========================================================
44810. Flickr
449============================================================ */
450if (jQuery('.punica-flickr-widget').length > 0) {
451
452    Modernizr.load([{
453        load: [rootpth + 'js/jflickrfeed.js', rootpth + 'js/imgliquid.js'],
454        complete: function () {
455            jQuery('.punica-flickr-widget ul').each(function () {
456                jQuery(this).jflickrfeed({
457                    limit: 9,
458                    qstrings: {
459                        id: jQuery(this).find('.flickr-wrap').attr('data-user')
460                    },
461                    itemTemplate: '<li class="flickr-badge-image">' + '<a target="blank" href="{{link}}" title="{{title}}" class="imgLiquid">' + '<img src="{{image_m}}" alt="{{title}}"  />' + '</a>' + '</li>'
462                }, 
463                function (data) {
464                    jQuery('.punica-flickr-widget .imgLiquid').imgLiquid();
465                });
466            });
467        }
468    }]);
469}
470
471
472
473jQuery(document).ready(function(){
474
475    /* =========================================================
476    11. Back to top
477    ============================================================ */
478
479    // hide #back-top first
480    jQuery(".back-top").hide();
481
482    // fade in #back-top
483    jQuery(function () {
484        jQuery(window).scroll(function () {
485            if (jQuery(this).scrollTop() > 200) {
486                jQuery('.back-top').fadeIn();
487            } else {
488                jQuery('.back-top').fadeOut();
489            }
490        });
491
492        // scroll body to 0px on click
493        jQuery('.back-top a').click(function () {
494            jQuery('body,html').animate({
495                scrollTop: 0
496            }, 800);
497            return false;
498        });
499    });
500
501    /* =========================================================
502    12. Accordion
503    ========================================================= */
504    var acc_wrapper=jQuery('.acc-wrapper');
505    if (acc_wrapper.length >0) 
506    {
507        
508        jQuery('.acc-wrapper .accordion-container').hide();
509        jQuery.each(acc_wrapper, function(index, item){
510            jQuery(this).find(jQuery('.accordion-title')).first().addClass('active').next().show();
511            
512        });
513        
514        jQuery('.accordion-title').on('click', function(e) {
515            punica_accordion_click(jQuery(this));
516            e.preventDefault();
517        });
518        
519        var titles = jQuery('.accordion-title');
520        
521        jQuery.each(titles,function(){
522            punica_accordion_click(jQuery(this));
523        });
524    } 
525
526    function punica_accordion_click (obj) {
527        if( obj.next().is(':hidden') ) {
528            obj.parent().find(jQuery('.active')).removeClass('active').next().slideUp(300);
529            obj.toggleClass('active').next().slideDown(300);
530                                
531        }
532    jQuery('.accordion-title span').removeClass('fa-chevron-up').addClass('fa-chevron-down');
533        if (obj.hasClass('active')) {
534            obj.find('span').removeClass('fa-chevron-down');
535            obj.find('span').addClass('fa-chevron-up');             
536        }
537    }
538
539
540    /* =========================================================
541    13. Toggle Boxes
542    ============================================================ */
543         
544    jQuery('.toggle-view li').click(function (event) {
545      
546        var text = jQuery(this).children('.punica-panel');
547
548        if (text.is(':hidden')) {
549            jQuery(this).addClass('active');
550            text.slideDown('300');
551            jQuery(this).children('span').removeClass('fa-chevron-down');
552            jQuery(this).children('span').addClass('fa-chevron-up');                 
553        } else {
554            jQuery(this).removeClass('active');
555            text.slideUp('300');
556            jQuery(this).children('span').removeClass('fa-chevron-up');
557            jQuery(this).children('span').addClass('fa-chevron-down');               
558        }
559       
560    });
561
562});

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.