Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@
"electron-context-menu": "^3.1.2",
"http-proxy-agent": "^4.0.1",
"https-proxy-agent": "^5.0.0",
"jquery": "^3.6.0",
"js-yaml": "^4.1.0",
"lodash.debounce": "^4.0.8",
"lodash.isequal": "^4.5.0",
Expand Down
96 changes: 51 additions & 45 deletions src/renderer/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import FtPrompt from './components/ft-prompt/ft-prompt.vue'
import FtButton from './components/ft-button/ft-button.vue'
import FtToast from './components/ft-toast/ft-toast.vue'
import FtProgressBar from './components/ft-progress-bar/ft-progress-bar.vue'
import $ from 'jquery'
import { marked } from 'marked'
import Parser from 'rss-parser'
import { IpcChannels } from '../constants'
Expand Down Expand Up @@ -57,7 +56,7 @@ export default Vue.extend({
isOpen: function () {
return this.$store.getters.getIsSideNavOpen
},
usingElectron: function() {
usingElectron: function () {
return this.$store.getters.getUsingElectron
},
showProgressBar: function () {
Expand All @@ -81,9 +80,9 @@ export default Vue.extend({
windowTitle: function () {
if (this.$route.meta.title !== 'Channel' && this.$route.meta.title !== 'Watch') {
let title =
this.$route.meta.path === '/home'
? process.env.PRODUCT_NAME
: `${this.$t(this.$route.meta.title)} - ${process.env.PRODUCT_NAME}`
this.$route.meta.path === '/home'
? process.env.PRODUCT_NAME
: `${this.$t(this.$route.meta.title)} - ${process.env.PRODUCT_NAME}`
if (!title) {
title = process.env.PRODUCT_NAME
}
Expand Down Expand Up @@ -138,13 +137,13 @@ export default Vue.extend({

secColor: 'checkThemeSettings',

$route () {
$route() {
// react to route changes...
// Hide top nav filter panel on page change
this.$refs.topNav.hideFilters()
}
},
created () {
created() {
this.checkThemeSettings()
this.setWindowTitle()
},
Expand Down Expand Up @@ -209,31 +208,34 @@ export default Vue.extend({
const { version } = require('../../package.json')
const requestUrl = 'https://api.github.com/repos/freetubeapp/freetube/releases?per_page=1'

$.getJSON(requestUrl, (response) => {
const tagName = response[0].tag_name
const versionNumber = tagName.replace('v', '').replace('-beta', '')
this.updateChangelog = marked.parse(response[0].body)
this.changeLogTitle = response[0].name

const message = this.$t('Version $ is now available! Click for more details')
this.updateBannerMessage = message.replace('$', versionNumber)

const appVersion = version.split('.')
const latestVersion = versionNumber.split('.')

if (parseInt(appVersion[0]) < parseInt(latestVersion[0])) {
this.showUpdatesBanner = true
} else if (parseInt(appVersion[1]) < parseInt(latestVersion[1])) {
this.showUpdatesBanner = true
} else if (parseInt(appVersion[2]) < parseInt(latestVersion[2]) && parseInt(appVersion[1]) <= parseInt(latestVersion[1])) {
this.showUpdatesBanner = true
}
}).fail((xhr, textStatus, error) => {
console.log(xhr)
console.log(textStatus)
console.log(requestUrl)
console.log(error)
})
fetch(requestUrl)
.then((response) => response.json())
.then((json) => {
const tagName = json[0].tag_name
const versionNumber = tagName.replace('v', '').replace('-beta', '')
this.updateChangelog = marked.parse(json[0].body)
this.changeLogTitle = json[0].name

const message = this.$t('Version $ is now available! Click for more details')
this.updateBannerMessage = message.replace('$', versionNumber)

const appVersion = version.split('.')
const latestVersion = versionNumber.split('.')

if (parseInt(appVersion[0]) < parseInt(latestVersion[0])) {
this.showUpdatesBanner = true
} else if (parseInt(appVersion[1]) < parseInt(latestVersion[1])) {
this.showUpdatesBanner = true
} else if (parseInt(appVersion[2]) < parseInt(latestVersion[2]) && parseInt(appVersion[1]) <= parseInt(latestVersion[1])) {
this.showUpdatesBanner = true
}
})
.catch((error) => {
console.group('checkForNewUpdates error')
console.error(requestUrl)
console.error(error)
console.groupEnd('checkForNewUpdates error')
})
}
},

Expand Down Expand Up @@ -295,8 +297,8 @@ export default Vue.extend({
},

activateKeyboardShortcuts: function () {
$(document).on('keydown', this.handleKeyboardShortcuts)
$(document).on('mousedown', () => {
document.addEventListener('keydown', this.handleKeyboardShortcuts)
document.addEventListener('mousedown', () => {
this.hideOutlines = true
})
},
Expand Down Expand Up @@ -329,16 +331,20 @@ export default Vue.extend({
},

openAllLinksExternally: function () {
$(document).on('click', 'a[href^="http"]', (event) => {
this.handleLinkClick(event)
document.addEventListener('click', (event) => {
if (event.target.tagName.toLowerCase() === 'a' && event.target.href.startsWith('http')) {
this.handleLinkClick(event)
}
})

$(document).on('auxclick', 'a[href^="http"]', (event) => {
// auxclick fires for all clicks not performed with the primary button
// only handle the link click if it was the middle button,
// otherwise the context menu breaks
if (event.button === 1) {
this.handleLinkClick(event)
document.addEventListener('auxclick', (event) => {
if (event.target.tagName.toLowerCase() === 'a' && event.target.href.startsWith('http')) {
if (event.button === 1) {
// auxclick fires for all clicks not performed with the primary button
// only handle the link click if it was the middle button,
// otherwise the context menu breaks
this.handleLinkClick(event)
}
}
})
},
Expand Down Expand Up @@ -373,7 +379,7 @@ export default Vue.extend({
}
},

handleYoutubeLink: function (href, { doCreateNewWindow = false } = { }) {
handleYoutubeLink: function (href, { doCreateNewWindow = false } = {}) {
this.getYoutubeUrlInfo(href).then((result) => {
switch (result.urlType) {
case 'video': {
Expand Down Expand Up @@ -473,7 +479,7 @@ export default Vue.extend({
})
},

openInternalPath: function({ path, doCreateNewWindow, query = {} }) {
openInternalPath: function ({ path, doCreateNewWindow, query = {} }) {
if (this.usingElectron && doCreateNewWindow) {
const { ipcRenderer } = require('electron')

Expand Down Expand Up @@ -516,7 +522,7 @@ export default Vue.extend({
}
},

setWindowTitle: function() {
setWindowTitle: function () {
if (this.windowTitle !== null) {
document.title = this.windowTitle
}
Expand Down
5 changes: 2 additions & 3 deletions src/renderer/components/ft-icon-button/ft-icon-button.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import Vue from 'vue'
import $ from 'jquery'

export default Vue.extend({
name: 'FtIconButton',
Expand Down Expand Up @@ -64,7 +63,7 @@ export default Vue.extend({
},
methods: {
toggleDropdown: function () {
const dropdownBox = $(`#${this.id}`)
const dropdownBox = document.getElementById(this.id)

if (this.dropdownShown) {
dropdownBox.get(0).style.display = 'none'
Expand Down Expand Up @@ -99,7 +98,7 @@ export default Vue.extend({
},

focusOut: function () {
const dropdownBox = $(`#${this.id}`)
const dropdownBox = document.getElementById(this.id)

dropdownBox.focusout()
dropdownBox.get(0).style.display = 'none'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import Vue from 'vue'
import { mapActions } from 'vuex'
import $ from 'jquery'

import FtCard from '../../components/ft-card/ft-card.vue'
import FtIconButton from '../../components/ft-icon-button/ft-icon-button.vue'
Expand Down Expand Up @@ -36,8 +35,8 @@ export default Vue.extend({
}
},
mounted: function () {
$('#profileList').focusout(() => {
$('#profileList')[0].style.display = 'none'
document.getElementById('profileList').addEventListener('focusout', (event) => {
event.currentTarget.style.display = 'none'
// When pressing the profile button
// It will make the menu reappear if we set `profileListShown` immediately
setTimeout(() => {
Expand All @@ -47,14 +46,14 @@ export default Vue.extend({
},
methods: {
toggleProfileList: function () {
const profileList = $('#profileList')
const profileList = document.getElementById('profileList')

if (this.profileListShown) {
profileList.get(0).style.display = 'none'
profileList.style.display = 'none'
this.profileListShown = false
} else {
profileList.get(0).style.display = 'inline'
profileList.get(0).focus()
profileList.style.display = 'inline'
profileList.focus()
this.profileListShown = true
}
},
Expand All @@ -63,7 +62,7 @@ export default Vue.extend({
this.$router.push({
path: '/settings/profile/'
})
$('#profileList').focusout()
document.getElementById('profileList').dispatchEvent(new FocusEvent('focusout'))
},

setActiveProfile: function (profile) {
Expand All @@ -80,7 +79,7 @@ export default Vue.extend({
}
}

$('#profileList').trigger('focusout')
document.getElementById('profileList').dispatchEvent(new FocusEvent('focusout'))
},

...mapActions([
Expand Down
Loading