Fixed the bug where extension didn't ignore binds when writing comments
This commit is contained in:
parent
8e1687a5b6
commit
3e787be684
@ -4,6 +4,7 @@ if(Debug.debug)
|
|||||||
class Keybinds {
|
class Keybinds {
|
||||||
constructor(pageInfo){
|
constructor(pageInfo){
|
||||||
this.pageInfo = pageInfo;
|
this.pageInfo = pageInfo;
|
||||||
|
this.inputs = ['input','select','button','textarea'];
|
||||||
}
|
}
|
||||||
|
|
||||||
setup(){
|
setup(){
|
||||||
@ -20,10 +21,16 @@ class Keybinds {
|
|||||||
// Tipke upoštevamo samo, če smo v celozaslonskem načinu oz. če ne pišemo komentarja
|
// Tipke upoštevamo samo, če smo v celozaslonskem načinu oz. če ne pišemo komentarja
|
||||||
// v nasprotnem primeru ne naredimo nič.
|
// v nasprotnem primeru ne naredimo nič.
|
||||||
// We only take actions if we're in full screen or not writing a comment
|
// We only take actions if we're in full screen or not writing a comment
|
||||||
if( !(PlayerData.isFullScreen() || (
|
var activeElement = document.activeElement;
|
||||||
(document.activeElement.getAttribute("role") != "textbox") &&
|
|
||||||
(document.activeElement.getAttribute("type") != "text")
|
console.log("[Keybinds::_kbd_process]\n\n\n\n", PlayerData.isFullScreen(), this.inputs.indexOf(activeElement.tagName.toLocaleLowerCase()) !== -1, PlayerData.isFullScreen() && this.inputs.indexOf(activeElement.tagName.toLocaleLowerCase()) !== -1 );
|
||||||
))){
|
|
||||||
|
|
||||||
|
if( (! PlayerData.isFullScreen()) && (
|
||||||
|
(this.inputs.indexOf(activeElement.tagName.toLocaleLowerCase()) !== -1) ||
|
||||||
|
(activeElement.getAttribute("role") === "textbox") ||
|
||||||
|
(activeElement.getAttribute("type") === "text")
|
||||||
|
)){
|
||||||
if(Debug.debug && Debug.keyboard)
|
if(Debug.debug && Debug.keyboard)
|
||||||
console.log("[Keybinds::_kbd_process] We're writing a comment or something. Doing nothing");
|
console.log("[Keybinds::_kbd_process] We're writing a comment or something. Doing nothing");
|
||||||
return;
|
return;
|
||||||
|
@ -83,8 +83,14 @@ class PlayerData {
|
|||||||
this.watchTimeout = setTimeout(function(){
|
this.watchTimeout = setTimeout(function(){
|
||||||
ths.watchTimeout = null;
|
ths.watchTimeout = null;
|
||||||
try{
|
try{
|
||||||
ths.ghettoWatcher();
|
ths.ghettoWatcher();
|
||||||
}catch(e){console.log("[PlayerData::scheduleGhettoWatcher] Scheduling failed. Error:",e)}
|
} catch(e) {
|
||||||
|
if (Debug.debug) {
|
||||||
|
console.log("[PlayerData::scheduleGhettoWatcher] Scheduling failed. Error:",e)
|
||||||
|
}
|
||||||
|
|
||||||
|
ths.scheduleGhettoWatcher(1000);
|
||||||
|
}
|
||||||
ths = null;
|
ths = null;
|
||||||
},
|
},
|
||||||
timeout
|
timeout
|
||||||
|
Loading…
Reference in New Issue
Block a user