Skip to content

Commit

Permalink
Add Share Playlist button to Playlist View (#400)
Browse files Browse the repository at this point in the history
  • Loading branch information
alarivan authored and PrestonN committed Oct 14, 2019
1 parent d593b97 commit f796661
Show file tree
Hide file tree
Showing 3 changed files with 72 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/js/templates.js
Expand Up @@ -418,6 +418,24 @@ let playlistView = new Vue({
clipboard.writeText(url);
showToast('URL has been copied to the clipboard');
},
copyYouTubePlaylist: (playlistId) => {
const url = `https://www.youtube.com/playlist?list=${playlistId}`
clipboard.writeText(url);
showToast('URL has been copied to the clipboard');
},
copyInvidiousPlaylist: (playlistId) => {
const url = `${invidiousInstance}/playlist?list=${playlistId}`
clipboard.writeText(url);
showToast('URL has been copied to the clipboard');
},
openYouTubePlaylist: (playlistId) => {
const url = `https://www.youtube.com/playlist?list=${playlistId}`
shell.openExternal(url);
},
openInvidiousPlaylist: (playlistId) => {
const url = `${invidiousInstance}/playlist?list=${playlistId}`
shell.openExternal(url);
},
history: (videoId) => {
removeFromHistory(videoId);
}
Expand Down
44 changes: 44 additions & 0 deletions src/style/playlist.css
Expand Up @@ -198,3 +198,47 @@
top: 20px;
right: 15px;
}

.playlistShare {
position: relative;
text-align: center;
text-transform: uppercase;
margin: 0 5px;
}

.playlistShare ul {
display: none;
position: absolute;
list-style: none;
padding: 0;
margin: 0;
width: 100%;
z-index: 100;
}

.playlistShare ul li {
width: 100%;
float: none;
box-sizing: border-box;
}

.playlistShare:hover ul {
display: block;
}

.playlistShare ul li a {
text-decoration: none;
color: inherit;
}

.playlistShareButton.smallButton {
float: none;
margin: 0;
}

.playlistShareButton.smallButton i {
position: absolute;
top: 50%;
right: 10px;
transform: translateY(-50%)
}
10 changes: 10 additions & 0 deletions src/templates/playlistView.html
Expand Up @@ -29,6 +29,16 @@ <h3>{{channelName}}</h3>
</div>
<p>{{videoCount}} videos - {{viewCount}} views - Last updated on {{lastUpdated}}</p>
<hr />
<div class='playlistShare'>
<div class='playlistShareButton smallButton'>Share Playlist <i class='fas fa-angle-down'></i></div>
<ul>
<li class='smallButton'><a v-on:click='copyYouTubePlaylist(playlistId)'>Copy YouTube Link</a></li>
<li class='smallButton'><a v-on:click='openYouTubePlaylist(playlistId)'>Open in YouTube</a></li>
<li class='smallButton'><a v-on:click='copyInvidiousPlaylist(playlistId)'>Copy Invidious Link</a></li>
<li class='smallButton'><a v-on:click='openInvidiousPlaylist(playlistId)'>Open in Invidious</a></li>
</ul>
</div>
<hr />
<p v-html='description'></p>
</div>
<div class='playlistVideoView'>
Expand Down

0 comments on commit f796661

Please sign in to comment.