Skip to content

Commit

Permalink
Version 2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
rberenguel committed Nov 24, 2024
1 parent 21e997e commit 45de35c
Show file tree
Hide file tree
Showing 83 changed files with 324 additions and 142 deletions.
78 changes: 40 additions & 38 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@

An extension to take and annotate screenshots.

It can also be used in a standalone way by visiting https://www.mostlymaths.net/goita/ To annotate an image you have in your clipboard, press `q`, otherwise you can paste pieces of images using `v` [NOTE: this is broken in Safari due to some clipboard permission issue]. Depending on the browser you may need to click "paste", or accept some clipboard access permissions. All images and text are processed locally, no data is sent anywhere.
It can also be used in a standalone way by visiting https://www.mostlymaths.net/goita/ To annotate an image you have in your clipboard, press `q`, otherwise you can paste pieces of images using `v` [NOTE: this is broken in Safari due to some clipboard permission issue]. Depending on the browser you may need to click "paste", or accept some clipboard access permissions. Use `m` to have fun with memes.

All images and text are processed locally, no data is sent anywhere.

## Demo video

Expand All @@ -31,43 +33,43 @@ Also, two features I have wanted for a while:

2. In addition to an image, **it can export the screenshot as a `data:base64` encoded URL**, where the image is clickable (combines with point 1). I can't embed an example in a README (github seems to throw such a long URL away) but you can find it in [`media/data-url-example`](https://raw.githubusercontent.com/rberenguel/goita/refs/heads/gh-pages/media/data-url-example), copy that blob of text in the URL of your browser (tested in Chrome and Safari) and you should see a screenshot as the one above, clickable.

## Annotation features

For all these, creation and deletion (click the element and press backspace) should be possible.

- [x] Choose color: press `c` and then one of:
- `r`: Red (this is the default).
- `y`: Yellow.
- `b`: Blue.
- `g`: Green.
- `w`: White.
- `x`: Redact (will use solid black in everything).
- `c`: To cancel the "choose color" mode.
- [x] Rectangles: press `r` and drag to create.
- [x] Arrows: press `a` and drag to create from source to destination.
- [x] Text: press `t` and click to place.
- [x] `Ctrl-.` and `Ctrl-,` increase and decrease the font for text, respectively.
- [x] `Ctrl + scrollwheel` over a text block increase / decrease the size of the bounding box.
- [x] `Ctrl-/` Cycle through fonts (Monoid, Reforma1969, Inter, Roboto)
- [x] Highlight: press `s` and drag to create. Use color `x` to redact. (why `s` and not `h`? Because all other shape/tool letters are on the left hand)
- [x] Redact: Use highlighting with color "redact".
- [x] Clip-on-drag the initial screenshot: press `k` at any time.
- The resulting clipped block is draggable after clicking on it to select it.
- Shift-dragging drags the clip.
- Select the clipped image and press `k` again to restore the viewframe.
- [x] Paste images from the clipboard: press `v` and then click somewhere.
- The pasted image is draggable.
- The pasted image can be deleted by pressing backspace (like any other element after selection).
- `Ctrl + scrollwheel` over a pasted image resizes it.
- [x] Paste HTML text from the clipboard: press `v` and then click somewhere.
- The pasted text is draggable.
- The pasted text is contenteditable.
- The pasted image can be deleted by pressing backspace (like any other element after selection).
- [x] Handle `text/plain`
- [x] Circles/ellipses: press `p` and drag, like a rectangle
- [x] The current mode and color (when drawing) is showed in the extension badge. Make sure to pin it.
- [x] Control font size for text (it is fixed and the same for all blocks)
- [x] Most shortcuts are quickly customizable in a single file (`shortcuts.js`)
## Features and functionality

Taken from the extension's help modal. These are the default shortcut keys.

