big update soon

This commit is contained in:
NodeMixaholic 2023-03-09 04:04:28 -06:00 committed by GitHub
parent f4d732a45c
commit f2221efedc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 5492 additions and 16 deletions

View file

@ -8,11 +8,18 @@
<link href="./styles.css" rel="stylesheet">
</head>
<body>
<input id="txtUrl" style="width:72%;" placeholder="Put the website here" name="url" type="text" onkeypress="clickPress(event)" />
<button onclick="go(); return false;" id="goBtn"></button> <button onclick="back(); return false;" id="backBtn">⬅️</button> <button onclick="forward(); return false;" id="forwardBtn">➡️</button>
<tab-group new-tab-button="true" sortable="true"><webview id="foo" style="width:100%; height:90vh" disablewebsecurity></webview></tab-group>
<div id="navBar">
<input id="txtUrl" placeholder="Put the website here" name="url" type="text" onkeypress="clickPress(event)" />
<button onclick="go(); return false;" id="goBtn"></button>
<button onclick="stop(); return false;" id="stopBtn">🛑</button>
<button onclick="back(); return false;" id="backBtn">⬅️</button>
<button onclick="forward(); return false;" id="forwardBtn">➡️</button>
</div>
<tab-group new-tab-button="true" sortable="true">
<webview id="foo" autosize plugins disablewebsecurity></webview>
</tab-group>
<script src="node_modules/electron-tabs/dist/electron-tabs.js"></script>
<script type="text/javascript" src="./extension/extensionList.js"></script>
<script type="text/javascript" src="./userscript/userscripts.js"></script>
<script type="text/javascript" src="./config.js"></script>
<script type="text/javascript" src="./libbrowz.js"></script>
</body>

View file

@ -8,6 +8,6 @@
</head>
<body>
<h1>Welcome to F-Stopium!</h1>
<p>Put extensions in ./extension. It uses a standard JS array format and uses URLs. Config is located at: ./config.json. Note: if you are using a pre-compiled version, these features are not available to you.</p>
<p>Put userscripts in ./userscript. It uses a standard JS array format and uses URLs. Config is located at: ./config.json. Note: if you are using a pre-compiled version, these features are not available to you.</p>
</body>
</html>

View file

@ -1,23 +1,40 @@
let tabGroup = document.querySelector("tab-group");
function go() {
let browserFrame = tabGroup.getActiveTab().webview
let browser = tabGroup.getActiveTab()
extensions.addTab(browserWindow, browserFrame)
browserFrame.loadURL(document.getElementById("txtUrl").value);
browserFrame.addEventListener('dom-ready', () => {
browserFrame.insertCSS(`
::-webkit-scrollbar {
display: none;
}
`)
})
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++) {
fetch(extensions[i]).then( r => r.text() ).then( t => browserFrame.executeJavaScript(t)).catch(() => {
for (let i = 0; i < userscripts.length; i++) {
fetch(extensions[i]).then( r => r.text() ).then( t => userscripts.executeJavaScript(t)).catch(() => {
console.log("Error loading extensions! (Did you provide any?)")
})
}
}
function stop() {
let browserFrame = tabGroup.getActiveTab().webview
browserFrame.stop()
}
function back() {
let browserFrame = tabGroup.getActiveTab().webview
browserFrame.goBack()
}
function forward() {
let browserFrame = tabGroup.getActiveTab().webview
browserFrame.goForward()
@ -29,8 +46,9 @@ tabGroup.setDefaultTab({
active: true
});
tabGroup.addTab()
function clickPress(keyEvent) {
if (keyEvent.keyCode == 13) {
go()
}
}
}

15
main.js
View file

@ -2,22 +2,26 @@
const {app, BrowserWindow, session} = require('electron')
const path = require('path')
const fetch = require("cross-fetch")
const { ElectronChromeExtensions } = require('electron-chrome-extensions')
function createWindow () {
// Create the browser window.
const mainWindow = new BrowserWindow({
width: 1094,
width: 800,
height: 600,
webPreferences: {
preload: path.join(__dirname, 'preload.js'),
webviewTag: true,
devTools: false
devTools: false,
nodeIntegration: true,
sandbox: true,
contextIsolation: true
}
})
mainWindow.removeMenu()
mainWindow.setMinimumSize(1094, 600)
mainWindow.setMinimumSize(600, 300)
const toBlock = [
@ -63,7 +67,10 @@ const toBlock = [
}
return callback({})
})
const extensions = new ElectronChromeExtensions({
session: session.defaultSession
})
extensions.addTab(mainWindow.webContents, mainWindow)
// and load the index.html of the app.
mainWindow.loadFile('index.html')

5397
package-lock.json generated Normal file

File diff suppressed because it is too large Load diff

View file

@ -22,14 +22,15 @@
"devDependencies": {
"@electron-forge/cli": "^6.0.5",
"@electron-forge/maker-deb": "^6.0.5",
"@electron-forge/maker-flatpak": "^6.0.5",
"@electron-forge/maker-rpm": "^6.0.5",
"@electron-forge/maker-squirrel": "^6.0.5",
"@electron-forge/maker-zip": "^6.0.5",
"@electron-forge/maker-flatpak": "^6.0.5",
"electron": "^23.1.3"
},
"dependencies": {
"cross-fetch": "^3.1.5",
"electron-chrome-extensions": "^3.10.0",
"electron-squirrel-startup": "^1.0.0",
"electron-tabs": "^1.0.1"
}

View file

@ -2,6 +2,26 @@
/* Add styles here to customize the appearance of your app */
html {
overflow: hidden;
}
body {
user-select: none;
margin: 0;
padding: 0;
position: fixed;
}
#navbar {
position: fixed;
top: 0;
height: 10%;
width: 100%;
padding: 0;
margin: 0;
}
#goBtn {
background-color: #4CAF50; /* Green */
border: none;
@ -14,7 +34,7 @@
}
#backBtn {
background-color: #f44336; /* Red */
background-color: #7a551d;
border: none;
color: white;
padding: 1% 1%;
@ -24,6 +44,18 @@
font-size: 1.25rem;
}
#stopBtn {
background-color: #4f1007; /* Red */
border: none;
color: white;
padding: 1% 1%;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 1.25rem;
}
#forwardBtn {
background-color: #01315e; /* Blue */
border: none;
@ -42,8 +74,21 @@
text-decoration: none;
display: inline-block;
font-size: 1.25rem;
width:72%;
}
body {
user-select: none;
html, body {
width: 100%;
height: 100%;
}
webview {
position: absolute;
top: 0;
left: 0;
max-height: 90% !important;
max-width: 100%;
width: 1rem;
height: 90% !important;
display: inline-flex !important;
}

View file

@ -0,0 +1 @@
var userscripts = [""]