Continued work on playlist management UI
This commit is contained in:
parent
04dec153ac
commit
c3781d6259
7 changed files with 201 additions and 32 deletions
|
|
@ -355,12 +355,14 @@ class canopyUXUtils{
|
|||
}
|
||||
|
||||
static popup = class{
|
||||
constructor(content, ajaxPopup = false, cb, doc = document){
|
||||
constructor(content, ajaxPopup = false, cb, doc = document, keyClose = true){
|
||||
//Define non-popup node values
|
||||
this.content = content;
|
||||
this.ajaxPopup = ajaxPopup;
|
||||
this.cb = cb;
|
||||
this.doc = doc;
|
||||
this.keyClose = keyClose
|
||||
|
||||
//define popup nodes
|
||||
this.createPopup();
|
||||
|
||||
|
|
@ -393,21 +395,23 @@ class canopyUXUtils{
|
|||
this.popupDiv.appendChild(this.closeIcon);
|
||||
this.popupDiv.appendChild(this.contentDiv);
|
||||
|
||||
//If we're closing on keydown
|
||||
if(this.keyClose){
|
||||
//Bit hacky but the only way to remove an event listener while keeping the function bound to this
|
||||
//Isn't javascript precious?
|
||||
this.keyClose = ((event)=>{
|
||||
//If we hit enter or escape
|
||||
if(event.key == "Enter" || event.key == "Escape"){
|
||||
//Close the pop-up
|
||||
this.closePopup();
|
||||
//Remove this event listener
|
||||
this.doc.removeEventListener('keydown', this.keyClose);
|
||||
}
|
||||
}).bind(this);
|
||||
|
||||
//Bit hacky but the only way to remove an event listener while keeping the function bound to this
|
||||
//Isn't javascript precious?
|
||||
this.keyClose = ((event)=>{
|
||||
//If we hit enter or escape
|
||||
if(event.key == "Enter" || event.key == "Escape"){
|
||||
//Close the pop-up
|
||||
this.closePopup();
|
||||
//Remove this event listener
|
||||
this.doc.removeEventListener('keydown', this.keyClose);
|
||||
}
|
||||
}).bind(this);
|
||||
|
||||
//Add event listener to close popup when enter is hit
|
||||
this.doc.addEventListener('keydown', this.keyClose);
|
||||
//Add event listener to close popup when enter is hit
|
||||
this.doc.addEventListener('keydown', this.keyClose);
|
||||
}
|
||||
}
|
||||
|
||||
async fillPopupContent(){
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue