sneedium/libbrowz.js

36 lines
1.1 KiB
JavaScript
Raw Normal View History

2023-03-02 17:26:33 -06:00
let tabGroup = document.querySelector("tab-group");
function go() {
let browserFrame = tabGroup.getActiveTab().webview
browserFrame.loadURL(document.getElementById("txtUrl").value);
browserFrame.addEventListener("page-title-updated", (titleEvent) => {
let title = browserFrame.getTitle()
tabGroup.getActiveTab().setTitle(title)
console.log(title)
})
document.getElementById("txtUrl").value = ""
for (let i = 0; i < extensions.length; i++) {
2023-03-02 18:20:58 -06:00
fetch(extensions[i]).then( r => r.text() ).then( t => browserFrame.executeJavaScript(t)).catch(() => {
console.log("Error loading extensions! (Did you provide any?)")
})
2023-03-02 17:26:33 -06:00
}
}
function back() {
let browserFrame = tabGroup.getActiveTab().webview
browserFrame.goBack()
}
function forward() {
let browserFrame = tabGroup.getActiveTab().webview
browserFrame.goForward()
}
tabGroup.setDefaultTab({
title: CONF.homepageTitle,
src: CONF.homepage,
active: true
});
tabGroup.addTab()
function clickPress(keyEvent) {
if (keyEvent.keyCode == 13) {
go()
}
2023-03-03 08:30:52 -06:00
}