-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- add a prettier configuration file - add a basic tsconfig to appease the typechecker - added @types - ran prettier on the files - checked and confirmed that the builds worked
- Loading branch information
Showing
9 changed files
with
93 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"trailingComma": "es5", | ||
"tabWidth": 2, | ||
"semi": false, | ||
"singleQuote": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,14 @@ | ||
async function getTab() { | ||
const queryOptions = { active: true, currentWindow: true }; | ||
const [firstTab] = await chrome.tabs.query(queryOptions); | ||
return firstTab; | ||
const queryOptions = { active: true, currentWindow: true } | ||
const [firstTab] = await chrome.tabs.query(queryOptions) | ||
return firstTab | ||
} | ||
|
||
chrome.tabs.onUpdated.addListener(function () { | ||
getTab().then((tab) => { | ||
console.log({ tab }); | ||
chrome.scripting.executeScript({ | ||
target: { tabId: tab.id, allFrames: true }, | ||
file: ["contentScripts/index.tsx"], | ||
}); | ||
}); | ||
}); | ||
files: ['contentScripts/index.tsx'], | ||
}) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,42 @@ | ||
import browser from "webextension-polyfill"; | ||
import browser from 'webextension-polyfill' | ||
|
||
interface CustomWindow extends Window { | ||
Run: boolean; | ||
Run: boolean | ||
} | ||
|
||
declare let window: CustomWindow; | ||
|
||
(function () { | ||
declare let window: CustomWindow | ||
;(function () { | ||
if (window.Run) { | ||
return; | ||
return | ||
} | ||
window.Run = true; | ||
window.Run = true | ||
|
||
browser.runtime.onMessage.addListener(({ command }) => { | ||
let url: string | null; | ||
let url: string | null | ||
|
||
switch (command) { | ||
case "swap-with-cats": | ||
case 'swap-with-cats': | ||
url = browser.runtime.getURL( | ||
"./up_/assets/nine-koepfer-lpgAlv8I7V8-unsplash.jpg" | ||
); | ||
break; | ||
'./up_/assets/nine-koepfer-lpgAlv8I7V8-unsplash.jpg' | ||
) | ||
break | ||
|
||
case "swap-with-dogs": | ||
case 'swap-with-dogs': | ||
url = browser.runtime.getURL( | ||
"./up_/assets/ben-michel-Uyn3kXAaZX8-unsplash.jpg" | ||
); | ||
break; | ||
'./up_/assets/ben-michel-Uyn3kXAaZX8-unsplash.jpg' | ||
) | ||
break | ||
|
||
default: | ||
url = null; | ||
return; | ||
url = null | ||
return | ||
} | ||
|
||
if (url) { | ||
var images = document.getElementsByTagName("img"); | ||
var images = document.getElementsByTagName('img') | ||
for (var i = 0; i < images.length; i++) { | ||
console.log("swapping with image: ", url); | ||
images[i].src = url; | ||
images[i].src = url | ||
} | ||
} | ||
}); | ||
})(); | ||
}) | ||
})() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
import { createRoot } from "react-dom/client"; | ||
import { Popup } from "./Popup"; | ||
import { createRoot } from 'react-dom/client' | ||
import { Popup } from './Popup' | ||
|
||
const container = document.getElementById("root"); | ||
const root = createRoot(container); // createRoot(container!) if you use TypeScript | ||
root.render(<Popup />); | ||
const container = document.getElementById('root') | ||
const root = createRoot(container) // createRoot(container!) if you use TypeScript | ||
root.render(<Popup />) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"compilerOptions": { | ||
"jsx": "react-jsx", | ||
"esModuleInterop": true | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters