Skip to content

Instantly share code, notes, and snippets.

@ringmaster
Last active January 3, 2021 16:48
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ringmaster/b33495b18d7069055d45 to your computer and use it in GitHub Desktop.
Save ringmaster/b33495b18d7069055d45 to your computer and use it in GitHub Desktop.
Make Content Editable Bookmarklet

How to Install

  1. Copy the contents of edit.js, below.
  2. Visit this page.
  3. Paste the contents of edit.js into the box labeled "Enter your javascript code here".
  4. Click "Convert to Bookmarklet".
  5. Drag the blue button that says "this link" to your bookmarks bar.

How to use

  1. Visit any web page.
  2. Click on the bookmarklet you created until a dialog appears saying "Content is now editable!"
  3. Click on the page anywhere and use the cursor to edit the page. Links will be disabled so you can click on them.
  4. Click on the bookmarklet to turn off editing and make links clickable again.
(document.body.contentEditable="false"==document.body.contentEditable)&&alert("Content is now editable!");
@ringmaster
Copy link
Author

@viliusle I appreciate your perspective. For a more complete product yours might be good advice. But frankly, for this four-year-old simple bookmarklet that is designed to toggle the enable content editing bit for a web page, the alert() seems like just the right amount of UI feedback for what it’s doing. Adding a “toast” would require embedding so much UI code in the bookmarklet as to make it needlessly complicated/bloated. That’s just my opinion, of course, and I’d love to see your alternative take on code that incorporates those UI elements in a bookmarklet efficiently. Obviously, if you’re doing this as part of a larger app and have control over the UI libraries so that it’s easy to add those elements, that would be a much better choice. But that’s not the case or intent here. Hopefully that makes sense to you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment