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