Skip to content

Commit

Permalink
auto query path
Browse files Browse the repository at this point in the history
* auto query path on start
* check channel/video id length
  • Loading branch information
horans committed Oct 20, 2021
1 parent 90cdaa1 commit 7a21a90
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ Most of the options use "1/0" to present "on/off".
* `key`: Generate your own YouTube app [key](https://console.developers.google.com/).
* Change it in iframe `head` or pass by URL query.
* Show in URL only when "Change Key" option is on with setting panel.
* `path`: To input a preset youtube video/channel url
* `path`: To input a preset youtube video/channel url.
* The preset path will be auto queried on start.
* `channel`: Default mode is for "video", turn this on for "channel".
* `desc`: To skip description under heading, turn this off.
* `link`: To manually input video views, turn this off.
Expand Down Expand Up @@ -72,7 +73,12 @@ Most of the options use "1/0" to present "on/off".

### Change Log

#### 20211018
#### 211020

* auto query path on start
* check channel/video id length

#### 211018

* allow pass video/channel path from url
* support "youtube.com/embed/" path
Expand Down
7 changes: 4 additions & 3 deletions youtube-revenue.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* description: main function *
* author: [email protected] *
* url: github.com/horans/youtube-revenue-calculator *
* update: 211018 *
* update: 211020 *
*****************************************************/
/* global Vue, WebFont, url, axios */
/* eslint no-unused-vars: ["error", { "varsIgnorePattern": "ytrc" }] */
Expand Down Expand Up @@ -195,10 +195,10 @@ var ytrc = new Vue({
for (var i = 0; i < a.pattern.length; i++) {
if (n === -1) {
n = t.link.path.indexOf(a.pattern[i])
id = t.link.path.substr(n + a.pattern[i].length)
id = t.link.path.substring(n + a.pattern[i].length)
}
}
if (n > -1) {
if (n > -1 && id.length === (t.config.channel ? 24 : 11)) {
t.state.done = true
t.state.error.url = false
} else {
Expand Down Expand Up @@ -254,6 +254,7 @@ var ytrc = new Vue({
}
},
created: function () {
if (this.link.path) this.queryYouTube()
},
mounted: function () {
// page ready when font loaded
Expand Down

1 comment on commit 7a21a90

@horans
Copy link
Owner Author

@horans horans commented on 7a21a90 Oct 20, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

improved #1

Please sign in to comment.