Skip to content

Commit

Permalink
Miscellaneous performance improvements (FreeTubeApp#6658)
Browse files Browse the repository at this point in the history
  • Loading branch information
absidue authored and SudharakaP committed Jan 28, 2025
1 parent 276b8bd commit e8f6398
Show file tree
Hide file tree
Showing 9 changed files with 35 additions and 52 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,14 @@
</div>
</template>

<div
v-if="primarySections"
class="primarySections"
>
<div class="primarySections">
<div
v-for="(primarySection, index) of primarySections"
:key="index"
class="primarySection"
>
<div
v-for="secondarySection in primarySection.secondarySections"
v-for="secondarySection in primarySection"
:key="secondarySection.title"
class="secondarySection"
>
Expand Down Expand Up @@ -85,30 +82,26 @@ const situationalAppShortcuts = computed(() =>
)
const primarySections = computed(() => [
{
secondarySections: [
{
title: t('KeyboardShortcutPrompt.Sections.Video.Playback'),
shortcutDictionary: playbackPlayerShortcuts.value
},
{
title: t('KeyboardShortcutPrompt.Sections.Video.General'),
shortcutDictionary: generalPlayerShortcuts.value
},
]
},
{
secondarySections: [
{
title: t('KeyboardShortcutPrompt.Sections.App.General'),
shortcutDictionary: generalAppShortcuts.value
},
{
title: t('KeyboardShortcutPrompt.Sections.App.Situational'),
shortcutDictionary: situationalAppShortcuts.value
}
]
}
[
{
title: t('KeyboardShortcutPrompt.Sections.Video.Playback'),
shortcutDictionary: playbackPlayerShortcuts.value
},
{
title: t('KeyboardShortcutPrompt.Sections.Video.General'),
shortcutDictionary: generalPlayerShortcuts.value
},
],
[
{
title: t('KeyboardShortcutPrompt.Sections.App.General'),
shortcutDictionary: generalAppShortcuts.value
},
{
title: t('KeyboardShortcutPrompt.Sections.App.Situational'),
shortcutDictionary: situationalAppShortcuts.value
}
]
])
const isMac = process.platform === 'darwin'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ export class AutoplayToggle extends shaka.ui.Element {

/** @private */
this.button_ = document.createElement('button')
this.button_.classList.add('autoplay-toggle')
this.button_.classList.add('shaka-tooltip')
this.button_.classList.add('autoplay-toggle', 'shaka-tooltip')

/** @private */
this.icon_ = document.createElement('i')
Expand All @@ -25,8 +24,7 @@ export class AutoplayToggle extends shaka.ui.Element {
this.button_.appendChild(this.icon_)

const label = document.createElement('label')
label.classList.add('shaka-overflow-button-label')
label.classList.add('shaka-overflow-menu-only')
label.classList.add('shaka-overflow-button-label', 'shaka-overflow-menu-only')

/** @private */
this.nameSpan_ = document.createElement('span')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ export class FullWindowButton extends shaka.ui.Element {

/** @private */
this.button_ = document.createElement('button')
this.button_.classList.add('full-window-button')
this.button_.classList.add('shaka-tooltip')
this.button_.classList.add('full-window-button', 'shaka-tooltip')

/** @private */
this.icon_ = document.createElement('i')
Expand All @@ -27,8 +26,7 @@ export class FullWindowButton extends shaka.ui.Element {
this.button_.appendChild(this.icon_)

const label = document.createElement('label')
label.classList.add('shaka-overflow-button-label')
label.classList.add('shaka-overflow-menu-only')
label.classList.add('shaka-overflow-button-label', 'shaka-overflow-menu-only')

/** @private */
this.nameSpan_ = document.createElement('span')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ export class LegacyQualitySelection extends shaka.ui.SettingsMenu {
constructor(activeLegacyFormat, legacyFormats, events, parent, controls) {
super(parent, controls, 'settings')

this.button.classList.add('legacy-quality-button')
this.button.classList.add('shaka-tooltip-status')
this.button.classList.add('legacy-quality-button', 'shaka-tooltip-status')
this.menu.classList.add('legacy-qualities')

/** @private */
Expand Down Expand Up @@ -86,8 +85,7 @@ export class LegacyQualitySelection extends shaka.ui.SettingsMenu {
span.classList.add('shaka-chosen-item')

const icon = document.createElement('i')
icon.classList.add('material-icons-round')
icon.classList.add('shaka-chosen-item')
icon.classList.add('material-icons-round', 'shaka-chosen-item')
icon.textContent = 'done'
icon.ariaHidden = 'true'
button.appendChild(icon)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ export class ScreenshotButton extends shaka.ui.Element {

/** @private */
this.button_ = document.createElement('button')
this.button_.classList.add('screenshot-button')
this.button_.classList.add('shaka-tooltip')
this.button_.classList.add('screenshot-button', 'shaka-tooltip')

const icon = document.createElement('i')
icon.classList.add('material-icons-round')
Expand All @@ -25,8 +24,7 @@ export class ScreenshotButton extends shaka.ui.Element {
this.button_.appendChild(icon)

const label = document.createElement('label')
label.classList.add('shaka-overflow-button-label')
label.classList.add('shaka-overflow-menu-only')
label.classList.add('shaka-overflow-button-label', 'shaka-overflow-menu-only')

/** @private */
this.nameSpan_ = document.createElement('span')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ export class TheatreModeButton extends shaka.ui.Element {

/** @private */
this.button_ = document.createElement('button')
this.button_.classList.add('theatre-button')
this.button_.classList.add('shaka-tooltip')
this.button_.classList.add('theatre-button', 'shaka-tooltip')

/** @private */
this.icon_ = document.createElement('i')
Expand All @@ -27,8 +26,7 @@ export class TheatreModeButton extends shaka.ui.Element {
this.button_.appendChild(this.icon_)

const label = document.createElement('label')
label.classList.add('shaka-overflow-button-label')
label.classList.add('shaka-overflow-menu-only')
label.classList.add('shaka-overflow-button-label', 'shaka-overflow-menu-only')

/** @private */
this.nameSpan_ = document.createElement('span')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ export default defineComponent({
handleInvidiousInstanceInput: function (input) {
let instance = input
// If NOT something like https:// (1-2 slashes), remove trailing slash
if (!/^(https?):(\/){1,2}$/.test(input)) {
if (!/^https?:\/{1,2}$/.test(input)) {
instance = input.replace(/\/$/, '')
}
this.setCurrentInvidiousInstanceBounce(instance)
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/components/playlist-info/playlist-info.js
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,7 @@ export default defineComponent({

handlePlaylistExport: async function () {
const dateStr = getTodayDateStrLocalTimezone()
const title = this.selectedUserPlaylist.playlistName.replaceAll(' ', '_').replaceAll(/["%*/:<>?\\|]/g, '_')
const title = this.selectedUserPlaylist.playlistName.replaceAll(/[ "%*/:<>?\\|]/g, '_')
const exportFileName = 'freetube-playlist-' + title + '-' + dateStr + '.db'

const data = JSON.stringify(this.selectedUserPlaylist) + '\n'
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/helpers/api/invidious.js
Original file line number Diff line number Diff line change
Expand Up @@ -594,7 +594,7 @@ export function youtubeImageUrlToInvidious(url, currentInstance = null) {
* @returns {string}
*/
export function invidiousImageUrlToInvidious(url, currentInstance = null) {
return url.replaceAll(/(\/ggpht\/)/g, `${currentInstance}/ggpht/`)
return url.replaceAll('/ggpht/', `${currentInstance}/ggpht/`)
}

/**
Expand Down

0 comments on commit e8f6398

Please sign in to comment.