Hide tokens and externalize CSS
This commit is contained in:
parent
3d32a436ac
commit
d8783c2440
2 changed files with 67 additions and 89 deletions
|
@ -4,46 +4,7 @@
|
||||||
<title>Spotify Duplicate Finder</title>
|
<title>Spotify Duplicate Finder</title>
|
||||||
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css">
|
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css">
|
||||||
<link rel="stylesheet" href="https://netdna.bootstrapcdn.com/font-awesome/3.0.2/css/font-awesome.css">
|
<link rel="stylesheet" href="https://netdna.bootstrapcdn.com/font-awesome/3.0.2/css/font-awesome.css">
|
||||||
<style type="text/css">
|
<link rel="stylesheet" href="./style.css">
|
||||||
#login, #loggedin {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.text-overflow {
|
|
||||||
overflow: hidden;
|
|
||||||
text-overflow: ellipsis;
|
|
||||||
white-space: nowrap;
|
|
||||||
width: 500px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.spinner {
|
|
||||||
display: none;
|
|
||||||
width: 0;
|
|
||||||
float: right;
|
|
||||||
margin-left: 5px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.has-spinner.loading .spinner {
|
|
||||||
display: inline-block;
|
|
||||||
width: 16px; /* This doesn't work, just fix for unkown width elements */
|
|
||||||
}
|
|
||||||
|
|
||||||
.pl_item {
|
|
||||||
text-align: left;
|
|
||||||
}
|
|
||||||
|
|
||||||
.glyphicon.glyphicon-chevron-right {
|
|
||||||
float: right;
|
|
||||||
display: inline-block;
|
|
||||||
width: 16px;
|
|
||||||
margin-left: 5px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.loading .glyphicon-chevron-right.glyphicon-chevron-right {
|
|
||||||
display: none;
|
|
||||||
width: 0;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
@ -53,15 +14,17 @@
|
||||||
<a href="/login" class="btn btn-primary">Log in with Spotify</a>
|
<a href="/login" class="btn btn-primary">Log in with Spotify</a>
|
||||||
</div>
|
</div>
|
||||||
<div id="loggedin">
|
<div id="loggedin">
|
||||||
|
<h1>Duplicates finder</h1>
|
||||||
<div id="user-profile">
|
<div id="user-profile">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<h1>Duplicates finder</h1>
|
|
||||||
<button class="btn btn-default has-spinner" id="get-playlists">
|
|
||||||
Get playlists <span class="spinner"><i class="icon-spin icon-refresh"></i></span>
|
|
||||||
</button>
|
|
||||||
<div class="media">
|
<div class="media">
|
||||||
<div class="pull-left">
|
<div class="pull-left">
|
||||||
|
<h2 id="playlists-title">Playlists
|
||||||
|
<button class="btn btn-default has-spinner" id="get-playlists">
|
||||||
|
Refresh <span class="spinner"><i class="icon-spin icon-refresh"></i></span>
|
||||||
|
</button>
|
||||||
|
</h2>
|
||||||
<div id="playlists">
|
<div id="playlists">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -73,23 +36,21 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script id="user-profile-template" type="text/x-handlebars-template">
|
<script id="playlists-template" type="text/x-handlebars-template">
|
||||||
<h1>Logged in as {{display_name}}</h1>
|
{{#list playlists}}
|
||||||
<div id="oauth">
|
<a class="pl_item list-group-item has-spinner" href="/pl/{{pl_uid}}/{{pl_id}}">
|
||||||
</div>
|
{{pl_name}}
|
||||||
<button class="btn btn-default has-spinner" id="obtain-new-token">
|
<span class="spinner"><i class="icon-spin icon-refresh"></i></span>
|
||||||
Obtain new token using the refresh token <span class="spinner"><i class="icon-spin icon-refresh"></i></span>
|
<i class="glyphicon glyphicon-chevron-right"></i>
|
||||||
</button>
|
</a>
|
||||||
|
{{/list}}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script id="oauth-template" type="text/x-handlebars-template">
|
<script id="user-profile-template" type="text/x-handlebars-template">
|
||||||
<h2>oAuth info</h2>
|
Logged in as {{display_name}}
|
||||||
<dl class="dl-horizontal">
|
<button class="btn btn-default has-spinner" id="obtain-new-token">
|
||||||
<dt>Access token</dt>
|
Refresh token <span class="spinner"><i class="icon-spin icon-refresh"></i></span>
|
||||||
<dd class="text-overflow">{{access_token}}</dd>
|
</button>
|
||||||
<dt>Refresh token</dt>
|
|
||||||
<dd class="text-overflow">{{refresh_token}}></dd>
|
|
||||||
</dl>
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script id="dups-template" type="text/x-handlebars-template">
|
<script id="dups-template" type="text/x-handlebars-template">
|
||||||
|
@ -100,17 +61,6 @@
|
||||||
{{/list}}
|
{{/list}}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script id="playlists-template" type="text/x-handlebars-template">
|
|
||||||
<h2>Playlists</h2>
|
|
||||||
{{#list playlists}}
|
|
||||||
<a class="pl_item list-group-item has-spinner" href="/pl/{{pl_uid}}/{{pl_id}}">
|
|
||||||
{{pl_name}}
|
|
||||||
<span class="spinner"><i class="icon-spin icon-refresh"></i></span>
|
|
||||||
<i class="glyphicon glyphicon-chevron-right"></i>
|
|
||||||
</a>
|
|
||||||
{{/list}}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<script src="//cdnjs.cloudflare.com/ajax/libs/handlebars.js/2.0.0-alpha.1/handlebars.min.js"></script>
|
<script src="//cdnjs.cloudflare.com/ajax/libs/handlebars.js/2.0.0-alpha.1/handlebars.min.js"></script>
|
||||||
<script src="https://code.jquery.com/jquery-1.12.3.min.js"></script>
|
<script src="https://code.jquery.com/jquery-1.12.3.min.js"></script>
|
||||||
<script>
|
<script>
|
||||||
|
@ -152,10 +102,6 @@
|
||||||
dupsTemplate = Handlebars.compile(dupsSource),
|
dupsTemplate = Handlebars.compile(dupsSource),
|
||||||
dupsPlaceholder = document.getElementById('dups');
|
dupsPlaceholder = document.getElementById('dups');
|
||||||
|
|
||||||
var oauthSource;
|
|
||||||
var oauthTemplate;
|
|
||||||
var oauthPlaceholder;
|
|
||||||
|
|
||||||
var params = getHashParams();
|
var params = getHashParams();
|
||||||
|
|
||||||
var access_token = params.access_token,
|
var access_token = params.access_token,
|
||||||
|
@ -174,16 +120,6 @@
|
||||||
success: function (response) {
|
success: function (response) {
|
||||||
userProfilePlaceholder.innerHTML = userProfileTemplate(response);
|
userProfilePlaceholder.innerHTML = userProfileTemplate(response);
|
||||||
|
|
||||||
oauthSource = document.getElementById('oauth-template').innerHTML;
|
|
||||||
oauthTemplate = Handlebars.compile(oauthSource);
|
|
||||||
oauthPlaceholder = document.getElementById('oauth');
|
|
||||||
|
|
||||||
// render oauth info
|
|
||||||
oauthPlaceholder.innerHTML = oauthTemplate({
|
|
||||||
access_token: access_token,
|
|
||||||
refresh_token: refresh_token
|
|
||||||
});
|
|
||||||
|
|
||||||
$('#login').hide();
|
$('#login').hide();
|
||||||
$('#loggedin').show();
|
$('#loggedin').show();
|
||||||
}
|
}
|
||||||
|
@ -203,7 +139,7 @@
|
||||||
'access_token': access_token
|
'access_token': access_token
|
||||||
}
|
}
|
||||||
}).done(function (data) {
|
}).done(function (data) {
|
||||||
var pl = data.data.map(function (item, index, array) {
|
var pl = data.data.map(function (item) {
|
||||||
return {
|
return {
|
||||||
pl_uid: item.owner.id,
|
pl_uid: item.owner.id,
|
||||||
pl_name: item.name,
|
pl_name: item.name,
|
||||||
|
@ -268,10 +204,6 @@
|
||||||
}).done(function (data) {
|
}).done(function (data) {
|
||||||
access_token = data.access_token;
|
access_token = data.access_token;
|
||||||
button.removeClass('loading');
|
button.removeClass('loading');
|
||||||
oauthPlaceholder.innerHTML = oauthTemplate({
|
|
||||||
access_token: access_token,
|
|
||||||
refresh_token: refresh_token
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
46
public/style.css
Normal file
46
public/style.css
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
#login, #loggedin {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.text-overflow {
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
white-space: nowrap;
|
||||||
|
width: 500px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.spinner {
|
||||||
|
display: none;
|
||||||
|
width: 0;
|
||||||
|
float: right;
|
||||||
|
margin-left: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.has-spinner.loading .spinner {
|
||||||
|
display: inline-block;
|
||||||
|
width: 16px; /* This doesn't work, just fix for unkown width elements */
|
||||||
|
}
|
||||||
|
|
||||||
|
#get-playlists {
|
||||||
|
float: right;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pl_item {
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
|
|
||||||
|
.glyphicon.glyphicon-chevron-right {
|
||||||
|
float: right;
|
||||||
|
display: inline-block;
|
||||||
|
width: 16px;
|
||||||
|
margin-left: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#loggedin .media .pull-left {
|
||||||
|
min-width: 20%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.loading .glyphicon-chevron-right.glyphicon-chevron-right {
|
||||||
|
display: none;
|
||||||
|
width: 0;
|
||||||
|
}
|
Loading…
Reference in a new issue