comparison app/assets/javascripts/init.tabs.js @ 103:a8768ad51926

Allows hash-based onload tab switch.
author Edho Arief <edho@myconan.net>
date Mon, 12 Nov 2012 11:28:11 +0700
parents 90b59418828a
children 9825e51ba30f
comparison
equal deleted inserted replaced
102:7a514c733e6c 103:a8768ad51926
1 $(document).ready(function() { 1 $(document).ready(function() {
2 raw = $('#plain > pre').text(); 2 raw = $('#plain > pre').text();
3 $('#highlight > pre').text(raw); 3 $('#highlight > pre').text(raw);
4 $('#markdown > div').html(marked(raw)); 4 $('#markdown > div').html(marked(raw));
5 mode = window.location.hash.substr(1);
6 if (mode == 'highlight') { $('#paste-tabs li:eq(1) a').click(); }
7 else if (mode == 'markdown') { $('#paste-tabs li:eq(2) a').click(); }
5 window.prettyPrint && prettyPrint(); 8 window.prettyPrint && prettyPrint();
6 }); 9 });