Added optional doc argument to popup class for cPanel usage.

This commit is contained in:
rainbow napkin 2025-02-07 06:27:25 -05:00
parent c04edb6691
commit c83ca63f9a
2 changed files with 19 additions and 17 deletions

View file

@ -156,7 +156,7 @@ class queuePanel extends panelObj{
clearMedia(event){
//Call up the popup
new clearPopup(event, this.client, null);
new clearPopup(event, this.client, null, this.ownerDoc);
}
/* add queue controls */
@ -171,7 +171,7 @@ class queuePanel extends panelObj{
queueAt(event){
//Call up the popup
new schedulePopup(event, this.client, this.addMediaLinkPrompt.value, this.addMediaNamePrompt.value, null);
new schedulePopup(event, this.client, this.addMediaLinkPrompt.value, this.addMediaNamePrompt.value, null, this.ownerDoc);
//Clear out prompts
this.addMediaLinkPrompt.value = '';
@ -519,7 +519,7 @@ class queuePanel extends panelObj{
//context menu
const menuMap = new Map([
["Play now", ()=>{this.client.socket.emit('move', {uuid: entry[1].uuid})}],
["Move To...", (event)=>{new reschedulePopup(event, this.client, entry[1])}],
["Move To...", (event)=>{new reschedulePopup(event, this.client, entry[1], null, this.ownerDoc)}],
["Delete", ()=>{this.client.socket.emit('delete', {uuid: entry[1].uuid})}],
["Open in New Tab", ()=>{window.open(entry[1].url, '_blank').focus();}],
["Copy URL", ()=>{navigator.clipboard.writeText(entry[1].url);}],
@ -875,7 +875,7 @@ class queuePanel extends panelObj{
}
class schedulePopup{
constructor(event, client, url, title, cb){
constructor(event, client, url, title, cb, doc){
//Set Client
this.client = client;
//Set link
@ -887,7 +887,7 @@ class schedulePopup{
//Create media popup and call async constructor when done
//unfortunately we cant call constructors asyncronously, and we cant call back to this from super, so we can't extend this as it stands :(
this.popup = new canopyUXUtils.popup('/scheduleMedia', true, this.asyncConstructor.bind(this));
this.popup = new canopyUXUtils.popup('/scheduleMedia', true, this.asyncConstructor.bind(this), doc);
}
asyncConstructor(){
@ -934,9 +934,9 @@ class schedulePopup{
}
class reschedulePopup extends schedulePopup{
constructor(event, client, media, cb){
constructor(event, client, media, cb, doc){
//Call derived constructor
super(event, client, null, null, cb);
super(event, client, null, null, cb, doc);
//Set media
this.media = media;
@ -958,15 +958,16 @@ class reschedulePopup extends schedulePopup{
}
class clearPopup{
constructor(event, client, cb){
constructor(event, client, cb, doc){
//Set Client
this.client = client;
//Set callback
this.cb = cb;
console.log(doc);
//Create media popup and call async constructor when done
//unfortunately we cant call constructors asyncronously, and we cant call back to this from super, so we can't extend this as it stands :(
this.popup = new canopyUXUtils.popup('/clearMedia', true, this.asyncConstructor.bind(this));
this.popup = new canopyUXUtils.popup('/clearMedia', true, this.asyncConstructor.bind(this), doc);
}
asyncConstructor(){