5

SE recently added "Stack Snippets" -- running JavaScript, CSS, and HTML code snippets. These are great, except for one problem.

I made a request for a console to be added, so that we don't have to manually open the browser console. It got some upvotes, but no official responses.

Never fear, the console is here!

Just install the script, and it'll enable simple console.log() calls from within Stack Snippets.

How it works

It uses the Web Messaging API to make the page and the snippet frame communicate. The script runs on both pages, setting up messaging between the two. Any console.log calls from the snippet are caught, and forwarded to the outer page. Don't worry, they're also logged to the regular console.

Planned features

  • Error catching
  • Better object visualizations
  • Styled output
  • Input?

Install

Install the script from Greasy Fork:

https://greasyfork.org/scripts/5479-stack-snippets-console

Should work cross-browser, provided you have a user script extension.

Tested on Chrome with Tampermonkey, and Firefox with Greasemonkey.

Bugs / Feature Requests?

Post them here.

1

Feature Request

Please use a fixed-width font. Also, the alternating width of the time stamps due to the unpadded time values is pretty annoying. If that time stamp really needs to stay, then please pad the numbers so they don't move the text left and right.

  • Planned features. Just got left out. :) – Scimonster Oct 9 '14 at 16:43
  • Fixed in the just released v1.0.1. – Scimonster Oct 10 '14 at 9:37
0

Changelog

I list what changed in each version here. Newest is on top.

v1.1.0 (2014-10-12)

  • Catch errors
  • Fix a bug with logging objects
  • Don't run if postMessage isn't supported

v1.0.1 (2014-10-10)

v1.0.0 (2014-10-05)

  • Everything was new :)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .