- Popularity is a value between 0 and 100 that is calculated by Spotify based on how many plays the song/artist has recieved and how recent those plays are.
-
-
- This means that an artist/song that has had 100 plays today will have a higher popularity than a song/artist that has 100 from a month ago.
-
-
- This number is not updated in real time so refreshing the page will not reflect it's absolute accurate value.
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/js/auth.js b/js/auth.js
deleted file mode 100644
index 24d8bdc..0000000
--- a/js/auth.js
+++ /dev/null
@@ -1,53 +0,0 @@
-function auth_url () {
- let params = [
- `client_id=${this.auth.client_id}`,
- `response_type=token`,
- `redirect_uri=${encodeURIComponent(this.auth.redirect)}`,
- `scope=${encodeURIComponent(this.auth.scopes.join(" "))}`,
- `show_dialog=${this.auth.show_dialog}`
- ];
-
- // Create the state data if we are using it
- if (this.auth.use_state) {
- let state = Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15);
- params.push(`state=${state}`);
- localStorage.setItem(`top-spotify-state`, state);
- };
-
- return `${this.auth.base_url}?${params.join("&")}`;
-};
-
-
-function verify_auth () {
- let params = new URLSearchParams(window.location.hash.slice(1));
-
- // Check to ensure the authorization was a success
- if (params.get(`access_token`)) {
- this.get_user()
-
- // Check if we compare state
- if (this.use_state) {
-
- // Compare given state to localstorage state
- let LS_state = localStorage.getItem(`top-spotify-state`);
- if (LS_state = params.get(`state`)) {
- console.info(`State compare success`)
- this.authed = true;
- return true
- }
- console.error(`State compare failed`)
- return false
- } else {
- return true
- }
- } else {
- let error = (new URLSearchParams(window.location.search)).get(`error`)
-
- // Authorization failed, error to the user
- if (error !== null) {
- this.error.auth = `Authentication failed or was cancelled, please try again.`;
- window.location.hash = ``;
- }
- return false;
- }
-}
\ No newline at end of file
diff --git a/js/data.js b/js/data.js
deleted file mode 100644
index aa0ed14..0000000
--- a/js/data.js
+++ /dev/null
@@ -1,57 +0,0 @@
-function fetch_data () {
- let url = `${this.api_base}/me/top/${this.type.toLowerCase()}`;
-
- let limit = parseInt(this.count);
- if (!limit) { limit = 10; };
-
- url += `?limit=${limit}&time_range=${this.duration}`;
-
- axios.get(
- url,
- { headers: { Authorization: `Bearer ${this.get_token()}` } }
- ).then((response) => {
- this.data.artists = [];
- this.data.tracks = [];
- this.error.main = ``;
- switch (this.type) {
- case `Tracks`:
- for (var track of response.data.items) {
- this.data.tracks.push({
- name: track.name,
- popularity: track.popularity,
- artists: track.artists,
- link: track.external_urls.spotify,
- duration: track.duration_ms,
- locality: track.is_local,
- id: track.uri,
- album: {
- name: track.album.name,
- image: track.album.images[1],
- link: track.album.external_urls.spotify
- }
- });
- };
- break;
-
- case `Artists`:
- for (var artist of response.data.items) {
- this.data.artists.push({
- name: artist.name,
- id: artist.id,
- popularity: artist.popularity,
- follower_count: artist.followers.total,
- image: artist.images[1],
- genres: artist.genres,
- link: artist.external_urls.spotify
- });
- };
- break;
-
- default:
- this.error.main = `TypeError: ${this.type} is not a supported category`;
- break
- };
- }).catch((err) => {
- this.error.main = `${err.name}: ${err.message}`
- })
-}
\ No newline at end of file
diff --git a/js/dev/app_modifications.js b/js/dev/app_modifications.js
deleted file mode 100644
index 43ae4e7..0000000
--- a/js/dev/app_modifications.js
+++ /dev/null
@@ -1,28 +0,0 @@
-let params = new URLSearchParams(window.location.search);
-let dev_mode = !(params.get(`dev`) == null || params.get(`dev`) === `false`);
-let preview = !(params.get(`preview`) == null || params.get(`preview`) === `false`);
-
-
-function get_dev_data () {
- switch (this.type) {
- case `Artists`:
- this.data.artists = dev_artists;
- this.data.tracks = [];
- break;
- case `Tracks`:
- this.data.artists = [];
- this.data.tracks = dev_tracks;
- break;
- default:
- this.data.tracks = [];
- this.data.artists = [];
- break;
- }
-}
-
-
-if (dev_mode || preview) {
- vue_config.data.user.name = `Preview Mode`;
- vue_config.methods.get_data = get_dev_data;
- vue_config.computed.is_authed = function () { return true; };
-};
\ No newline at end of file
diff --git a/js/dev/data.js b/js/dev/data.js
deleted file mode 100644
index af7c0f2..0000000
--- a/js/dev/data.js
+++ /dev/null
@@ -1 +0,0 @@
-const dev_tracks = [{name:"Into the Unknown",popularity:34,locality:false,link:"https://open.spotify.com/track/37POsvF7xupvgDnYYIXoYX",id:"spotify:track:37POsvF7xupvgDnYYIXoYX",duration:225273,artists:[{external_urls:{spotify:"https://open.spotify.com/artist/6ls5A8Wys9Swixpz4v6kj3"},href:"https://api.spotify.com/v1/artists/6ls5A8Wys9Swixpz4v6kj3",id:"6ls5A8Wys9Swixpz4v6kj3",name:"The Lighthouse And The Whaler",type:"artist",uri:"spotify:artist:6ls5A8Wys9Swixpz4v6kj3"}],album:{name:"Into the Unknown",link:"https://open.spotify.com/album/6NpAhMmG0TkOpapqs6NFnj",image:{url:"https://i.scdn.co/image/ab67616d00001e02e0f91ea6315c150d84e031be"}}},{name:"The Science Love Song",popularity:35,locality:false,link:"https://open.spotify.com/track/0DkvyLEW2VG5e2ruf7kTS9",id:"spotify:track:0DkvyLEW2VG5e2ruf7kTS9",duration:200054,artists:[{external_urls:{spotify:"https://open.spotify.com/artist/7E8gU2qkctwGqHBizPRH9A"},href:"https://api.spotify.com/v1/artists/7E8gU2qkctwGqHBizPRH9A",id:"7E8gU2qkctwGqHBizPRH9A",name:"AsapSCIENCE",type:"artist",uri:"spotify:artist:7E8gU2qkctwGqHBizPRH9A"}],album:{name:"The Science Love Song",link:"https://open.spotify.com/album/13sXGjZuZgXuvjAZfXOXfP",image:{url:"https://i.scdn.co/image/ab67616d00001e02d5e24468d455c3140f0581b2"}}}]; const dev_artists = [{popularity:87,name:"Avicii",link:"https://open.spotify.com/artist/1vCWHaC5f2uS3yhpwWbIA6",image:{url:"https://i.scdn.co/image/9c0d8fa969a9f5db6ff860203d6880a125e501d2"},id:"1vCWHaC5f2uS3yhpwWbIA6",genres:["big room","dance pop","edm","pop"],follower_count:17671212},{popularity:52,name:"'Come From Away' Company",link:"https://open.spotify.com/artist/3yVB4N2PhQy60dAxzCoNdQ",image:undefined,id:"3yVB4N2PhQy60dAxzCoNdQ",genres:["broadway","show tunes"],follower_count:3143}];
\ No newline at end of file
diff --git a/js/prototypes.js b/js/prototypes.js
deleted file mode 100644
index 69f5556..0000000
--- a/js/prototypes.js
+++ /dev/null
@@ -1,10 +0,0 @@
-String.prototype.toTitleCase = function () {
- let words = this.split(` `);
- let new_words = [];
- for (var word of words) {
- new_words.push(
- `${word[0].toUpperCase()}${word.slice(1).toLowerCase()}`
- );
- };
- return new_words.join(` `);
-}
\ No newline at end of file
diff --git a/js/text_computation.js b/js/text_computation.js
deleted file mode 100644
index 0b10959..0000000
--- a/js/text_computation.js
+++ /dev/null
@@ -1,19 +0,0 @@
-function get_button_text () {
- if (this.count === ``) {
- return this.type;
- }
- else if (this.count === `1`) {
- this.error.main = ``;
- return this.type.slice(0,-1);
- }
- else if (this.count <= 0) {
- this.error.main = `Cannot get 0 or fewer ${this.type.toLowerCase()}`;
- return false;
- }
- else if (this.count > 50) {
- this.error.main = `Cannot get more than 50 ${this.type.toLowerCase()}`;
- return false;
- };
- this.error.main = ``;
- return this.type;
-};
\ No newline at end of file