mirror of
https://github.com/ION606/browser-chromium.git
synced 2026-05-14 22:26:56 +00:00
backup
This commit is contained in:
+11
-3
@@ -3,7 +3,8 @@ import { findPath } from "../utils/paths.js";
|
||||
|
||||
|
||||
import fs from 'fs';
|
||||
const youtube = fs.readFileSync(await findPath('youtubeutils.js'));
|
||||
const youtube = fs.readFileSync(await findPath('youtubeutils.js')),
|
||||
contextmenu = fs.readFileSync(await findPath('contextmenu.js'));
|
||||
|
||||
/**
|
||||
* @param {Electron.WebContents} contents
|
||||
@@ -19,15 +20,22 @@ const youtubeinject = (contents) => {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param {Electron.WebContents} contents
|
||||
*/
|
||||
const contextMenuInject = (contents) => contents.executeJavaScript(contextmenu).catch(console.error);
|
||||
|
||||
|
||||
/**
|
||||
* @param {Electron.WebContents} contents
|
||||
*/
|
||||
export default async function addonManager(contents) {
|
||||
try {
|
||||
const hostname = await contents.executeJavaScript('window.location.hostname');
|
||||
contextMenuInject(contents);
|
||||
|
||||
const hostname = await contents.executeJavaScript('window.location.hostname');
|
||||
if (hostname === 'www.youtube.com') return youtubeinject(contents);
|
||||
|
||||
|
||||
return {};
|
||||
}
|
||||
catch (err) {
|
||||
|
||||
Reference in New Issue
Block a user