House Status:
Senate Status:
Senate Status:
\/a><\/li>'); //close wrapping ul if (counter === measures.length ) { tabsFrame = tabsFrame.concat('<\/ul>'); } counter ++; }); $("#infinite-tabs").html(tabsFrame); } //load data loadMeasuresData(measures); // Tabs // Set up //show only selected tab and hide others $('.infinite-tabs').each(function(){ var id = $(this).parent().parent().children(".next-nav").attr("id"); if(id!=undefined){ var prefix = id.substr(0,(id.length - ("-next-nav".length))); } else{ var prefix = ""; } $(this).find("ul.tabs-nav li:first").addClass("tab-selected"); $(this).find(".tab-content").hide(); if(prefix == "bill" && location.hash != "") { var hash = location.hash.substr(1); if(hash != '') var activeTabNum = parseInt(hash); else var activeTabNum = 1; update_tabs(activeTabNum, prefix); } else $(this).find(".tab-content:first").show(); }); //Responsible for setting pagination correctly //On this page, as it is related to bills, //after refreshing data it can be used as // update_tabs(1, 'bill'); function update_tabs(activeTabNum, prefix){ if(!isNaN(activeTabNum)){ if(prefix == "bill") location.hash = activeTabNum; //hiding and showing the tabs let activeTab = "#"+prefix+"-tab-"+ activeTabNum; $('.'+prefix+'-tab-content').hide(); $(activeTab).show(); let navgroup = $("#"+prefix+"-next-nav"); let href_link = activeTab.split("-")[0] + '-' + activeTab.split("-")[1]; if(activeTabNum > 1) { navgroup.find("#tab-back-button").attr("href", href_link +"-"+(activeTabNum-1)); } else { navgroup.find("#tab-back-button").attr("href", href_link +"-1"); } let lastTabNum = navgroup.find("#tab-last-button").attr("href").split("-")[2]; if(activeTabNum < lastTabNum) { navgroup.find("#tab-next-button").attr("href", href_link +"-"+(activeTabNum+1)); } else { navgroup.find("#tab-next-button").attr("href", href_link +"-"+lastTabNum); } navgroup.find("#tab-disp-num").html(activeTabNum); } }; // Find from url which tab to open // add case for bill-tab- and remove it $(window).bind('hashchange', function() { let id = $('.next-nav').attr("id"); let prefix = id.substr(0,(id.length - ("-next-nav".length))); if(prefix === "bill") { let hash = location.hash.substr(1); if (hash.includes('bill-tab-')) { hash = hash.replace('bill-tab-',''); } let activeTabNum = ''; if(hash != '') { activeTabNum = parseInt(hash); } else { activeTabNum = 1; } update_tabs(activeTabNum, prefix); } }); // On click on the navigation (pagination) // open next nav and set new ids $("div.next-nav a").click(function(e) { e.preventDefault(); tabgroup = $(this).parent().parent().parent(); navgroup = $(tabgroup).find('.next-nav'); let id = navgroup.attr("id"); let prefix = id.substr(0,(id.length - ("-next-nav".length))); $(tabgroup).find('.'+prefix+'tab-content').hide(); let activeTab = $(this).attr("href"); let activeTabNum = parseInt(activeTab.split("-")[2]); update_tabs(activeTabNum, prefix); return false; }); //reset form $('.cancel-btn').click(function(e) { document.getElementById('id_name').value = null; loadMeasuresData(measures); //set pagination update_tabs(1, 'bill'); }); }); -->