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,
|
playlistShowList: true,
|
||||||
recommendedVideoList: [],
|
recommendedVideoList: [],
|
||||||
playlistVideoList: [],
|
playlistVideoList: [],
|
||||||
distractionFreeMode: false
|
distractionFreeMode: false,
|
||||||
|
includeCurrentTime: false
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
channel: (channelId) => {
|
channel: (channelId) => {
|
||||||
|
@ -951,12 +952,12 @@ let playerView = new Vue({
|
||||||
addSavedVideo(videoId);
|
addSavedVideo(videoId);
|
||||||
},
|
},
|
||||||
copyYouTube: (videoId) => {
|
copyYouTube: (videoId) => {
|
||||||
const url = 'https://youtube.com/watch?v=' + videoId;
|
const url = 'https://youtube.com/watch?v=' + videoId + currentTimeParameter();
|
||||||
clipboard.writeText(url);
|
clipboard.writeText(url);
|
||||||
showToast('URL has been copied to the clipboard');
|
showToast('URL has been copied to the clipboard');
|
||||||
},
|
},
|
||||||
openYouTube: (videoId) => {
|
openYouTube: (videoId) => {
|
||||||
shell.openExternal('https://youtube.com/watch?v=' + videoId);
|
shell.openExternal('https://youtube.com/watch?v=' + videoId + currentTimeParameter());
|
||||||
},
|
},
|
||||||
openYouTubeNoCookie: (videoId) => {
|
openYouTubeNoCookie: (videoId) => {
|
||||||
const url = 'https://www.youtube-nocookie.com/embed/' + 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');
|
showToast('URL has been copied to the clipboard');
|
||||||
},
|
},
|
||||||
copyInvidious: (videoId) => {
|
copyInvidious: (videoId) => {
|
||||||
const url = invidiousInstance + '/watch?v=' + videoId;
|
const url = invidiousInstance + '/watch?v=' + videoId + currentTimeParameter();
|
||||||
clipboard.writeText(url);
|
clipboard.writeText(url);
|
||||||
showToast('URL has been copied to the clipboard');
|
showToast('URL has been copied to the clipboard');
|
||||||
},
|
},
|
||||||
openInvidious: (videoId) => {
|
openInvidious: (videoId) => {
|
||||||
shell.openExternal(invidiousInstance + '/watch?v=' + videoId);
|
shell.openExternal(invidiousInstance + '/watch?v=' + videoId + currentTimeParameter());
|
||||||
},
|
},
|
||||||
save: (videoId) => {
|
save: (videoId) => {
|
||||||
toggleSavedVideo(videoId);
|
toggleSavedVideo(videoId);
|
||||||
|
@ -1789,3 +1790,12 @@ function hideViews() {
|
||||||
editProfileView.seen = false;
|
editProfileView.seen = false;
|
||||||
backButtonView.lastView = 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'>
|
<div class='smallButton shareButton'>
|
||||||
<span>SHARE</span> <i class="fas fa-angle-down"></i>
|
<span>SHARE</span> <i class="fas fa-angle-down"></i>
|
||||||
<div class='shareTypes'>
|
<div class='shareTypes'>
|
||||||
|
<input type="checkbox" id="timeCheckbox" v-model="includeCurrentTime">
|
||||||
|
<label for="timeCheckbox">AT CURRENT TIME</label>
|
||||||
<ul>
|
<ul>
|
||||||
<li v-on:click='copyYouTube(videoId)'>COPY YOUTUBE LINK</li>
|
<li v-on:click='copyYouTube(videoId)'>COPY YOUTUBE LINK</li>
|
||||||
<li v-on:click='openYouTube(videoId)'>OPEN IN YOUTUBE</li>
|
<li v-on:click='openYouTube(videoId)'>OPEN IN YOUTUBE</li>
|
||||||
|
|
Loading…
Reference in New Issue