Skip to content

Commit 627baa0

Browse files
committed
fix bug with enable/disable all in options page. bump version to 2.4.1
1 parent 1e414b5 commit 627baa0

File tree

7 files changed

+32
-24
lines changed

7 files changed

+32
-24
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "stylebot",
3-
"version": "2.4.0",
3+
"version": "2.4.1",
44
"description": "Change the appearance of websites instantly.",
55
"scripts": {
66
"build": "cross-env NODE_ENV=production webpack --hide-modules; node ./build_scripts/compile_templates",

src/browseraction/App.vue

+3-3
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
</v-list-item-content>
1616
</v-list-item>
1717

18-
<Style
18+
<style-component
1919
:tab="tab"
2020
:key="style.url"
2121
:url="style.url"
@@ -42,12 +42,12 @@
4242
import Vue from 'vue';
4343
import { mdiCogOutline, mdiImageEditOutline } from '@mdi/js';
4444
45-
import Style from './components/Style.vue';
45+
import StyleComponent from './components/Style.vue';
4646
4747
export default Vue.extend({
4848
name: 'App',
4949
components: {
50-
Style,
50+
StyleComponent,
5151
},
5252
5353
data(): {

src/manifest.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"manifest_version": 2,
33
"name": "Stylebot",
4-
"version": "2.4",
4+
"version": "2.4.1",
55
"description": "Change the appearance of websites instantly.",
66

77
"background": {

src/options/components/Style.vue

+7-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
:label="url"
1818
:ripple="false"
1919
v-model="enabled"
20-
@click="enabled ? $emit('enable') : $emit('disable')"
20+
@click="$emit('toggle')"
2121
/>
2222
</v-col>
2323

@@ -41,6 +41,12 @@ export default Vue.extend({
4141
name: 'Style',
4242
props: ['url', 'css', 'initialEnabled'],
4343
44+
watch: {
45+
initialEnabled(newVal: boolean): void {
46+
this.enabled = newVal;
47+
},
48+
},
49+
4450
components: {
4551
StyleEditor,
4652
StyleEditButton,

src/options/components/StyleEditor.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
<app-button text="Cancel" @click="$emit('cancel')" />
3737
</v-col>
3838

39-
<v-col cols="4">
39+
<v-col cols="4" class="mr-1">
4040
<app-button
4141
text="Save"
4242
color="primary"

src/options/components/TheNavigation.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
<div class="ma-4 ml-7">
2323
<span class="caption">
24-
v2.4 •
24+
v2.4.1
2525
<a target="_blank" href="http://github.com/ankit/stylebot">Readme</a>
2626
2727
<a

src/options/components/TheStylesTab.vue

+18-16
Original file line numberDiff line numberDiff line change
@@ -48,16 +48,15 @@
4848
</v-col>
4949
</v-row>
5050

51-
<Style
51+
<style-component
5252
:key="style.url"
5353
:css="style.css"
5454
:url="style.url"
5555
:initialEnabled="style.enabled"
5656
v-for="style in styles"
5757
@save="saveStyle"
5858
@delete="deleteStyle(style)"
59-
@enable="enableStyle(style)"
60-
@disable="disableStyle(style)"
59+
@toggle="toggleStyle(style)"
6160
/>
6261
</v-col>
6362
</v-row>
@@ -67,8 +66,8 @@
6766
<script lang="ts">
6867
import Vue from 'vue';
6968
70-
import Style from './Style.vue';
7169
import AppButton from './AppButton.vue';
70+
import StyleComponent from './Style.vue';
7271
import StyleEditor from './StyleEditor.vue';
7372
import TheDeleteAllStylesButton from './TheDeleteAllStylesButton.vue';
7473
@@ -83,18 +82,15 @@ import {
8382
deleteAllStyles,
8483
} from '../utilities';
8584
86-
type Style = {
87-
url: string;
88-
css: string;
89-
enabled: boolean;
90-
};
85+
import { Style } from '../types';
9186
9287
export default Vue.extend({
9388
name: 'TheStylesTab',
89+
9490
components: {
95-
Style,
9691
AppButton,
9792
StyleEditor,
93+
StyleComponent,
9894
TheDeleteAllStylesButton,
9995
},
10096
@@ -119,26 +115,32 @@ export default Vue.extend({
119115
this.urlFilter = str;
120116
this.getStyles();
121117
},
118+
122119
deleteStyle(style: Style): void {
123120
deleteStyle(style.url);
124121
this.getStyles();
125122
},
126-
enableStyle(style: Style): void {
127-
enableStyle(style.url);
128-
this.getStyles();
129-
},
130-
disableStyle(style: Style): void {
131-
disableStyle(style.url);
123+
124+
toggleStyle(style: Style): void {
125+
if (style.enabled) {
126+
disableStyle(style.url);
127+
} else {
128+
enableStyle(style.url);
129+
}
130+
132131
this.getStyles();
133132
},
133+
134134
enableAll(): void {
135135
enableAllStyles();
136136
this.getStyles();
137137
},
138+
138139
disableAll(): void {
139140
disableAllStyles();
140141
this.getStyles();
141142
},
143+
142144
deleteAll(): void {
143145
deleteAllStyles();
144146
this.getStyles();

0 commit comments

Comments
 (0)