PageSourceSearch

https://actionnetwork.org/includes/js/tabs.js?v=71

js actionnetwork.org collected 2026-09-24 07:04:19 UTC 4,735 bytes, 126 lines download raw bytes

1function resetTabs(){
2    $("#tab_wrap > div, #tab_wrap > form > div").hide(); // allow tabs that have form tags between them like sharing options to work
3    $("#tabs a").attr("id","");       
4}
5
6function tabbing() {
7    $("#tab_wrap > div, #tab_wrap > form > div").hide(); // Initially hide all content, allow tabs that have form tags between them like sharing options to work
8    //console.log(window.location.hash);
9    // does the URL contain a hash of a tab?
10    
11    if (window.location.hash != '') {
12	    $("#tabs a").each(function() {
13	       if (window.location.hash == $(this).attr("name")) {
14	           tab_selectedByHash = $(this).attr("name");
15	       }
16	    });
17    } else {
18       tab_selectedByHash = 'first';
19   }
20    
21    
22    if(tab_selectedByHash == 'first') {
23        $("#tabs li:first a").attr("id","current"); // Activate first tab
24        if ($(".js-form-tab-wrap").length) {
25	        $("#tab_wrap .js-tab_response").fadeIn(); // Show first tab content. NOTE: This only works because we don't have a first tab that's in a form like sharing options. If we ever do, we'll have to fix this so it gets shown first.
26        } else {
27	        $("#tab_wrap > div:first").fadeIn(); // Show first tab content. NOTE: This only works because we don't have a first tab that's in a form like sharing options. If we ever do, we'll have to fix this so it gets shown first.
28        }
29        
30    } else {
31        $("#tabs a[name=" + tab_selectedByHash + "]").attr("id","current"); // Activate tab via url
32        $("#tab_wrap " + tab_selectedByHash).fadeIn(function() {
33	         $(document).trigger('tabMove', tab_selectedByHash);  
34        }); // Show tab via url content
35        
36        //scroll to tab, a bit hacky
37        //window.setTimeout(function() {
38           // $(window).scrollTop(parseInt($("#tabs").offset().top) + parseInt($("#tabs").css("margin-top") + parseInt($("#tabs").css("padding-top"))) - 50);
39        //}, 500); 
40        
41        //console.log(selectedByHash); 
42        
43       
44    }
45    
46    $(window).scrollTop(tab_scroll_position);
47}
48
49
50
51(function(){
52    //fire on initialization
53    tab_scroll_position = window.scrollY;
54    $(document).on('ready', function() {
55        var hashMatchesTab = window.location.hash !== '' &&
56            $("#tabs a[name='" + window.location.hash + "']").length > 0;
57        if (!hashMatchesTab) {
58            $(document).trigger('tabMove', $("#tabs li:first a").attr('name'));
59        }
60        
61        tab_selectedByHash = 'first';
62        
63        $(window).on('hashchange', function(e) {
64	        e.preventDefault();
65	        tab_scroll_position = $(window).scrollTop();
66	        resetTabs();
67	        tabbing();
68	        //console.log(selectedByHash);
69		    $("#tabs a[name=" + tab_selectedByHash + "]").attr("id","current"); // Activate this
70		    $(document).trigger('tabMove', $(this).attr("name"));
71		    //$(window).scrollTop(0);
72        });
73        
74        tabbing();
75        
76    
77        
78        
79        //console.log('docready');
80        
81    });
82    
83    
84    
85    $("#tabs a").on("click",function(e) {
86    	if (!$(this).hasClass('disabled')) {
87	    	//window.location = $(this).attr("name");
88	        e.preventDefault();
89	        if ($(this).attr("id") == "current"){ // detection for current tab
90	            return       
91	        } else {             
92	            resetTabs();
93	            $(this).attr("id","current"); // Activate this
94	            $($(this).attr('name')).fadeIn(); // Show content for current tab
95	            history.pushState({}, '', window.location.origin + window.location.pathname + $(this).attr("name"));
96	        }
97	     
98	        $(document).trigger('tabMove', $(this).attr("name"));
99    	}
100    });
101
102    $(".js-nested_tab_wrap .js-nested_tab").hide();
103    $(".js-nested_tab_wrap").each(function(i, tab) {
104		$(tab).find(".js-nested_tab").first().show();
105	});
106    $(".js-tabs_nested a").on("click", function (e) {
107        if (!$(this).hasClass('disabled')) {
108	        e.preventDefault();
109	        if ($(this).attr("id") == "current"){ // detection for current tab
110                return;       
111	        } else {           
112                $(".js-nested_tab_wrap .js-nested_tab").hide();
113                $(".js-tabs_nested a").attr("id","");       
114	            $(this).attr("id","current"); // Activate this
115	            $($(this).attr('name')).fadeIn(); // Show content for current tab
116                
117                if($(this).attr("name") == "#tab_stats_first_hour") {
118                   $('.stats-filter__wrap').removeClass('d-flex').addClass('hide');
119                } else {
120                   $('.stats-filter__wrap').removeClass('hide').addClass('d-flex');
121                }
122	        }
123    	}
124    })
125
126})()

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.