Skip to content

Commit

Permalink
Ran grunt
Browse files Browse the repository at this point in the history
  • Loading branch information
hansmorb committed Dec 4, 2024
1 parent ef87033 commit fcb787b
Show file tree
Hide file tree
Showing 3 changed files with 99 additions and 2 deletions.
36 changes: 35 additions & 1 deletion assets/admin/css/admin.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@charset "UTF-8";
/*
* Admin styles
*
Expand Down Expand Up @@ -3507,7 +3508,40 @@ a.disabled {
display: none;
}

/* Booking form */
/* Map creation */
/*
* The CPT creation form map
*/
#cmb2-metabox-cb_map-custom-fields .map-organizer .cmb2-metabox-title {
font-size: x-large;
}
#cmb2-metabox-cb_map-custom-fields .map-organizer .cmb2-metabox-title:before {
/* arrow to right */
content: "→ ";
}
#cmb2-metabox-cb_map-custom-fields .cmb-group-name {
font-size: x-large;
font-weight: bold;
}
#cmb2-metabox-cb_map-custom-fields .cmb-group-name:before {
content: "→ ";
}
#cmb2-metabox-cb_map-custom-fields #shortcode-field {
display: flex;
align-items: center;
flex-wrap: nowrap;
gap: 10px;
}
#cmb2-metabox-cb_map-custom-fields #shortcode-field code {
white-space: nowrap;
margin-right: 10px;
}
#cmb2-metabox-cb_map-custom-fields #shortcode-field .button {
padding: 5px 10px;
line-height: 1.5;
}

/* Plugin update page */
/**
* Plugin list update message
*
Expand Down
63 changes: 63 additions & 0 deletions assets/admin/js/admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,69 @@
});
})(jQuery);

(function($) {
"use strict";
$(function() {
const mapSettingsForm = $("#cmb2-metabox-cb_map-custom-fields");
const hideFieldset = function(set) {
$.each(set, function() {
$(this).parents(".cmb-row").hide();
});
};
const showFieldset = function(set) {
$.each(set, function() {
$(this).parents(".cmb-row").show();
});
};
const copyToClipboard = function(element) {
let code = $(element).find("code")[0];
let text = code.innerText;
navigator.clipboard.writeText(text).then(function() {
let button = $(element).find(".button");
let buttonText = button.text();
button.text("✓");
button.disabled = true;
setTimeout(function() {
button.text(buttonText);
button.disabled = false;
}, 2e3);
});
};
const copyToClipboardButton = $("#shortcode-field").find(".button");
copyToClipboardButton.on("click", function() {
copyToClipboard($("#shortcode-field"));
});
function handleCustomFileInput(fileSelectorID, fileInputFields) {
const markerFileSelect = document.querySelector(fileSelectorID);
const handleSelectCustomMarker = function() {
showFieldset(fileInputFields);
if (markerFileSelect.value === "") {
hideFieldset(fileInputFields);
}
};
handleSelectCustomMarker();
const observerConfig = {
attributes: true,
childList: false,
subtree: false
};
const observer = new MutationObserver(function(mutations) {
mutations.forEach(function(mutation) {
if (mutation.attributeName === "value") {
handleSelectCustomMarker();
}
});
});
observer.observe(markerFileSelect, observerConfig);
}
if (mapSettingsForm.length) {
handleCustomFileInput("#custom_marker_media", [ $("#marker_icon_width"), $("#marker_icon_height"), $("#marker_icon_anchor_x"), $("#marker_icon_anchor_y") ]);
handleCustomFileInput("#custom_marker_cluster_media", [ $("#marker_cluster_icon_width"), $("#marker_cluster_icon_height") ]);
handleCustomFileInput("#marker_item_draft_media", [ $("#marker_item_draft_icon_width"), $("#marker_item_draft_icon_height"), $("#marker_item_draft_icon_anchor_x"), $("#marker_item_draft_icon_anchor_y") ]);
}
});
})(jQuery);

(function($) {
"use strict";
$(function() {
Expand Down
Loading

0 comments on commit fcb787b

Please sign in to comment.