Fix queue panel bugs caused by newer browsers not respecting valueAsDate for 'datetime-local' inputs
This commit is contained in:
parent
7660db75e7
commit
f90fdf2588
1 changed files with 11 additions and 8 deletions
|
|
@ -1716,7 +1716,7 @@ class schedulePopup{
|
||||||
//Zero out time to the nearest minute
|
//Zero out time to the nearest minute
|
||||||
curDate.setSeconds(0,0);
|
curDate.setSeconds(0,0);
|
||||||
//Set the date prompt to the next minute, adjusted to display local time
|
//Set the date prompt to the next minute, adjusted to display local time
|
||||||
this.datePrompt.valueAsDate = utils.ux.localizeDate(curDate);
|
this.datePrompt.valueAsNumber = utils.ux.localizeDate(curDate).getTime();
|
||||||
|
|
||||||
//Setup input
|
//Setup input
|
||||||
this.setupInput();
|
this.setupInput();
|
||||||
|
|
@ -1745,7 +1745,7 @@ class schedulePopup{
|
||||||
//If we clicked or hit enter
|
//If we clicked or hit enter
|
||||||
if(event.key == null || event.key == "Enter"){
|
if(event.key == null || event.key == "Enter"){
|
||||||
//Get localized input date
|
//Get localized input date
|
||||||
const inputDate = utils.ux.normalizeDate(this.datePrompt.valueAsDate);
|
const inputDate = utils.ux.normalizeDate(new Date(this.datePrompt.valueAsNumber));
|
||||||
|
|
||||||
//Tell the server to move the media
|
//Tell the server to move the media
|
||||||
this.client.socket.emit("queue",{url: this.url, title: this.title, start: inputDate.getTime()});
|
this.client.socket.emit("queue",{url: this.url, title: this.title, start: inputDate.getTime()});
|
||||||
|
|
@ -1783,7 +1783,7 @@ class reschedulePopup extends schedulePopup{
|
||||||
//If we clicked or hit enter
|
//If we clicked or hit enter
|
||||||
if(event.key == null || event.key == "Enter"){
|
if(event.key == null || event.key == "Enter"){
|
||||||
//Get localized input date
|
//Get localized input date
|
||||||
const inputDate = utils.ux.normalizeDate(this.datePrompt.valueAsDate);
|
const inputDate = utils.ux.normalizeDate(new Date(this.datePrompt.valueAsNumber));
|
||||||
|
|
||||||
//Tell the server to move the media
|
//Tell the server to move the media
|
||||||
this.client.socket.emit('move', {uuid: this.media.uuid, start: inputDate.getTime()});
|
this.client.socket.emit('move', {uuid: this.media.uuid, start: inputDate.getTime()});
|
||||||
|
|
@ -1827,7 +1827,7 @@ class clearPopup{
|
||||||
/**
|
/**
|
||||||
* Continuation of object construction, called after child popup object construction
|
* Continuation of object construction, called after child popup object construction
|
||||||
*/
|
*/
|
||||||
asyncConstructor(){
|
async asyncConstructor(){
|
||||||
//Grab required UI elements
|
//Grab required UI elements
|
||||||
this.clearButton = this.popup.contentDiv.querySelector('#clear-media-popup-clear-button');
|
this.clearButton = this.popup.contentDiv.querySelector('#clear-media-popup-clear-button');
|
||||||
this.startDatePrompt = this.popup.contentDiv.querySelector('#clear-media-popup-start-time-prompt');
|
this.startDatePrompt = this.popup.contentDiv.querySelector('#clear-media-popup-start-time-prompt');
|
||||||
|
|
@ -1838,11 +1838,14 @@ class clearPopup{
|
||||||
//Zero out current time to the nearest minute
|
//Zero out current time to the nearest minute
|
||||||
curDate.setSeconds(0,0);
|
curDate.setSeconds(0,0);
|
||||||
//Set the start date prompt to the next minute, adjusted to display local time
|
//Set the start date prompt to the next minute, adjusted to display local time
|
||||||
this.startDatePrompt.valueAsDate = utils.ux.localizeDate(curDate);
|
//For whatever reason firefox fucking hates me for accessing valueAsDate from popups now
|
||||||
|
//Not sure why, this used to work fine
|
||||||
|
//Waitin for DOM to load don't fix it, trust me i've waited for literally seconds worth if render frames and still nuttin'
|
||||||
|
this.startDatePrompt.valueAsNumber = utils.ux.localizeDate(curDate).getTime();
|
||||||
//Add 30 minutes
|
//Add 30 minutes
|
||||||
curDate.setMinutes(curDate.getMinutes() + 30);
|
curDate.setMinutes(curDate.getMinutes() + 30);
|
||||||
//Set the end date prompt to 30 minutes in the futre, adjusted to display local time
|
//Set the end date prompt to 30 minutes in the futre, adjusted to display local time
|
||||||
this.endDatePrompt.valueAsDate = utils.ux.localizeDate(curDate);
|
this.endDatePrompt.valueAsNumber = utils.ux.localizeDate(curDate).getTime();
|
||||||
|
|
||||||
//Setup input
|
//Setup input
|
||||||
this.setupInput();
|
this.setupInput();
|
||||||
|
|
@ -1871,8 +1874,8 @@ class clearPopup{
|
||||||
//If we clicked or hit enter
|
//If we clicked or hit enter
|
||||||
if(event.key == null || event.key == "Enter"){
|
if(event.key == null || event.key == "Enter"){
|
||||||
//Get localized input date
|
//Get localized input date
|
||||||
const inputStartDate = utils.ux.normalizeDate(this.startDatePrompt.valueAsDate);
|
const inputStartDate = utils.ux.normalizeDate(new Date(this.startDatePrompt.valueAsNumber));
|
||||||
const inputEndDate = utils.ux.normalizeDate(this.endDatePrompt.valueAsDate);
|
const inputEndDate = utils.ux.normalizeDate(new Date(this.endDatePrompt.valueAsNumber));
|
||||||
|
|
||||||
//Tell the server to clear media between the input range
|
//Tell the server to clear media between the input range
|
||||||
this.client.socket.emit("clear",{start: inputStartDate.getTime(), end: inputEndDate.getTime()});
|
this.client.socket.emit("clear",{start: inputStartDate.getTime(), end: inputEndDate.getTime()});
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue