/
index.html
243 lines (217 loc) · 9.6 KB
/
index.html
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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title>Syntax Highlighting Demo</title>
<link type="text/css" rel="stylesheet" href="./css/jquery.snippet.css" />
<link type="text/css" rel="stylesheet" href="./css/jquery.snippet.symfony.css" />
<link type="text/css" rel="stylesheet" href="./css/jquery.snippet.monokai.css" />
<style type="text/css">
.sticky { position: fixed; top: 0; z-index: 10; background-color: #fff;}
</style>
</head>
<body>
<h1>Syntax Highlighting Demo</h1>
<div class="sticky">
<label for="r">Rotate Style</label>
<select id="r">
<option>symfony</option>
<option>monokai</option>
</select>
</div>
<h2>HTML</h2>
<pre class="html">
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8"/>
<title></title><br> <meta name="description" content=""/><br> <meta name="author" content=""/>
<!-- mobile viewport optimisation -->
<meta name="viewport" content="width=device-width, initial-scale=1.0"><br />
<!-- stylesheets --><br> <link rel="stylesheet" href="yaml/core/base.min.css" type="text/css"/>
<link rel="stylesheet" href="css/styles.css" type="text/css"/>
<!--[if lte IE 7]><br /> <link rel="stylesheet" href="yaml/core/iehacks.min.css" type="text/css"/><br /> <![endif]-->
</head>
<body>
...
</body>
</html></pre>
<h2>CSS</h2>
<pre class="css">
/*---------- typical Styles ---------*/
.sh_typical{background:none; padding:0; margin:0; border:0 none;}
.sh_typical .sh_sourceCode{background-color:#fff;color:#000;font-weight:normal;font-style:normal;}
.sh_typical .sh_sourceCode .sh_keyword{color:#00f;font-weight:bold;font-style:normal;}
.sh_typical .sh_sourceCode .sh_type{color:#00f;font-weight:normal;font-style:normal;}
.sh_typical .sh_sourceCode .sh_string{color:#f00;font-weight:normal;font-style:normal;}
.sh_typical .sh_sourceCode .sh_regexp{color:#f00;font-weight:normal;font-style:normal;}
.sh_typical .sh_sourceCode .sh_specialchar{color:#C42DA8;font-weight:normal;font-style:normal;}
.sh_typical .sh_sourceCode .sh_comment{color:#666;font-weight:normal;font-style:italic;}
.sh_typical .sh_sourceCode .sh_number{color:#a900a9;font-weight:normal;font-style:normal;}
.sh_typical .sh_sourceCode .sh_preproc{color:#00b800;font-weight:normal;font-style:normal;}
.sh_typical .sh_sourceCode .sh_symbol{color:#f00;font-weight:normal;font-style:normal;}
.sh_typical .sh_sourceCode .sh_function{color:#000;font-weight:bold;font-style:normal;}
.sh_typical .sh_sourceCode .sh_cbracket{color:#f00;font-weight:normal;font-style:normal;}
.sh_typical .sh_sourceCode .sh_url{color:#f00;font-weight:normal;font-style:normal;}
.sh_typical .sh_sourceCode .sh_date{color:#00f;font-weight:bold;font-style:normal;}
.sh_typical .sh_sourceCode .sh_time{color:#00f;font-weight:bold;font-style:normal;}
.sh_typical .sh_sourceCode .sh_file{color:#00f;font-weight:bold;font-style:normal;}
.sh_typical .sh_sourceCode .sh_ip{color:#f00;font-weight:normal;font-style:normal;}
.sh_typical .sh_sourceCode .sh_name{color:#f00;font-weight:normal;font-style:normal;}
.sh_typical .sh_sourceCode .sh_variable{color:#ec7f15;font-weight:normal;font-style:normal;}
.sh_typical .sh_sourceCode .sh_oldfile{color:#C42DA8;font-weight:normal;font-style:normal;}
.sh_typical .sh_sourceCode .sh_newfile{color:#f00;font-weight:normal;font-style:normal;}
.sh_typical .sh_sourceCode .sh_difflines{color:#00f;font-weight:bold;font-style:normal;}
.sh_typical .sh_sourceCode .sh_selector{color:#ec7f15;font-weight:normal;font-style:normal;}
.sh_typical .sh_sourceCode .sh_property{color:#00f;font-weight:bold;font-style:normal;}
sh_typical .sh_sourceCode .sh_value{color:#f00;font-weight:normal;font-style:normal;}
/*-------- Snippet Base Styles ----------*/
.snippet-wrap {position:relative;}
*:first-child+html .snippet-wrap {display:inline-block;}
* html .snippet-wrap {display:inline-block;}
.snippet-reveal{text-decoration:underline;}
.snippet-wrap .snippet-menu, .snippet-wrap .snippet-hide {position:absolute; top:10px; right:15px; font-size:.9em;z-index:1;background-color:transparent;}
.snippet-wrap .snippet-hide {top:auto; bottom:10px;}
*:first-child+html .snippet-wrap .snippet-hide {bottom:25px;}
* html .snippet-wrap .snippet-hide {bottom:25px;}
.snippet-wrap .snippet-menu pre, .snippet-wrap .snippet-hide pre {background-color:transparent; margin:0; padding:0;}
.snippet-wrap .snippet-menu a, .snippet-wrap .snippet-hide a {padding:0 5px; text-decoration:underline;}
.snippet-wrap pre.sh_sourceCode{padding:1em;line-height:1.8em;overflow:auto;position:relative;
-moz-border-radius:15px;
-webkit-border-radius:15px;
border-radius:15px;
box-shadow: 2px 2px 5px #000;
-moz-box-shadow: 2px 2px 5px #000;
-webkit-box-shadow: 2px 2px 5px #000;}
.snippet-wrap pre.snippet-textonly {padding:2em;}
*:first-child+html .snippet-wrap pre.snippet-formatted {padding:2em 1em;}
* html .snippet-wrap pre.snippet-formatted {padding:2em 1em;}
.snippet-reveal pre.sh_sourceCode {padding:.5em 1em; text-align:right;}
.snippet-wrap .snippet-num li{padding-left:1.5em;}
.snippet-wrap .snippet-no-num{list-style:none; padding:.6em 1em; margin:0;}
.snippet-wrap .snippet-no-num li {list-style:none; padding-left:0;}
.snippet-wrap .snippet-num {margin:1em 0 1em 1em; padding-left:3em;}
.snippet-wrap .snippet-num li {list-style:decimal-leading-zero outside none;}
.snippet-wrap .snippet-no-num li.box {padding:0 6px; margin-left:-6px;}
.snippet-wrap .snippet-num li.box {border:1px solid; list-style-position:inside; margin-left:-3em; padding-left:6px;}
*:first-child+html .snippet-wrap .snippet-num li.box {margin-left:-2.4em;}
* html .snippet-wrap .snippet-num li.box {margin-left:-2.4em;}
.snippet-wrap li.box-top {border-width:1px 1px 0 !important;}
.snippet-wrap li.box-bot {border-width:0 1px 1px !important;}
.snippet-wrap li.box-mid {border-width:0 1px !important;}
.snippet-wrap .snippet-num li .box-sp {width:18px; display:inline-block;}
*:first-child+html .snippet-wrap .snippet-num li .box-sp {width:27px;}
* html .snippet-wrap .snippet-num li .box-sp {width:27px;}
.snippet-wrap .snippet-no-num li.box {border:1px solid;}
.snippet-wrap .snippet-no-num li .box-sp {display:none;}</pre>
<h2>JavaScript</h2>
<pre class="javascript">/**
* "Yet Another Multicolumn Layout" - YAML CSS Framework
*
* (en) Workaround for IE8 und Webkit browsers to fix focus problems when using skiplinks
* (de) Workaround für IE8 und Webkit browser, um den Focus zu korrigieren, bei Verwendung von Skiplinks
*
* @note inspired by Paul Ratcliffe's article
* http://www.communis.co.uk/blog/2009-06-02-skip-links-chrome-safari-and-added-wai-aria
* Many thanks to Mathias Schäfer (http://molily.de/) for his code improvements
*
* @copyright Copyright 2005-2012, Dirk Jesse
* @license CC-BY 2.0 (http://creativecommons.org/licenses/by/2.0/),
* YAML-CDL (http://www.yaml.de/license.html)
* @link http://www.yaml.de
* @package yaml
* @version 4.0+
* @revision $Revision: 617 $
* @lastmodified $Date: 2012-01-05 23:56:54 +0100 (Do, 05 Jan 2012) $
*/
(function () {
var YAML_focusFix = {
skipClass : 'ym-skip',
init : function () {
var userAgent = navigator.userAgent.toLowerCase();
var is_webkit = userAgent.indexOf('webkit') > -1;
var is_ie = userAgent.indexOf('msie') > -1;
if (is_webkit || is_ie) {
var body = document.body,
handler = YAML_focusFix.click;
if (body.addEventListener) {
body.addEventListener('click', handler, false);
} else if (body.attachEvent) {
body.attachEvent('onclick', handler);
}
}
},
trim : function (str) {
return str.replace(/^\s\s*/, '').replace(/\s\s*$/, '');
},
click : function (e) {
e = e || window.event;
var target = e.target || e.srcElement;
var a = target.className.split(' ');
for (var i=0; i < a.length; i++) {
var cls = YAML_focusFix.trim(a[i]);
if ( cls === YAML_focusFix.skipClass) {
YAML_focusFix.focus(target);
break;
}
}
},
focus : function (link) {
if (link.href) {
var href = link.href,
id = href.substr(href.indexOf('#') + 1),
target = document.getElementById(id);
if (target) {
target.setAttribute("tabindex", "-1");
target.focus();
}
}
}
};
YAML_focusFix.init();
})();</pre>
<h2>PHP</h2>
<pre class="php">
require_once 'Zend.php';
require_once 'Zend/Uri/Exception.php';
require_once 'Zend/Uri/Http.php';
require_once 'Zend/Uri/Mailto.php';
abstract class Zend_Uri
{
/**
* Return a string representation of this URI.
*
* @see getUri()
* @return string
*/
public function __toString()
{
return $this->getUri();
}
static public function factory($uri = 'http')
{
$uri = explode(':', $uri, 2);
$scheme = strtolower($uri[0]);
$schemeSpecific = isset($uri[1]) ? $uri[1] : '';
// Security check: $scheme is used to load a class file,
// so only alphanumerics are allowed.
if (!ctype_alnum($scheme)) {
throw new Zend_Uri_Exception('Illegal scheme');
}
}
}</pre>
<script type="text/javascript" src="./js/jquery.js"></script>
<script type="text/javascript" src="./js/jquery.snippet.js"></script>
<script type="text/javascript">
$(document).ready(function () {
var p = $("pre");
var r = $("#r");
r.on("change", function () {
$.each(p, function () {
$(this).snippet($(this).attr("class"), {style:r.val()});
});
}).change();
});
</script>
</body>
</html>