This repository has been archived by the owner on May 23, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
dojo.html
195 lines (178 loc) · 6.16 KB
/
dojo.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
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>DojoRosetta</title>
<script src="js/lib/dojo.1.7.1.js" type="text/javascript"></script>
<script src="js/rosetta.js" type="text/javascript"></script>
<link rel="stylesheet" href="css/styles.css" type="text/css"charset="utf-8" />
<script type="text/javascript">
dojo.addOnLoad(function() {
var sampleText = 'Artlung Rosetta with Dojo!';
dojo.query("ul li:nth-child(4n-3)").addClass("start");
dojo.query("ul li:nth-child(4n)").addClass("end");
dojo.query('h1').addClass('active');
dojo.query('p').addClass('bad');
var testIdentifier = dojo.byId('testIdentifier');
dojo.style(testIdentifier, {
border:'1px solid #000',
backgroundColor:'#ccc'
});
testIdentifier.innerHTML = sampleText;
dojo.query('#interactionExperiments input').on('click', function(e){
this.style.display = 'none';
dojo.stopEvent(e);
});
dojo.query('#interactionExperiments a').on('click', function(e){
dojo.query('input', this.parentNode).forEach(function(bar){
bar.style.display = 'inline';
});
dojo.stopEvent(e);
});
dojo.query('#nav a:has(img)').on('mouseover', function(e){
dojo.query('img',this).forEach("item.src = item.src.replace('-off','-over')");
})
dojo.query('#nav a:has(img)').on('mouseout', function(e){
dojo.query('img',this).forEach("item.src = item.src.replace('-over','-off')");
});
var addRandomLink= dojo.byId('addRandomString');
dojo.connect(addRandomLink, 'onclick', function(e){
if (Rosetta.mayIncrement()) {
dojo.query('#addRandomString').addContent(' World' + Rosetta.getIndex(), 'after');
Rosetta.increment();
}
dojo.stopEvent(e);
});
dojo.query('#loginArea h2').forEach(function(item){
dojo.connect(item, 'onclick', function(e){
var formDiv = dojo.byId('loginForm');
if (formDiv.style.display === 'none') {
formDiv.style.display = 'block';
dojo.query('span', item)[0].innerHTML = '-';
} else {
formDiv.style.display = 'none';
dojo.query('span', item)[0].innerHTML = '+';
}
});
});
// Load HTML with Ajax
dojo.connect(dojo.byId('ajaxloadHtml'), 'onclick', function(e){
dojo.xhrGet({
url : "ajax/chunk.html",
handleAs : "text",
load : function(response, ioArgs) {
dojo.byId('ajaxOutput').innerHTML = response;
return;
}
});
dojo.stopEvent(e);
});
// Load text with Ajax
dojo.connect(dojo.byId('ajaxloadText'), 'onclick', function(e){
dojo.xhrGet({
url : "ajax/chunk.txt",
handleAs : "text",
load : function(response, ioArgs) {
dojo.byId('ajaxOutput').innerHTML = response;
return;
}
});
dojo.stopEvent(e);
});
// Load JSON with Ajax
dojo.connect(dojo.byId('ajaxloadJson'), 'onclick', function(e){
dojo.xhrGet({
url : "ajax/chunk.json",
handleAs : "json",
load : function(json, ioArgs) {
dojo.byId('ajaxOutput').innerHTML = json.txt;
return;
}
});
dojo.stopEvent(e);
});
// Load XML with Ajax
dojo.connect(dojo.byId('ajaxloadXml'), 'onclick', function(e){
dojo.xhrGet({
url : "ajax/chunk.xml",
handleAs : "xml",
load : function(xml, ioArgs) {
dojo.byId('ajaxOutput').innerHTML = xml.getElementsByTagName("text")[0].firstChild.nodeValue;
return;
}
});
dojo.stopEvent(e);
});
dojo.byId('code').innerHTML = dojo.query('script')[2].innerHTML;
});
</script>
</head>
<body>
<div id="testIdentifier">
If you are reading this then the library did not load for some reason.
</div>
<div id="loginArea">
<h2>(<span>+</span>) Show Login</h2>
<div id="loginForm" style="display: none">
<form method="post" action=".">
Username: <input type="text" name="username" /><br />
Password: <input type="password" name="password" /><br />
<input type="submit" value="Login" />
</form>
</div><!-- #loginForm-->
</div><!-- #loginArea -->
<div id="interactionExperiments">
Click the buttons in here to make them go away.
<a href="#" class="reset">Reset Buttons</a>
<br />
<input value="click" type="button" />
<input value="to" type="button" />
<input value="remove" type="button" />
</div>
<div id="ajaxExamples" class="basicArea">
Load:
<a href="#" id="ajaxloadHtml">html</a> ·
<a href="#" id="ajaxloadJson">json</a> ·
<a href="#" id="ajaxloadText">text</a> ·
<a href="#" id="ajaxloadXml">xml</a>:
<div id="ajaxOutput">Load data into this by clicking the links above.</div>
</div>
<div id="randomContent">
<a href="#" id="addRandomString">To whom do you say hello when programming?</a>
</div>
<div id="nav">
<table cellspacing="0" cellpadding="0" border="0">
<tr><td><a href="index.html"><img src="images/home-off.gif" alt="Home" border="0" /></a></td></tr>
<tr><td><a href="index.html"><img src="images/newcomer-off.gif" alt="Newcomer?" border="0" /></a></td></tr>
<tr><td><a href="index.html"><img src="images/biography-off.gif" alt="Biography" border="0" /></a></td></tr>
<tr><td><a href="index.html"><img src="images/favorite-sites-off.gif" alt="Favorite Sites" border="0" /></a></td></tr>
<tr><td><a href="index.html"><img src="images/resume-off.gif" alt="Resume" border="0" /></a></td></tr>
<tr><td><a href="index.html"><img src="images/portfolio-off.gif" alt="Portfolio" border="0" /></a></td></tr>
<tr><td><a href="index.html"><img src="images/email-off.gif" alt="Email" border="0" /></a></td></tr>
</table>
<a href="#" title="This is another a link inserted into the nav. The mouseover code may not explode because of this.">This link is here to foolproof our mouseover code</a>
</div>
<h1>Test</h1>
<p>whatever</p>
<p>else</p>
<ul>
<li><a href="#">line 1</a></li>
<li><a href="#">line 2</a></li>
<li><a href="#">line 3</a></li>
<li><a href="#">line 4</a></li>
<li><a href="#">line 5</a></li>
<li><a href="#">line 6</a></li>
<li><a href="#">line 7</a></li>
<li><a href="#">line 8</a></li>
<li><a href="#">line 9</a></li>
<li><a href="#">line 10</a></li>
<li><a href="#">line 11</a></li>
<li><a href="#">line 12</a></li>
</ul>
<pre>
Code for this implementation:
<code id="code"></code>
</pre>
<p id="contribute">Contribute to this page and report bugs via <a href="http://github.com/">GitHub</a>: <a href="http://github.com/artlung/Artlung-Rosetta/">http://github.com/artlung/Artlung-Rosetta/</a></p>
</body>
</html>