jQuery(document).ready(function() { /* If there are required actions, add an icon with the number of required actions in the About shapely page -> Actions required tab */ var shapely_nr_actions_required = shapelyLiteWelcomeScreenObject.nr_actions_required; if ( (typeof shapely_nr_actions_required !== 'undefined') && (shapely_nr_actions_required != '0') ) { jQuery('li.shapely-w-red-tab a').append('' + shapely_nr_actions_required + ''); } /* Dismiss required actions */ jQuery(".shapely-dismiss-required-action").click(function(){ var id= jQuery(this).attr('id'); console.log(id); jQuery.ajax({ type : "GET", data : { action: 'shapely_lite_dismiss_required_action',dismiss_id : id }, dataType : "html", url : shapelyLiteWelcomeScreenObject.ajaxurl, beforeSend : function(data,settings){ jQuery('.shapely-tab-pane#actions_required h1').append('
'); }, success : function(data){ jQuery("#temp_load").remove(); /* Remove loading gif */ jQuery('#'+ data).parent().remove(); /* Remove required action box */ var shapely_lite_actions_count = jQuery('.shapely-actions-count').text(); /* Decrease or remove the counter for required actions */ if( typeof shapely_lite_actions_count !== 'undefined' ) { if( shapely_lite_actions_count == '1' ) { jQuery('.shapely-actions-count').remove(); jQuery('.shapely-tab-pane#actions_required').append('

' + shapelyLiteWelcomeScreenObject.no_required_actions_text + '

'); } else { jQuery('.shapely-actions-count').text(parseInt(shapely_lite_actions_count) - 1); } } }, error : function(jqXHR, textStatus, errorThrown) { console.log(jqXHR + " :: " + textStatus + " :: " + errorThrown); } }); }); /* Tabs in welcome page */ function shapely_welcome_page_tabs(event) { jQuery(event).parent().addClass("active"); jQuery(event).parent().siblings().removeClass("active"); var tab = jQuery(event).attr("href"); jQuery(".shapely-tab-pane").not(tab).css("display", "none"); jQuery(tab).fadeIn(); } var shapely_actions_anchor = location.hash; if( (typeof shapely_actions_anchor !== 'undefined') && (shapely_actions_anchor != '') ) { shapely_welcome_page_tabs('a[href="'+ shapely_actions_anchor +'"]'); } jQuery(".shapely-nav-tabs a").click(function(event) { event.preventDefault(); shapely_welcome_page_tabs(this); }); /* Tab Content height matches admin menu height for scrolling purpouses */ $tab = jQuery('.shapely-tab-content > div'); $admin_menu_height = jQuery('#adminmenu').height(); if( (typeof $tab !== 'undefined') && (typeof $admin_menu_height !== 'undefined') ) { $newheight = $admin_menu_height - 180; $tab.css('min-height',$newheight); } });