Add home history button

This commit is contained in:
Alice Gaudon 2020-05-19 05:56:28 +02:00
parent 63229428ca
commit 13173334bf
3 changed files with 15 additions and 3 deletions

View File

@ -18,6 +18,7 @@
<body>
<div id="navigation">
<div id="history">
<button id="home"><i class="fas fa-home"></i></button>
<button id="back"><i class="fas fa-arrow-left"></i></button>
<button id="forward" class="disabled"><i class="fas fa-arrow-right"></i></button>
</div>

View File

@ -16,6 +16,7 @@ const icons = [];
let services = [];
let selectedService = null;
let homeButton;
let forwardButton;
let backButton;
let addButton;
@ -365,13 +366,16 @@ function reorderService(serviceId, targetId) {
}
document.addEventListener('DOMContentLoaded', () => {
forwardButton = document.querySelector('#forward');
homeButton = document.getElementById('home');
homeButton.addEventListener('click', () => goHome());
forwardButton = document.getElementById('forward');
forwardButton.addEventListener('click', () => goForward());
backButton = document.querySelector('#back');
backButton = document.getElementById('back');
backButton.addEventListener('click', () => goBack());
addButton = document.querySelector('#add-button');
addButton = document.getElementById('add-button');
addButton.addEventListener('click', () => ipcRenderer.send('openServiceSettings', null));
});
@ -607,6 +611,12 @@ function updateWindowTitle() {
}
}
function goHome() {
let service = services[selectedService];
service.view.loadURL(service.url)
.catch(console.error);
}
function goForward() {
let view = services[selectedService].view;
if (view) remote.webContents.fromId(view.getWebContentsId()).goForward();

View File

@ -150,6 +150,7 @@ body {
display: inline;
width: 24px;
height: 24px;
margin: 2px;
padding: initial;
font-size: 12px;