lupine.web
Version:
lupine.web is a extremely fast, small size and lightweight frontend framework, using React TSX syntax.
17 lines (15 loc) • 618 B
text/typescript
import { _lupineJs } from './export-lupine';
export function bindLinks(el: Element | Document) {
const links = el.getElementsByTagName('a');
for (var i = 0, l = links.length; i < l; i++) {
let href = new URL(links[i].href, document.baseURI).href;
if (links[i].target !== '_blank' && href.startsWith(document.location.origin)) {
href = href.substring(document.location.origin.length);
// console.log(`====${href}, javascript:init('${document.links[i].href}')`);
links[i].onclick = () => {
_lupineJs.initializePage(href);
return false;
};
}
}
}