mirror of https://github.com/FreeTubeApp/FreeTube
Added 'current time' option to share menu as a checkbox. (#468)
Co-authored-by: Kyle <watson@criptext.com>
This commit is contained in:
parent
a6e5c0eac0
commit
f1c9214f65
|
@ -893,7 +893,8 @@ let playerView = new Vue({
|
|||
playlistShowList: true,
|
||||
recommendedVideoList: [],
|
||||
playlistVideoList: [],
|
||||
distractionFreeMode: false
|
||||
distractionFreeMode: false,
|
||||
includeCurrentTime: false
|
||||
},
|
||||
methods: {
|
||||
channel: (channelId) => {
|
||||
|
@ -951,12 +952,12 @@ let playerView = new Vue({
|
|||
addSavedVideo(videoId);
|
||||
},
|
||||
copyYouTube: (videoId) => {
|
||||
const url = 'https://youtube.com/watch?v=' + videoId;
|
||||
const url = 'https://youtube.com/watch?v=' + videoId + currentTimeParameter();
|
||||
clipboard.writeText(url);
|
||||
showToast('URL has been copied to the clipboard');
|
||||
},
|
||||
openYouTube: (videoId) => {
|
||||
shell.openExternal('https://youtube.com/watch?v=' + videoId);
|
||||
shell.openExternal('https://youtube.com/watch?v=' + videoId + currentTimeParameter());
|
||||
},
|
||||
openYouTubeNoCookie: (videoId) => {
|
||||
const url = 'https://www.youtube-nocookie.com/embed/' + videoId;
|
||||
|
@ -968,12 +969,12 @@ let playerView = new Vue({
|
|||
showToast('URL has been copied to the clipboard');
|
||||
},
|
||||
copyInvidious: (videoId) => {
|
||||
const url = invidiousInstance + '/watch?v=' + videoId;
|
||||
const url = invidiousInstance + '/watch?v=' + videoId + currentTimeParameter();
|
||||
clipboard.writeText(url);
|
||||
showToast('URL has been copied to the clipboard');
|
||||
},
|
||||
openInvidious: (videoId) => {
|
||||
shell.openExternal(invidiousInstance + '/watch?v=' + videoId);
|
||||
shell.openExternal(invidiousInstance + '/watch?v=' + videoId + currentTimeParameter());
|
||||
},
|
||||
save: (videoId) => {
|
||||
toggleSavedVideo(videoId);
|
||||
|
@ -1789,3 +1790,12 @@ function hideViews() {
|
|||
editProfileView.seen = false;
|
||||
backButtonView.lastView = false;
|
||||
}
|
||||
|
||||
function currentTimeParameter(){
|
||||
if (!playerView.includeCurrentTime) return "";
|
||||
if (typeof (playerView.currentTime) !== 'undefined') return "&t=" + Math.floor(playerView.currentTime);
|
||||
if (typeof (player) !== 'undefined') return "&t=" + Math.floor(player.currentTime);
|
||||
const legacyPlayer = $('#legacyPlayer').get(0);
|
||||
if (typeof (legacyPlayer) !== 'undefined') return "&t=" + Math.floor(legacyPlayer.currentTime);
|
||||
return "";
|
||||
}
|
|
@ -61,6 +61,8 @@
|
|||
<div class='smallButton shareButton'>
|
||||
<span>SHARE</span> <i class="fas fa-angle-down"></i>
|
||||
<div class='shareTypes'>
|
||||
<input type="checkbox" id="timeCheckbox" v-model="includeCurrentTime">
|
||||
<label for="timeCheckbox">AT CURRENT TIME</label>
|
||||
<ul>
|
||||
<li v-on:click='copyYouTube(videoId)'>COPY YOUTUBE LINK</li>
|
||||
<li v-on:click='openYouTube(videoId)'>OPEN IN YOUTUBE</li>
|
||||
|
|
Loading…
Reference in New Issue