Skip to content

Commit

Permalink
fallback to default
Browse files Browse the repository at this point in the history
fallback to default value when key/title state is disabled.
  • Loading branch information
horans committed Jul 30, 2018
1 parent 2c5f520 commit 6131218
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions youtube-revenue.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* url: github.com/horans/youtube-revenue-calculator *
* update: 180730 *
*****************************************************/
/* global Vue, WebFont, url, key, axios */
/* global Vue, WebFont, url, axios */
/* eslint no-unused-vars: ["error", { "varsIgnorePattern": "ytrc" }] */

/* bus */
Expand All @@ -31,16 +31,16 @@ var ytrc = new Vue({
note: url('?note') === undefined ? true : url('?note') === '1',
detail: url('?detail') === undefined ? false : url('?detail') === '1',
title: url('?title') || '',
key: url('?key') || key || ''
key: url('?key') || window.key || ''
},
state: {
init: false,
wait: false,
done: true,
tool: false,
help: false,
title: false,
key: false
title: url('?title'),
key: url('?key')
},
link: {
path: '',
Expand Down Expand Up @@ -238,12 +238,14 @@ var ytrc = new Vue({
deep: true,
immediate: true
},
// update url when key/title state changes
'state.key': function () {
// update url when key/title state changes
'state.key': function (nv) {
this.toggleLink()
if (!nv) this.config.key = window.key
},
'state.title': function () {
'state.title': function (nv) {
this.toggleLink()
if (!nv) this.config.title = ''
},
// link counter with slider for views
'slider.views.value': {
Expand Down

0 comments on commit 6131218

Please sign in to comment.