chore: removed commented code; chore: removed jQUery from deps

This commit is contained in:
Roberto Tonino 2020-09-22 22:01:52 +02:00
parent 717a1a87b8
commit 3a6577e9a8
4 changed files with 5 additions and 56 deletions

9
package-lock.json generated
View File

@ -1,6 +1,6 @@
{ {
"name": "deemix", "name": "deemix-webui",
"version": "1.3.7", "version": "0.2.0",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {
@ -1241,11 +1241,6 @@
} }
} }
}, },
"jquery": {
"version": "3.5.1",
"resolved": "https://registry.npmjs.org/jquery/-/jquery-3.5.1.tgz",
"integrity": "sha512-XwIBPqcMn57FxfT+Go5pzySnm4KWkT1Tv7gjrpT1srtf8Weynl6R273VJ5GjkRb51IzMp5nbaPjJXMWeju2MKg=="
},
"js-base64": { "js-base64": {
"version": "2.6.2", "version": "2.6.2",
"resolved": "https://registry.npmjs.org/js-base64/-/js-base64-2.6.2.tgz", "resolved": "https://registry.npmjs.org/js-base64/-/js-base64-2.6.2.tgz",

View File

@ -17,7 +17,6 @@
"build": "npm-run-all --sequential clean build:js build:styles" "build": "npm-run-all --sequential clean build:js build:styles"
}, },
"dependencies": { "dependencies": {
"jquery": "^3.5.1",
"lodash-es": "^4.17.15", "lodash-es": "^4.17.15",
"svg-country-flags": "^1.2.7", "svg-country-flags": "^1.2.7",
"toastify-js": "^1.8.0", "toastify-js": "^1.8.0",

File diff suppressed because one or more lines are too long

View File

@ -29,8 +29,6 @@ export default {
this.previewStopped = false this.previewStopped = false
await adjustVolume(this.$refs.preview, window.vol.preview_max_volume / 100, { duration: 500 }) await adjustVolume(this.$refs.preview, window.vol.preview_max_volume / 100, { duration: 500 })
// $(this.$refs.preview).animate({ volume: window.vol.preview_max_volume / 100 }, 500)
// this.$refs.preview.volume = window.vol.preview_max_volume / 100
}, },
async onTimeUpdate() { async onTimeUpdate() {
// Prevents first time entering in this function // Prevents first time entering in this function
@ -46,24 +44,17 @@ export default {
if (this.previewStopped) return if (this.previewStopped) return
await adjustVolume(this.$refs.preview, 0, { duration: 800 }) await adjustVolume(this.$refs.preview, 0, { duration: 800 })
// this.$refs.preview.volume = 0
// $(this.$refs.preview).animate({ volume: 0 }, 800)
this.previewStopped = true this.previewStopped = true
// $('a[playing] > .preview_controls').css({ opacity: 0 })
document.querySelectorAll('a[playing] > .preview_controls').forEach(control => { document.querySelectorAll('a[playing] > .preview_controls').forEach(control => {
control.style.opacity = 0 control.style.opacity = 0
}) })
// $('*').removeAttr('playing')
document.querySelectorAll('*').forEach(el => { document.querySelectorAll('*').forEach(el => {
el.removeAttribute('playing') el.removeAttribute('playing')
}) })
// $('.preview_controls').text('play_arrow')
// $('.preview_playlist_controls').text('play_arrow')
document.querySelectorAll('.preview_controls, .preview_playlist_controls').forEach(el => { document.querySelectorAll('.preview_controls, .preview_playlist_controls').forEach(el => {
el.textContent = 'play_arrow' el.textContent = 'play_arrow'
}) })
@ -74,110 +65,74 @@ export default {
const { currentTarget: obj } = event const { currentTarget: obj } = event
// var $icon = obj.tagName == 'I' ? $(obj) : $(obj).children('i')
var icon = obj.tagName == 'I' ? obj : obj.querySelector('i') var icon = obj.tagName == 'I' ? obj : obj.querySelector('i')
// if ($(obj).attr('playing')) {
if (obj.hasAttribute('playing')) { if (obj.hasAttribute('playing')) {
if (this.$refs.preview.paused) { if (this.$refs.preview.paused) {
this.$refs.preview.play() this.$refs.preview.play()
this.previewStopped = false this.previewStopped = false
// $icon.text('pause')
icon.innerText = 'pause' icon.innerText = 'pause'
// this.$refs.preview.volume = window.vol.preview_max_volume / 100
await adjustVolume(this.$refs.preview, window.vol.preview_max_volume / 100, { duration: 500 }) await adjustVolume(this.$refs.preview, window.vol.preview_max_volume / 100, { duration: 500 })
// $(this.$refs.preview).animate({ volume: window.vol.preview_max_volume / 100 }, 500)
} else { } else {
this.previewStopped = true this.previewStopped = true
// $icon.text('play_arrow')
icon.innerText = 'play_arrow' icon.innerText = 'play_arrow'
// this.$refs.preview.volume = 0
await adjustVolume(this.$refs.preview, 0, { duration: 250 }) await adjustVolume(this.$refs.preview, 0, { duration: 250 })
// $(this.$refs.preview).animate({ volume: 0 }, 250, 'swing', () => {
this.$refs.preview.pause() this.$refs.preview.pause()
// })
} }
} else { } else {
// $('*').removeAttr('playing')
document.querySelectorAll('*').forEach(el => { document.querySelectorAll('*').forEach(el => {
el.removeAttribute('playing') el.removeAttribute('playing')
}) })
// $(obj).attr('playing', true)
obj.setAttribute('playing', true) obj.setAttribute('playing', true)
// $('.preview_controls').text('play_arrow')
// $('.preview_playlist_controls').text('play_arrow')
document.querySelectorAll('.preview_controls, .preview_playlist_controls').forEach(el => { document.querySelectorAll('.preview_controls, .preview_playlist_controls').forEach(el => {
el.textContent = 'play_arrow' el.textContent = 'play_arrow'
}) })
// $('.preview_controls').css({ opacity: 0 })
document.querySelectorAll('.preview_controls').forEach(el => { document.querySelectorAll('.preview_controls').forEach(el => {
el.style.opacity = 0 el.style.opacity = 0
}) })
// $icon.text('pause')
// $icon.css({ opacity: 1 })
icon.innerText = 'pause' icon.innerText = 'pause'
icon.style.opacity = 1 icon.style.opacity = 1
this.previewStopped = false this.previewStopped = false
// this.$refs.preview.volume = 0
// $(this.$refs.preview).animate({ volume: 0 }, 250, 'swing', () => {
await adjustVolume(this.$refs.preview, 0, { duration: 250 }) await adjustVolume(this.$refs.preview, 0, { duration: 250 })
this.$refs.preview.pause() this.$refs.preview.pause()
// $('#preview-track_source').prop('src', $(obj).data('preview'))
document.getElementById('preview-track_source').src = obj.getAttribute('data-preview') document.getElementById('preview-track_source').src = obj.getAttribute('data-preview')
this.$refs.preview.load() this.$refs.preview.load()
// })
} }
}, },
async stopStackedTabsPreview() { async stopStackedTabsPreview() {
let controls = Array.prototype.slice.call(document.querySelectorAll('.preview_playlist_controls[playing]')) let controls = Array.prototype.slice.call(document.querySelectorAll('.preview_playlist_controls[playing]'))
// $('.preview_playlist_controls').filter(function () {
// return $(this).attr('playing')
// }).length
if (controls.length === 0) return if (controls.length === 0) return
// $(this.$refs.preview).animate({ volume: 0 }, 800)
await adjustVolume(this.$refs.preview, 0, { duration: 800 }) await adjustVolume(this.$refs.preview, 0, { duration: 800 })
// this.$refs.preview.volume = 0
this.previewStopped = true this.previewStopped = true
controls.forEach(control => { controls.forEach(control => {
control.removeAttribute('playing') control.removeAttribute('playing')
control.innerText = 'play_arrow' control.innerText = 'play_arrow'
}) })
// $('.preview_playlist_controls').removeAttr('playing')
// $('.preview_playlist_controls').text('play_arrow')
}, },
previewMouseEnter(e) { previewMouseEnter(e) {
e.currentTarget.style.opacity = 1 e.currentTarget.style.opacity = 1
// $(e.currentTarget).css({ opacity: 1 })
}, },
previewMouseLeave(event) { previewMouseLeave(event) {
const { currentTarget: obj } = event const { currentTarget: obj } = event
const parentIsPlaying = obj.parentElement.hasAttribute('playing') const parentIsPlaying = obj.parentElement.hasAttribute('playing')
// if (($(obj).parent().attr('playing') && this.previewStopped) || !$(obj).parent().attr('playing')) {
// $(obj).css({ opacity: 0 }, 200)
// }
if ((parentIsPlaying && this.previewStopped) || !parentIsPlaying) { if ((parentIsPlaying && this.previewStopped) || !parentIsPlaying) {
// $(obj).css({ opacity: 0 }, 200)
obj.style.opacity = 0 obj.style.opacity = 0
} }
} }