chore: also enable submitting the form with enter key

This commit is contained in:
Eli Bosley
2025-04-28 16:14:27 -04:00
parent 5ddbb60122
commit d2e05bfcbf

View File

@@ -15,41 +15,50 @@ Tag="download"
*/
?>
<script>
const my = {};
const my = {};
function installPlugin(file) {
if (file == null) {
$('#plugin_file').val('');
openPlugin(my.cmd,my.title,my.plg);
return;
}
file = file.trim();
if (!file) return;
$.get('/plugins/dynamix.plugin.manager/include/ShowPlugins.php',{cmd:'alert'},function(data) {
const forceInstall = $('#force_install').prop('checked');
my.cmd = 'plugin install ' + file + (forceInstall ? ' force' : '');
my.title = "_(Install Plugin)_";
my.plg = file.replace(/^.*(\\|\/|\:)/,'').replace('.plg','')+':install';
if (data==0) {
// no alert message - proceed with install
setTimeout(installPlugin);
} else {
// show alert message and ask for confirmation
openAlert("showchanges <?=$alerts?>","<?=_('Alert Message')?>",'installPlugin');
function installPlugin(file) {
if (file == null) {
$('#plugin_file').val('');
openPlugin(my.cmd, my.title, my.plg);
return;
}
file = file.trim();
if (!file) return;
$.get('/plugins/dynamix.plugin.manager/include/ShowPlugins.php', {
cmd: 'alert'
}, function(data) {
const forceInstall = $('#force_install').prop('checked');
my.cmd = 'plugin install ' + file + (forceInstall ? ' force' : '');
my.title = "_(Install Plugin)_";
my.plg = file.replace(/^.*(\\|\/|\:)/, '').replace('.plg', '') + ':install';
if (data == 0) {
// no alert message - proceed with install
setTimeout(installPlugin);
} else {
// show alert message and ask for confirmation
openAlert("showchanges <?= $alerts ?>", "<?= _('Alert Message') ?>", 'installPlugin');
}
});
}
$(function() {
$('form[name="plugin_install"]').on('submit', function(e) {
e.preventDefault();
installPlugin($('#plugin_file').val());
});
});
}
</script>
**_(Enter URL of remote plugin file or local plugin file)_**
<form name="plugin_install" method="POST" target="progressFrame">
<input type="text" name="file" id="plugin_file" maxlength="1024" value="" style="width:33%">
<input type="button" value="_(Install)_" onclick="installPlugin(this.form.file.value)">
<label style="margin-left: 10px;"><input type="checkbox" id="force_install" name="force_install"> _(Force Install)_</label>
<input type="text" name="file" id="plugin_file" maxlength="1024" value="" style="width:33%">
<label style="margin-right: 10px;" title="_(Use this option to reinstall a plugin or bypass compatibility checks)_"><input type="checkbox" id="force_install" name="force_install"> _(Force Install)_</label>
<input type="submit" value="_(Install)_">
</form>
:plugin_install_help:
**_(Select local plugin file)_**
<div id="plugin_tree" class="textarea"></div>
<div id="plugin_tree" class="textarea"></div>