Remove direct use of jQuery

jQuery is still required by jQuery UI
This commit is contained in:
rubenwardy
2023-08-26 12:34:55 +01:00
parent 9eb03c6a57
commit 2f458ba40e
22 changed files with 233 additions and 191 deletions

View File

@@ -88,7 +88,7 @@
<fieldset class="mt-4">
<legend class="pkg_meta">{{ _("Repository and Links") }}</legend>
<div class="pkg_wiz_1">
<div class="pkg_wiz_1 d-none">
<p>{{ _("Enter the repo URL for the package.
If the repo uses git then the metadata will be automatically imported.") }}</p>
@@ -98,12 +98,12 @@
{{ render_field(form.website, class_="pkg_meta") }}
{{ render_field(form.repo, class_="pkg_repo", hint=_("HTTP URL to a Git, Mercurial, or other repository")) }}
<div class="pkg_wiz_1">
<div class="pkg_wiz_1 d-none">
<a id="pkg_wiz_1_next" class="btn btn-primary">{{ _("Next (Autoimport)") }}</a>
<a id="pkg_wiz_1_skip" class="btn btn-default">{{ _("Skip Autoimport") }}</a>
</div>
<div class="pkg_wiz_2">
<div class="pkg_wiz_2 d-none">
{{ _("Importing... (This may take a while)") }}
</div>

View File

@@ -42,26 +42,5 @@
{% block scriptextra %}
<script src="/static/release_minmax.js?v=2"></script>
<script>
function setup_toggle(type) {
const toggle = $("#set_" + type);
function on_change() {
if (toggle.is(":checked")) {
// $("#" + type + "_rel").removeAttr("disabled");
$("#" + type + "_rel").parent().css("opacity", "1");
} else {
// $("#" + type + "_rel").attr("disabled", "disabled");
$("#" + type + "_rel").parent().css("opacity", "0.4");
$("#" + type + "_rel").val($("#" + type + "_rel option:first-child").attr("value"));
$("#" + type + "_rel").change();
}
}
toggle.change(on_change);
on_change();
}
setup_toggle("min");
setup_toggle("max");
</script>
<script src="/static/release_bulk_change.js"></script>
{% endblock %}

View File

@@ -86,22 +86,9 @@
{{ render_submit_field(form.submit) }}
</p>
</form>
{% endblock %}
{% block scriptextra %}
<script src="/static/release_minmax.js?v=2"></script>
<script>
function check_opt() {
if ($("input[name=uploadOpt]:checked").val() == "vcs") {
$("#file_upload").parent().hide();
$("#vcsLabel").parent().show();
} else {
$("#file_upload").parent().show();
$("#vcsLabel").parent().hide();
}
}
$("input[name=uploadOpt]").change(check_opt);
check_opt();
</script>
<script src="/static/release_new.js"></script>
{% endblock %}

View File

@@ -131,20 +131,7 @@
{% endblock %}
{% block scriptextra %}
<script src="/static/libs/jquery.min.js?v=2"></script>
<script src="/static/libs/jquery-ui.min.js?v=2"></script>
<script>
function update() {
const elements = Array.from(document.getElementsByClassName("sortable")[0].children);
const ids = elements.map(x => x.dataset.id).filter(x => x);
$("input[name='order']").val(ids.join(","))
}
update();
$(function() {
$(".sortable").sortable({
update: update
});
});
</script>
<script src="/static/screenshots_editor.js"></script>
{% endblock %}