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