subscribers.js 997 B

1234567891011121314151617181920212223242526272829303132
  1. document.documentElement.classList.add('script-active');
  2. document.documentElement.classList.remove('script-inactive');
  3. const xml_base_pub = document.documentElement.getAttribute("data-xml-base-pub");
  4. function probeHref(elms) {
  5. //console.log("probeHref");
  6. for (let a of elms) {
  7. console.debug("probeHref: %s", a.href);
  8. if(a.getAttribute("aria-disabled"))
  9. // disabled a priori
  10. return;
  11. fetch(a.href)
  12. .then(function(response) {
  13. a.classList.remove("probe-2xx");
  14. if (response.ok)
  15. return;
  16. a.setAttribute("aria-disabled",true);
  17. })
  18. .catch(function(err) {
  19. console.error("%s: %s", a.href, err);
  20. });
  21. }
  22. }
  23. // Firefox 56+ doesn't fire that one in xslt situation: document.addEventListener("DOMContentLoaded", function(event) { console.log("DOM fully loaded and parsed"); });
  24. var addlink;
  25. document.onreadystatechange = function () {
  26. if(addlink !== undefined)
  27. return;
  28. probeHref(document.getElementsByClassName("probe-2xx"));
  29. }