PageSourceSearch

https://www.harianpilar.com/wp-content/themes/newkarma/js/tab-ajax.js?ver=1.0.0

js harianpilar.com collected 2026-10-02 22:31:50 UTC 2,224 bytes, 86 lines download raw bytes

1/**
2 * Copyright (c) 2017 Gian MR
3 * Gian MR Theme Custom Javascript
4 * Base on open source wp tab widget
5 *
6 * @package Newkarma
7 */
8
9/**
10 * Load Tab Content
11 */
12function idtnews_loadTabContent(tab_name, page_num, container, args_obj) {
13	var container   = jQuery( container );
14	var tab_content = container.find( '#' + tab_name + '-tab-content' );
15
16	// only load content if it wasn't already loaded.
17	var isLoaded = tab_content.data( 'loaded' );
18
19	if ( ! isLoaded || page_num != 1 ) {
20		if ( ! container.hasClass( 'gmr-loading' ) ) {
21			container.addClass( 'gmr-loading' );
22
23			tab_content.load(
24				idthemenews.ajax_url,
25				{
26					action: 'newkar_widget_content',
27					tab: tab_name,
28					page: page_num,
29					args: args_obj
30				},
31				function() {
32					container.removeClass( 'gmr-loading' );
33					tab_content.data( 'loaded', 1 ).hide().fadeIn().siblings().hide();
34				}
35			);
36		}
37	} else {
38		tab_content.fadeIn().siblings().hide();
39	}
40}
41
42jQuery( document ).ready(
43	function() {
44		jQuery( '.gmr_widget_content' ).each(
45			function() {
46				var $this     = jQuery( this );
47				var widget_id = this.id;
48				var args      = $this.data( 'args' );
49
50				// load tab content on click.
51				$this.find( '.gmr-tabs a' ).click(
52					function(e) {
53						e.preventDefault();
54						jQuery( this ).parent().addClass( 'selected' ).siblings().removeClass( 'selected' );
55						var tab_name = this.id.slice( 0, -4 ); // -tab
56						idtnews_loadTabContent( tab_name, 1, $this, args );
57					}
58				);
59
60				// pagination.
61				$this.on(
62					'click',
63					'.gmr-pagination a',
64					function(e) {
65						e.preventDefault();
66						var $this_a  = jQuery( this );
67						var tab_name = $this_a.closest( '.tab-content' ).attr( 'id' ).slice( 0, -12 ); // -tab-content
68						var page_num = parseInt( $this_a.closest( '.tab-content' ).children( '.page_num' ).val() );
69
70						if ( $this_a.hasClass( 'next' ) ) {
71							idtnews_loadTabContent( tab_name, page_num + 1, $this, args );
72						} else {
73							$this.find( '#' + tab_name + '-tab-content' ).data( 'loaded', 0 );
74							idtnews_loadTabContent( tab_name, page_num - 1, $this, args );
75						}
76
77					}
78				);
79
80				// load first tab now.
81				$this.find( '.gmr-tabs a' ).first().click();
82			}
83		);
84
85	}
86);

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.