Added basic option to specify alternative IA CDN servers within the settings panel.
This commit is contained in:
parent
08d2bf8bc9
commit
e9c474eaf0
6 changed files with 98 additions and 5 deletions
|
|
@ -32,8 +32,16 @@ class settingsPanel extends panelObj{
|
|||
}
|
||||
|
||||
docSwitch(){
|
||||
/**
|
||||
* Youtube Source Selector
|
||||
*/
|
||||
this.youtubeSource = this.panelDocument.querySelector("#settings-panel-youtube-source select");
|
||||
|
||||
/**
|
||||
* Internet Archive CDN Server Input
|
||||
*/
|
||||
this.IACDNInput = this.panelDocument.querySelector("#settings-panel-ia-server input");
|
||||
|
||||
this.renderSettings();
|
||||
this.setupInput();
|
||||
}
|
||||
|
|
@ -43,6 +51,7 @@ class settingsPanel extends panelObj{
|
|||
*/
|
||||
setupInput(){
|
||||
this.youtubeSource.addEventListener('change', this.updateYoutubeSource.bind(this));
|
||||
this.IACDNInput.addEventListener('keydown', this.updateIACDN.bind(this));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -50,6 +59,7 @@ class settingsPanel extends panelObj{
|
|||
*/
|
||||
renderSettings(){
|
||||
this.youtubeSource.value = localStorage.getItem("ytPlayerType");
|
||||
this.IACDNInput.value = localStorage.getItem("IACDN");
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -59,4 +69,15 @@ class settingsPanel extends panelObj{
|
|||
localStorage.setItem("ytPlayerType", this.youtubeSource.value);
|
||||
client.processConfig("ytPlayerType", this.youtubeSource.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Event handler for Internet Archive CDN Server input
|
||||
* @param {Event} event - Event handed down by event listener
|
||||
*/
|
||||
updateIACDN(event){
|
||||
if(event.key == "Enter"){
|
||||
localStorage.setItem("IACDN", this.IACDNInput.value);
|
||||
client.processConfig("IACDN", this.IACDNInput.value);
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue