Merge pull request #3634 from crobibero/plugin-config

fix built in plugin js

(cherry picked from commit f23e119a68)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
pull/4001/head
Anthony Lavado 4 years ago committed by Joshua M. Boniface
parent dadd42e574
commit 3b758c3a66

@ -28,29 +28,31 @@
pluginId: "a629c0da-fac5-4c7e-931a-7174223f14c8" pluginId: "a629c0da-fac5-4c7e-931a-7174223f14c8"
}; };
$('.configPage').on('pageshow', function () { document.querySelector('.configPage')
Dashboard.showLoadingMsg(); .addEventListener('pageshow', function () {
ApiClient.getPluginConfiguration(PluginConfig.pluginId).then(function (config) { Dashboard.showLoadingMsg();
$('#enable').checked = config.Enable; ApiClient.getPluginConfiguration(PluginConfig.pluginId).then(function (config) {
$('#replaceAlbumName').checked = config.ReplaceAlbumName; document.querySelector('#enable').checked = config.Enable;
document.querySelector('#replaceAlbumName').checked = config.ReplaceAlbumName;
Dashboard.hideLoadingMsg();
Dashboard.hideLoadingMsg();
});
}); });
});
$('.configForm').on('submit', function (e) {
Dashboard.showLoadingMsg();
var form = this; document.querySelector('.configForm')
ApiClient.getPluginConfiguration(PluginConfig.pluginId).then(function (config) { .addEventListener('submit', function (e) {
config.Enable = $('#enable', form).checked; Dashboard.showLoadingMsg();
config.ReplaceAlbumName = $('#replaceAlbumName', form).checked;
ApiClient.getPluginConfiguration(PluginConfig.pluginId).then(function (config) {
ApiClient.updatePluginConfiguration(PluginConfig.pluginId, config).then(Dashboard.processPluginConfigurationUpdateResult); config.Enable = document.querySelector('#enable').checked;
config.ReplaceAlbumName = document.querySelector('#replaceAlbumName').checked;
ApiClient.updatePluginConfiguration(PluginConfig.pluginId, config).then(Dashboard.processPluginConfigurationUpdateResult);
});
e.preventDefault();
return false;
}); });
return false;
});
</script> </script>
</div> </div>
</body> </body>

@ -36,33 +36,47 @@
uniquePluginId: "8c95c4d2-e50c-4fb0-a4f3-6c06ff0f9a1a" uniquePluginId: "8c95c4d2-e50c-4fb0-a4f3-6c06ff0f9a1a"
}; };
$('.musicBrainzConfigPage').on('pageshow', function () { document.querySelector('.musicBrainzConfigPage')
Dashboard.showLoadingMsg(); .addEventListener('pageshow', function () {
ApiClient.getPluginConfiguration(MusicBrainzPluginConfig.uniquePluginId).then(function (config) { Dashboard.showLoadingMsg();
$('#server').val(config.Server).change(); ApiClient.getPluginConfiguration(MusicBrainzPluginConfig.uniquePluginId).then(function (config) {
$('#rateLimit').val(config.RateLimit).change(); var server = document.querySelector('#server');
$('#enable').checked = config.Enable; server.value = config.Server;
$('#replaceArtistName').checked = config.ReplaceArtistName; server.dispatchEvent(new Event('change', {
bubbles: true,
cancelable: false
}));
var rateLimit = document.querySelector('#rateLimit');
rateLimit.value = config.RateLimit;
rateLimit.dispatchEvent(new Event('change', {
bubbles: true,
cancelable: false
}));
document.querySelector('#enable').checked = config.Enable;
document.querySelector('#replaceArtistName').checked = config.ReplaceArtistName;
Dashboard.hideLoadingMsg(); Dashboard.hideLoadingMsg();
});
}); });
});
document.querySelector('.musicBrainzConfigForm')
$('.musicBrainzConfigForm').on('submit', function (e) { .addEventListener('submit', function (e) {
Dashboard.showLoadingMsg(); Dashboard.showLoadingMsg();
var form = this; ApiClient.getPluginConfiguration(MusicBrainzPluginConfig.uniquePluginId).then(function (config) {
ApiClient.getPluginConfiguration(MusicBrainzPluginConfig.uniquePluginId).then(function (config) { config.Server = document.querySelector('#server').value;
config.Server = $('#server', form).val(); config.RateLimit = document.querySelector('#rateLimit').value;
config.RateLimit = $('#rateLimit', form).val(); config.Enable = document.querySelector('#enable').checked;
config.Enable = $('#enable', form).checked; config.ReplaceArtistName = document.querySelector('#replaceArtistName').checked;
config.ReplaceArtistName = $('#replaceArtistName', form).checked;
ApiClient.updatePluginConfiguration(MusicBrainzPluginConfig.uniquePluginId, config).then(Dashboard.processPluginConfigurationUpdateResult);
ApiClient.updatePluginConfiguration(MusicBrainzPluginConfig.uniquePluginId, config).then(Dashboard.processPluginConfigurationUpdateResult); });
e.preventDefault();
return false;
}); });
return false;
});
</script> </script>
</div> </div>
</body> </body>

@ -24,25 +24,28 @@
pluginId: "a628c0da-fac5-4c7e-9d1a-7134223f14c8" pluginId: "a628c0da-fac5-4c7e-9d1a-7134223f14c8"
}; };
$('.configPage').on('pageshow', function () { document.querySelector('.configPage')
Dashboard.showLoadingMsg(); .addEventListener('pageshow', function () {
ApiClient.getPluginConfiguration(PluginConfig.pluginId).then(function (config) { Dashboard.showLoadingMsg();
$('#castAndCrew').checked = config.CastAndCrew; ApiClient.getPluginConfiguration(PluginConfig.pluginId).then(function (config) {
Dashboard.hideLoadingMsg(); document.querySelector('#castAndCrew').checked = config.CastAndCrew;
Dashboard.hideLoadingMsg();
});
}); });
});
$('.configForm').on('submit', function (e) {
Dashboard.showLoadingMsg(); document.querySelector('.configForm')
.addEventListener('submit', function (e) {
var form = this; Dashboard.showLoadingMsg();
ApiClient.getPluginConfiguration(PluginConfig.pluginId).then(function (config) {
config.CastAndCrew = $('#castAndCrew', form).checked; ApiClient.getPluginConfiguration(PluginConfig.pluginId).then(function (config) {
ApiClient.updatePluginConfiguration(PluginConfig.pluginId, config).then(Dashboard.processPluginConfigurationUpdateResult); config.CastAndCrew = document.querySelector('#castAndCrew').checked;
ApiClient.updatePluginConfiguration(PluginConfig.pluginId, config).then(Dashboard.processPluginConfigurationUpdateResult);
});
e.preventDefault();
return false;
}); });
return false;
});
</script> </script>
</div> </div>
</body> </body>

Loading…
Cancel
Save