Skip to content

Commit 420a91a

Browse files
Feature/new window right click (#2027)
* right click menu for open in a new window * open video in new window when right click * router link added to channel images for easier selection in the context of a context menu * fix security bug user can visit other website via freetube * simplify context menu entry condition * createWindow in open new window adapted with the merged function * Change the open new window selector for the origin of the page no matter the name of the website * Keypress reintegrate into the code for accesibility * Keypress reintegrate into the code for accesibility * Fix style for sidenav subscription links Co-authored-by: PikachuEXE <[email protected]>
1 parent e90b9f4 commit 420a91a

File tree

6 files changed

+52
-23
lines changed

6 files changed

+52
-23
lines changed

src/main/index.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,13 @@ function runApp() {
2727
click: () => {
2828
browserWindow.webContents.send('showVideoStatistics')
2929
}
30+
},
31+
{
32+
label: 'Open in a New Window',
33+
visible: parameters.linkURL.includes((new URL(browserWindow.webContents.getURL())).origin),
34+
click: () => {
35+
createWindow({ replaceMainWindow: false, windowStartupUrl: parameters.linkURL, showWindowNow: true })
36+
}
3037
}
3138
]
3239
})

src/renderer/components/side-nav/side-nav.css

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,11 @@
8989
transform: translateY(-50%);
9090
}
9191

92+
.channelLink {
93+
color: inherit;
94+
text-decoration: inherit;
95+
}
96+
9297
.channelThumbnail {
9398
border-radius: 50%;
9499
width: 35px;

src/renderer/components/side-nav/side-nav.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@ export default Vue.extend({
7777
navigate: function (route) {
7878
this.$router.push('/' + route)
7979
},
80-
8180
goToChannel: function (id) {
8281
this.$router.push({ path: `/channel/${id}` })
8382
}

src/renderer/components/side-nav/side-nav.vue

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -224,23 +224,28 @@
224224
:title="channel.name"
225225
role="button"
226226
tabindex="0"
227-
@click="goToChannel(channel.id)"
228227
@keypress="goToChannel(channel.id)"
228+
@click="goToChannel(channel.id)"
229229
>
230-
<div
231-
class="thumbnailContainer"
230+
<router-link
231+
:to="`/channel/${channel.id}`"
232+
class="channelLink"
232233
>
233-
<img
234-
class="channelThumbnail"
235-
:src="channel.thumbnail"
234+
<div
235+
class="thumbnailContainer"
236236
>
237-
</div>
238-
<p
239-
v-if="isOpen"
240-
class="navLabel"
241-
>
242-
{{ channel.name }}
243-
</p>
237+
<img
238+
class="channelThumbnail"
239+
:src="channel.thumbnail"
240+
>
241+
</div>
242+
<p
243+
v-if="isOpen"
244+
class="navLabel"
245+
>
246+
{{ channel.name }}
247+
</p>
248+
</router-link>
244249
</div>
245250
</div>
246251
</div>

src/renderer/components/watch-video-info/watch-video-info.sass

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,3 +86,7 @@
8686
:deep(.iconDropdown)
8787
left: calc(50% - 20px)
8888
right: auto
89+
90+
.channelLink
91+
color: inherit
92+
text-decoration: inherit

src/renderer/components/watch-video-info/watch-video-info.vue

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,28 @@
1313
class="profileRow"
1414
>
1515
<div>
16-
<img
17-
:src="channelThumbnail"
18-
class="channelThumbnail"
19-
@click="goToChannel"
16+
<router-link
17+
:to="`/channel/${channelId}`"
2018
>
19+
<img
20+
:src="channelThumbnail"
21+
class="channelThumbnail"
22+
@click="goToChannel"
23+
>
24+
</router-link>
2125
</div>
2226
<div>
23-
<div
24-
class="channelName"
25-
@click="goToChannel"
27+
<router-link
28+
:to="`/channel/${channelId}`"
29+
class="channelLink"
2630
>
27-
{{ channelName }}
28-
</div>
31+
<div
32+
class="channelName"
33+
@click="goToChannel"
34+
>
35+
{{ channelName }}
36+
</div>
37+
</router-link>
2938
<ft-button
3039
v-if="!hideUnsubscribeButton"
3140
:label="subscribedText"

0 commit comments

Comments
 (0)