Show the source code of embedded script tags.
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


If you need to show the source of a script you've included in your page, but didn't know where to turn, now you do!


Sure, why not.

Click the button. Enjoy.


Include showsrc.js on your page, then call showSrc() when your page is finished loading.

ShowSrc will search your document body for any script tags, and check if they have a data-showsrc attribute. If they do, ShowSrc will download the source code for that script tag, and then append a hidden ```pre`` after the script (including a prettyprint class), along with a "Show Source" button.

The button automatically gets a click handler that will allow you to toggle the visibility of the pre element.

You can also pass a callback to showSrc() that will be called after all relevant scripts have been downloaded and appended to the document. You could maybe use this to run prettyprint if you like.


Sorry, this is a super fast hack-n-slash. I highly doubt it'll work in IE.