How it works:
- The browser bookmark code(in A.) loads the pretty.js a (github)gist hosted script.
- The pretty.js script itselfs loads external jquery.js and prettify.js libs(in D. by using B.)
- When external libs are fully loaded it runs a bit of code that for every pre html tag(tipically where code exists) makes it pretty(syntax highlighted). (in C.)
Pretty.js is hosted here: https://gist.github.com/4213877
- A. The code to be used in the URL field of the browser bookmark. Note that depending on the url you use from gist, you can choose to share a versioned version or the lastest one.
- C. Is the function to run when external scripts are loaded on page.
I imagine this is a very common pattern for this type of script, so feel free to use, re-use, modify.
Kudos for the github:gist service! (it even includes versioning !!)
- Here’s is a nice collection of ready made bookmarklets: https://github.com/yaph/bookmarklets
In Page Debug tool - August 2012
A visual debug tool to inspect custom tracking code placed in the different html elements of a web page, to ease the debugging of web analytics tracking code.
comments powered by Disqus