diff --git a/themes-default/slim/src/app.js b/themes-default/slim/src/app.js index 1949353fa3..d050e9d734 100644 --- a/themes-default/slim/src/app.js +++ b/themes-default/slim/src/app.js @@ -10,6 +10,11 @@ import { App } from './components'; Vue.config.devtools = true; Vue.config.performance = true; +if (document.body.getAttribute('developer') === 'True') { + Vue.config.devtools = true; + Vue.config.performance = true; +} + registerPlugins(); // @TODO: Remove this before v1.0.0 diff --git a/themes-default/slim/src/components/backstretch.vue b/themes-default/slim/src/components/backstretch.vue index da04cac4de..090ddab61f 100644 --- a/themes-default/slim/src/components/backstretch.vue +++ b/themes-default/slim/src/components/backstretch.vue @@ -10,7 +10,8 @@ export default { }, data() { return { - created: false + created: false, + wrapper: null }; }, computed: { @@ -53,21 +54,24 @@ export default { $wrap.css('top', offset); $wrap.css('opacity', opacity).fadeIn(500); this.created = true; + this.wrapper = $wrap; + } + }, + removeBackStretch() { + if (this.created) { + $.backstretch('destroy'); + this.created = false; } } }, destroyed() { - if (this.created) { - $.backstretch('destroy'); - } + this.removeBackStretch(); }, activated() { this.setBackStretch(); }, deactivated() { - if (this.created) { - $.backstretch('destroy'); - } + this.removeBackStretch(); }, watch: { opacity(newOpacity) { diff --git a/themes-default/slim/src/components/display-show.vue b/themes-default/slim/src/components/display-show.vue index 384214bd94..0251a42035 100644 --- a/themes-default/slim/src/components/display-show.vue +++ b/themes-default/slim/src/components/display-show.vue @@ -377,6 +377,7 @@ - - - - + - diff --git a/themes/dark/assets/js/add-show-options.js b/themes/dark/assets/js/add-show-options.js deleted file mode 100644 index f010f0df92..0000000000 --- a/themes/dark/assets/js/add-show-options.js +++ /dev/null @@ -1,37 +0,0 @@ -$(document).ready(() => { - $(document.body).on('click', '#saveDefaultsButton', event => { - const anyQualArray = []; - const bestQualArray = []; - $('select[name="allowed_qualities"] option:selected').each((i, d) => { - anyQualArray.push($(d).val()); - }); - $('select[name="preferred_qualities"] option:selected').each((i, d) => { - bestQualArray.push($(d).val()); - }); - - const data = { - default_status: $('#statusSelect').val(), // eslint-disable-line camelcase - allowed_qualities: anyQualArray.join(','), // eslint-disable-line camelcase - preferred_qualities: bestQualArray.join(','), // eslint-disable-line camelcase - default_season_folders: $('#season_folders').prop('checked'), // eslint-disable-line camelcase - subtitles: $('#subtitles').prop('checked'), - anime: $('#anime').prop('checked'), - scene: $('#scene').prop('checked'), - default_status_after: $('#statusSelectAfter').val() // eslint-disable-line camelcase - }; - - // @TODO: Move this to API - $.get('config/general/saveAddShowDefaults', data); - - $(event.currentTarget).prop('disabled', true); - new PNotify({ // eslint-disable-line no-new - title: 'Saved Defaults', - text: 'Your "add show" defaults have been set to your current selections.', - shadow: false - }); - }); - - $(document.body).on('change', '#statusSelect, select[name="quality_preset"], #season_folders, select[name="allowed_qualities"], select[name="preferred_qualities"], #subtitles, #scene, #anime, #statusSelectAfter', () => { - $('#saveDefaultsButton').prop('disabled', false); - }); -}); diff --git a/themes/dark/assets/js/add-shows/init.js b/themes/dark/assets/js/add-shows/init.js deleted file mode 100644 index 9cd271d8e9..0000000000 --- a/themes/dark/assets/js/add-shows/init.js +++ /dev/null @@ -1,196 +0,0 @@ -MEDUSA.addShows.init = function() { - $('#tabs').tabs({ - collapsible: true, - selected: (MEDUSA.config.layout.sortArticle ? -1 : 0) - }); - - const imgLazyLoad = new LazyLoad({ - // Example of options object -> see options section - threshold: 500 - }); - - $.initRemoteShowGrid = function() { - // Set defaults on page load - imgLazyLoad.update(); - imgLazyLoad.handleScroll(); - $('#showsort').val('original'); - $('#showsortdirection').val('asc'); - - $('#showsort').on('change', function() { - let sortCriteria; - switch (this.value) { - case 'original': - sortCriteria = 'original-order'; - break; - case 'rating': - /* Randomise, else the rating_votes can already - * have sorted leaving this with nothing to do. - */ - $('#container').isotope({ sortBy: 'random' }); - sortCriteria = 'rating'; - break; - case 'rating_votes': - sortCriteria = ['rating', 'votes']; - break; - case 'votes': - sortCriteria = 'votes'; - break; - default: - sortCriteria = 'name'; - break; - } - $('#container').isotope({ - sortBy: sortCriteria - }); - }); - - $(document.body).on('change', '#rootDirs', () => { - $.rootDirCheck(); - }); - - $('#showsortdirection').on('change', function() { - $('#container').isotope({ - sortAscending: (this.value === 'asc') - }); - }); - - $('#container').isotope({ - sortBy: 'original-order', - layoutMode: 'fitRows', - getSortData: { - name(itemElem) { - const name = $(itemElem).attr('data-name') || ''; - return (MEDUSA.config.layout.sortArticle ? name : name.replace(/^((?:the|a|an)\s)/i, '')).toLowerCase(); - }, - rating: '[data-rating] parseInt', - votes: '[data-votes] parseInt' - } - }).on('layoutComplete arrangeComplete removeComplete', () => { - imgLazyLoad.update(); - imgLazyLoad.handleScroll(); - }); - }; - - $.fn.loadRemoteShows = function(path, loadingTxt, errorTxt) { - $(this).html(' ' + loadingTxt); - $(this).load(path + ' #container', function(response, status) { - if (status === 'error') { - $(this).empty().html(errorTxt); - } else { - $.initRemoteShowGrid(); - imgLazyLoad.update(); - imgLazyLoad.handleScroll(); - } - }); - }; - - /* - * Blacklist a show by series id. - */ - $.initBlackListShowById = function() { - $(document.body).on('click', 'button[data-blacklist-show]', function(e) { - e.preventDefault(); - - if ($(this).is(':disabled')) { - return false; - } - - $(this).html('Blacklisted').prop('disabled', true); - $(this).parent().find('button[data-add-show]').prop('disabled', true); - - $.get('addShows/addShowToBlacklist?seriesid=' + $(this).attr('data-indexer-id')); - return false; - }); - }; - - /* - * Adds show by indexer and indexer_id with a number of optional parameters - * The show can be added as an anime show by providing the data attribute: data-isanime="1" - */ - $.initAddShowById = function() { - $(document.body).on('click', 'button[data-add-show]', function(e) { - e.preventDefault(); - - if ($(this).is(':disabled')) { - return false; - } - - $(this).html('Added').prop('disabled', true); - $(this).parent().find('button[data-blacklist-show]').prop('disabled', true); - - const anyQualArray = []; - const bestQualArray = []; - $('select[name="allowed_qualities"] option:selected').each((i, d) => { - anyQualArray.push($(d).val()); - }); - $('select[name="preferred_qualities"] option:selected').each((i, d) => { - bestQualArray.push($(d).val()); - }); - - const configureShowOptions = $('#configure_show_options').prop('checked'); - - $.get('addShows/addShowByID?showslug=' + $(this).attr('data-indexer') + $(this).attr('data-indexer-id'), { - root_dir: $('#rootDirs option:selected').val(), // eslint-disable-line camelcase - configure_show_options: configureShowOptions, // eslint-disable-line camelcase - show_name: $(this).attr('data-show-name'), // eslint-disable-line camelcase - quality_preset: $('select[name="quality_preset"]').val(), // eslint-disable-line camelcase - default_status: $('#statusSelect').val(), // eslint-disable-line camelcase - any_qualities: anyQualArray.join(','), // eslint-disable-line camelcase - best_qualities: bestQualArray.join(','), // eslint-disable-line camelcase - season_folders: $('#season_folders').prop('checked'), // eslint-disable-line camelcase - subtitles: $('#subtitles').prop('checked'), - anime: $('#anime').prop('checked'), - scene: $('#scene').prop('checked'), - default_status_after: $('#statusSelectAfter').val() // eslint-disable-line camelcase - }); - return false; - }); - }; - - $.updateBlackWhiteList = function(showName) { - $('#white').children().remove(); - $('#black').children().remove(); - $('#pool').children().remove(); - - if ($('#anime').prop('checked') && showName) { - $('#blackwhitelist').show(); - if (showName) { - $.getJSON('home/fetch_releasegroups', { - series_name: showName // eslint-disable-line camelcase - }, data => { - if (data.result === 'success') { - $.each(data.groups, (i, group) => { - const option = $('