+ ${video.account.host} +
: + +`); +} + +function removeVideoLink() { + const existingLink = document.getElementById(LINK_ID); + existingLink && existingLink.remove(); +} + +function ready(fn) { + if (document.attachEvent ? document.readyState === "complete" : document.readyState !== "loading") { + fn(); + } else { + document.addEventListener('DOMContentLoaded', fn); + } +} diff --git a/webpack.config.js b/webpack.config.js new file mode 100644 index 0000000..56ba2b4 --- /dev/null +++ b/webpack.config.js @@ -0,0 +1,31 @@ +const path = require('path'); +const webpack = require('webpack'); + +module.exports = { + entry: { + background: 'background.js', + youtube: 'youtube.js', + }, + output: { + path: path.join(__dirname, 'extension', 'dist'), + filename: '[name].js', + }, + resolve: { + // This allows you to import modules just like you would in a NodeJS app. + extensions: ['.js'], + modules: [ + path.join(__dirname, 'src'), + 'node_modules', + ], + }, + plugins: [ + // Since some NodeJS modules expect to be running in Node, it is helpful + // to set this environment var to avoid reference errors. + new webpack.DefinePlugin({ + 'process.env.NODE_ENV': JSON.stringify('production'), + }), + ], + // This will expose source map files so that errors will point to your + // original source files instead of the transpiled files. + devtool: 'sourcemap', +}; diff --git a/youtube.js b/youtube.js deleted file mode 100644 index 319dc36..0000000 --- a/youtube.js +++ /dev/null @@ -1,46 +0,0 @@ -/* This file is part of PeerTubeify. - * - * PeerTubeify is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * PeerTubeify is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with PeerTubeify. If not, see- ${video.account.host} -
: - -`); -}