1<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 2<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> 3<head> 4 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> 5 <title>SyntaxHighlighter Theme Tests</title> 6 <script type="text/javascript" src="/components/jquery/jquery.min.js"></script> 7 <script type="text/javascript" src="/components/qunit/qunit/qunit.js"></script> 8 <link type="text/css" rel="stylesheet" href="/components/qunit/qunit/qunit.css"/> 9</head> 10 11<body> 12 13<div id="output"></div> 14 15<style> 16body { 17 background: white; 18 font-family: Helvetica; 19} 20 21.test-wrap { 22 width: 100%; 23 height: 800px; 24 overflow: auto; 25 border: none; 26} 27</style> 28 29<script id="sample" type="text/plain"> 30 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 31 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> 32 <head> 33 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> 34 <title>SyntaxHighlighter Theme Tests</title> 35 </head> 36 37 <body> 38 <script> 39 /** 40 * Looks for a child or parent node which has specified classname. 41 * Equivalent to jQuery's $(container).find(".className") 42 * @param {Element} target Target element. 43 * @param {String} search Class name or node name to look for. 44 * @param {Boolean} reverse If set to true, will go up the node tree instead of down. 45 * @return {Element} Returns found child or parent element on null. 46 */ 47 function findElement(target, search, reverse /* optional */) 48 { 49 if (target == null) 50 return null; 51 52 var nodes = reverse != true ? target.childNodes : [ target.parentNode ], 53 propertyToFind = { '#' : 'id', '.' : 'className' }[search.substr(0, 1)] || 'nodeName', 54 expectedValue, 55 found 56 ; 57 58 // main return of the found node 59 if ((target[propertyToFind] || '').indexOf(expectedValue) != -1) 60 return target; 61 62 return found; 63 }; 64 </script> 65 66 </body> 67 </html> 68</script> 69 70<script type="text/javascript"> 71var themes = [ 72 ['#fff', 'Default'], 73 // ['#000', 'Django'], 74 // ['#fff', 'Eclipse'], 75 // ['#000', 'Emacs'], 76 // ['#000', 'FadeToGrey'], 77 // ['#000', 'MDUltra'], 78 // ['#000', 'Midnight'], 79 // ['#000', 'RDark'] 80 ]; 81 82$(document).ready(function() 83{ 84 var sample = $('#sample').text().replace(/</g, '<'); 85 86 $.each(themes, function(index) 87 { 88 var $iframe = $('<iframe class="test-wrap" src="about:blank" />'), 89 background = this[0], 90 themeName = this[1] 91 ; 92 93 $('#output') 94 .append('' 95 + '<h1>' 96 + '<a href="#theme' + (index + 1) + '">next</a> ' 97 + '<a name="theme' + index + '">' 98 + themeName 99 + '</a>' 100 + '</h1>' 101 ) 102 .append($iframe) 103 ; 104 105 $iframe.ready(function() 106 { 107 var doc = $iframe[0].contentDocument; 108 $iframe.css('background', background); 109 110 doc.write('' 111 + '<scr' + 'ipt type="text/javascript" src="/components/xregexp/xregexp-all.js"></scr' + 'ipt>' 112 + '<scr' + 'ipt type="text/javascript" src="/src/js/shCore.js"></scr' + 'ipt>' 113 + '<scr' + 'ipt type="text/javascript" src="/src/js/shBrushXml.js"></scr' + 'ipt>' 114 + '<scr' + 'ipt type="text/javascript" src="/src/js/shBrushJScript.js"></scr' + 'ipt>' 115 + '<link type="text/css" rel="stylesheet" href="/pkg/styles/shCore' + themeName + '.css"/>' 116 + '<pre type="syntaxhighlighter" class="brush: js; html-script: true; highlight: [5, 20]" title="This is SyntaxHighlighter theme ' + themeName + ' in action!">' 117 + sample 118 + '</pre>' 119 + '<pre type="syntaxhighlighter" class="brush: js; html-script: true; collapse: true">' 120 + sample 121 + '</pre>' 122 + '<scr' + 'ipt type="text/javascript">' 123 + 'SyntaxHighlighter.highlight();' 124 + '</scr' + 'ipt>' 125 ); 126 doc.close(); 127 }); 128 }); 129 130 $('#output a[name]:first').attr('name', 'top'); 131 $('#output a[href]:last').attr('href', '#top').html('top'); 132}); 133</script> 134 135</body> 136</html> 137