aboutsummaryrefslogtreecommitdiff
blob: 49ddd3a236f35a273426b8e761f5bfc830e60f23 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
	<title>SyntaxHighlighter Theme Tests</title>
	<script type="text/javascript" src="/js/jquery-1.4.2.js"></script>
</head>

<body>

<div id="output"></div>

<style>
body {
	background: white;
	font-family: Helvetica;
}

.test-wrap {
	width: 100%;
	height: 800px;
	overflow: auto;
	border: none;
}
</style>

<script id="sample" type="text/plain">
	<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
	<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
		<title>SyntaxHighlighter Theme Tests</title>
	</head>
	
	<body>
		&lt;script>
		/**
		 * Looks for a child or parent node which has specified classname.
		 * Equivalent to jQuery's $(container).find(".className")
		 * @param {Element} target Target element.
		 * @param {String} search Class name or node name to look for.
		 * @param {Boolean} reverse If set to true, will go up the node tree instead of down.
		 * @return {Element} Returns found child or parent element on null.
		 */
		function findElement(target, search, reverse /* optional */)
		{
			if (target == null)
				return null;
		
			var nodes			= reverse != true ? target.childNodes : [ target.parentNode ],
				propertyToFind	= { '#' : 'id', '.' : 'className' }[search.substr(0, 1)] || 'nodeName',
				expectedValue,
				found
				;
				
			// main return of the found node
			if ((target[propertyToFind] || '').indexOf(expectedValue) != -1)
				return target;
		
			return found;
		};
		&lt;/script>
		
	
<!-- jinwei.me Baidu tongji analytics -->
<script type="text/javascript">
var _bdhmProtocol = (("https:" == document.location.protocol) ? " https://" : " http://");

document.write(unescape("%3Cscript src='" + _bdhmProtocol + "hm.baidu.com/h.js%3F91918ac6d6854623883a2b546ebc00ac' type='text/javascript'%3E%3C/script%3E"));

</script>

</body>
	</html>
</script>

<script type="text/javascript">
var themes = [
		['#fff', 'Default'],
		['#000', 'Django'],
		['#fff', 'Eclipse'],
		['#000', 'Emacs'],
		['#000', 'FadeToGrey'],
		['#000', 'MDUltra'],
		['#000', 'Midnight'],
		['#000', 'RDark']
	];
	
$(document).ready(function()
{
	var sample = $('#sample').text().replace(/</g, '&lt;');
	
	$.each(themes, function(index)
	{
		var $iframe = $('<iframe class="test-wrap" src="about:blank" />'),
			background = this[0],
			themeName = this[1]
			;
		
		$('#output')
			.append(''
				+ '<h1>'
					+ '<a href="#theme' + (index + 1) + '">next</a> '
					+ '<a name="theme' + index + '">'
						+ themeName
					+ '</a>'
				+ '</h1>'
			)
			.append($iframe)
			;
			
		$iframe.ready(function()
		{
			var doc = $iframe[0].contentDocument;
			$iframe.css('background', background);
			
			doc.write(''
				+ '<scr' + 'ipt type="text/javascript" src="/sh/scripts/XRegExp.js"></scr' + 'ipt>'
				+ '<scr' + 'ipt type="text/javascript" src="/sh/scripts/shCore.js"></scr' + 'ipt>'
				+ '<scr' + 'ipt type="text/javascript" src="/sh/scripts/shBrushXml.js"></scr' + 'ipt>'
				+ '<scr' + 'ipt type="text/javascript" src="/sh/scripts/shBrushJScript.js"></scr' + 'ipt>'
				+ '<link type="text/css" rel="stylesheet" href="/sh/styles/shCore' + themeName + '.css"/>'
				+ '<pre type="syntaxhighlighter" class="brush: js; html-script: true; highlight: [5, 20]" title="This is SyntaxHighlighter theme ' + themeName + ' in action!">'
					+ sample
				+ '</pre>'
				+ '<pre type="syntaxhighlighter" class="brush: js; html-script: true; collapse: true">'
					+ sample
				+ '</pre>'
				+ '<scr' + 'ipt type="text/javascript">'
					+ 'SyntaxHighlighter.highlight();'
				+ '</scr' + 'ipt>'
				);
			doc.close();
		});
	});
	
	$('#output a[name]:first').attr('name', 'top');
	$('#output a[href]:last').attr('href', '#top').html('top');
});
</script>

</body>
</html>
Powered by cgit v1.2.3 (git 2.41.0)