Skip to content

Commit

Permalink
Merge pull request #7 from kazcfz/v1.1.2
Browse files Browse the repository at this point in the history
V1.1.2
  • Loading branch information
kazcfz authored Mar 19, 2024
2 parents a290cec + 6811388 commit 220f65e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
8 changes: 5 additions & 3 deletions content.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@ let clientY = 0;

function afterDOMLoaded(){
// Prep all input file elements
const fileInputs = document.querySelectorAll("input[type='file']");
fileInputs.forEach(input => input.addEventListener('click', handleFileInputClick));
document.addEventListener("click", event => {
if (event.target.id != "cnp-overlay-file-input" && event.target.tagName.toLowerCase() === "input" && event.target.type === "file")
event.target.addEventListener("click", handleFileInputClick);
}, true);

// Find and prep customized input file elements
const observer = new MutationObserver(mutations => {
Expand Down Expand Up @@ -42,6 +44,7 @@ function afterDOMLoaded(){
// When prepped input elements are clicked
function handleFileInputClick(event) {
event.preventDefault();
event.stopPropagation();
const originalInput = event.target;

// Create overlay
Expand Down Expand Up @@ -116,7 +119,6 @@ function handleFileInputClick(event) {
const imagePreview = overlay.querySelector('#cnp-image-container');
let noImg = overlay.querySelector('#cnp-not-image');
navigator.clipboard.read().then(clipboardItems => {
console.log(clipboardItems)
clipboardItems.forEach(clipboardItem => {
clipboardItem['types'].forEach(clipboardItemType => {

Expand Down
4 changes: 2 additions & 2 deletions manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"manifest_version": 3,
"name": "Copy-n-Paste: Image Upload Simplified",
"version": "1.1.1",
"version": "1.1.2",
"description": "Easily upload screenshots and images from your clipboard to webpages.",
"action": {},
"icons": {
Expand All @@ -15,7 +15,7 @@
"content_scripts": [
{
"matches": ["<all_urls>"],
"exclude_matches": ["*://steamcommunity.com/id/*"],
"exclude_matches": ["*://steamcommunity.com/id/*", "*://web.whatsapp.com/*"],
"js": ["content.js"]
}
],
Expand Down

0 comments on commit 220f65e

Please sign in to comment.