Skip to content

Commit

Permalink
idk
Browse files Browse the repository at this point in the history
  • Loading branch information
Alstroemerys committed Apr 8, 2023
1 parent b9d2bc7 commit 5d6e2cf
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 2 deletions.
23 changes: 23 additions & 0 deletions FirefoxExtension/image_converter.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<!DOCTYPE html>
<html lang = "en">
<head>
<header>Changing Contrast Mode</header>
</head>
<canvas id="canvas"></canvas>
<script type = "text/javascript">

var currentLocation = window.location
var imageArray = [] //to make an empty array

currentLocation.forEach(element => {
curURL = changeImage(element) // creates a new url for the altered element
changeURL(curURL) // gives the file the new url for element
});

</script>
<body>
<h1>Turn on high contrast mode?</h1>
<button onclick>Yes</button>
<button onclick>No</button>
</body>
</html>
8 changes: 6 additions & 2 deletions FirefoxExtension/image_converter.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
// script to steal the original picture and make it our own.

function changeURL(imageSrc) {
document.getElementById("img").src=imageSrc; // set the current source to the new image
}

async function changeImage (imageSrc){
const ctx = canvas.getContext('2d');
const canvas = document.getElementById('imageSrc');
const canvas = document.getElementById('canvas');

// set the canvas size to the image size
canvas.width = imageSrc.width;
Expand Down Expand Up @@ -37,5 +41,5 @@ async function changeImage (imageSrc){

// put the modified pixel data back on the canvas
ctx.putImageData(imageData, 0, 0);
return ctx

}

0 comments on commit 5d6e2cf

Please sign in to comment.