-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
218 lines (205 loc) · 6.24 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
<!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">
<head>
<title>MooContentAssist</title>
<meta content="text/html; charset=UTF-8" />
<style type="text/css">
body {
font-family: serif;
padding: 0 10px;
}
form, fieldset, p, textarea {
margin: 0 0 1em 0; padding: 0;
}
fieldset {
border: 0;
}
strong {
font-family: monospace;
font-style: italic;
color: #00588F;
}
#discovered {
font-style: italic;
}
textarea {
width: 90%;
height: 100px;
}
</style>
<link type="text/css" rel="stylesheet" href="Source/MooContentAssist.css" />
<script src="js/lib/mootools-core-1.3.1-full-nocompat.js"></script>
<script src="js/lib/mootools-more-1.3.1.1.js"></script>
<script src="Source/MooContentAssist.js"></script>
<script>
window.addEvent("domready", function() {
var editorAssisted = new MooContentAssist( {
frameSize : 3,
aggressiveAssist : true,
/*vocabularyUrl: "words.json",
vocabularyUrlParam : "ns",
vocabularyUrlMethod : "get",*/
onStart : function(mca) {
var ns = this.getNameSpace();
var found = this._discoverUserVocabulary(ns);
document.id("discovered").set("html", found.join(", "));
},
onSelectItem : function(item) {
//console.log("FIRED","onSelectItem",item);
},
onUseItem : function(item) {
//console.log("FIRED","onUseItem",item);
},
onShow : function(mca) {
//console.log("FIRED","onShow");
},
onHide : function(mca) {
//console.log("FIRED","onHide");
},
onEnd : function(mca) {
//console.log("FIRED","end");
},
source : document.id("editor"),
vocabulary : {
"$content": {
"Immagine": ["getImagePath(\"\")","text"],
"CorpoTesto": ["text","textBeforeImage(0)","textAfterImage(0)","textByRange(0,0)"],
"Abstract": ["text"],
"Allegati": ["size()"],
"categories": [null],
"DataInizio": ["shortDate","fullDate","mediumDate","getFormattedDate(\"\")"],
"DataFine": ["shortDate","fullDate","mediumDate","getFormattedDate(\"\")"],
"SitoWeb": ["destination","text"]
},
"$18n": ["getLabel(\"\")"],
"a": ["a1111","a2222","a33333"],
"albatros": ["quack"],
"b": ["bbb111","bbbbb2222","word-b2"],
"babbalotto": ["ouch"],
"c": [null],
"c1": [null],
"c12": [null],
"c123": [null],
"c124": [null],
"c125": [null],
"c126": [null],
"c127": [null],
"c128": [null],
"c129": [null],
"c120": [null],
"c1211": [null],
"c1212": [null],
"contentAssist": ["help","editor","start"]
}
});
document.id("aggressive").addEvent("change", function(ev) {
editorAssisted.setAggressiveAssist(ev.target.getProperty("checked"));
});
document.id("discoverWords").addEvent(
"change",
function(ev) {
editorAssisted.options.vocabularyDiscoverer = ev.target
.getProperty("checked");
});
document.id("frameSize").addEvent("change", function(ev) {
editorAssisted.options.frameSize = ev.target.get("value").toInt();
});
document.id("apply").addEvent("click", function(ev) {
var a = null;
try {
a = JSON.decode(document.id("static").get("value"));
//console.log("new vocabulary:",a);
} catch (e) {
console.log("error static sintax");
alert("sintax error, check it");
}
if (a !== null) {
editorAssisted.options.vocabulary = a;
}
});
/* domready -end */
});
</script>
</head>
<body>
<h1><label for="editor">MooContentAssist v0.80.3</label></h1>
<p>This software is released under GNU General Public License, version 2.</p>
<p>Author: <a href="mailto:nkjoep@gmail.com">Andrea Dessì</a>.</p>
<hr />
<h2 id="demo">Demo</h2>
<form action="#" method="get">
<fieldset>
<p>Instructions:</p>
<ol>
<li>Use <strong>control+space</strong> or <strong>alt+space</strong> to get help.</li>
<li>Available vocabulary: <strong>a, b, c, $</strong>.</li>
<li>Use <strong>up/down</strong> arrow to choose, <strong>enter/click</strong> to confirm.</li>
<li>Press <strong>ESC/Tab</strong> to close the window with the suggested words.</li>
<li>Add <strong>dot</strong> to navigate inside objects.</li>
</ol>
<p>
<textarea cols="4" rows="4" id="editor">Some text here.1
Some text here.2
Some text here.3
Some text here.4
Some text here.5
Some text here.6
Some text here.7
Some text here.8
Some text here.9
</textarea>
<br />
<input type="checkbox" id="aggressive" checked="checked" />
<label for="aggressive">Toggle Aggressive Help while writing in the textarea.</label>
<br/>
<input type="checkbox" id="discoverWords" checked="checked" />
<label for="discoverWords">Enable/Disable Local Keywords Discoverer</label>
<br/>
<select id="frameSize">
<option value="1">1</option>
<option value="2">2</option>
<option value="3" selected="selected">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
</select>
<label for="frameSize"># items on list</label>
</p>
</fieldset>
</form>
<p>
Discovered Keywords (will appear when the MooContentAssist window popups):<br/>
<span id="discovered"></span>
</p>
<hr />
<p>
Insert a json object here as vocabulary:<input type="submit" value="apply" id="apply" />
<br />
<textarea cols="4" rows="4" id="static">
{
"keyB": ["function", "Function", "fUnCt10n", "FUNCTion"],
"keyA": {
"key2": null,
"key3": ["ok","ok2", "Ok"],
"key4": {
"a": null,
"b": null,
"c": [1,2,3]
}
},
"keySOMEThingMOreElse": null,
"keyFagiano:E": [1,2,3,"a","b","c"]
}
</textarea>
</p>
<hr />
<h2>Download</h2>
<p><a href="http://github.com/NKjoep/MooContentAssist/raw/master/Source/MooContentAssist.js">MooContentAssist Latest Version</a></p>
<h2>Learn More</h2>
<ul>
<li><a href="http://moocontentassist.altervista.org/docs/">MooContentAssist Docs</a></li>
<li><a href="http://github.com/NKjoep/MooContentAssist">MooContentAssist@GitHub</a></li>
<li><a href="http://mootools.net/forge/p/moocontentassist">MooContentAssist@MooForge</a></li>
</ul>
</body>
</html>