Fixes for crop mode persistence on the popup side of things
This commit is contained in:
parent
5e20925ec5
commit
ab42557283
@ -403,7 +403,7 @@ var ExtensionConf = {
|
|||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
name: 'Persist crop for current session',
|
name: 'Persist crop for current session',
|
||||||
label: 'Always persist',
|
label: 'Current session',
|
||||||
cmd: [{
|
cmd: [{
|
||||||
action: 'set-ar-persistence',
|
action: 'set-ar-persistence',
|
||||||
arg: CropModePersistence.CurrentSession,
|
arg: CropModePersistence.CurrentSession,
|
||||||
|
@ -158,7 +158,6 @@ class ActionHandler {
|
|||||||
"\nevent:", event,
|
"\nevent:", event,
|
||||||
"\nevent.target:", event.target
|
"\nevent.target:", event.target
|
||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// lately youtube has allowed you to read and write comments while watching video in
|
// lately youtube has allowed you to read and write comments while watching video in
|
||||||
@ -256,8 +255,15 @@ class ActionHandler {
|
|||||||
this.settings.active.sites[site].arStatus = cmd.arg;
|
this.settings.active.sites[site].arStatus = cmd.arg;
|
||||||
} else if (cmd.action === 'set-keyboard') {
|
} else if (cmd.action === 'set-keyboard') {
|
||||||
this.settings.active.sites[site].keyboardShortcutsEnabled = cmd.arg;
|
this.settings.active.sites[site].keyboardShortcutsEnabled = cmd.arg;
|
||||||
|
} else if (cmd.action === 'set-ar-persistence') {
|
||||||
|
this.settings.active.sites[site]['cropModePersistence'] = cmd.arg;
|
||||||
|
this.pageInfo.setArPersistence(cmd.arg);
|
||||||
|
this.settings.saveWithoutReload();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (cmd.action !== 'set-ar-persistence') {
|
||||||
|
this.settings.save();
|
||||||
}
|
}
|
||||||
this.settings.save();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@ class Settings {
|
|||||||
}
|
}
|
||||||
const parsedSettings = JSON.parse(changes.uwSettings.newValue);
|
const parsedSettings = JSON.parse(changes.uwSettings.newValue);
|
||||||
if(changes['uwSettings'] && changes['uwSettings'].newValue) {
|
if(changes['uwSettings'] && changes['uwSettings'].newValue) {
|
||||||
ths.setActive(parsedSettings);
|
this.setActive(parsedSettings);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!parsedSettings.preventReload && this.updateCallback) {
|
if(!parsedSettings.preventReload && this.updateCallback) {
|
||||||
|
@ -29,11 +29,11 @@ class ExecAction {
|
|||||||
|
|
||||||
// set-ar-persistence sends stuff to content scripts as well (!)
|
// set-ar-persistence sends stuff to content scripts as well (!)
|
||||||
// it's important to do that BEFORE the save step
|
// it's important to do that BEFORE the save step
|
||||||
if (cmd === 'set-ar-persistence') {
|
if (cmd.action === 'set-ar-persistence') {
|
||||||
// even when setting global defaults, we only send message to the current tab in
|
// even when setting global defaults, we only send message to the current tab in
|
||||||
// order to avoid problems related to
|
// order to avoid problems related to
|
||||||
const message = {
|
const message = {
|
||||||
forwardToContentScript: true,
|
forwardToActive: true,
|
||||||
targetFrame: frame,
|
targetFrame: frame,
|
||||||
frame: frame,
|
frame: frame,
|
||||||
cmd: cmd.action,
|
cmd: cmd.action,
|
||||||
@ -65,8 +65,14 @@ class ExecAction {
|
|||||||
this.settings.active.sites[site].autoar = cmd.arg;
|
this.settings.active.sites[site].autoar = cmd.arg;
|
||||||
} else if (cmd.action === 'set-keyboard') {
|
} else if (cmd.action === 'set-keyboard') {
|
||||||
this.settings.active.sites[site].keyboardShortcutsEnabled = cmd.arg;
|
this.settings.active.sites[site].keyboardShortcutsEnabled = cmd.arg;
|
||||||
|
} else if (cmd.action === 'set-ar-persistence') {
|
||||||
|
this.settings.active.sites[site]['cropModePersistence'] = cmd.arg;
|
||||||
|
this.settings.saveWithoutReload();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (cmd.action !== 'set-ar-persistence') {
|
||||||
|
this.settings.save();
|
||||||
}
|
}
|
||||||
this.settings.save();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -31,7 +31,7 @@
|
|||||||
<div class="flex flex-row flex-wrap">
|
<div class="flex flex-row flex-wrap">
|
||||||
<ShortcutButton v-for="(action, index) of aardActions"
|
<ShortcutButton v-for="(action, index) of aardActions"
|
||||||
class="flex flex-grow button"
|
class="flex flex-grow button"
|
||||||
:class="{'setting-selected': getCurrent('cropModePersistence') === action.cmd[0].arg}"
|
:class="{'setting-selected': getCurrent('autoar') === action.cmd[0].arg}"
|
||||||
:key="index"
|
:key="index"
|
||||||
:label="(action.scopes[scope] && action.scopes[scope].label) ? action.scopes[scope].label : action.label"
|
:label="(action.scopes[scope] && action.scopes[scope].label) ? action.scopes[scope].label : action.label"
|
||||||
:shortcut="parseShortcut(action)"
|
:shortcut="parseShortcut(action)"
|
||||||
@ -49,8 +49,8 @@
|
|||||||
<div class="label">Persists crop mode <template v-if="scope === 'site'">for {{site}}</template>:</div>
|
<div class="label">Persists crop mode <template v-if="scope === 'site'">for {{site}}</template>:</div>
|
||||||
<div class="flex flex-row flex-wrap">
|
<div class="flex flex-row flex-wrap">
|
||||||
<ShortcutButton v-for="(action, index) of cropModePersistenceActions"
|
<ShortcutButton v-for="(action, index) of cropModePersistenceActions"
|
||||||
class="flex flex-grow button"
|
class="flex flex-grow button b3"
|
||||||
:class="{'setting-selected': getCurrent('autoar') === action.cmd[0].arg}"
|
:class="{'setting-selected': getCurrent('cropModePersistence') === action.cmd[0].arg}"
|
||||||
:key="index"
|
:key="index"
|
||||||
:label="(action.scopes[scope] && action.scopes[scope].label) ? action.scopes[scope].label : action.label"
|
:label="(action.scopes[scope] && action.scopes[scope].label) ? action.scopes[scope].label : action.label"
|
||||||
:shortcut="parseShortcut(action)"
|
:shortcut="parseShortcut(action)"
|
||||||
|
Loading…
Reference in New Issue
Block a user