Advertisement
jcunews

EpigraphicListExtractToHTML bookmarklet

Mar 28th, 2022
1,593
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. javascript:/*EpigraphicListExtractToHTML*/
  2. ((u, t) => {
  3.   if (location.href !== (u = "https://db.edcs.eu/epigr/epi_ergebnis.php")) {
  4.     if (confirm("This bookmarklet is only for website page with below URL:\n" + u + "\n\nOpen that page now?")) open(t);
  5.     return
  6.   }
  7.   t = document.createElement("TABLE");
  8.   document.querySelectorAll('a[href*="bilder.php"]').forEach((lnk, i, row, cell) => {
  9.     (row = t.insertRow()).insertCell().textContent = i + 1;
  10.     row.insertCell().textContent = lnk.textContent;
  11.     cell = row.insertCell();
  12.     lnk.href.match(/bild=([^&]+)/)[1].split(";").forEach((fn, m, e) => {
  13.       if (fn !== "pp") {
  14.         cell.appendChild(e = document.createElement("A")).href =
  15.           "https://db.edcs.eu/epigr/bilder/" + fn + (!fn.includes(".jpg") && ".jpg" || "");
  16.         e.textContent = e.href
  17.       }
  18.     });
  19.     row.insertCell().textContent = lnk.parentNode.querySelector('a[href*="bilder.php"]~noscript+br').nextSibling.data.trim()
  20.   });
  21.   t = '\
  22. <!doctype html><html><head><!--source: ' + u + '--><meta charset="utf-8"><style>\
  23. body{font-family:sans-serif}table{width:100%}tr:nth-child(2n){background:#eee}\
  24. td{padding:.1em .2em;max-width:50vw;vertical-align:top;word-break:break-word}\
  25. td:first-child{text-align:right}a{display:block;margin-top:.3em}\
  26. a:nth-child(2n){background:#dde}\
  27. </style></head><body>' + t.outerHTML + '</body></html';
  28.   open(URL.createObjectURL(new Blob([t], {type: "text/html"})));
  29. })()
  30.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement