-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.html
166 lines (146 loc) · 8.66 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>Playlistify</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.0.0-alpha.6/css/bootstrap.min.css">
<script src="https://use.fontawesome.com/47a4b5d58f.js"></script>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div id="app" v-cloak>
<div class="container" >
<div class="row">
<div class="col-md-6">
<h1 class="ui header">
<span class="fa fa-spotify"></span>
Playlistify <small>for Spotify</small>
</h1>
</div>
<div class="col-md-6">
<div id="player" class="aplayer"></div>
</div>
</div>
<div class="row" v-if="accessToken != null">
<div class="col-md-6" v-on:submit.prevent="search()">
<form class="" action="index.html" method="post">
<div class="input-group">
<input type="text" class="form-control" placeholder="Search for music, artists and abums..." v-model="queryBox">
<span class="input-group-btn">
<button class="btn btn-primary" type="submit"><span class="fa fa-search"></span></button>
</span>
</div>
</form>
<br>
<ul class="list-group" v-if="tracks.length > 0">
<li class="list-group-item" v-for="(track, index) in tracks">
<div class="row">
<div class="col-md-3">
<a v-bind:href="track.uri">
<img v-bind:src="track.album.images[0].url" class="img-fluid">
</a>
</div>
<div class="col-md-9">
<div class="d-flex w-100 justify-content-between">
<h5 class="mb-1">{{ track.name }}</h5>
<small>{{ track.explicit ? 'EXPLICIT' : '' }}</small>
</div>
<p class="mb-1">{{ track.artists[0].name }}</p>
<small>{{ track.album.name }}</small>
<div class="float-right">
<button type="button" class="btn btn-sm btn-info" v-on:click="playPreview(track)"><span class="fa fa-play"></span></button>
<button type="button" class="btn btn-sm btn-success float-right" v-on:click="add(index)"><span class="fa fa-plus"></span></button>
</div>
</div>
</div>
</li>
</ul>
<div class="spinner" v-if="isLoading">
<div class="rect1"></div>
<div class="rect2"></div>
<div class="rect3"></div>
<div class="rect4"></div>
<div class="rect5"></div>
</div>
<button type="button" class="btn btn-info btn-block top-spaced-1" v-if="tracks.length > 0 && ! isLoading" v-on:click="search()">Load more...</button>
</div>
<div class="col-md-6">
<h3 v-if="! isEditingplaylistName">{{ playlistName }} <small>({{ selectedTracks.length }} tracks)</small> <button type="button" class="btn btn-sm btn-info" v-on:click="isEditingplaylistName = true"><span class="fa fa-edit"></span></button></h3>
<form v-on:submit.prevent="finishedEditingPlaylistName()">
<div class="input-group" v-if="isEditingplaylistName">
<input type="text" class="form-control" v-model="playlistName">
<span class="input-group-btn">
<button class="btn btn-primary" type="submit"><span class="fa fa-check"></span></button>
</span>
</div>
</form>
<br>
<template v-if="selectedTracks.length > 0">
<ul class="list-group">
<li class="list-group-item" v-for="(track, index) in selectedTracks" v-bind:key="index">
<div class="row">
<div class="col-md-3">
<a v-bind:href="track.uri">
<img v-bind:src="track.album.images[0].url" class="img-fluid">
</a>
</div>
<div class="col-md-9">
<div class="d-flex w-100 justify-content-between">
<h5 class="mb-1">{{ track.name }}</h5>
<small>{{ track.explicit ? 'EXPLICIT' : '' }}</small>
</div>
<p class="mb-1">{{ track.artists[0].name }}</p>
<small>{{ track.album.name }}</small>
<div class="float-right">
<button type="button" class="btn btn-sm btn-info" v-on:click="playPreview(track)"><span class="fa fa-play"></span></button>
<button type="button" class="btn btn-sm btn-danger" v-on:click="remove(index)"><span class="fa fa-minus"></span></button>
</div>
</div>
</div>
</li>
</ul>
<br>
<template>
<div class="form-group" v-if="selectedTracks.length > 1">
<button type="button" class="btn btn-success btn-block" v-on:click="checkout()" v-bind:disabled="savingOrSaved">{{ savePlaylistButtonLabel }}</button>
</div>
</template>
<br>
<div class="list-group" v-if="playlistUrl">
<a class="list-group-item list-group-item-action hide-overflow" v-bind:href="playlistUrl" target="_blank">
<h3>{{ playlistName }} </h3> <small> by {{ userId }}</small>
{{ playlistUrl }}
</a>
</div>
</template>
<p v-else="selectedTracks.length > 0">There are currently no tracks in your playlist.</p>
</div>
</div>
<div class="card" v-else="accessToken != null">
<div class="card-block">
<h3 class="card-title">Log In</h3>
<p class="card-text">
In order to save the playlists to your spotify account,
<br>
first you need to authorize access to your spotify playlists.
</p>
<a class="btn btn-success text-center" v-bind:href="authUrl()">Authorize</a>
</div>
</div>
<br>
<p class="text-center" v-if="this.userId">Logged in as {{ this.userId }}.</p>
<p class="text-center">This is a <a href="https://vuejs.org" target="_blank">VueJS</a> experiment, made by <a href="https://ivmelo.com" target="_blank">Ivanilson Melo</a>.</p>
</div>
</div>
<!-- Vue JS and friends -->
<script src="https://unpkg.com/vue"></script>
<script src="https://unpkg.com/axios/dist/axios.min.js"></script>
<script src="https://code.jquery.com/jquery-3.2.0.slim.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/tether/1.4.0/js/tether.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.0.0-alpha.6/js/bootstrap.min.js"></script>
<script src="https://unpkg.com/aplayer@1.5.8/dist/APlayer.min.js"></script>
<script src="env.js"></script>
<script src="app.js"></script>
</body>
</html>