Prepare v2.0.0 release
This commit is contained in:
@@ -232,7 +232,7 @@
|
||||
var content = document.getElementById('slide-schedule-content');
|
||||
var triggers = document.querySelectorAll('[data-schedule-config]');
|
||||
|
||||
if (!dialog || !content || !triggers.length) {
|
||||
if (!dialog || !content) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -297,20 +297,22 @@
|
||||
window.openScheduleModal = openScheduleModal;
|
||||
window.closeScheduleModal = closeScheduleModal;
|
||||
|
||||
Array.prototype.forEach.call(triggers, function (trigger) {
|
||||
trigger.addEventListener('click', function () {
|
||||
var url = trigger.getAttribute('data-schedule-config');
|
||||
var rowKey = trigger.getAttribute('data-schedule-config-row') || '';
|
||||
var row = trigger.closest('tr[data-playlist-slide-row]');
|
||||
if (row) {
|
||||
var params = collectScheduleParams(row, rowKey || row.getAttribute('data-row-key') || '');
|
||||
url += (url.indexOf('?') === -1 ? '?' : '&') + params.toString();
|
||||
} else if (rowKey && url.indexOf('row_key=') === -1) {
|
||||
url += (url.indexOf('?') === -1 ? '?' : '&') + 'row_key=' + encodeURIComponent(rowKey);
|
||||
}
|
||||
openScheduleModal(url);
|
||||
if (triggers.length) {
|
||||
Array.prototype.forEach.call(triggers, function (trigger) {
|
||||
trigger.addEventListener('click', function () {
|
||||
var url = trigger.getAttribute('data-schedule-config');
|
||||
var rowKey = trigger.getAttribute('data-schedule-config-row') || '';
|
||||
var row = trigger.closest('tr[data-playlist-slide-row]');
|
||||
if (row) {
|
||||
var params = collectScheduleParams(row, rowKey || row.getAttribute('data-row-key') || '');
|
||||
url += (url.indexOf('?') === -1 ? '?' : '&') + params.toString();
|
||||
} else if (rowKey && url.indexOf('row_key=') === -1) {
|
||||
url += (url.indexOf('?') === -1 ? '?' : '&') + 'row_key=' + encodeURIComponent(rowKey);
|
||||
}
|
||||
openScheduleModal(url);
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -727,8 +729,6 @@
|
||||
showVideoDurationButton: slide.showVideoDurationButton,
|
||||
videoSourcePath: slide.videoSourcePath,
|
||||
videoDurationSeconds: slide.videoDurationSeconds,
|
||||
media_type: slide.media_type,
|
||||
media_path: slide.media_path,
|
||||
title: slide.title || 'Slide',
|
||||
duration_seconds: 10,
|
||||
schedule_mode: 'always',
|
||||
@@ -808,6 +808,34 @@
|
||||
return 'Always visible';
|
||||
}
|
||||
|
||||
function collectScheduleParams(row, rowKey) {
|
||||
var params = new URLSearchParams();
|
||||
var fields = getScheduleRowFields(row);
|
||||
|
||||
params.set('row_key', String(rowKey || ''));
|
||||
|
||||
if (fields.mode && fields.mode.value) {
|
||||
params.set('schedule_mode', String(fields.mode.value || ''));
|
||||
}
|
||||
if (fields.startDatetime && fields.startDatetime.value) {
|
||||
params.set('schedule_start_datetime', String(fields.startDatetime.value || ''));
|
||||
}
|
||||
if (fields.endDatetime && fields.endDatetime.value) {
|
||||
params.set('schedule_end_datetime', String(fields.endDatetime.value || ''));
|
||||
}
|
||||
if (fields.startTime && fields.startTime.value) {
|
||||
params.set('schedule_start_time', String(fields.startTime.value || ''));
|
||||
}
|
||||
if (fields.endTime && fields.endTime.value) {
|
||||
params.set('schedule_end_time', String(fields.endTime.value || ''));
|
||||
}
|
||||
if (fields.daysJson && fields.daysJson.value) {
|
||||
params.set('schedule_days_json', String(fields.daysJson.value || ''));
|
||||
}
|
||||
|
||||
return params;
|
||||
}
|
||||
|
||||
function syncAddSlideOptions() {
|
||||
var activeSlideIds = {};
|
||||
var activeCanvasSignatures = {};
|
||||
@@ -951,14 +979,12 @@
|
||||
row.setAttribute('data-row-key', rowKey);
|
||||
row.setAttribute('data-slide-id', String(values.slide_id));
|
||||
row.setAttribute('data-canvas-signature', String(values.canvas_signature || ''));
|
||||
row.setAttribute('data-media-type', String(values.media_type || ''));
|
||||
row.setAttribute('data-media-path', String(values.media_path || ''));
|
||||
row.setAttribute('data-video-source-path', String(values.videoSourcePath || values.media_path || ''));
|
||||
row.setAttribute('data-video-source-path', String(values.videoSourcePath || ''));
|
||||
row.setAttribute('data-video-duration-seconds', String(values.videoDurationSeconds || ''));
|
||||
row.setAttribute('data-use-video-duration', String(Boolean(values.useVideoDuration)));
|
||||
row.setAttribute('data-use-video-duration-state', String(Boolean(values.useVideoDuration)));
|
||||
var durationActionMarkup = buildVideoDurationButtonMarkup(
|
||||
Boolean(values.useVideoDuration),
|
||||
Boolean(values.showVideoDurationButton) || String(values.media_type || '').trim() === 'video'
|
||||
Boolean(values.showVideoDurationButton)
|
||||
);
|
||||
row.innerHTML = '' +
|
||||
buildPlaylistOrderCellMarkup() +
|
||||
@@ -1071,7 +1097,7 @@
|
||||
}
|
||||
|
||||
if (row) {
|
||||
row.setAttribute('data-use-video-duration', isPressed ? 'true' : 'false');
|
||||
row.setAttribute('data-use-video-duration-state', isPressed ? 'true' : 'false');
|
||||
}
|
||||
|
||||
if (!row || !input) {
|
||||
@@ -1096,10 +1122,9 @@
|
||||
}
|
||||
|
||||
async function applyVideoDurationToRow(row, button) {
|
||||
var mediaType = String(row && row.getAttribute('data-media-type') || '').trim().toLowerCase();
|
||||
var mediaPath = String(row && (row.getAttribute('data-video-source-path') || row.getAttribute('data-media-path')) || '').trim();
|
||||
var mediaPath = String(row && row.getAttribute('data-video-source-path') || '').trim();
|
||||
var input = row ? row.querySelector('[name="duration_seconds[]"]') : null;
|
||||
var isVideoRow = mediaType === 'video' || Boolean(mediaPath);
|
||||
var isVideoRow = Boolean(mediaPath);
|
||||
var storedDuration = Number(row && row.getAttribute('data-video-duration-seconds') || 0);
|
||||
|
||||
if (!isVideoRow || !input) {
|
||||
@@ -1160,7 +1185,7 @@
|
||||
|
||||
var removeButton = event.target.closest('[data-playlist-remove-row]');
|
||||
var scheduleButton = event.target.closest('[data-schedule-config]');
|
||||
var durationButton = event.target.closest('[data-use-video-duration]');
|
||||
var durationButton = event.target.closest('.playlist-use-video-duration');
|
||||
var row = getPlaylistSlideRow(event.target);
|
||||
|
||||
if (!row) {
|
||||
@@ -1177,7 +1202,11 @@
|
||||
if (scheduleButton) {
|
||||
event.preventDefault();
|
||||
if (typeof window.openScheduleModal === 'function') {
|
||||
window.openScheduleModal(scheduleButton.getAttribute('data-schedule-config') + '?row_key=' + encodeURIComponent(getPlaylistSlideRowKey(row)));
|
||||
var rowKey = getPlaylistSlideRowKey(row);
|
||||
var url = scheduleButton.getAttribute('data-schedule-config') || '';
|
||||
var params = collectScheduleParams(row, rowKey);
|
||||
url += (url.indexOf('?') === -1 ? '?' : '&') + params.toString();
|
||||
window.openScheduleModal(url);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -1252,7 +1281,7 @@
|
||||
var useVideoDuration = Boolean(editedButton && editedButton.getAttribute('aria-pressed') === 'true');
|
||||
|
||||
if (editedRow) {
|
||||
editedRow.setAttribute('data-use-video-duration', useVideoDuration ? 'true' : 'false');
|
||||
editedRow.setAttribute('data-use-video-duration-state', useVideoDuration ? 'true' : 'false');
|
||||
}
|
||||
|
||||
if (useVideoDuration && editedMirror) {
|
||||
|
||||
Reference in New Issue
Block a user