Skip to content

Commit

Permalink
lint versions and imgtitle
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex313031 committed Feb 20, 2024
1 parent 415aeaf commit 9967aa4
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 10 deletions.
1 change: 0 additions & 1 deletion source/browser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ async function withSettingsMenu(callback: () => Promise<void> | void): Promise<v
await withMenu(settingsMenu as HTMLElement, callback);
}


async function selectMenuItem(itemNumber: number): Promise<void> {
let selector;

Expand Down
11 changes: 6 additions & 5 deletions source/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,18 +107,19 @@ electronContextMenu({
// Only show it when right-clicking an image
visible: parameters.mediaType === 'image',
click: () => {
const imgURL = parameters.srcURL;
const imgTitle = imgURL.substring(imgURL.lastIndexOf('/') + 1);
const imgWin = new BrowserWindow({
title: 'New Window',
title: imgTitle,
useContentSize: true,
darkTheme: darkMode.isEnabled,
webPreferences: {
nodeIntegration: false,
nodeIntegrationInWorker: false,
experimentalFeatures: true,
devTools: true,
},
},
});
const imgURL = parameters.srcURL;
imgWin.loadURL(imgURL);
},
},
Expand All @@ -127,8 +128,8 @@ electronContextMenu({
// Only show it when right-clicking video
visible: parameters.mediaType === 'video',
click: () => {
const vidURL = parameters.srcURL;
const vidTitle = vidURL.substring(vidURL.lastIndexOf('/') + 1);
const vidURL = parameters.srcURL;
const vidTitle = vidURL.substring(vidURL.lastIndexOf('/') + 1);
const vidWin = new BrowserWindow({
title: vidTitle,
width: 1024,
Expand Down
2 changes: 1 addition & 1 deletion source/menu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -750,7 +750,7 @@ ${debugInfo()}`;
click() {
const verWindow = new BrowserWindow({
width: 280,
height: 174,
height: 190,
useContentSize: true,
autoHideMenuBar: true,
maximizable: false,
Expand Down
21 changes: 20 additions & 1 deletion static/preload.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
const Os = require('os');
const remote = require('@electron/remote');

// Globally export what OS we are on
const isLinux = process.platform === 'linux';
const isWin = process.platform === 'win32';
const isMac = process.platform === 'darwin';

// Show version numbers of bundled Electron.
window.addEventListener('DOMContentLoaded', () => {
const replaceText = (selector, text) => {
Expand All @@ -14,12 +20,25 @@ window.addEventListener('DOMContentLoaded', () => {
// Get app version from package.json
const appVersion = remote.app.getVersion();

let osType;
if (isLinux) {
osType = 'Linux';
} else if (isWin) {
osType = 'Win';
} else if (isMac) {
osType = 'MacOS';
} else {
osType = 'BSD';
}
const archType = Os.arch();

// Show app version in about.html
window.addEventListener('DOMContentLoaded', () => {
const replaceText = (selector, text) => {
const element = document.getElementById(selector);
if (element) element.innerText = text
};

replaceText('caprine-version', appVersion);
replaceText('os-type', osType);
replaceText('arch-type', archType);
});
13 changes: 11 additions & 2 deletions static/versions.html
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,17 @@
</head>
<body>
<p>
Caprine:&nbsp;v<span class="ver" id="caprine-version"></span><br>
<a href="https://www.electronjs.org/" target="_blank" rel="noopener">Electron</a>:&nbsp;<span class="ver" id="electron-version"></span><br><a href="https://www.chromium.org/" target="_blank" rel="noopener">Chromium</a>:&nbsp;<span class="ver" id="chrome-version"></span><br><a href="https://nodejs.org/" target="_blank" rel="noopener">Node.js</a>:&nbsp;<span class="ver" id="node-version"></span><br><a href="https://v8.dev/" target="_blank" rel="noopener">V8</a>:&nbsp;<span class="ver" id="v8-version"></span>
<u>Caprine</u>:&nbsp;v<span class="ver" id="caprine-version"></span>
<br>
<a href="https://www.electronjs.org/" target="_blank" rel="noopener">Electron</a>:&nbsp;<span class="ver" id="electron-version"></span>
<br>
<a href="https://www.chromium.org/" target="_blank" rel="noopener">Chromium</a>:&nbsp;<span class="ver" id="chrome-version"></span>
<br>
<a href="https://nodejs.org/" target="_blank" rel="noopener">Node.js</a>:&nbsp;<span class="ver" id="node-version"></span>
<br>
<a href="https://v8.dev/" target="_blank" rel="noopener">V8</a>:&nbsp;<span class="ver" id="v8-version"></span>
<br>
<span title="OS Type"><u>OS Type</u>:&nbsp;<span class="ver" id="os-type"></span>&nbsp;<span class="ver" id="arch-type"></span></span>
</p>
<p>
<small>Copyright © 2024 by <a href="https://github.com/Alex313031" target="_blank" rel="noopener">Alex313031</a></small>
Expand Down

0 comments on commit 9967aa4

Please sign in to comment.