Sha256: ff9a4bfb2ee1ac8079d690b3846349809dac40784e3fb7123db382ed308d0cf1
Contents?: true
Size: 1.19 KB
Versions: 6
Compression:
Stored size: 1.19 KB
Contents
$(() => { $(".check-custom-redirections").on("click", (evt) => { evt.preventDefault(); if ($(evt.target).hasClass("disabled")) { return; } $(evt.target).addClass("disabled"); const getReport = (tr, response) => { const item = $(tr).data("item"); const $td = $(tr).find(".redirect-status"); let type = response.type; let status = response.status; if (response.type === "opaqueredirect") { type = "redirect"; status = "302"; } if (item.active) { if (type === "redirect") { $td.addClass("success"); } else { $td.addClass("alert"); } } else { $td.addClass("muted"); } return `${type} (${status})`; }; $("tr.custom-redirection").each((index, tr) => { const $td = $(tr).find(".redirect-status"); $td.html('<span class="loading-spinner" />'); fetch($(tr).data("origin"), {method: "HEAD", redirect: "manual"}). then((response) => { $td.html(getReport(tr, response)) }). catch((error) => { console.error("ERROR", error) $td.removeClass("loading"); }); }); }); });
Version data entries
6 entries across 6 versions & 1 rubygems