Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions media/system/js/fields/calendar-vanilla.js
Original file line number Diff line number Diff line change
Expand Up @@ -1020,11 +1020,16 @@
}
};

/** Init the Calendars on the page */
JoomlaCalendar.init = function (className) {
/**
* Init the Calendars on the page
*
* @param {String} className The field class name (required)
* @param {HTMLElement} container The field container (optional)
*/
JoomlaCalendar.init = function (className, container) {
var elements, i, instance;

elements = document.querySelectorAll(className);
elements = (container || document).querySelectorAll(className);

// Fall back for translation strings
window.JoomlaCalLocale = window.JoomlaCalLocale ? JoomlaCalLocale : {};
Expand Down Expand Up @@ -1065,6 +1070,10 @@
/** Instantiate all the calendar fields when the document is ready */
document.addEventListener("DOMContentLoaded", function() {
JoomlaCalendar.init(".field-calendar");

window.jQuery && jQuery(document).on("subform-row-add", function (event, row) {
JoomlaCalendar.init(".field-calendar", row);
});
});

})(window, document);
Loading