Move jquery .load() to fetch
This commit is contained in:
parent
a19ee80c1e
commit
8a52344b29
3 changed files with 16 additions and 7 deletions
|
@ -16,7 +16,10 @@ L.OSM.key = function (options) {
|
||||||
|
|
||||||
function shown() {
|
function shown() {
|
||||||
map.on("zoomend baselayerchange", update);
|
map.on("zoomend baselayerchange", update);
|
||||||
$section.load("/key", update);
|
fetch("/key")
|
||||||
|
.then(r => r.text())
|
||||||
|
.then(html => { $section.html(html); })
|
||||||
|
.then(update);
|
||||||
}
|
}
|
||||||
|
|
||||||
function hidden() {
|
function hidden() {
|
||||||
|
|
|
@ -36,9 +36,15 @@
|
||||||
if (preview.children(".richtext").contents().length === 0) {
|
if (preview.children(".richtext").contents().length === 0) {
|
||||||
preview.children(".richtext_placeholder").removeAttr("hidden").addClass("delayed-fade-in");
|
preview.children(".richtext_placeholder").removeAttr("hidden").addClass("delayed-fade-in");
|
||||||
|
|
||||||
preview.children(".richtext").load(editor.data("previewUrl"), { text: editor.val() }, function () {
|
fetch(editor.data("previewUrl"), {
|
||||||
preview.children(".richtext_placeholder").attr("hidden", true).removeClass("delayed-fade-in");
|
method: "POST",
|
||||||
});
|
body: new URLSearchParams({ text: editor.val(), ...OSM.csrf })
|
||||||
|
})
|
||||||
|
.then(r => r.text())
|
||||||
|
.then(html => {
|
||||||
|
preview.children(".richtext").html(html);
|
||||||
|
preview.children(".richtext_placeholder").attr("hidden", true).removeClass("delayed-fade-in");
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -210,10 +210,10 @@ $(document).ready(function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
$("input[name=legale]").change(function () {
|
$("input[name=legale]").change(function () {
|
||||||
const url = $(this).data("url");
|
|
||||||
|
|
||||||
$("#contributorTerms").html("<div class='spinner-border' role='status'><span class='visually-hidden'>" + I18n.t("browse.start_rjs.loading") + "</span></div>");
|
$("#contributorTerms").html("<div class='spinner-border' role='status'><span class='visually-hidden'>" + I18n.t("browse.start_rjs.loading") + "</span></div>");
|
||||||
$("#contributorTerms").load(url);
|
fetch($(this).data("url"))
|
||||||
|
.then(r => r.text())
|
||||||
|
.then(html => { $("#contributorTerms").html(html); });
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#read_ct").on("click", function () {
|
$("#read_ct").on("click", function () {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue