-
Notifications
You must be signed in to change notification settings - Fork 0
/
demo.html
149 lines (128 loc) · 3.95 KB
/
demo.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
<!doctype html>
<html>
<head>
<title>Syntax Chroma JavaScript Library</title>
<meta charset="utf8">
<meta name="author" content="Arthur Khachatryan">
<script type="text/javascript" src="syntax-chroma.js"></script>
<link type="text/css" rel="stylesheet" href="themes/schroma-base.css">
<!-- theme options, uncomment to apply theme -->
<!--<link type="text/css" rel="stylesheet" href="themes/schroma-theme-blue.css">-->
<!--<link type="text/css" rel="stylesheet" href="themes/schroma-theme-dark.css">-->
<!--<link type="text/css" rel="stylesheet" href="themes/schroma-theme-red.css">-->
</head>
<body>
<div class="container">
<h1>Syntax Chroma JavaScript Library</h1>
<h2>A modern, simple, unobtrusive code syntax color highlighter with no dependencies!</h2>
<h3>Plain Text Chroma</h3>
<code>
This is a simple text Chroma.
The indentation persists to give the user control over the look and feel,
but no styling is applied to it.
It abides by carriage returns and new paragraphs.
</code>
<h3>JS Syntax Chroma</h3>
<code class="rows-alternate" data-lang="JS" data-code-wrapper="1">
/* jQuery .ready */
$(function() {
$(this).changeUriParam("param3","77"); /* change param 3 to 77 */
});
/**
* @extends String via prototype
*/
String.prototype.repeat= function(x){
x = x || 1;
alert('test');
return Array(x+1).join(this); // inline comments
}
// end of code
</code>
<h3>PHP Syntax Chroma</h3>
<code data-lang="PHP" data-code-wrapper="1">
class Example extends CI_Controller {
function __construct() // this function allows you to load things you can use in all other functions in this class
{
parent::__construct();
}
function index()
{
// load libraries
$this->load->library(array("session", "form_validation"));
// load helper
$this->load->helper("form");
// setup form validation
$this->form_validation->set_rules("name", "name", "required");
$this->form_validation->set_rules("email", "email", "valid_email");
$this->form_validation->set_rules("url", "url", "prep_url");
$this->form_validation->set_rules("captcha", "captcha", "required|callback_check_captcha");
$this->form_validation->set_rules("comment", "comment", "required");
if( $this->form_validation->run() )
{
// create comment
die("Validated!");
}
// setup textCAPTCHA
$xml = @new SimpleXMLElement("http://textcaptcha.com/api/your_api_key", NULL, TRUE);
// store answers in session for use later
$answers = array();
foreach( $xml->answer as $hash )
{
$answers[] = (string)$hash;
}
$this->session->set_userdata("captcha_answers", $answers);
// load vars into view
$this->load->vars(array( "captcha" => (string)$xml->question ));
// load the view
$this->load->view("example");
}
function check_captcha( $string )
{
$user_answer = md5(strtolower(trim($string)));
$answers = $this->session->userdata("captcha_answers");
if( in_array($user_answer, $answers) )
{
return TRUE;
}
else
{
$this->form_validation->set_message("check_captcha", "Your answer was incorrect!");
return FALSE;
}
}
}
</code>
<h3>CSS Syntax Chroma</h3>
<code data-lang="CSS" data-code-wrapper="1">
span {
color: red;
background: white;
}
#theid {
padding: 5px 10px; /* top and bottom - right and left */
margin: 1px 2px 3px 4px;
}
#theid.class {
padding: 5px 10px;
margin: 1px 2px 3px 4px;
}
.class {
font-size: 1px;
}
.class.class2{
font-size: 1px;
}
#theid div {
padding: 5px 10px;
margin: 1px 2px 3px 4px;
}
.class div{
font-size: 1px;
}
p [title^="Hello"] {
color:red;
}
</code>
</div>
</body>
</html>