PageSourceSearch

https://malangkota.go.id/wp-content/plugins/theme-core/assets/js/dev/na-core-front.js

js malangkota.go.id collected 2026-09-24 22:29:40 UTC 23,095 bytes, 536 lines download raw bytes

1
2(function ($) {
3    "use strict";
4    function customAttribute(){
5        // Custom  }
6        $( '.nano-custom-attribute > li' ).live( 'click', function(e) {
7            e.preventDefault();
8
9            var variation_value = $(this).data( 'value' ),
10                selectId        = $(this).parent().data( 'attribute' ),
11                select          = $( 'select#'+selectId );
12
13            $(this).addClass( 'selected' ).siblings().removeClass( 'selected' );
14
15            select.val( variation_value ).trigger( 'change' );
16        } );
17
18        $( '.variations_form' ).live( 'change', 'select[data-attribute_name]', function() {
19            // Auto select option thas has only 1 choice availible
20            setTimeout( function() {
21                $( '.variations_form select[data-attribute_name]' ).each( function( i, e ) {
22                    if ( $( e ).val() == '' && $( e ).children( '[value!=""]' ).length == 1 ) {
23                        $( e ).val( $( e ).children( '[value!=""]' ).attr( 'value' ) ).trigger( 'change' );
24                    }
25                } );
26            }, 50 );
27
28            $( '.nano-custom-attribute[data-attribute]' ).each( function( i, e ) {
29                ( function( e ) {
30                    setTimeout( function() {
31                        var option = $( e ).attr( 'data-attribute' ),
32                            select = $( '#' + option );
33
34                        $( e ).children().each( function( i2, e2 ) {
35                            if ( select.children( '[value="' + $( e2 ).attr( 'data-value' ) + '"]' ).length == 1 ) {
36                                $( e2 ).show();
37                            } else {
38                                $( e2 ).hide();
39                            }
40                        } );
41                    }, 50 );
42                } )( e );
43            } );
44        } );
45
46        $( 'a.reset_variations' ).live( 'click',  function() {
47            $( '.nano-custom-attribute' ).each( function( i, e ) {
48                $( e ).find( 'li.selected' ).removeClass( 'selected' );
49            } )
50        } );
51    }
52
53    $(document).ready(function() {
54        customAttribute();
55
56
57        var paged = 1;
58        //loadMore =====================================================================================================
59        jQuery('.type-loadMore').each(function(){
60            var wrapper              = jQuery(this);
61            var loadMore_button      = jQuery(this).find('#loadMore');
62            loadMore_button.live('click', function(){
63                paged++;
64                var number         = parseInt(wrapper.data( 'number' )),
65                    cat            = wrapper.data( 'cat'),
66                    col            = wrapper.data( 'col'),
67                    pages          = wrapper.data( 'paged'),
68                    layout         = wrapper.data( 'layout');
69                $.ajax({
70                    url: NaScript.ajax_url,
71                    dataType: 'html',
72                    type: 'POST',
73                    data: {
74                        action        : 'load_post',
75                        number        : number,
76                        cat           : cat,
77                        paged         : paged,
78                        col           : col,
79                        layout        : layout
80                    },
81                    beforeSend: function() {
82                        loadMore_button.addClass( 'loading' );
83                    },
84                    success:function(data) {
85                        var val = $(data);
86                        var $container = wrapper.find('.affect-isotope').isotope();
87                        $container.append(val).isotope( 'appended', val );
88                        $("img.lazy").lazy();
89                        setTimeout(function() {
90                            $container.imagesLoaded().progress( function() {
91                                $container.isotope('layout');
92                            });
93                        }, 100)
94
95                        loadMore_button.removeClass( 'loading' );
96                        if ( paged == pages ) {
97                            loadMore_button.addClass( 'hidden' );
98                        }
99                    },
100
101                    error: function(data){
102                        console.log(data);
103                    },
104                });
105                return false;
106            });
107        });
108        //infinitescroll ===============================================================================================
109        $('.type-infiniteScroll').each(function(){
110            var win = $(window);
111            var nextPage      = $('.wrapper-posts').find('#nextPage');
112            function bindScroll(){
113                if($(window).scrollTop() + $(window).innerHeight() > $(document).height() - 250) {
114                    $(window).unbind('scroll');
115                    loadMore();
116                }
117            }
118            function loadMore()
119            {
120                paged++;
121                var wrapper        = $('.wrapper-posts'),
122                    number         = parseInt(wrapper.data( 'number' )),
123                    cat            = wrapper.data( 'cat'),
124                    col            = wrapper.data( 'col'),
125                    pages          = wrapper.data( 'paged'),
126                    layout         = wrapper.data( 'layout');
127
128                $.ajax({
129                    url: NaScript.ajax_url,
130                    dataType: 'html',
131                    type: 'POST',
132                    data: {
133                        action        : 'load_more_post',
134                        number        : number,
135                        cat           : cat,
136                        paged         : paged,
137                        col           : col,
138                        layout        : layout
139                    },
140                    beforeSend: function() {
141                        nextPage.addClass( 'loading' );
142                    },
143                    success:function(data) {
144                        var val = $(data);
145                        // Set Container
146                        var $container =  $( '.wrapper-posts').find('.affect-isotope').isotope();
147                        $container.append(val).isotope( 'appended', val );
148                        $("img.lazy").lazy();
149                        setTimeout(function() {
150                            $container.imagesLoaded().progress( function() {
151                                $container.isotope('layout');
152                            });
153                        }, 100)
154
155                        nextPage.removeClass( 'loading' );
156                        $(window).bind('scroll', bindScroll);
157                        if ( paged == pages ) {
158                            nextPage.addClass( 'hidden' );
159                        }
160                    },
161                    error: function(data){
162                        console.log(data);
163                    },
164                });
165
166
167
168            }
169            $(window).scroll(bindScroll);
170        });
171
172        //Load Category ================================================================================================
173        jQuery('.box-recent').each(function(){
174            var loadMoreCat_button      = $('.wrapper-posts').find('#loadMoreCat');
175            var loadMore_button         = $('.wrapper-posts').find('#loadMore');
176            var $wrapper                = jQuery(this).find('.tab-content');
177            var $catItem                = jQuery(this).find('.wrapper-filter .cat-item');
178            var $catAll                 = jQuery(this).find('.wrapper-filter .cat-items');
179            $catItem.live('click', function(){
180                var agr            = $wrapper.parent().find('.agr-loading'),
181                    archive        = $wrapper.find('.archive-blog'),
182                    cat            = jQuery(this).data( 'catfilter' ),
183                    number         = $wrapper.parent().data( 'number' ),
184                    col            = $wrapper.parent().data( 'col'),
185                    layout         = $wrapper.parent().data( 'layout');
186                $catItem.parent().removeClass('active');
187                jQuery(this).parent().addClass( 'active' );
188
189                // RequestData ============================
190                var requestData = {
191                    action        : 'load_more_category',
192                    number        : number,
193                    cat           : cat,
194                    col           : col,
195                    layout        : layout
196                };
197
198                if(!jQuery(this).hasClass('loaded')){
199                    $.ajax({
200                        url: NaScript.ajax_url,
201                        dataType: 'html',
202                        type: 'POST',
203                        data: requestData,
204                        beforeSend: function() {
205                            agr.addClass( 'post-loading' );
206                            archive.addClass( 'archive-affect' );
207                            return true;
208                        },
209                        success:function(data) {
210                            agr.removeClass( 'post-loading' );
211                            archive.removeClass( 'archive-affect');
212                            ajaxResponse(data);
213                        },
214                        error: function(data){
215                            console.log(data);
216                        }
217                    });
218                }
219
220                jQuery(this).not('.loaded').addClass('loaded');
221                var $activeContent='allCat';
222                if(jQuery(this).parent().hasClass('active')){
223                    $activeContent = jQuery(this).data( 'catfilter' );
224                }
225                $wrapper.find('.archive-blog').removeClass('active');
226                $wrapper.find('.archive-blog').removeClass('affect-isotope');
227                $wrapper.find('#'+$activeContent).addClass('active').addClass('affect-isotope');;
228                jQuery( '.wrapper-posts').find('.affect-isotope').isotope({
229                    transitionDuration: '0.4s',
230                    masonry: {
231                        columnWidth:'.col-item'
232                    },
233                    fitWidth: true,
234                });
235            });
236
237            function ajaxResponse(data) {
238                var val                     = $(data);
239                var $container              = $( '.wrapper-posts').find('.affect-isotope').isotope({
240                    transitionDuration: '0.4s',
241                    masonry: {
242                        columnWidth:'.col-item'
243                    },
244                    fitWidth: true,
245                });
246
247                loadMore_button.addClass( 'hidden' );
248                loadMoreCat_button.removeClass( 'hidden' );
249                $wrapper.append(val).find('.affect-isotope').isotope({
250                    transitionDuration: '0.4s',
251                    masonry: {
252                        columnWidth:'.col-item'
253                    },
254                    fitWidth: true,
255                });
256                $wrapper.find("img.lazy").lazy();
257                setTimeout(function() {
258                    $container.imagesLoaded().progress( function() {
259                        $container.isotope('layout');
260                    });
261                    $("img.lazy").lazy();
262                }, 100)
263            }
264
265            $catAll.live('click', function(){
266                $catItem.parent().removeClass('active');
267                jQuery(this).parent().addClass( 'active' );
268                jQuery(this).not('.loaded').addClass('loaded');
269                var $activeContent='allCat';
270                if(jQuery(this).parent().hasClass('active')){
271                    $activeContent = jQuery(this).data( 'catfilter' );
272                }
273                $wrapper.find('.archive-blog').removeClass('active');
274                $wrapper.find('.archive-blog').removeClass('affect-isotope');
275                $wrapper.find('#'+$activeContent).addClass('active').addClass('affect-isotope');;
276                jQuery( '.wrapper-posts').find('.affect-isotope').isotope({
277                    transitionDuration: '0.4s',
278                    masonry: {
279                        columnWidth:'.col-item'
280                    },
281                    fitWidth: true,
282                });
283                loadMore_button.removeClass( 'hidden' );
284                loadMoreCat_button.addClass( 'hidden' );
285            });
286        });
287
288        // then loadmore
289        jQuery('.box-recent .box-filter').each(function(){
290            var wrapper                 = jQuery(this).parent().parent();
291            var loadMoreCat_button      = wrapper.find('#loadMoreCat');
292            var paged = 1;
293            loadMoreCat_button.on('click', function(){
294                jQuery('.wrapper-filter .cat-item').on('click', function(){
295                    return paged = 1;
296                });
297                paged++;
298                var pages= 1,
299                    cat='',
300                    number='9',
301                    col='',
302                    layout='',
303                    wrapperActive=wrapper.find('.archive-blog.active');
304
305                if(jQuery('.wrapper-posts').find('.archive-blog').hasClass('active')){
306                        pages          = parseInt(wrapperActive.find('#filterPages').data('filter-pages')),
307                        cat            = wrapperActive.find('#filterPages').data('filter-cat'),
308                        number         = wrapperActive.find('#filterPages').data('filter-number'),
309                        col            = jQuery('.wrapper-posts').data( 'col'),
310                        layout         = jQuery('.wrapper-posts').data( 'layout');
311                }
312
313                if(paged <= pages) {
314                    $.ajax({
315                        url: NaScript.ajax_url,
316                        dataType: 'html',
317                        type: 'POST',
318                        data: {
319                            action: 'load_more_post',
320                            number: number,
321                            cat: cat,
322                            paged: paged,
323                            col: col,
324                            layout: layout
325                        },
326                        beforeSend: function () {
327                            loadMoreCat_button.addClass('loading');
328                        },
329                        success: function (response) {
330                            var val2 = $(response);
331                            var $container =  $( '.wrapper-posts').find('.affect-isotope').isotope({
332                                transitionDuration: '0.4s',
333                                masonry: {
334                                    columnWidth:'.col-item'
335                                },
336                                fitWidth: true,
337                            });
338                            $container.append(val2).isotope( 'appended', val2 );
339                            $("img.lazy").lazy();
340                            setTimeout(function() {
341                                $container.imagesLoaded().progress( function() {
342                                    $container.isotope('layout');
343                                });
344                                $("img.lazy").lazy();
345                            }, 100)
346
347                            loadMoreCat_button.removeClass('loading');
348
349                            if (paged == pages) {
350                                loadMoreCat_button.addClass('hidden');
351                            }
352                        },
353                        error: function (data) {
354                            console.log(data);
355                        },
356                    });
357                    return false;
358                }
359                if (pages == '1') {
360                    loadMoreCat_button.addClass('hidden');
361                }
362            });
363        });
364
365        //loadCategory BOX=============================================================================================
366        jQuery('.box-cats').each(function(){
367            var $wrapper              = jQuery(this).find('.tab-content');
368            var $catItem              = jQuery(this).find('.wrapper-filter .cat-item');
369            $catItem.live('click', function(){
370                var agr            = $wrapper.parent().find('.agr-loading'),
371                    archive        = $wrapper.find('.archive-blog'),
372                    cat            = jQuery(this).data( 'catfilter' ),
373                    number         = $wrapper.parent().data( 'number' ),
374                    col            = $wrapper.parent().data( 'col'),
375                    layout         = $wrapper.parent().data( 'layout');
376                $catItem.parent().removeClass('active');
377                jQuery(this).parent().addClass( 'active' );
378
379                // RequestData ============================
380                var requestData = {
381                    action        : 'load_more_category',
382                    number        : number,
383                    cat           : cat,
384                    col           : col,
385                    layout        : layout
386                };
387
388                if(!jQuery(this).hasClass('loaded')){
389                    $.ajax({
390                        url: NaScript.ajax_url,
391                        dataType: 'html',
392                        type: 'POST',
393                        data: requestData,
394                        beforeSend: function() {
395                            agr.addClass( 'post-loading' );
396                            archive.addClass( 'archive-affect' );
397                            return true;
398                        },
399                        success:function(data) {
400                            agr.removeClass( 'post-loading' );
401                            archive.removeClass( 'archive-affect');
402                            ajaxResponse(data);
403                        },
404                        error: function(data){
405                            console.log(data);
406                        }
407                    });
408                }
409
410                jQuery(this).not('.loaded').addClass('loaded');
411                var $activeContent='allCat';
412                if(jQuery(this).parent().hasClass('active')){
413                    $activeContent = jQuery(this).data( 'catfilter' );
414                }
415                $wrapper.find('.archive-blog').removeClass('active');
416                $wrapper.find('#'+$activeContent).addClass('active');
417            });
418
419            function ajaxResponse(data) {
420                var val                     = $(data);
421                $wrapper.append(val);
422                $wrapper.find("img.lazy").lazy();
423            }
424
425        });
426
427        //Videos BOX=============================================================================================
428        jQuery('.box-videos').each(function(){
429            var $wrapper              = jQuery(this).find('.slider-video .post-item');
430
431            var $btn                  = jQuery(this).find('.btn-play');
432
433
434            var $postItem             =   jQuery('.box-video .slider-video .post-item');
435
436            $btn.live('click', function(){
437
438                //check active nav
439                if( jQuery('.slider-nav .post-image').hasClass('active')){
440                    jQuery('.slider-nav .post-image').removeClass('active');
441                };
442                jQuery(this).addClass('active');
443
444                var id                    = jQuery(this).data( 'id');
445                var videoItem             = jQuery('.slider-video .post-item.video-'+id);
446                var iframeVideo           = $postItem.find('.video-item');
447                var iframeCurrent         = videoItem.find('.video-item');
448
449
450                //reset active slider
451                if($wrapper.hasClass('active')){
452                    $wrapper.removeClass('active');
453                }
454
455                //active
456                videoItem.addClass('active');
457
458
459                // RequestData ============================
460                var requestData = {
461                    action        : 'load_videos',
462                    id            : id,
463                };
464                if(!videoItem.hasClass('loaded')){
465                    $.ajax({
466                        url: NaScript.ajax_url,
467                        dataType: 'html',
468                        type: 'POST',
469                        data: requestData,
470                        beforeSend: function() {
471                            //archive.addClass( 'archive-affect' );
472                            jQuery('.slider-video .post-item.video-'+id).addClass('video-loading');
473                            return true;
474                        },
475                        success:function(data) {
476                            jQuery('.slider-video .post-item.video-'+id).removeClass('video-loading');
477                            var val                     = $(data);
478                            jQuery('.slider-video .post-item.video-'+id+' .article-video').append(val);
479                            jQuery('.slider-video .post-item.video-'+id).addClass('loaded');
480                            jQuery('.playing').videoController('play');
481                            jQuery('.paused').videoController('pause');
482                        },
483                        error: function(data){
484                            console.log(data);
485                        }
486                    });
487                }
488                //add paused
489                if(iframeVideo.not('paused')){
490                    iframeVideo.addClass('paused');
491                };
492                //reset playing
493                if(iframeVideo.hasClass('playing')){
494                    iframeVideo.removeClass('playing');
495                };
496
497                //add playing
498                iframeCurrent.removeClass('paused');
499                iframeCurrent.addClass('playing');
500
501                if(iframeVideo.hasClass('playing')){
502                    playVideo();
503                }
504                if(iframeVideo.hasClass('paused')){
505                    pauseVideo();
506                }
507            });
508
509            function ajaxResponse(data) {
510                var val                     = $(data);
511                $append.append(val);
512            }
513
514        });
515        jQuery('.video-item').videoController({
516            videoReady: function() { displayEvent('ready'); },
517            videoStart: function() { displayEvent('start'); },
518            videoPlay: function() { displayEvent('play'); },
519            videoPause: function() { displayEvent('pause'); },
520            videoEnded: function() { displayEvent('ended'); }
521        });
522
523    });
524    function playVideo() {
525        jQuery('.playing').videoController('play');
526    }
527
528    function pauseVideo() {
529        jQuery('.paused').videoController('pause');
530    }
531    function displayEvent(eventType) {
532        var textarea  = $('.events');
533        textarea.val(textarea.val() + '\n' + eventType);
534    }
535
536})(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.