You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
38 lines
944 B
38 lines
944 B
(function () {
|
|
|
|
const previewFrame = document.getElementById('preview_frame');
|
|
|
|
initDataOptions();
|
|
initResponsiveMode();
|
|
|
|
/**
|
|
* Functions
|
|
*/
|
|
|
|
function initDataOptions() {
|
|
const dataOptionsSelect = document.getElementById('data-options');
|
|
if (!dataOptionsSelect) {
|
|
return;
|
|
}
|
|
|
|
dataOptionsSelect.addEventListener('change', function () {
|
|
previewFrame.src = window.previewFrameUrl + '?data=' + this.value;
|
|
});
|
|
}
|
|
|
|
function initResponsiveMode() {
|
|
|
|
document.querySelectorAll('input[name="responsive_mode"]').forEach((input) => {
|
|
input.addEventListener('change', (event) => {
|
|
const mode = event.target.value;
|
|
|
|
previewFrame.classList.remove('breakpoint--desktop');
|
|
previewFrame.classList.remove('breakpoint--tablet');
|
|
previewFrame.classList.remove('breakpoint--mobile');
|
|
|
|
previewFrame.classList.add('breakpoint--' + mode);
|
|
});
|
|
});
|
|
}
|
|
|
|
})();
|
|
|