mtekk_adminkit_tabs.js (1464B)
1 jQuery(function() 2 { 3 mtekk_admin_tabulator_init(); 4 }); 5 /** 6 * Tabulator Bootup 7 */ 8 function mtekk_admin_tabulator_init(){ 9 if(!jQuery("#hasadmintabs").length) return; 10 /* init markup for tabs */ 11 jQuery('#hasadmintabs').prepend('<ul class="nav-tab-wrapper"><\/ul>'); 12 jQuery('#hasadmintabs > fieldset').each(function(i){ 13 id = jQuery(this).attr('id'); 14 cssc = jQuery(this).attr('class'); 15 title = jQuery(this).find('h3.tab-title').attr('title'); 16 caption = jQuery(this).find('h3.tab-title').text(); 17 jQuery('#hasadmintabs > ul').append('<li><a href="#'+id+'" class="nav-tab '+cssc+'" title="'+title+'"><span>'+caption+"<\/span><\/a><\/li>"); 18 jQuery(this).find('h3.tab-title').hide(); 19 }); 20 var form = jQuery('#'+objectL10n.mtad_uid+'-options'); 21 /* init the tabs plugin */ 22 var tabs = jQuery("#hasadmintabs").tabs({ 23 beforeActivate: function(event, ui){ 24 form.find('input').each(function(){ 25 if(!this.checkValidity()){ 26 form.find(':submit').click(); 27 event.preventDefault(); 28 } 29 }); 30 /* Update form action for reload on tab traversal*/ 31 var action = form.attr("action").split('#', 1) + '#' + ui.newPanel[0].id; 32 form.get(0).setAttribute("action", action); 33 }, 34 create: function(event, ui){ 35 /* Update form action for reload of current tab on page load */ 36 var action = form.attr("action").split('#', 1) + '#' + ui.panel[0].id; 37 form.get(0).setAttribute("action", action); 38 } 39 }); 40 }