- `a`: draw an arrow
- `r`: draw a rectangle
- `p`: draw an ellipse
- `s`: highlight an area
- `t`: write text
- `ctrl .`: Make text larger (for this text block)
- `ctrl ,`: Make text smaller (for this text block)
- `ctrl /`: Cycle through fonts (Monoid, Reforma, Inter, Roboto)
- `ctrl + scrollwheel`: Resize the text bounding box
- `ctrl + c`: Center the text
- `v`: paste images or text from the clipboard
- `ctrl + scrollwheel`: Resize the pasted image while selected
- `k`: clip the screenshot
- `drag`: dragging moves the clipped image
- `shift+drag`: dragging moves the clipping rectangle
- `q`: swap the screenshot for whatever image there is on the clipboard (or go back to the screenshot)
- `c`: choose color for the next operations
- `r`: red (default)
- `y`: yellow
- `b`: blue
- `g`: green
- `o`: orange
- `w`: white
- `x`: black (and highlight then redacts)
- `m`: enter meme selection, it will be placed on the last click and behave as a pasted image
- `type`: to dynamically search through the list of memes
- `tab`: to display meme thumbnails
- `enter`: to select the topmost meme
- `click`: on the image or name to select it
- `paste`: an external meme URL (should be valid) to use that instead
- `esc`: to dismiss
- `z`: switch between the screenshot and a white canvas (better for tweaking memes or diagrams)
- `backspace`: delete anything selected

## Installation

Expand Down
Binary file added favicon.ico
Binary file not shown.
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,6 @@
</div>
<div id="filter-text"></div>
<div id="filtered-memes"></div>
<script type="module" src="main.js"></script>
<script type="module" src="src/main.js"></script>
</body>
</html>
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"manifest_version": 3,
"name": "Goita",
"description": "Take a screenshot, add arrows and sh*t as you wish. With blackjack, and memes",
"version": "1.9.3",
"version": "2.0.0",
"permissions": [
"tabs",
"activeTab",
Expand Down
Binary file added media/favicon.ico
Binary file not shown.
Empty file added media/icon.ico
Empty file.
Binary file modified memes/always-been.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified memes/american-chopper.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified memes/ancient-aliens.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified memes/bart-chair.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified memes/batman-slapping.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified memes/batman-thinking.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified memes/be-normal.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified memes/boardroom-suggestion.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified memes/cadaver.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified memes/carbon-rod.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified memes/change-my-mind.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified memes/confused-travolta.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified memes/distracted-boyfriend.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified memes/do-today.jpg
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 memes/facepalm.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified memes/flex-tape.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified memes/go-banana.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified memes/hammocks.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified memes/harold.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified memes/homer-terminator.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified memes/i-hate-this-more.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified memes/invisible-typewriter.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified memes/is-this-a-pigeon.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified memes/khaaan.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified memes/kick-barney.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified memes/kill-it-with-fire.jpg
Binary file modified memes/left-exit-12.jpg
Binary file modified memes/make-it-so.jpg
29 changes: 23 additions & 6 deletions memes/memes.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ const memes = [
{
title: "Confused Travolta",
file: "confused-travolta.jpg",
keywords: ["confused", "travolta", "pulp fiction"],
keywords: ["confused travolta", "pulp fiction"],
},
{
title: "Homer Terminator",
file: "homer-terminator.jpg",
keywords: ["terminator", "homer", "rod tod", "simpsons"],
keywords: ["terminator homer", "rod tod", "simpsons"],
},
{
title: "Ralph: Go Banana",
Expand All @@ -29,7 +29,12 @@ const memes = [
{
title: "Ralph (Chuckles): I'm in Danger",
file: "ralph-danger.jpg",
keywords: ["ralph chuckle in danger", "ralph", "simpsons"],
keywords: [
"Ralph (Chuckles): I'm in Danger",
"ralph chuckle in danger",
"ralph",
"simpsons",
],
},
{
title: "Skinner Out of Touch",
Expand Down Expand Up @@ -310,6 +315,12 @@ const memes = [
],
},

{
title: "Picard Facepalm",
file: "facepalm.jpg",
keywords: ["Picard facepalm", "facepalm", "jean-luc picard", "star trek"],
},

{
title: "Khaaan!",
file: "khaaan.jpg",
Expand Down Expand Up @@ -416,8 +427,15 @@ const memes = [
},
];

const filterTextElement = document.getElementById("filter-text");
const filteredMemesElement = document.getElementById("filtered-memes");
const filterTextElement =
document.getElementById("filter-text") ||
document.body.appendChild(document.createElement("div"));
filterTextElement.id = "filter-text";

const filteredMemesElement =
document.getElementById("filtered-memes") ||
document.body.appendChild(document.createElement("div"));
filteredMemesElement.id = "filtered-memes";

function filterMemes(text, settings = {}) {
const lowerCaseText = text.toLowerCase();
Expand Down Expand Up @@ -452,7 +470,6 @@ function filterMemes(text, settings = {}) {
}

function displayMemes(memes, settings) {
console.log(memes);
const container = document.getElementById("meme-container");

if (container) {
Expand Down
Binary file modified memes/not-sure-if-fry.jpg
Binary file modified memes/nothing-to-see-here.jpg
Binary file modified memes/old-man-yells.jpg
Binary file modified memes/one-does-not-simply.jpg
Binary file modified memes/one-of-us.jpg
Binary file modified memes/pepe-silvia.jpg
Binary file modified memes/pingu-dont-want-to.jpg
Binary file modified memes/pingu-toot.jpg
Binary file modified memes/ptsdog.jpg
Binary file modified memes/raccoon-plan.jpg
Binary file modified memes/raccoon-praise.jpg
Binary file modified memes/ralph-danger.jpg
Binary file modified memes/say-it-bart.jpg
Binary file modified memes/shut-up-and-take-my-money.jpg
Binary file modified memes/side-eye-monkey.jpg
Binary file modified memes/skinner-idea.jpg
Binary file modified memes/smarts.jpg
Binary file modified memes/so-far.jpg
Binary file modified memes/spice-adams.jpg
Binary file modified memes/spiderman-pointing.jpg
Binary file modified memes/steamed-hams.jpg
Binary file modified memes/stop-already.jpg
Binary file modified memes/thought-police.jpg
Binary file modified memes/to-do-webcomicname-dot-com.jpg
Binary file modified memes/tom-gauld-science-hell.jpg
Binary file modified memes/two-buttons.jpg
Binary file modified memes/wink-wink.jpg
66 changes: 66 additions & 0 deletions src/help.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
export { createHelpDiv };

function createHelpDiv() {
if (document.getElementById("help")) {
return;
}

const helpDiv = document.createElement("div");
helpDiv.id = "help";
helpDiv.classList.add("hide");

helpDiv.innerHTML = `
<p style="text-align: center"><code>Goita!</code> Ruben Berenguel 2024</p>
<hr />
<ul>
<li>Everything you can create can be dragged around and deleted.</li>
<li>Click to select things.</li>
<li>Drag to move them.</li>
<li>
If you prefer other shortcuts, change them in
<code>shortcuts.js</code> (only those
<span class="u">underlined</span> are configurable).
</li>
</ul>
<p><code>h</code> show and hide this help</p>
<p><code class="u">{arrow}</code> draw an arrow</p>
<p><code class="u">{rect}</code>: draw a rectangle</p>
<p><code class="u">{ellipse}</code> draw an ellipse</p>
<p><code class="u">{highlight}</code> highlight an area</p>
<p><code class="u">{text}</code> write text</p>
<p><code> ctrl .</code> Make text larger (for this text block)</p>
<p><code> ctrl ,</code> Make text smaller (for this text block)</p>
<p>
<code> ctrl /</code> Cycle through fonts (Monoid, Reforma, Inter,
Roboto)
</p>
<p><code> ctrl + scrollwheel</code> Resize the text bounding box</p>
<p><code> ctrl + c</code> Center the text</p>
<p><code class="u">{paste}</code> paste images or text from the clipboard</p>
<p><code> ctrl + scrollwheel</code> Resize the pasted image</p>
<p><code class="u">{clip}</code> clip the screenshot</p>
<p><code> drag</code> dragging moves the clipped image</p>
<p><code> shift+drag</code> dragging moves the clipping rectangle</p>
<p><code class="u">{clipboard}</code> swap the screenshot for whatever
image there is on the clipboard (or go back to the screenshot)</p>
<p><code class="u">{color}</code> choose color for the next operations</p>
<p><code> r</code> red (default)</p>
<p><code> y</code> yellow</p>
<p><code> b</code> blue</p>
<p><code> g</code> green</p>
<p><code> o</code> orange</p>
<p><code> w</code> white</p>
<p><code> x</code> black (and highlight then redacts)</p>
<p><code>{memes}</code>: enter meme selection, it will be placed on the last click</p>
<p><code> type</code> to dynamically search through the list of memes</p>
<p><code> tab</code> to display meme thumbnails</p>
<p><code> enter</code> to select the topmost meme</p>
<p><code> click</code> on the image or name to select it</p>
<p><code> paste</code> an external meme URL (should be valid) to use that instead</p>
<p><code> esc</code> to dismiss</p>
<p><code>{empty}</code>: switch between the screenshot and a white canvas (better for tweaking memes or diagrams)</p>
<p><code>backspace</code>: delete anything selected</p>
`;

document.body.insertBefore(helpDiv, document.body.firstChild);
}
48 changes: 0 additions & 48 deletions src/screenshot.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,54 +6,6 @@
<link href="style.css" rel="stylesheet" />
</head>
<body>
<div id="help" class="hide">
<p style="text-align: center"><code>Goita!</code> Ruben Berenguel 2024</p>
<hr />
<ul>
<li>Everything you can create can be dragged around and deleted.</li>
<li>Click to select things.</li>
<li>Drag to move them.</li>
<li>
If you prefer other shortcuts, change them in
<code>shortcuts.js</code> (only those
<span class="u">underlined</span> are configurable).
</li>
</ul>
<p><code>h</code> show and hide this help</p>
<p><code class="u">{arrow}</code> draw an arrow</p>
<p><code class="u">{rect}</code>: draw a rectangle</p>
<p><code class="u">{ellipse}</code> draw an ellipse</p>
<p><code class="u">{highlight}</code> highlight an area</p>
<p><code class="u">{text}</code> write text</p>
<p><code> ctrl .</code> Make text larger (for this text block)</p>
<p><code> ctrl ,</code> Make text smaller (for this text block)</p>
<p>
<code> ctrl /</code> Cycle through fonts (Monoid, Reforma, Inter,
Roboto)
</p>
<p><code> ctrl + scrollwheel</code> Resize the text bounding box</p>
<p><code> ctrl + c</code> Center the text</p>
<p>
<code class="u">{paste}</code> paste images or text from the clipboard
</p>
<p><code> ctrl + scrollwheel</code> Resize the pasted image</p>
<p><code class="u">{clip}</code> clip the screenshot</p>
<p><code> drag</code> dragging moves the clipped image</p>
<p><code> shift+drag</code> dragging moves the clipping rectangle</p>
<p>
<code class="u">{clipboard}</code> swap the screenshot for whatever
image there is on the clipboard (or go back to the screenshot)
</p>
<p><code class="u">{color}</code> choose color for the next operations</p>
<p><code> r</code> red (default)</p>
<p><code> y</code> yellow</p>
<p><code> b</code> blue</p>
<p><code> g</code> green</p>
<p><code> o</code> orange</p>
<p><code> w</code> white</p>
<p><code> x</code> black (and highlight then redacts)</p>
<p><code>backspace</code>: delete anything selected</p>
</div>
<div id="screenshotContainer">
<div id="sourceLink"></div>
<svg id="svgOverlay"></svg>
Expand Down
Loading

0 comments on commit 45de35c

Please sign in to comment.