Add GoatCounter count.js component (as goat.js), MIT license logo
All checks were successful
Build And Deploy / build-and-deploy (push) Successful in 5m19s
All checks were successful
Build And Deploy / build-and-deploy (push) Successful in 5m19s
(mit.svg), and htmz assets (htmz.js and htmz.dev.js). Add LICENSE file containing this project's MIT license and 3rd-party component licenses.
This commit is contained in:
parent
89c369d1cc
commit
2548a84e0b
7 changed files with 437 additions and 30 deletions
29
public/htmz.dev.js
Normal file
29
public/htmz.dev.js
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
function htmz(frame) {
|
||||
// -------------------------------->1------------------------------------
|
||||
// No history
|
||||
// ----------------------------------------------------------------------
|
||||
// This clears the iframe's history from the global history
|
||||
// by removing the iframe from the DOM (but immediately adding it back
|
||||
// for subsequent requests).
|
||||
// ---------------------------------1<-----------------------------------
|
||||
// -------------------------------->2-----------------------------------
|
||||
// Repeat GETs
|
||||
// ----------------------------------------------------------------------
|
||||
// This clears the iframe URL for a fresh start on next load.
|
||||
// ---------------------------------2<-----------------------------------
|
||||
// ------------------------------->1&2-----------------------------------
|
||||
if (frame.contentWindow.location.href === "about:blank") return;
|
||||
// --------------------------------1&2<----------------------------------
|
||||
setTimeout(() => {
|
||||
document
|
||||
.querySelector(frame.contentWindow.location.hash || null)
|
||||
?.replaceWith(...frame.contentDocument.body.childNodes);
|
||||
// ---------------------------------2<-----------------------------------
|
||||
frame.contentWindow.location.replace("about:blank");
|
||||
// -------------------------------->2------------------------------------
|
||||
// ---------------------------------1<-----------------------------------
|
||||
frame.remove();
|
||||
document.body.appendChild(frame);
|
||||
// -------------------------------->1------------------------------------
|
||||
});
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue