Connect popup (video settings only so far) to content script logic

This commit is contained in:
Tamius Han 2022-03-22 01:23:50 +01:00
parent 7fefe255ea
commit 89168b643c
3 changed files with 6 additions and 3 deletions

View File

@ -309,6 +309,8 @@ export default {
BrowserDetect.runtime.openOptionsPage();
},
execAction(command) {
const cmd = JSON.parse(JSON.stringify(command));
window.parent.postMessage(cmd, '*');
// this.eventBus?.send(command.action, command.arguments);
},
parseShortcut(command) {

View File

@ -15,7 +15,6 @@ class ExecAction {
async exec(action, scope, frame, useBus) {
console.log('execing actioN!');
for (var cmd of action.cmd) {
if (!scope || scope === 'page') {
const message = {
@ -29,6 +28,7 @@ class ExecAction {
if (useBus) {
// todo: postMessage out of the iframe!
// window.ultrawidify.bus.sendMessage(message.cmd, message);
window.parent.sendMessage(message.cmd, message);
} else {
Comms.sendMessage(message);
}
@ -49,8 +49,9 @@ class ExecAction {
// this hopefully delays settings.save() until current crops are saved on the site
// and thus avoid any fucky-wuckies
if (useBus) {
// todo: postMessage out of the iframe!
// todo: postMessage out of the iframe!
// window.ultrawidify.bus.sendMessage(message.cmd, message);
window.parent.sendMessage(message.cmd, message);
} else {
await Comms.sendMessage(message);
}

View File

@ -95,7 +95,7 @@ class PlayerData {
this.element = this.getPlayer();
// this.notificationService = new PlayerNotificationUi(this.element, this.settings, this.eventBus);
this.ui = new UI('ultrawidifyUi', {parentElement: this.element});
this.ui = new UI('ultrawidifyUi', {parentElement: this.element, eventBus: this.eventBus});
// this.ui.init();
this.dimensions = undefined;