From 6b67a67e649f1376230510eabbc740637052a447 Mon Sep 17 00:00:00 2001 From: Alexis Tyler Date: Fri, 20 Apr 2018 15:23:01 +0930 Subject: [PATCH] move quality-chooser to vue (#3818) * move quality-chooser to vue * add js libs * fix form submitting * move new vue component to vue-components dir * rename qualityChooser file * Rename "preffered" to preferred * Fix quality chooser (tested only on add new show page) + a few changes in add-show-options I needed to make the save defaults button work better * Remove imports of quality-chooser.js, remove map files * Update files in the other themes quality-chooser.mako add-show-options.js vue-submit-form.js * More fixes - Fix Backlog warning missing word and link. - Fix archive episodes button, html and function. * remove old js tag and move component import to main.mako * Fix quality chooser for add-show-options **Always render** the allowed/preferred qualities select elements, so jQuery could pull data from them to send to Python. Signed-off-by: sharkykh * Remove quality-chooser.js again it was probably re-added in the rebase by mistake Signed-off-by: sharkykh * Add watches to emit event when qualities change. * Update component to support massEdit and some finishing touches * gulp * Fix Add Show 'Step 3' section height not expanding when changing from a preset to custom quality + Fix indentation in Vue code --- .../slim/static/js/add-show-options.js | 8 +- .../slim/static/js/add-shows/new-show.js | 8 +- .../slim/static/js/quality-chooser.js | 139 ----------- .../slim/static/js/vue-submit-form.js | 21 ++ .../slim/views/addShows_addExistingShow.mako | 1 - .../slim/views/addShows_newShow.mako | 11 +- .../slim/views/addShows_recommended.mako | 1 - .../slim/views/addShows_trendingShows.mako | 1 - themes-default/slim/views/editShow.mako | 4 +- .../slim/views/inc_addShowOptions.mako | 3 +- .../slim/views/inc_qualityChooser.mako | 62 ----- themes-default/slim/views/layouts/main.mako | 3 +- .../slim/views/manage_massEdit.mako | 50 +--- .../views/vue-components/quality-chooser.mako | 228 ++++++++++++++++++ themes/dark/assets/js/add-show-options.js | 8 +- themes/dark/assets/js/add-show-options.js.map | 2 +- themes/dark/assets/js/add-shows/new-show.js | 8 +- .../dark/assets/js/add-shows/new-show.js.map | 2 +- themes/dark/assets/js/quality-chooser.js | 139 ----------- themes/dark/assets/js/quality-chooser.js.map | 1 - themes/dark/assets/js/vue-submit-form.js | 21 ++ themes/dark/assets/js/vue-submit-form.js.map | 1 + .../templates/addShows_addExistingShow.mako | 1 - themes/dark/templates/addShows_newShow.mako | 11 +- .../dark/templates/addShows_recommended.mako | 1 - .../templates/addShows_trendingShows.mako | 1 - themes/dark/templates/editShow.mako | 4 +- themes/dark/templates/inc_addShowOptions.mako | 3 +- themes/dark/templates/inc_qualityChooser.mako | 62 ----- themes/dark/templates/layouts/main.mako | 3 +- themes/dark/templates/manage_massEdit.mako | 50 +--- .../vue-components/quality-chooser.mako | 228 ++++++++++++++++++ themes/light/assets/js/add-show-options.js | 8 +- .../light/assets/js/add-show-options.js.map | 2 +- themes/light/assets/js/add-shows/new-show.js | 8 +- .../light/assets/js/add-shows/new-show.js.map | 2 +- themes/light/assets/js/quality-chooser.js | 139 ----------- themes/light/assets/js/quality-chooser.js.map | 1 - themes/light/assets/js/vue-submit-form.js | 21 ++ themes/light/assets/js/vue-submit-form.js.map | 1 + .../templates/addShows_addExistingShow.mako | 1 - themes/light/templates/addShows_newShow.mako | 11 +- .../light/templates/addShows_recommended.mako | 1 - .../templates/addShows_trendingShows.mako | 1 - themes/light/templates/editShow.mako | 4 +- .../light/templates/inc_addShowOptions.mako | 3 +- .../light/templates/inc_qualityChooser.mako | 62 ----- themes/light/templates/layouts/main.mako | 3 +- themes/light/templates/manage_massEdit.mako | 50 +--- .../vue-components/quality-chooser.mako | 228 ++++++++++++++++++ 50 files changed, 840 insertions(+), 792 deletions(-) delete mode 100644 themes-default/slim/static/js/quality-chooser.js create mode 100644 themes-default/slim/static/js/vue-submit-form.js delete mode 100644 themes-default/slim/views/inc_qualityChooser.mako create mode 100644 themes-default/slim/views/vue-components/quality-chooser.mako delete mode 100644 themes/dark/assets/js/quality-chooser.js delete mode 100644 themes/dark/assets/js/quality-chooser.js.map create mode 100644 themes/dark/assets/js/vue-submit-form.js create mode 100644 themes/dark/assets/js/vue-submit-form.js.map delete mode 100644 themes/dark/templates/inc_qualityChooser.mako create mode 100644 themes/dark/templates/vue-components/quality-chooser.mako delete mode 100644 themes/light/assets/js/quality-chooser.js delete mode 100644 themes/light/assets/js/quality-chooser.js.map create mode 100644 themes/light/assets/js/vue-submit-form.js create mode 100644 themes/light/assets/js/vue-submit-form.js.map delete mode 100644 themes/light/templates/inc_qualityChooser.mako create mode 100644 themes/light/templates/vue-components/quality-chooser.mako diff --git a/themes-default/slim/static/js/add-show-options.js b/themes-default/slim/static/js/add-show-options.js index 4ea832c159..4506e66844 100644 --- a/themes-default/slim/static/js/add-show-options.js +++ b/themes-default/slim/static/js/add-show-options.js @@ -2,10 +2,10 @@ $(document).ready(() => { $(document.body).on('click', '#saveDefaultsButton', event => { const anyQualArray = []; const bestQualArray = []; - $('#allowed_qualities option:selected').each((i, d) => { + $('select[name="allowed_qualities"] option:selected').each((i, d) => { anyQualArray.push($(d).val()); }); - $('#preferred_qualities option:selected').each((i, d) => { + $('select[name="preferred_qualities"] option:selected').each((i, d) => { bestQualArray.push($(d).val()); }); @@ -31,11 +31,11 @@ $(document).ready(() => { }); }); - $(document.body).on('change', '#statusSelect, #qualityPreset, #season_folders, #allowed_qualities, #preferred_qualities, #subtitles, #scene, #anime, #statusSelectAfter', () => { + $(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); }); - $(document.body).on('change', '#qualityPreset', () => { + $(document.body).on('change', 'select[name="quality_preset"]', () => { // Fix issue #181 - force re-render to correct the height of the outer div $('span.prev').click(); $('span.next').click(); diff --git a/themes-default/slim/static/js/add-shows/new-show.js b/themes-default/slim/static/js/add-shows/new-show.js index 8077b4840c..3f1fdfc578 100644 --- a/themes-default/slim/static/js/add-shows/new-show.js +++ b/themes-default/slim/static/js/add-shows/new-show.js @@ -163,10 +163,6 @@ MEDUSA.addShows.newShow = function() { $('#addShowForm').submit(); }); - $('#qualityPreset').on('change', () => { - myform.loadsection(2); // eslint-disable-line no-use-before-define - }); - /* JQuery Form to Form Wizard- (c) Dynamic Drive (www.dynamicdrive.com) * This notice MUST stay intact for legal use * Visit http://www.dynamicdrive.com/ for this script and 100s more. */ @@ -207,6 +203,10 @@ MEDUSA.addShows.newShow = function() { myform.loadsection(2); }); + $(document.body).on('change', 'select[name="quality_preset"]', () => { + setTimeout(() => myform.loadsection(2), 100); + }); + $('#rootDirs').on('change', () => { updateSampleText(); }); diff --git a/themes-default/slim/static/js/quality-chooser.js b/themes-default/slim/static/js/quality-chooser.js deleted file mode 100644 index 87bfa3104b..0000000000 --- a/themes-default/slim/static/js/quality-chooser.js +++ /dev/null @@ -1,139 +0,0 @@ -$(document).ready(() => { - function setFromPresets(preset) { - if (parseInt(preset, 10) === 0) { - $('#customQuality').show(); - return; - } - - $('#customQuality').hide(); - - $('#allowed_qualities option').each((index, element) => { - const result = preset & $(element).val(); - if (result > 0) { - $(element).prop('selected', true); - } else { - $(element).prop('selected', false); - } - }); - - $('#preferred_qualities option').each((index, element) => { - const result = preset & ($(element).val() << 16); - if (result > 0) { - $(element).prop('selected', true); - } else { - $(element).prop('selected', false); - } - }); - } - - function backloggedEpisodes() { - const selectedPreffered = []; - const selectedAllowed = []; - $('#preferred_qualities :selected').each((i, selected) => { - selectedPreffered[i] = $(selected).val(); - }); - $('#allowed_qualities :selected').each((i, selected) => { - selectedAllowed[i] = $(selected).val(); - }); - const url = 'series/' + $('#series-slug').attr('value') + - '/legacy/backlogged' + - '?allowed=' + selectedAllowed + - '&preferred=' + selectedPreffered; - api.get(url).then(response => { - const newBacklogged = response.data.new; - const existingBacklogged = response.data.existing; - const variation = Math.abs(newBacklogged - existingBacklogged); - let html = 'Current backlog: ' + existingBacklogged + ' episodes
'; - if (newBacklogged === -1 || existingBacklogged === -1) { - html = 'No qualities selected'; - } else if (newBacklogged === existingBacklogged) { - html += 'This change won\'t affect your backlogged episodes'; - } else { - html += '
New backlog: ' + newBacklogged + ' episodes'; - html += '

'; - let change = ''; - if (newBacklogged > existingBacklogged) { - html += 'WARNING: '; - change = 'increase'; - // Only show the archive action div if we have backlog increase - $('#archive').show(); - } else { - change = 'decrease'; - } - html += 'Backlog will ' + change + ' by ' + variation + ' episodes.'; - } - $('#backloggedEpisodes').html(html); - }); - } - - function archiveEpisodes() { - const url = 'series/' + $('#series-slug').attr('value') + '/operation'; - api.post(url, { type: 'ARCHIVE_EPISODES' }).then(response => { - let html = ''; - if (response.status === 201) { - html = 'Successfully archived episodes'; - // Recalculate backlogged episodes after we archive it - backloggedEpisodes(); - } else if (response.status === 204) { - html = 'No episodes to be archived'; - } - $('#archivedStatus').html(html); - // Restore button text - $('#archiveEpisodes').val('Finished'); - $('#archiveEpisodes').prop('disabled', true); - }); - } - - function setQualityText() { - const preferred = $.map($('#preferred_qualities option:selected'), option => { - return option.text; - }); - const allowed = $.map($('#allowed_qualities option:selected'), option => { - return option.text; - }); - const both = allowed.concat(preferred.filter(item => { - return allowed.indexOf(item) < 0; - })); - - const allowedPreferredExplanation = both.join(', '); - const preferredExplanation = preferred.join(', '); - const allowedExplanation = allowed.join(', '); - - $('#allowedPreferredExplanation').text(allowedPreferredExplanation); - $('#preferredExplanation').text(preferredExplanation); - $('#allowedExplanation').text(allowedExplanation); - - $('#allowedText').hide(); - $('#preferredText1').hide(); - $('#preferredText2').hide(); - $('#qualityExplanation').show(); - - if (preferred.length >= 1) { - $('#preferredText1').show(); - $('#preferredText2').show(); - } else if (allowed.length >= 1) { - $('#allowedText').show(); - } else { - $('#qualityExplanation').hide(); - } - } - - $(document.body).on('click', '#archiveEpisodes', event => { - $.get($(event.currentTarget).attr('href')); - $(event.currentTarget).val('Archiving...'); - archiveEpisodes(); - return false; - }); - - $(document.body).on('change', '#qualityPreset', () => { - setFromPresets($('#qualityPreset :selected').val()); - }); - - $(document.body).on('change', '#qualityPreset, #preferred_qualities, #allowed_qualities', () => { - setQualityText(); - backloggedEpisodes(); - }); - - setFromPresets($('#qualityPreset :selected').val()); - setQualityText(); -}); diff --git a/themes-default/slim/static/js/vue-submit-form.js b/themes-default/slim/static/js/vue-submit-form.js new file mode 100644 index 0000000000..4b66f55790 --- /dev/null +++ b/themes-default/slim/static/js/vue-submit-form.js @@ -0,0 +1,21 @@ +window.vueSubmitForm = async function(formId) { + const element = document.getElementById(formId); + const formData = new FormData(element); + const method = element.getAttribute('method'); + const base = document.getElementsByTagName('base')[0].getAttribute('href'); + const path = element.getAttribute('action'); + const redirect = element.getAttribute('redirect'); + + // @TODO: Add this back when we're JSON only + // This converts formData to JSON + // const body = Array.from(formData.entries()).reduce((memo, pair) => ({ + // ...memo, + // [pair[0]]: pair[1] + // }), {}); + this.$http[method](path, { body: formData, redirect: 'follow' }) + .then(() => { + if (redirect) { + window.location.href = base + redirect; + } + }); +}; diff --git a/themes-default/slim/views/addShows_addExistingShow.mako b/themes-default/slim/views/addShows_addExistingShow.mako index 6ce29aa747..d890a03af5 100644 --- a/themes-default/slim/views/addShows_addExistingShow.mako +++ b/themes-default/slim/views/addShows_addExistingShow.mako @@ -3,7 +3,6 @@ from medusa import app %> <%block name="scripts"> - + + + % if enable_anime_options: % endif diff --git a/themes-default/slim/views/addShows_trendingShows.mako b/themes-default/slim/views/addShows_trendingShows.mako index 436ce5298a..363402437f 100644 --- a/themes-default/slim/views/addShows_trendingShows.mako +++ b/themes-default/slim/views/addShows_trendingShows.mako @@ -3,7 +3,6 @@ from medusa import app %> <%block name="scripts"> - % if enable_anime_options: % endif diff --git a/themes-default/slim/views/editShow.mako b/themes-default/slim/views/editShow.mako index 7f0a2bc977..3ad7566153 100644 --- a/themes-default/slim/views/editShow.mako +++ b/themes-default/slim/views/editShow.mako @@ -13,7 +13,6 @@ <%block name="scripts"> - % if show.is_anime: @@ -71,8 +70,7 @@ const startVue = () => { diff --git a/themes-default/slim/views/inc_addShowOptions.mako b/themes-default/slim/views/inc_addShowOptions.mako index 9159a85071..4f16b8c000 100644 --- a/themes-default/slim/views/inc_addShowOptions.mako +++ b/themes-default/slim/views/inc_addShowOptions.mako @@ -8,8 +8,7 @@ diff --git a/themes-default/slim/views/inc_qualityChooser.mako b/themes-default/slim/views/inc_qualityChooser.mako deleted file mode 100644 index ac2e625a79..0000000000 --- a/themes-default/slim/views/inc_qualityChooser.mako +++ /dev/null @@ -1,62 +0,0 @@ -<%! - from medusa import app - from medusa.common import Quality, qualityPresets, qualityPresetStrings -%> -<% -if not show is UNDEFINED: - __quality = int(show.quality) -else: - __quality = int(app.QUALITY_DEFAULT) -allowed_qualities, preferred_qualities = Quality.split_quality(__quality) -overall_quality = Quality.combine_qualities(allowed_qualities, preferred_qualities) -selected = None -%> - -
-
-

Preferred qualities will replace those in allowed, even if they are lower.

-
-
Allowed
- <% any_quality_list = filter(lambda x: x > Quality.NONE, Quality.qualityStrings) %> - -
-
-
Preferred
- <% preferred_quality_list = filter(lambda x: x >= Quality.SDTV and x < Quality.UNKNOWN, Quality.qualityStrings) %> - -
-
-
-
Quality setting explanation:
-
This will download any of these qualities and then stops searching:
-
Downloads any of these qualities:
-
But it will stop searching when one of these is downloaded:
-
-
-
-
- -
diff --git a/themes-default/slim/views/layouts/main.mako b/themes-default/slim/views/layouts/main.mako index c2162744ff..f6bbde1046 100644 --- a/themes-default/slim/views/layouts/main.mako +++ b/themes-default/slim/views/layouts/main.mako @@ -115,7 +115,7 @@ <% - ## Add Global Vue component x-templates here + ## Add Vue component x-templates here ## @NOTE: These will be usable on all pages %> @@ -127,6 +127,7 @@ <%include file="/vue-components/file-browser.mako"/> <%include file="/vue-components/plot-info.mako"/> <%include file="/vue-components/saved-message.mako"/> + <%include file="/vue-components/quality-chooser.mako"/> <%block name="scripts" /> diff --git a/themes-default/slim/views/manage_massEdit.mako b/themes-default/slim/views/manage_massEdit.mako index 568443cbc9..fc6171ad2f 100644 --- a/themes-default/slim/views/manage_massEdit.mako +++ b/themes-default/slim/views/manage_massEdit.mako @@ -1,20 +1,12 @@ <%inherit file="/layouts/main.mako"/> <%! + import json from medusa import app - from medusa import common - from medusa.common import SKIPPED, WANTED, UNAIRED, ARCHIVED, IGNORED, SNATCHED, SNATCHED_PROPER, SNATCHED_BEST, FAILED - from medusa.common import Quality, qualityPresets, qualityPresetStrings, statusStrings + from medusa.common import SKIPPED, WANTED, IGNORED, statusStrings + from medusa.common import Quality, qualityPresets, qualityPresetStrings from medusa.helper import exceptions %> <%block name="scripts"> -<% - if quality_value is not None: - initial_quality = int(quality_value) - else: - initial_quality = common.SD - allowed_qualities, preferred_qualities = common.Quality.split_quality(initial_quality) -%> - +<%! + import json + from medusa import app + from medusa.numdict import NumDict + from medusa.common import Quality, qualityPresets, qualityPresetStrings +%> +<% +if show is not UNDEFINED: + __quality = int(show.quality) +else: + __quality = int(app.QUALITY_DEFAULT) +allowed_qualities, preferred_qualities = Quality.split_quality(__quality) +overall_quality = Quality.combine_qualities(allowed_qualities, preferred_qualities) + +def convert(obj): + ## This converts the keys to strings as keys can't be ints + if isinstance(obj, (NumDict, dict)): + new_obj = {} + for key in obj: + new_obj[str(key)] = obj[key] + obj = new_obj + + return json.dumps(obj) +%> + diff --git a/themes/dark/assets/js/add-show-options.js b/themes/dark/assets/js/add-show-options.js index 4ea832c159..4506e66844 100644 --- a/themes/dark/assets/js/add-show-options.js +++ b/themes/dark/assets/js/add-show-options.js @@ -2,10 +2,10 @@ $(document).ready(() => { $(document.body).on('click', '#saveDefaultsButton', event => { const anyQualArray = []; const bestQualArray = []; - $('#allowed_qualities option:selected').each((i, d) => { + $('select[name="allowed_qualities"] option:selected').each((i, d) => { anyQualArray.push($(d).val()); }); - $('#preferred_qualities option:selected').each((i, d) => { + $('select[name="preferred_qualities"] option:selected').each((i, d) => { bestQualArray.push($(d).val()); }); @@ -31,11 +31,11 @@ $(document).ready(() => { }); }); - $(document.body).on('change', '#statusSelect, #qualityPreset, #season_folders, #allowed_qualities, #preferred_qualities, #subtitles, #scene, #anime, #statusSelectAfter', () => { + $(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); }); - $(document.body).on('change', '#qualityPreset', () => { + $(document.body).on('change', 'select[name="quality_preset"]', () => { // Fix issue #181 - force re-render to correct the height of the outer div $('span.prev').click(); $('span.next').click(); diff --git a/themes/dark/assets/js/add-show-options.js.map b/themes/dark/assets/js/add-show-options.js.map index fef4913002..8c38b521ce 100644 --- a/themes/dark/assets/js/add-show-options.js.map +++ b/themes/dark/assets/js/add-show-options.js.map @@ -1 +1 @@ -{"version":3,"names":[],"mappings":"","sources":["js/add-show-options.js"],"sourcesContent":["(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require==\"function\"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error(\"Cannot find module '\"+o+\"'\");throw f.code=\"MODULE_NOT_FOUND\",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require==\"function\"&&require;for(var o=0;o {\n $(document.body).on('click', '#saveDefaultsButton', event => {\n const anyQualArray = [];\n const bestQualArray = [];\n $('#allowed_qualities option:selected').each((i, d) => {\n anyQualArray.push($(d).val());\n });\n $('#preferred_qualities option:selected').each((i, d) => {\n bestQualArray.push($(d).val());\n });\n\n const data = {\n defaultStatus: $('#statusSelect').val(),\n allowed_qualities: anyQualArray.join(','), // eslint-disable-line camelcase\n preferred_qualities: bestQualArray.join(','), // eslint-disable-line camelcase\n defaultFlattenFolders: !$('#season_folders').prop('checked'), // Flatten folders is the contrary of season folders!\n subtitles: $('#subtitles').prop('checked'),\n anime: $('#anime').prop('checked'),\n scene: $('#scene').prop('checked'),\n defaultStatusAfter: $('#statusSelectAfter').val()\n };\n\n // @TODO: Move this to API\n $.get('config/general/saveAddShowDefaults', data);\n\n $(event.currentTarget).prop('disabled', true);\n new PNotify({ // eslint-disable-line no-new\n title: 'Saved Defaults',\n text: 'Your \"add show\" defaults have been set to your current selections.',\n shadow: false\n });\n });\n\n $(document.body).on('change', '#statusSelect, #qualityPreset, #season_folders, #allowed_qualities, #preferred_qualities, #subtitles, #scene, #anime, #statusSelectAfter', () => {\n $('#saveDefaultsButton').prop('disabled', false);\n });\n\n $(document.body).on('change', '#qualityPreset', () => {\n // Fix issue #181 - force re-render to correct the height of the outer div\n $('span.prev').click();\n $('span.next').click();\n });\n});\n\n},{}]},{},[1]);\n"],"file":"add-show-options.js"} \ No newline at end of file +{"version":3,"names":[],"mappings":"","sources":["js/add-show-options.js"],"sourcesContent":["(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require==\"function\"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error(\"Cannot find module '\"+o+\"'\");throw f.code=\"MODULE_NOT_FOUND\",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require==\"function\"&&require;for(var o=0;o {\n $(document.body).on('click', '#saveDefaultsButton', event => {\n const anyQualArray = [];\n const bestQualArray = [];\n $('select[name=\"allowed_qualities\"] option:selected').each((i, d) => {\n anyQualArray.push($(d).val());\n });\n $('select[name=\"preferred_qualities\"] option:selected').each((i, d) => {\n bestQualArray.push($(d).val());\n });\n\n const data = {\n defaultStatus: $('#statusSelect').val(),\n allowed_qualities: anyQualArray.join(','), // eslint-disable-line camelcase\n preferred_qualities: bestQualArray.join(','), // eslint-disable-line camelcase\n defaultFlattenFolders: !$('#season_folders').prop('checked'), // Flatten folders is the contrary of season folders!\n subtitles: $('#subtitles').prop('checked'),\n anime: $('#anime').prop('checked'),\n scene: $('#scene').prop('checked'),\n defaultStatusAfter: $('#statusSelectAfter').val()\n };\n\n // @TODO: Move this to API\n $.get('config/general/saveAddShowDefaults', data);\n\n $(event.currentTarget).prop('disabled', true);\n new PNotify({ // eslint-disable-line no-new\n title: 'Saved Defaults',\n text: 'Your \"add show\" defaults have been set to your current selections.',\n shadow: false\n });\n });\n\n $(document.body).on('change', '#statusSelect, select[name=\"quality_preset\"], #season_folders, select[name=\"allowed_qualities\"], select[name=\"preferred_qualities\"], #subtitles, #scene, #anime, #statusSelectAfter', () => {\n $('#saveDefaultsButton').prop('disabled', false);\n });\n\n $(document.body).on('change', 'select[name=\"quality_preset\"]', () => {\n // Fix issue #181 - force re-render to correct the height of the outer div\n $('span.prev').click();\n $('span.next').click();\n });\n});\n\n},{}]},{},[1]);\n"],"file":"add-show-options.js"} \ No newline at end of file diff --git a/themes/dark/assets/js/add-shows/new-show.js b/themes/dark/assets/js/add-shows/new-show.js index 8077b4840c..3f1fdfc578 100644 --- a/themes/dark/assets/js/add-shows/new-show.js +++ b/themes/dark/assets/js/add-shows/new-show.js @@ -163,10 +163,6 @@ MEDUSA.addShows.newShow = function() { $('#addShowForm').submit(); }); - $('#qualityPreset').on('change', () => { - myform.loadsection(2); // eslint-disable-line no-use-before-define - }); - /* JQuery Form to Form Wizard- (c) Dynamic Drive (www.dynamicdrive.com) * This notice MUST stay intact for legal use * Visit http://www.dynamicdrive.com/ for this script and 100s more. */ @@ -207,6 +203,10 @@ MEDUSA.addShows.newShow = function() { myform.loadsection(2); }); + $(document.body).on('change', 'select[name="quality_preset"]', () => { + setTimeout(() => myform.loadsection(2), 100); + }); + $('#rootDirs').on('change', () => { updateSampleText(); }); diff --git a/themes/dark/assets/js/add-shows/new-show.js.map b/themes/dark/assets/js/add-shows/new-show.js.map index a2d9030710..71255add6a 100644 --- a/themes/dark/assets/js/add-shows/new-show.js.map +++ b/themes/dark/assets/js/add-shows/new-show.js.map @@ -1 +1 @@ -{"version":3,"names":[],"mappings":"","sources":["js/add-shows/new-show.js"],"sourcesContent":["(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require==\"function\"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error(\"Cannot find module '\"+o+\"'\");throw f.code=\"MODULE_NOT_FOUND\",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require==\"function\"&&require;for(var o=0;o