Merge branch 'develop'
This commit is contained in:
commit
573a87b296
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "tabs",
|
"name": "tabs",
|
||||||
"version": "0.4.1",
|
"version": "0.5.0",
|
||||||
"description": "Persistent and separate browser tabs in one window",
|
"description": "Persistent and separate browser tabs in one window",
|
||||||
"author": {
|
"author": {
|
||||||
"name": "Alice Gaudon",
|
"name": "Alice Gaudon",
|
||||||
@ -9,7 +9,6 @@
|
|||||||
"homepage": "https://gitlab.com/ArisuOngaku/tabs",
|
"homepage": "https://gitlab.com/ArisuOngaku/tabs",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"main": "tabs.js",
|
"main": "tabs.js",
|
||||||
"type": "module",
|
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "electron .",
|
"start": "electron .",
|
||||||
"dev": "electron . --dev",
|
"dev": "electron . --dev",
|
||||||
@ -24,7 +23,7 @@
|
|||||||
"single-instance": "^0.0.1"
|
"single-instance": "^0.0.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"electron": "^6.0.10",
|
"electron": "^8.0.1",
|
||||||
"electron-builder": "^21.2.0"
|
"electron-builder": "^21.2.0"
|
||||||
},
|
},
|
||||||
"build": {
|
"build": {
|
||||||
|
11
resources/empty.html
Normal file
11
resources/empty.html
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<title>Loading...</title>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<p>Loading...</p>
|
||||||
|
</body>
|
||||||
|
</html>
|
@ -16,6 +16,7 @@ let selectedService = null;
|
|||||||
let forwardButton;
|
let forwardButton;
|
||||||
let backButton;
|
let backButton;
|
||||||
let addButton;
|
let addButton;
|
||||||
|
let emptyPage;
|
||||||
|
|
||||||
|
|
||||||
// Service context menu
|
// Service context menu
|
||||||
@ -69,7 +70,7 @@ function openServiceContextMenu(event, serviceId) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ipcRenderer.on('data', (event, appData, brandIcons, solidIcons, actualServices, actualSelectedService) => {
|
ipcRenderer.on('data', (event, appData, brandIcons, solidIcons, actualServices, actualSelectedService, emptyUrl) => {
|
||||||
// App info
|
// App info
|
||||||
appInfo.title = appData.title;
|
appInfo.title = appData.title;
|
||||||
|
|
||||||
@ -113,6 +114,9 @@ ipcRenderer.on('data', (event, appData, brandIcons, solidIcons, actualServices,
|
|||||||
actualSelectedService = 0;
|
actualSelectedService = 0;
|
||||||
}
|
}
|
||||||
setActiveService(actualSelectedService);
|
setActiveService(actualSelectedService);
|
||||||
|
|
||||||
|
// Empty
|
||||||
|
emptyPage = emptyUrl;
|
||||||
});
|
});
|
||||||
|
|
||||||
ipcRenderer.on('updateService', (e, id, data) => {
|
ipcRenderer.on('updateService', (e, id, data) => {
|
||||||
@ -331,16 +335,20 @@ function loadService(serviceId, service) {
|
|||||||
|
|
||||||
document.querySelector('#services > .loader').classList.remove('hidden');
|
document.querySelector('#services > .loader').classList.remove('hidden');
|
||||||
service.view = document.createElement('webview');
|
service.view = document.createElement('webview');
|
||||||
service.view.setAttribute('src', service.url);
|
|
||||||
service.view.setAttribute('partition', 'persist:service_' + service.partition);
|
service.view.setAttribute('partition', 'persist:service_' + service.partition);
|
||||||
service.view.setAttribute('autosize', 'true');
|
service.view.setAttribute('autosize', 'true');
|
||||||
service.view.setAttribute('preload', 'js/service-webview.js');
|
service.view.setAttribute('preload', 'js/service-webview.js');
|
||||||
|
service.view.setAttribute('src', emptyPage);
|
||||||
|
|
||||||
// Append element to DOM
|
// Append element to DOM
|
||||||
document.querySelector('#services').appendChild(service.view);
|
document.querySelector('#services').appendChild(service.view);
|
||||||
|
|
||||||
// On load event
|
// Load chain
|
||||||
service.view.addEventListener('dom-ready', () => {
|
let listener;
|
||||||
|
service.view.addEventListener('dom-ready', listener = () => {
|
||||||
|
service.view.removeEventListener('dom-ready', listener);
|
||||||
|
|
||||||
|
service.view.addEventListener('dom-ready', listener = () => {
|
||||||
if (service.customCSS) {
|
if (service.customCSS) {
|
||||||
service.view.insertCSS(service.customCSS);
|
service.view.insertCSS(service.customCSS);
|
||||||
}
|
}
|
||||||
@ -356,6 +364,13 @@ function loadService(serviceId, service) {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (typeof service.customUserAgent === 'string') {
|
||||||
|
let webContents = remote.webContents.fromId(service.view.getWebContentsId());
|
||||||
|
webContents.setUserAgent(service.customUserAgent);
|
||||||
|
}
|
||||||
|
service.view.setAttribute('src', service.url);
|
||||||
|
});
|
||||||
|
|
||||||
// Load favicon
|
// Load favicon
|
||||||
service.view.addEventListener('page-favicon-updated', event => {
|
service.view.addEventListener('page-favicon-updated', event => {
|
||||||
console.debug('Loaded favicons for', service.name, event.favicons);
|
console.debug('Loaded favicons for', service.name, event.favicons);
|
||||||
@ -440,16 +455,16 @@ function updateWindowTitle() {
|
|||||||
if (selectedService === null) {
|
if (selectedService === null) {
|
||||||
ipcRenderer.send('updateWindowTitle', null);
|
ipcRenderer.send('updateWindowTitle', null);
|
||||||
} else if (services[selectedService].viewReady) {
|
} else if (services[selectedService].viewReady) {
|
||||||
ipcRenderer.send('updateWindowTitle', selectedService, services[selectedService].view.getWebContents().getTitle());
|
ipcRenderer.send('updateWindowTitle', selectedService, remote.webContents.fromId(services[selectedService].view.getWebContentsId()).getTitle());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function goForward() {
|
function goForward() {
|
||||||
let view = services[selectedService].view;
|
let view = services[selectedService].view;
|
||||||
if (view) view.getWebContents().goForward();
|
if (view) remote.webContents.fromId(view.getWebContentsId()).goForward();
|
||||||
}
|
}
|
||||||
|
|
||||||
function goBack() {
|
function goBack() {
|
||||||
let view = services[selectedService].view;
|
let view = services[selectedService].view;
|
||||||
if (view) view.getWebContents().goBack();
|
if (view) remote.webContents.fromId(view.getWebContentsId()).goBack();
|
||||||
}
|
}
|
@ -47,6 +47,10 @@ document.addEventListener('DOMContentLoaded', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
ipcRenderer.send('sync-settings');
|
ipcRenderer.send('sync-settings');
|
||||||
|
|
||||||
|
document.getElementById('userAgentAutoFill').addEventListener('click', () => {
|
||||||
|
document.getElementById('custom-user-agent').value = 'Mozilla/5.0 (X11; Linux x86_64; rv:73.0) Gecko/20100101 Firefox/73.0';
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
function updateIconSearchResults() {
|
function updateIconSearchResults() {
|
||||||
@ -120,6 +124,7 @@ function loadServiceValues() {
|
|||||||
document.getElementById('use-favicon').checked = service.useFavicon;
|
document.getElementById('use-favicon').checked = service.useFavicon;
|
||||||
document.getElementById('auto-load').checked = service.autoLoad;
|
document.getElementById('auto-load').checked = service.autoLoad;
|
||||||
document.getElementById('custom-css').value = service.customCSS;
|
document.getElementById('custom-css').value = service.customCSS;
|
||||||
|
document.getElementById('custom-user-agent').value = service.customUserAgent;
|
||||||
|
|
||||||
isImageCheckbox.checked = service.isImage;
|
isImageCheckbox.checked = service.isImage;
|
||||||
if (service.isImage) {
|
if (service.isImage) {
|
||||||
@ -148,6 +153,8 @@ function save() {
|
|||||||
service.autoLoad = formData.get('autoLoad') === 'on';
|
service.autoLoad = formData.get('autoLoad') === 'on';
|
||||||
service.customCSS = formData.get('customCSS');
|
service.customCSS = formData.get('customCSS');
|
||||||
|
|
||||||
|
let customUserAgent = formData.get('customUserAgent').trim();
|
||||||
|
service.customUserAgent = customUserAgent.length === 0 ? null : customUserAgent;
|
||||||
|
|
||||||
if (!isValid()) {
|
if (!isValid()) {
|
||||||
return;
|
return;
|
||||||
|
@ -40,6 +40,12 @@
|
|||||||
<textarea name="customCSS" id="custom-css" rows="3"></textarea>
|
<textarea name="customCSS" id="custom-css" rows="3"></textarea>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="custom-user-agent">Custom UserAgent (i.e. google services)</label>
|
||||||
|
<input type="text" name="customUserAgent" id="custom-user-agent">
|
||||||
|
<button type="button" id="userAgentAutoFill">Auto-fill</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div id="icon-choice">
|
<div id="icon-choice">
|
||||||
<div class="form-group-header">
|
<div class="form-group-header">
|
||||||
<h2>Service icon</h2>
|
<h2>Service icon</h2>
|
||||||
|
@ -34,17 +34,20 @@ body {
|
|||||||
|
|
||||||
background-color: rgb(43, 43, 43);
|
background-color: rgb(43, 43, 43);
|
||||||
}
|
}
|
||||||
|
|
||||||
#service-selector .drag-target button::after {
|
#service-selector .drag-target button::after {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
left: 0;
|
left: 0;
|
||||||
top: 0;
|
top: 0;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
#service-last-drag-position:not(.hidden):not(.drag-target) {
|
#service-last-drag-position:not(.hidden):not(.drag-target) {
|
||||||
display: block;
|
display: block;
|
||||||
padding: 16px 4px;
|
padding: 16px 4px;
|
||||||
background-color: #fff5;
|
background-color: #fff5;
|
||||||
}
|
}
|
||||||
|
|
||||||
#service-last-drag-position:not(.drag-target)::after {
|
#service-last-drag-position:not(.drag-target)::after {
|
||||||
content: "";
|
content: "";
|
||||||
display: block;
|
display: block;
|
||||||
|
@ -70,7 +70,7 @@ form {
|
|||||||
display: grid;
|
display: grid;
|
||||||
|
|
||||||
margin: 8px;
|
margin: 8px;
|
||||||
grid-template-columns: 0fr auto;
|
grid-template-columns: 0fr auto 0fr;
|
||||||
}
|
}
|
||||||
|
|
||||||
.form-group > * {
|
.form-group > * {
|
||||||
@ -80,11 +80,11 @@ form {
|
|||||||
align-self: center;
|
align-self: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.form-group > :nth-child(1) {
|
.form-group > :first-child {
|
||||||
justify-self: end;
|
justify-self: end;
|
||||||
}
|
}
|
||||||
|
|
||||||
.form-group > :nth-child(2) {
|
.form-group > :not(:first-child) {
|
||||||
margin-left: 8px;
|
margin-left: 8px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,6 +35,7 @@ Service.requiredProperties = {
|
|||||||
'useFavicon': true,
|
'useFavicon': true,
|
||||||
'autoLoad': false,
|
'autoLoad': false,
|
||||||
'customCSS': null,
|
'customCSS': null,
|
||||||
|
'customUserAgent': null,
|
||||||
};
|
};
|
||||||
|
|
||||||
export default Service;
|
export default Service;
|
@ -194,7 +194,7 @@ function createWindow() {
|
|||||||
|
|
||||||
function sendData() {
|
function sendData() {
|
||||||
console.log('Syncing data');
|
console.log('Syncing data');
|
||||||
window.webContents.send('data', Meta.title, brandIcons, solidIcons, config.services, selectedService);
|
window.webContents.send('data', Meta.title, brandIcons, solidIcons, config.services, selectedService, path.resolve(resourcesDir, 'empty.html'));
|
||||||
}
|
}
|
||||||
|
|
||||||
function setActiveService(index) {
|
function setActiveService(index) {
|
||||||
|
Loading…
Reference in New Issue
Block a user