|
|
@ -28,8 +28,6 @@ store.subscribe(() => { |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
consoleFrames.initialize(window.document); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const reloadSettings = () => { |
|
|
|
const reloadSettings = () => { |
|
|
|
return browser.runtime.sendMessage({ |
|
|
|
return browser.runtime.sendMessage({ |
|
|
|
type: messages.SETTINGS_QUERY, |
|
|
|
type: messages.SETTINGS_QUERY, |
|
|
@ -38,6 +36,11 @@ const reloadSettings = () => { |
|
|
|
}); |
|
|
|
}); |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// TODO: the followin methods should be implemented in each top component and
|
|
|
|
|
|
|
|
// frame component
|
|
|
|
|
|
|
|
const initTopComponents = () => { |
|
|
|
|
|
|
|
consoleFrames.initialize(window.document); |
|
|
|
|
|
|
|
|
|
|
|
browser.runtime.onMessage.addListener((action) => { |
|
|
|
browser.runtime.onMessage.addListener((action) => { |
|
|
|
switch (action.type) { |
|
|
|
switch (action.type) { |
|
|
|
case messages.CONSOLE_HIDE_COMMAND: |
|
|
|
case messages.CONSOLE_HIDE_COMMAND: |
|
|
@ -50,5 +53,26 @@ browser.runtime.onMessage.addListener((action) => { |
|
|
|
return Promise.resolve(); |
|
|
|
return Promise.resolve(); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const initFrameConponents = () => { |
|
|
|
|
|
|
|
browser.runtime.onMessage.addListener((action) => { |
|
|
|
|
|
|
|
switch (action.type) { |
|
|
|
|
|
|
|
case messages.CONSOLE_HIDE_COMMAND: |
|
|
|
|
|
|
|
window.focus(); |
|
|
|
|
|
|
|
return Promise.resolve(); |
|
|
|
|
|
|
|
case messages.SETTINGS_CHANGED: |
|
|
|
|
|
|
|
return reloadSettings(); |
|
|
|
|
|
|
|
default: |
|
|
|
|
|
|
|
return Promise.resolve(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (window.self === window.top) { |
|
|
|
|
|
|
|
initTopComponents(); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
initFrameConponents(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
reloadSettings(); |
|
|
|
reloadSettings(); |
|
|
|