-
Notifications
You must be signed in to change notification settings - Fork 278
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
vueify start of showheader #5087
Changes from 2 commits
10f1e44
2235194
8d717d5
c96981b
8e7af4b
9d82908
498b8ac
e3e9f2c
5fdafcf
6f07b45
91fccc4
2f71380
515d375
72a629b
0db433e
9674927
ffea063
e6eb779
ae5b7db
106497d
6354111
ba08733
3cbe2f0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
<script> | ||
import { isVisible } from 'is-visible'; | ||
import { scrollTo } from 'vue-scrollto'; | ||
import { mapState, mapGetters } from 'vuex'; | ||
import { api, apiRoute } from '../api'; | ||
import AppLink from './app-link.vue'; | ||
|
@@ -11,6 +13,20 @@ export default { | |
AppLink, | ||
PlotInfo | ||
}, | ||
props: { | ||
/** | ||
* Show id | ||
*/ | ||
showId: { | ||
type: Number | ||
}, | ||
/** | ||
* Show indexer | ||
*/ | ||
showIndexer: { | ||
type: String | ||
} | ||
}, | ||
metaInfo() { | ||
if (!this.show || !this.show.title) { | ||
return { | ||
|
@@ -31,10 +47,10 @@ export default { | |
'getShowById' | ||
]), | ||
indexer() { | ||
return this.$route.query.indexername; | ||
return this.showIndexer || this.$route.query.indexername; | ||
}, | ||
id() { | ||
return this.$route.query.seriesid; | ||
return this.showId || this.$route.query.seriesid; | ||
}, | ||
show() { | ||
const { indexer, id, getShowById, shows, $store } = this; | ||
|
@@ -52,6 +68,11 @@ export default { | |
return show; | ||
} | ||
}, | ||
beforeMount() { | ||
// Get detailed show from API | ||
const { $store, id, indexer } = this; | ||
$store.dispatch('getShow', { id, indexer, detailed: true }); | ||
}, | ||
mounted() { | ||
const { | ||
setQuality, | ||
|
@@ -62,13 +83,13 @@ export default { | |
showHideRows | ||
} = this; | ||
|
||
$(window).on('resize', () => { | ||
this.reflowLayout(); | ||
['load', 'resize'].map(event => { | ||
return window.addEventListener(event, () => { | ||
this.reflowLayout(); | ||
}); | ||
}); | ||
|
||
window.addEventListener('load', () => { | ||
this.reflowLayout(); | ||
|
||
$.ajaxEpSearch({ | ||
colorRow: true | ||
}); | ||
|
@@ -78,17 +99,6 @@ export default { | |
$.ajaxEpRedownloadSubtitle(); | ||
}); | ||
|
||
$(document.body).on('change', '#seasonJump', event => { | ||
const id = $('#seasonJump option:selected').val(); | ||
if (id && id !== 'jump') { | ||
const season = $('#seasonJump option:selected').data('season'); | ||
$('html,body').animate({ scrollTop: $('[name="' + id.substring(1) + '"]').offset().top - 100 }, 'slow'); | ||
$('#collapseSeason-' + season).collapse('show'); | ||
location.hash = id; | ||
} | ||
$(event.currentTarget).val('jump'); | ||
}); | ||
|
||
$(document.body).on('click', '#changeStatus', () => { | ||
const epArr = []; | ||
const status = $('#statusSelect').val(); | ||
|
@@ -158,24 +168,28 @@ export default { | |
}); | ||
}); | ||
|
||
// Selects all visible episode checkboxes. | ||
$(document.body).on('click', '.seriesCheck', () => { | ||
$('.epCheck:visible').each((index, element) => { | ||
element.checked = true; | ||
}); | ||
$('.seasonCheck:visible').each((index, element) => { | ||
element.checked = true; | ||
}); | ||
// Selects all visible episode checkboxes | ||
document.addEventListener('click', event => { | ||
if (event.target && event.target.className.includes('clearAll')) { | ||
[...document.getElementsByClassName('epCheck')].filter(isVisible).forEach(element => { | ||
element.checked = true; | ||
}); | ||
[...document.getElementsByClassName('seasonCheck')].filter(isVisible).forEach(element => { | ||
element.checked = true; | ||
}); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You could use this instead of the two loops, but it's probably going to be replaced later.. [...document.querySelectorAll('.epCheck, .seasonCheck')].filter(isVisible).forEach(element => {
element.checked = true;
}); |
||
} | ||
}); | ||
|
||
// Clears all visible episode checkboxes and the season selectors | ||
$(document.body).on('click', '.clearAll', () => { | ||
$('.epCheck:visible').each((index, element) => { | ||
element.checked = false; | ||
}); | ||
$('.seasonCheck:visible').each((index, element) => { | ||
element.checked = false; | ||
}); | ||
document.addEventListener('click', event => { | ||
OmgImAlexis marked this conversation as resolved.
Show resolved
Hide resolved
|
||
if (event.target && event.target.className.includes('clearAll')) { | ||
[...document.getElementsByClassName('epCheck')].filter(isVisible).forEach(element => { | ||
element.checked = false; | ||
}); | ||
[...document.getElementsByClassName('seasonCheck')].filter(isVisible).forEach(element => { | ||
element.checked = false; | ||
}); | ||
} | ||
}); | ||
|
||
// Show/hide different types of rows when the checkboxes are changed | ||
|
@@ -265,25 +279,20 @@ export default { | |
$.tablesorter.columnSelector.attachTo($('#showTable, #animeTable'), '#popover-target'); | ||
}); | ||
|
||
// Moved and rewritten this from displayShow. This changes the button when clicked for collapsing/expanding the | ||
// Season to Show Episodes or Hide Episodes. | ||
$('.collapse.toggle').on('hide.bs.collapse', function() { | ||
// Changes the button when clicked for collapsing/expanding the season to show/hide episodes | ||
document.addEventListener('hide.bs.collapse', function() { | ||
const reg = /collapseSeason-(\d+)/g; | ||
const result = reg.exec(this.id); | ||
$('#showseason-' + result[1]).text('Show Episodes'); | ||
$('#season-' + result[1] + '-cols').addClass('shadow'); | ||
}); | ||
$('.collapse.toggle').on('show.bs.collapse', function() { | ||
document.addEventListener('show.bs.collapse', function() { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There's a good chance this is broken. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I suggest: document.querySelectorAll('.collapse.toggle').forEach(element => {
element.addEventListener('hide.bs.collapse', function() {
// on hide
});
element.addEventListener('show.bs.collapse', function() {
// on show
});
)); And to test this you need to disable |
||
const reg = /collapseSeason-(\d+)/g; | ||
const result = reg.exec(this.id); | ||
$('#showseason-' + result[1]).text('Hide Episodes'); | ||
$('#season-' + result[1] + '-cols').removeClass('shadow'); | ||
}); | ||
|
||
// Generate IMDB stars | ||
$('.imdbstars').each((index, element) => { | ||
$(element).html($('<span/>').width($(element).text() * 12)); | ||
}); | ||
attachImdbTooltip(); // eslint-disable-line no-undef | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Tooltip is not working. It's possible you need to put this in |
||
|
||
// Get the season exceptions and the xem season mappings. | ||
|
@@ -504,6 +513,36 @@ export default { | |
$('#' + seasonNo + '-cols').show(); | ||
} | ||
}); | ||
}, | ||
jumpToSeason(event) { | ||
const { id } = event.currentTarget; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That is incorrect, it uses |
||
|
||
// Don't jump until an option is selected | ||
if (id && id !== 'jump') { | ||
scrollTo(id, 600, { | ||
container: 'body', | ||
easing: 'ease-in', | ||
offset: -100 | ||
}); | ||
|
||
// Update URL hash | ||
location.hash = id; | ||
|
||
// Reset jump | ||
event.currentTarget.value = 'jump'; | ||
} | ||
}, | ||
toggleSpecials() { | ||
this.$store.dispatch('setConfig', { | ||
layout: { | ||
show: { | ||
specials: !this.config.layout.show.specials | ||
} | ||
} | ||
}); | ||
}, | ||
reverse(array) { | ||
return array.slice().reverse(); | ||
} | ||
} | ||
}; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That class is incorrect, should be
seriesCheck
.