notify.js 1.0 KB

123456789101112131415161718192021222324252627282930313233
  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 checkLinkHref(elms) {
  5. //console.log("checkLinkHref");
  6. for (let a of elms) {
  7. //console.log(a.href);
  8. fetch(a.href)
  9. .then(function(response) {
  10. //console.log("checkLinkHref II");
  11. if (response.ok)
  12. return;
  13. //console.log("checkLinkHref III");
  14. a.classList.remove("enabled");
  15. a.classList.add("disabled");
  16. })
  17. .catch(function(err) {
  18. //console.log("checkLinkHref");
  19. console.log(a.href);
  20. console.log(err);
  21. }) ;
  22. }
  23. }
  24. // Firefox 56+ doesn't fire that one in xslt situation: document.addEventListener("DOMContentLoaded", function(event) { console.log("DOM fully loaded and parsed"); });
  25. var addlink;
  26. document.onreadystatechange = function () {
  27. if(addlink !== undefined)
  28. return;
  29. checkLinkHref(document.getElementsByClassName("enabled"));
  30. }