jQuery(document).ready(function() { /* INIT */ jQuery('#page_template').change(function() { var sel = jQuery(this).val(); var newid = npr_admin_template_newid(sel); var div = jQuery('#'+newid); npr_admin_close_all_template_option(); if(div.length > 0) { npr_admin_open_template_option(newid); } else { npr_admin_open_template_option('npr_page_template_info'); } }); if(jQuery("#page_template").length > 0) { /* EDIT POST SECTION */ curr = jQuery("#page_template").val(); curr = npr_admin_template_newid(curr); if(curr != 'default') { npr_admin_close_all_template_option(); npr_admin_open_template_option(curr); } /* CONTACT PAGE TEMPLATE */ if(jQuery("#npr_show_googlemaps").is(":checked")) { jQuery("#npr_googlemaps_url").show(); } jQuery("#npr_show_googlemaps").change(function(){ if(jQuery(this).is(":checked")) { jQuery("#npr_googlemaps_url").show(); } else { jQuery("#npr_googlemaps_url").hide(); } }); if(jQuery("#npr_show_contact_infos").is(":checked")) { jQuery("#npr_contact_infos").show(); } jQuery("#npr_show_contact_infos").change(function(){ if(jQuery(this).is(":checked")) { jQuery("#npr_contact_infos").show(); } else { jQuery("#npr_contact_infos").hide(); } }); if(jQuery("#npr_minibox_icon").length > 0) { jQuery("#npr_minibox_icon li").click(function(){ var ic = jQuery(this).attr('data-icon'); jQuery("#npr_minibox_icon li").removeClass('selected'); jQuery(this).addClass('selected'); jQuery("#npr_minibox_icon").val(ic); }); } /* EDIT POST SECTION END */ } if(jQuery("#editor_lasttab").length > 0) { npr_init_post_options(); } }); function npr_admin_close_all_template_option() { jQuery(".npr_template_meta_box").removeClass('npr_show'); } function npr_admin_open_template_option(template) { jQuery("#"+template).addClass('npr_show'); if(ipt > 0) jQuery("#npr_post_settings_tabs").find('li:first-child a').effect('highlight',{},1500); ipt = 1; } function npr_admin_template_newid(template) { newid = template; newid = newid.replace('.php',''); newid = 'npr_'+newid; return newid; } function npr_init_post_options() { var inclick = 0; var lstid = ''; if(lastTab != '') { jQuery("#npr_post_settings_tabs").find('a[rel="'+lastTab+'"]').parent('li').addClass('selected'); jQuery("#npr_post_settings_panels").find('#'+lastTab).addClass('selected'); lstid = lastTab; } else { jQuery("#npr_post_settings_tabs").find('li:first-child').addClass('selected'); jQuery("#npr_post_settings_panels").find('div:first-child').addClass('selected'); lstid = jQuery("#npr_post_settings_panels").find('div:first-child').attr('id'); } jQuery("#npr_post_settings_tabs").find('a').click(function(){ if (inclick == 0) { inclick = 1; var lnk = jQuery(this); var nbid = lnk.attr('rel'); jQuery('#'+lstid).fadeOut(500,function(){ jQuery("#npr_post_settings_tabs").find('li').removeClass('selected'); lnk.parent('li').addClass('selected'); jQuery('#'+nbid).fadeIn(500,function(){ inclick = 0; lstid = nbid; jQuery('#editor_lasttab').val(nbid); }) }); } return false; }); }