Skip to content

Commit

Permalink
fix bug with enable/disable all in options page. bump version to 2.4.1
Browse files Browse the repository at this point in the history
  • Loading branch information
ankit committed Jun 21, 2020
1 parent 1e414b5 commit 627baa0
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 24 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "stylebot",
"version": "2.4.0",
"version": "2.4.1",
"description": "Change the appearance of websites instantly.",
"scripts": {
"build": "cross-env NODE_ENV=production webpack --hide-modules; node ./build_scripts/compile_templates",
Expand Down
6 changes: 3 additions & 3 deletions src/browseraction/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
</v-list-item-content>
</v-list-item>

<Style
<style-component
:tab="tab"
:key="style.url"
:url="style.url"
Expand All @@ -42,12 +42,12 @@
import Vue from 'vue';
import { mdiCogOutline, mdiImageEditOutline } from '@mdi/js';
import Style from './components/Style.vue';
import StyleComponent from './components/Style.vue';
export default Vue.extend({
name: 'App',
components: {
Style,
StyleComponent,
},
data(): {
Expand Down
2 changes: 1 addition & 1 deletion src/manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"manifest_version": 2,
"name": "Stylebot",
"version": "2.4",
"version": "2.4.1",
"description": "Change the appearance of websites instantly.",

"background": {
Expand Down
8 changes: 7 additions & 1 deletion src/options/components/Style.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
:label="url"
:ripple="false"
v-model="enabled"
@click="enabled ? $emit('enable') : $emit('disable')"
@click="$emit('toggle')"
/>
</v-col>

Expand All @@ -41,6 +41,12 @@ export default Vue.extend({
name: 'Style',
props: ['url', 'css', 'initialEnabled'],
watch: {
initialEnabled(newVal: boolean): void {
this.enabled = newVal;
},
},
components: {
StyleEditor,
StyleEditButton,
Expand Down
2 changes: 1 addition & 1 deletion src/options/components/StyleEditor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
<app-button text="Cancel" @click="$emit('cancel')" />
</v-col>

<v-col cols="4">
<v-col cols="4" class="mr-1">
<app-button
text="Save"
color="primary"
Expand Down
2 changes: 1 addition & 1 deletion src/options/components/TheNavigation.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

<div class="ma-4 ml-7">
<span class="caption">
v2.4 •
v2.4.1
<a target="_blank" href="http://github.com/ankit/stylebot">Readme</a>
<a
Expand Down
34 changes: 18 additions & 16 deletions src/options/components/TheStylesTab.vue
Original file line number Diff line number Diff line change
Expand Up @@ -48,16 +48,15 @@
</v-col>
</v-row>

<Style
<style-component
:key="style.url"
:css="style.css"
:url="style.url"
:initialEnabled="style.enabled"
v-for="style in styles"
@save="saveStyle"
@delete="deleteStyle(style)"
@enable="enableStyle(style)"
@disable="disableStyle(style)"
@toggle="toggleStyle(style)"
/>
</v-col>
</v-row>
Expand All @@ -67,8 +66,8 @@
<script lang="ts">
import Vue from 'vue';
import Style from './Style.vue';
import AppButton from './AppButton.vue';
import StyleComponent from './Style.vue';
import StyleEditor from './StyleEditor.vue';
import TheDeleteAllStylesButton from './TheDeleteAllStylesButton.vue';
Expand All @@ -83,18 +82,15 @@ import {
deleteAllStyles,
} from '../utilities';
type Style = {
url: string;
css: string;
enabled: boolean;
};
import { Style } from '../types';
export default Vue.extend({
name: 'TheStylesTab',
components: {
Style,
AppButton,
StyleEditor,
StyleComponent,
TheDeleteAllStylesButton,
},
Expand All @@ -119,26 +115,32 @@ export default Vue.extend({
this.urlFilter = str;
this.getStyles();
},
deleteStyle(style: Style): void {
deleteStyle(style.url);
this.getStyles();
},
enableStyle(style: Style): void {
enableStyle(style.url);
this.getStyles();
},
disableStyle(style: Style): void {
disableStyle(style.url);
toggleStyle(style: Style): void {
if (style.enabled) {
disableStyle(style.url);
} else {
enableStyle(style.url);
}
this.getStyles();
},
enableAll(): void {
enableAllStyles();
this.getStyles();
},
disableAll(): void {
disableAllStyles();
this.getStyles();
},
deleteAll(): void {
deleteAllStyles();
this.getStyles();
Expand Down

0 comments on commit 627baa0

Please sign in to comment.