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()
|
2023-03-09 06:00:35 -06:00
|
|
|
let url = document.getElementById("txtUrl").value
|
2023-03-09 08:03:50 -06:00
|
|
|
if (url.includes("youtube.com") || url.includes("youtu.be")) {
|
|
|
|
url = url.replaceAll("youtube.com", "yewtu.be")
|
|
|
|
url = url.replaceAll("youtu.be", "yewtu.be")
|
2023-03-09 08:18:28 -06:00
|
|
|
} else if (url.includes("google.com/?q")) {
|
|
|
|
url = url.replaceAll("google.com/?q", "startpage.com/?q")
|
2023-03-09 08:27:36 -06:00
|
|
|
} else if (url.includes("https://news.google.com")) {
|
|
|
|
url = url.replaceAll("https://news.google.com", "http://68k.news")
|
|
|
|
} else if (url.includes("news.google.com")) {
|
|
|
|
url = url.replaceAll("news.google.com", "68k.news")
|
2024-05-26 09:14:45 -05:00
|
|
|
} else if (url.includes("google.com") && !url.includes("maps") && !url.includes("news") && !url.includes("webstore") && !url.includes("mail")) {
|
|
|
|
url = url.replaceAll("google.com", "startpage.com")
|
2023-03-09 08:03:50 -06:00
|
|
|
}
|
2023-03-09 06:00:35 -06:00
|
|
|
document.getElementById("txtUrl").value = ""
|
|
|
|
browserFrame.loadURL(url);
|
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)
|
|
|
|
})
|
2023-03-09 04:04:28 -06:00
|
|
|
for (let i = 0; i < userscripts.length; i++) {
|
2023-03-09 05:25:24 -06:00
|
|
|
fetch(userscripts[i]).then( r => r.text() ).then( t => userscripts.executeJavaScript(t)).catch(() => {
|
|
|
|
console.log("Error loading userscripts! (Did you provide any?)")
|
2023-03-02 18:20:58 -06:00
|
|
|
})
|
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
|
|
|
}
|
2023-03-09 08:03:50 -06:00
|
|
|
|