diff --git a/dashboard-ui/bower_components/emby-webcomponents/actionsheet/actionsheet.js b/dashboard-ui/bower_components/emby-webcomponents/actionsheet/actionsheet.js index 84719ba103..988f771092 100644 --- a/dashboard-ui/bower_components/emby-webcomponents/actionsheet/actionsheet.js +++ b/dashboard-ui/bower_components/emby-webcomponents/actionsheet/actionsheet.js @@ -25,7 +25,9 @@ results[i] = { top: box.top, - left: box.left + left: box.left, + width: box.width, + height: box.height }; } @@ -45,10 +47,10 @@ var pos = getOffsets([options.positionTo])[0]; if (options.positionY != 'top') { - pos.top += options.positionTo.offsetHeight / 2; + pos.top += (pos.height || 0) / 2; } - pos.left += options.positionTo.offsetWidth / 2; + pos.left += (pos.width || 0) / 2; var height = dlg.offsetHeight || 300; var width = dlg.offsetWidth || 160; diff --git a/dashboard-ui/bower_components/emby-webcomponents/dialoghelper/dialoghelper.js b/dashboard-ui/bower_components/emby-webcomponents/dialoghelper/dialoghelper.js index f2b5ef3042..bbcdb866c8 100644 --- a/dashboard-ui/bower_components/emby-webcomponents/dialoghelper/dialoghelper.js +++ b/dashboard-ui/bower_components/emby-webcomponents/dialoghelper/dialoghelper.js @@ -281,7 +281,7 @@ })); } }; - if (!dlg.animationConfig || !dlg.animate) { + if (!dlg.animationConfig) { onAnimationFinish(); return; } @@ -312,7 +312,7 @@ } }; - if (!dlg.animationConfig || !dlg.animate) { + if (!dlg.animationConfig) { onAnimationFinish(); return; } diff --git a/dashboard-ui/bower_components/emby-webcomponents/emby-button/emby-button.css b/dashboard-ui/bower_components/emby-webcomponents/emby-button/emby-button.css index 96d9522955..4237df422f 100644 --- a/dashboard-ui/bower_components/emby-webcomponents/emby-button/emby-button.css +++ b/dashboard-ui/bower_components/emby-webcomponents/emby-button/emby-button.css @@ -28,7 +28,6 @@ font-weight: 500; /* Disable webkit tap highlighting */ -webkit-tap-highlight-color: rgba(0,0,0,0); - box-shadow: 0 2px 2px 0 rgba(0, 0, 0, 0.14), 0 1px 5px 0 rgba(0, 0, 0, 0.12), 0 3px 1px -2px rgba(0, 0, 0, 0.2); } .emby-button::-moz-focus-inner { diff --git a/dashboard-ui/components/accessschedule/accessschedule.js b/dashboard-ui/components/accessschedule/accessschedule.js new file mode 100644 index 0000000000..d6545acea3 --- /dev/null +++ b/dashboard-ui/components/accessschedule/accessschedule.js @@ -0,0 +1,113 @@ +define(['dialogHelper', 'datetime', 'emby-select', 'paper-icon-button-light', 'formDialogStyle'], function (dialogHelper, datetime) { + + function getDisplayTime(hours) { + + var minutes = 0; + + var pct = hours % 1; + + if (pct) { + minutes = parseInt(pct * 60); + } + + return datetime.getDisplayTime(new Date(2000, 1, 1, hours, minutes, 0, 0)); + } + + function populateHours(context) { + + var html = ''; + + for (var i = 0; i < 24; i++) { + + html += ''; + } + + html += ''; + + context.querySelector('#selectStart').innerHTML = html; + context.querySelector('#selectEnd').innerHTML = html; + } + + function loadSchedule(context, schedule) { + + context.querySelector('#selectDay').value = schedule.DayOfWeek || 'Sunday'; + context.querySelector('#selectStart').value = schedule.StartHour || 0; + context.querySelector('#selectEnd').value = schedule.EndHour || 0; + } + + function submitSchedule(context, options) { + + var updatedSchedule = { + DayOfWeek: context.querySelector('#selectDay').value, + StartHour: context.querySelector('#selectStart').value, + EndHour: context.querySelector('#selectEnd').value + }; + + if (parseFloat(updatedSchedule.StartHour) >= parseFloat(updatedSchedule.EndHour)) { + + alert(Globalize.translate('ErrorMessageStartHourGreaterThanEnd')); + + return; + } + + context.submitted = true; + options.schedule = Object.assign(options.schedule, updatedSchedule); + dialogHelper.close(context); + } + + return { + show: function (options) { + return new Promise(function (resolve, reject) { + + var xhr = new XMLHttpRequest(); + xhr.open('GET', 'components/accessschedule/accessschedule.template.html', true); + + xhr.onload = function (e) { + + var template = this.response; + var dlg = dialogHelper.createDialog({ + removeOnClose: true, + size: 'small' + }); + + dlg.classList.add('formDialog'); + + var html = ''; + + html += Globalize.translateDocument(template); + + dlg.innerHTML = html; + + populateHours(dlg); + loadSchedule(dlg, options.schedule); + + dialogHelper.open(dlg); + + dlg.addEventListener('close', function () { + + if (dlg.submitted) { + resolve(options.schedule); + } else { + reject(); + } + }); + + dlg.querySelector('.btnCancel').addEventListener('click', function (e) { + + dialogHelper.close(dlg); + }); + + dlg.querySelector('form').addEventListener('submit', function (e) { + + submitSchedule(dlg, options); + + e.preventDefault(); + return false; + }); + } + + xhr.send(); + }); + } + }; +}); \ No newline at end of file diff --git a/dashboard-ui/components/accessschedule/accessschedule.template.html b/dashboard-ui/components/accessschedule/accessschedule.template.html new file mode 100644 index 0000000000..a388acbf1f --- /dev/null +++ b/dashboard-ui/components/accessschedule/accessschedule.template.html @@ -0,0 +1,39 @@ +