index.html 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
  2. <html><head>
  3. <title>Prettify Themes Gallery</title>
  4. <style type="text/css">
  5. iframe { width: 100%; border-style: none; margin: 0; padding: 0 }
  6. </style>
  7. <script>
  8. var allThemes = [
  9. { name: 'default' },
  10. { name: 'desert',
  11. authorHtml: '<a href="http://code.google.com/u/@VhJeSlJYBhVMWgF7/">'
  12. + 'techto&hellip;@<\/a>' },
  13. { name: 'sunburst', authorHtml: 'David Leibovic' },
  14. { name: 'sons-of-obsidian',
  15. authorHtml: '<a href="http://CodeTunnel.com/blog/post/71'
  16. + '/google-code-prettify-obsidian-theme">Alex Ford<\/a>' },
  17. { name: 'doxy', authorHtml: 'Robert Sperberg' },
  18. ];
  19. // Called by the demo.html frames loaded per theme to
  20. // size the iframes properly and to allow them to tile
  21. // the page nicely.
  22. function adjustChildIframeSize(themeName, width, height) {
  23. if (typeof console != 'undefined') {
  24. try {
  25. console.log('adjusting ' + themeName + ' to ' + width + 'x' + height);
  26. } catch (ex) {
  27. // Don't bother logging log failure.
  28. }
  29. }
  30. var container = document.getElementById(themeName).parentNode;
  31. container.style.width = (+width + 16) + 'px';
  32. container.style.display = 'inline-block';
  33. var iframe = container.getElementsByTagName('iframe')[0];
  34. iframe.style.height = (+height + 16) + 'px';
  35. }
  36. </script>
  37. </head>
  38. <body>
  39. <noscript>This page requires JavaScript</noscript>
  40. <h1>Gallery of themes for
  41. <a href="http://code.google.com/p/google-code-prettify/">code prettify</a></h1>
  42. <p>
  43. Click on a theme name for a link to the file in revision control.
  44. Print preview this page to see how the themes work on the printed page.
  45. </p>
  46. <script>(function () {
  47. // Produce an iframe per theme.
  48. // We pass the threme name to the iframe via its URI query, and
  49. // it loads prettify and the theme CSS, and calls back to this page
  50. // to resize the iframe.
  51. for (var i = 0, n = allThemes.length; i < n; ++i) {
  52. var theme = allThemes[i];
  53. if (!theme) { continue; }
  54. var iframe = document.createElement('iframe');
  55. iframe.name = theme.name;
  56. iframe.src = 'demo.html?' + encodeURIComponent(theme.name);
  57. var header = document.createElement('h2');
  58. header.id = theme.name;
  59. var linkToThemeSrc = document.createElement('a');
  60. linkToThemeSrc.href = (
  61. 'http://code.google.com/p/google-code-prettify/source/browse/trunk/' +
  62. (theme.name === 'default'
  63. ? 'src/prettify.css'
  64. : 'styles/' + encodeURIComponent(theme.name) + '.css'));
  65. linkToThemeSrc.appendChild(document.createTextNode(
  66. theme.name.replace(/\b[a-z]/g, // Capitalize first letter of each word
  67. function (letter) { return letter.toUpperCase(); })));
  68. header.appendChild(linkToThemeSrc);
  69. var attribution;
  70. if (theme.authorHtml) {
  71. attribution = document.createElement('span');
  72. attribution.className = 'attribution';
  73. attribution.innerHTML = 'by ' + theme.authorHtml;
  74. }
  75. var div = document.createElement('div');
  76. div.appendChild(header);
  77. if (attribution) { div.appendChild(attribution); }
  78. div.appendChild(iframe);
  79. document.body.appendChild(div);
  80. }
  81. })()</script>
  82. </body></html>