Skip to content

Commit

Permalink
clean up extension
Browse files Browse the repository at this point in the history
Signed-off-by: zFernand0 <[email protected]>
  • Loading branch information
zFernand0 committed Aug 1, 2024
1 parent da9558e commit efca6ce
Show file tree
Hide file tree
Showing 15 changed files with 71 additions and 216 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
**/.DS_Store
npm-debug.log
node_modules/
dist/
Expand Down
Binary file removed public/icon.png
Binary file not shown.
35 changes: 0 additions & 35 deletions public/manifest.json

This file was deleted.

12 changes: 0 additions & 12 deletions public/options.html

This file was deleted.

13 changes: 0 additions & 13 deletions public/popup.html

This file was deleted.

6 changes: 0 additions & 6 deletions src/background.ts

This file was deleted.

25 changes: 25 additions & 0 deletions src/content.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// Function to create the copy button
function createCopyButton() {
const button = document.createElement('button');
button.innerText = 'Copy to Clipboard';
button.id = 'copy-to-clipboard-button';
button.style.position = 'fixed';
button.style.bottom = '10px';
button.style.right = '10px';
button.style.zIndex = '1000';
button.addEventListener('click', copyToClipboard);
document.body.appendChild(button);
}

// Function to copy the current PR URL to the clipboard
function copyToClipboard() {
const url = window.location.href;
navigator.clipboard.writeText(url).then(() => {
alert('URL copied to clipboard!');
}).catch(err => {
console.error('Failed to copy: ', err);
});
}

// Run the function to create the button
createCopyButton();
9 changes: 0 additions & 9 deletions src/content_script.tsx

This file was deleted.

13 changes: 13 additions & 0 deletions src/css/content.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#copy-to-clipboard-button {
background-color: #2ea44f;
color: white;
border: none;
padding: 10px 20px;
border-radius: 5px;
cursor: pointer;
font-size: 16px;
}

#copy-to-clipboard-button:hover {
background-color: #218c3c;
}
22 changes: 22 additions & 0 deletions src/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"manifest_version": 3,

"name": "Copy-to-clipboard for GiHub Pull Requests",
"description": "Copy-to-clipboard for GiHub Pull Requests",
"version": "1.0",

"icons": {
"256": "res/icon.png"
},

"content_scripts": [
{
"matches": ["https://github.com/*/pull/*"],
"js": ["content.js"],
"css": ["css/content.css"]
}
],
"permissions": [
"activeTab", "scripting"
]
}
77 changes: 0 additions & 77 deletions src/options.tsx

This file was deleted.

58 changes: 0 additions & 58 deletions src/popup.tsx

This file was deleted.

3 changes: 3 additions & 0 deletions src/res/copy.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/res/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 7 additions & 6 deletions webpack/webpack.common.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,10 @@ const srcDir = path.join(__dirname, "..", "src");

module.exports = {
entry: {
popup: path.join(srcDir, 'popup.tsx'),
options: path.join(srcDir, 'options.tsx'),
background: path.join(srcDir, 'background.ts'),
content_script: path.join(srcDir, 'content_script.tsx'),
content: path.join(srcDir, 'content.ts'),
},
output: {
path: path.join(__dirname, "../dist/js"),
path: path.join(__dirname, "../dist"),
filename: "[name].js",
},
optimization: {
Expand All @@ -36,7 +33,11 @@ module.exports = {
},
plugins: [
new CopyPlugin({
patterns: [{ from: ".", to: "../", context: "public" }],
patterns: [
{ from: "src/css", to: "./css", },
{ from: "src/res", to: "./res", },
{ from: "src/manifest.json", to: ".", },
],
options: {},
}),
],
Expand Down

0 comments on commit efca6ce

Please sign in to comment.