/** * JS for the Admin Edit Pages * * @author: Alex Stillwagon * @package Alex's Feature Maps * Author URI: http://alexstillwagon.com * @version: 1.3.3 */ jQuery(document).ready(function ($) { /** * Set General Category Overrides |||||||||||||||||||||||||||||||||||||||||||||||||||||||| * @type {*|jQuery} */ // Find the Containing Table var $table = $('.edit-tags-php.taxonomy-asd_map_category').find('table.wp-list-table'); // Remove the Delete Option from the General Category $table.find('span.view a[href*="/map_category/general/"]').parent().parent().find('span.delete').remove(); $table.find('.row-actions span.view').remove(); // Find the Bulk Edit Checkbox var $editcheck = jQuery('.check-column'); // Remove the Checkbox if ($editcheck.find('label').text() == 'Select General') { $editcheck.find('input').remove(); $editcheck.find('label').remove(); } // Set the Map Category to 'General' automatically for all New Places var $checkbox = $('#asd_map_categorychecklist'); // If on Edit Place Page if ($checkbox.length) { // Check if any Category is already chosen var atLeastOneIsChecked = $checkbox.find(':checkbox:checked').length > 0; // If no Category is already chosen if (!atLeastOneIsChecked) { // Loop through Category Checkboxes $checkbox.find('label').each(function () { // Find General category if ($(this).text() == ' General') { // Choose the 'General' Category $(this).find('input').prop("checked", true); } }); } } /** * Map Place Icon Display |||||||||||||||||||||||||||||||||||||||||||||||||||||||| * @type {*|jQuery|HTMLElement} */ // Find the icon container var $iconDiv = $('[data-name="asd_feature_place_icon"]'); // for ACF backwards compatibility if ($iconDiv.length == 0) { // Set to hook used in ACF v.4 $iconDiv = $('[data-field_name="asd_feature_place_icon"]'); } // Add