hobix 0.6
Sign up to get free protection for your applications and to get access to all the features.
- data/COPYING +18 -0
- data/README +18 -0
- data/Rakefile +96 -0
- data/bin/hobix +94 -0
- data/contrib/blosxom-to-hobix.rb +253 -0
- data/contrib/txp-to-hobix.rb +56 -0
- data/contrib/webrick-all-mine.rb +20 -0
- data/doc/CHANGELOG +285 -0
- data/doc/rdoc/classes/Hobix/API.html +382 -0
- data/doc/rdoc/classes/Hobix/Article.html +111 -0
- data/doc/rdoc/classes/Hobix/BaseContent.html +692 -0
- data/doc/rdoc/classes/Hobix/BaseEntry.html +218 -0
- data/doc/rdoc/classes/Hobix/BaseFacet.html +205 -0
- data/doc/rdoc/classes/Hobix/BaseOutput.html +122 -0
- data/doc/rdoc/classes/Hobix/BasePlugin.html +201 -0
- data/doc/rdoc/classes/Hobix/BaseProperties/ClassMethods.html +243 -0
- data/doc/rdoc/classes/Hobix/BaseProperties.html +218 -0
- data/doc/rdoc/classes/Hobix/BasePublish.html +157 -0
- data/doc/rdoc/classes/Hobix/BaseStorage.html +417 -0
- data/doc/rdoc/classes/Hobix/BixWik/Entry.html +196 -0
- data/doc/rdoc/classes/Hobix/BixWik/IndexEntry.html +170 -0
- data/doc/rdoc/classes/Hobix/BixWik/WikiRedCloth.html +111 -0
- data/doc/rdoc/classes/Hobix/BixWik.html +418 -0
- data/doc/rdoc/classes/Hobix/BixWikPlugin.html +158 -0
- data/doc/rdoc/classes/Hobix/CommandLine.html +1970 -0
- data/doc/rdoc/classes/Hobix/Comment.html +113 -0
- data/doc/rdoc/classes/Hobix/Config.html +212 -0
- data/doc/rdoc/classes/Hobix/DataMarsh.html +667 -0
- data/doc/rdoc/classes/Hobix/Entry.html +178 -0
- data/doc/rdoc/classes/Hobix/EntryEnum.html +162 -0
- data/doc/rdoc/classes/Hobix/Enumerable.html +170 -0
- data/doc/rdoc/classes/Hobix/Facets/WikiEdit.html +180 -0
- data/doc/rdoc/classes/Hobix/Facets.html +111 -0
- data/doc/rdoc/classes/Hobix/LinkList.html +182 -0
- data/doc/rdoc/classes/Hobix/Out/Quick.html +412 -0
- data/doc/rdoc/classes/Hobix/Out.html +119 -0
- data/doc/rdoc/classes/Hobix/Page.html +381 -0
- data/doc/rdoc/classes/Hobix/Trackback.html +113 -0
- data/doc/rdoc/classes/Hobix/UriStr.html +198 -0
- data/doc/rdoc/classes/Hobix/WebApp/QueryString.html +207 -0
- data/doc/rdoc/classes/Hobix/WebApp/QueryValidationFailure.html +111 -0
- data/doc/rdoc/classes/Hobix/WebApp.html +1383 -0
- data/doc/rdoc/classes/Hobix/Weblog/AuthorNotFound.html +111 -0
- data/doc/rdoc/classes/Hobix/Weblog.html +2082 -0
- data/doc/rdoc/classes/Hobix.html +399 -0
- data/doc/rdoc/classes/Kernel.html +139 -0
- data/doc/rdoc/classes/Regexp.html +154 -0
- data/doc/rdoc/classes/YAML/Omap.html +144 -0
- data/doc/rdoc/classes/YAML.html +111 -0
- data/doc/rdoc/created.rid +1 -0
- data/doc/rdoc/files/COPYING.html +129 -0
- data/doc/rdoc/files/README.html +131 -0
- data/doc/rdoc/files/doc/CHANGELOG.html +101 -0
- data/doc/rdoc/files/lib/hobix/api_rb.html +119 -0
- data/doc/rdoc/files/lib/hobix/article_rb.html +126 -0
- data/doc/rdoc/files/lib/hobix/base_rb.html +128 -0
- data/doc/rdoc/files/lib/hobix/bixwik_rb.html +126 -0
- data/doc/rdoc/files/lib/hobix/commandline_rb.html +140 -0
- data/doc/rdoc/files/lib/hobix/comments_rb.html +126 -0
- data/doc/rdoc/files/lib/hobix/config_rb.html +125 -0
- data/doc/rdoc/files/lib/hobix/datamarsh_rb.html +108 -0
- data/doc/rdoc/files/lib/hobix/entry_rb.html +118 -0
- data/doc/rdoc/files/lib/hobix/linklist_rb.html +127 -0
- data/doc/rdoc/files/lib/hobix/publisher_rb.html +126 -0
- data/doc/rdoc/files/lib/hobix/trackbacks_rb.html +128 -0
- data/doc/rdoc/files/lib/hobix/webapp_rb.html +127 -0
- data/doc/rdoc/files/lib/hobix/weblog_rb.html +135 -0
- data/doc/rdoc/files/lib/hobix_rb.html +127 -0
- data/doc/rdoc/fr_class_index.html +67 -0
- data/doc/rdoc/fr_file_index.html +44 -0
- data/doc/rdoc/fr_method_index.html +307 -0
- data/doc/rdoc/index.html +24 -0
- data/doc/rdoc/rdoc-style.css +208 -0
- data/git_hobix_update.php +13 -0
- data/lib/hobix/api.rb +91 -0
- data/lib/hobix/article.rb +22 -0
- data/lib/hobix/base.rb +480 -0
- data/lib/hobix/bixwik.rb +200 -0
- data/lib/hobix/commandline.rb +677 -0
- data/lib/hobix/comments.rb +98 -0
- data/lib/hobix/config.rb +39 -0
- data/lib/hobix/datamarsh.rb +110 -0
- data/lib/hobix/entry.rb +84 -0
- data/lib/hobix/facets/comments.rb +99 -0
- data/lib/hobix/facets/publisher.rb +314 -0
- data/lib/hobix/facets/trackbacks.rb +80 -0
- data/lib/hobix/linklist.rb +81 -0
- data/lib/hobix/out/atom.rb +101 -0
- data/lib/hobix/out/erb.rb +64 -0
- data/lib/hobix/out/okaynews.rb +55 -0
- data/lib/hobix/out/quick.rb +314 -0
- data/lib/hobix/out/rdf.rb +97 -0
- data/lib/hobix/out/redrum.rb +26 -0
- data/lib/hobix/out/rss.rb +128 -0
- data/lib/hobix/plugin/akismet.rb +196 -0
- data/lib/hobix/plugin/bloglines.rb +73 -0
- data/lib/hobix/plugin/calendar.rb +212 -0
- data/lib/hobix/plugin/flickr.rb +110 -0
- data/lib/hobix/plugin/recent_comments.rb +84 -0
- data/lib/hobix/plugin/sections.rb +91 -0
- data/lib/hobix/plugin/tags.rb +60 -0
- data/lib/hobix/publish/ping.rb +53 -0
- data/lib/hobix/publish/replicate.rb +283 -0
- data/lib/hobix/publisher.rb +18 -0
- data/lib/hobix/search/dictionary.rb +141 -0
- data/lib/hobix/search/porter_stemmer.rb +203 -0
- data/lib/hobix/search/simple.rb +209 -0
- data/lib/hobix/search/vector.rb +100 -0
- data/lib/hobix/storage/filesys.rb +408 -0
- data/lib/hobix/trackbacks.rb +93 -0
- data/lib/hobix/util/objedit.rb +193 -0
- data/lib/hobix/util/patcher.rb +155 -0
- data/lib/hobix/webapp/cli.rb +195 -0
- data/lib/hobix/webapp/htmlform.rb +107 -0
- data/lib/hobix/webapp/message.rb +177 -0
- data/lib/hobix/webapp/urigen.rb +141 -0
- data/lib/hobix/webapp/webrick-servlet.rb +90 -0
- data/lib/hobix/webapp.rb +723 -0
- data/lib/hobix/weblog.rb +893 -0
- data/lib/hobix.rb +230 -0
- data/share/default-blog/hobix.yaml +16 -0
- data/share/default-blog/htdocs/site.css +174 -0
- data/share/default-blog/skel/entry.html.quick +0 -0
- data/share/default-blog/skel/index.atom.atom +0 -0
- data/share/default-blog/skel/index.html.quick-summary +0 -0
- data/share/default-blog/skel/index.xml.rss +0 -0
- data/share/default-blog/skel/index.yaml.okaynews +0 -0
- data/share/default-blog/skel/monthly.html.quick-archive +0 -0
- data/share/default-blog/skel/section.html.quick-archive +0 -0
- data/share/default-blog/skel/yearly.html.quick-archive +0 -0
- data/share/default-blog-modes.yaml +7 -0
- data/share/default-blog.apache-cgi.patch +8 -0
- data/share/default-blog.apache-ssi.patch +38 -0
- data/share/default-blog.apache2-ssi.patch +3 -0
- data/share/default-blog.cgi.patch +8 -0
- data/share/default-blog.comments.patch +5 -0
- data/share/default-blog.prototype.patch +766 -0
- data/share/default-blog.publisher.patch +5 -0
- data/share/default-blog.wiki.patch +29 -0
- data/share/publisher/css/control.css +90 -0
- data/share/publisher/css/form.css +238 -0
- data/share/publisher/css/form.import.css +72 -0
- data/share/publisher/css/main-menu.css +134 -0
- data/share/publisher/i/hobix-emblazen-1.png +0 -0
- data/share/publisher/i/hobix-emblazen-2.png +0 -0
- data/share/publisher/i/hobix-emblazen-3.png +0 -0
- data/share/publisher/i/hobix-emblazen-4.png +0 -0
- data/share/publisher/i/hobix-emblazen-5.png +0 -0
- data/share/publisher/i/hobix-emblazen-6.png +0 -0
- data/share/publisher/i/hobix-emblazen-7.png +0 -0
- data/share/publisher/index.erb +66 -0
- data/share/publisher/js/controls.js +261 -0
- data/share/publisher/js/dragdrop.js +476 -0
- data/share/publisher/js/effects.js +570 -0
- data/share/publisher/js/prototype.js +1011 -0
- metadata +230 -0
@@ -0,0 +1,766 @@
|
|
1
|
+
--- !hobix.com,2004/patches/^list
|
2
|
+
htdocs/js/prototype.js: !^file-create |
|
3
|
+
/* Prototype: an object-oriented Javascript library, version 1.2.0
|
4
|
+
* (c) 2005 Sam Stephenson <sam@conio.net>
|
5
|
+
*
|
6
|
+
* THIS FILE IS AUTOMATICALLY GENERATED. When sending patches, please diff
|
7
|
+
* against the source tree, available from the Prototype darcs repository.
|
8
|
+
*
|
9
|
+
* Prototype is freely distributable under the terms of an MIT-style license.
|
10
|
+
*
|
11
|
+
* For details, see the Prototype web site: http://prototype.conio.net/
|
12
|
+
*
|
13
|
+
/*--------------------------------------------------------------------------*/
|
14
|
+
|
15
|
+
var Prototype = {
|
16
|
+
Version: '1.2.0'
|
17
|
+
}
|
18
|
+
|
19
|
+
var Class = {
|
20
|
+
create: function() {
|
21
|
+
return function() {
|
22
|
+
this.initialize.apply(this, arguments);
|
23
|
+
}
|
24
|
+
}
|
25
|
+
}
|
26
|
+
|
27
|
+
var Abstract = new Object();
|
28
|
+
|
29
|
+
Object.prototype.extend = function(object) {
|
30
|
+
for (property in object) {
|
31
|
+
this[property] = object[property];
|
32
|
+
}
|
33
|
+
return this;
|
34
|
+
}
|
35
|
+
|
36
|
+
Function.prototype.bind = function(object) {
|
37
|
+
var method = this;
|
38
|
+
return function() {
|
39
|
+
method.apply(object, arguments);
|
40
|
+
}
|
41
|
+
}
|
42
|
+
|
43
|
+
Function.prototype.bindAsEventListener = function(object) {
|
44
|
+
var method = this;
|
45
|
+
return function(event) {
|
46
|
+
method.call(object, event || window.event);
|
47
|
+
}
|
48
|
+
}
|
49
|
+
|
50
|
+
Number.prototype.toColorPart = function() {
|
51
|
+
var digits = this.toString(16);
|
52
|
+
if (this < 16) return '0' + digits;
|
53
|
+
return digits;
|
54
|
+
}
|
55
|
+
|
56
|
+
var Try = {
|
57
|
+
these: function() {
|
58
|
+
var returnValue;
|
59
|
+
|
60
|
+
for (var i = 0; i < arguments.length; i++) {
|
61
|
+
var lambda = arguments[i];
|
62
|
+
try {
|
63
|
+
returnValue = lambda();
|
64
|
+
break;
|
65
|
+
} catch (e) {}
|
66
|
+
}
|
67
|
+
|
68
|
+
return returnValue;
|
69
|
+
}
|
70
|
+
}
|
71
|
+
|
72
|
+
/*--------------------------------------------------------------------------*/
|
73
|
+
|
74
|
+
var PeriodicalExecuter = Class.create();
|
75
|
+
PeriodicalExecuter.prototype = {
|
76
|
+
initialize: function(callback, frequency) {
|
77
|
+
this.callback = callback;
|
78
|
+
this.frequency = frequency;
|
79
|
+
this.currentlyExecuting = false;
|
80
|
+
|
81
|
+
this.registerCallback();
|
82
|
+
},
|
83
|
+
|
84
|
+
registerCallback: function() {
|
85
|
+
setTimeout(this.onTimerEvent.bind(this), this.frequency * 1000);
|
86
|
+
},
|
87
|
+
|
88
|
+
onTimerEvent: function() {
|
89
|
+
if (!this.currentlyExecuting) {
|
90
|
+
try {
|
91
|
+
this.currentlyExecuting = true;
|
92
|
+
this.callback();
|
93
|
+
} finally {
|
94
|
+
this.currentlyExecuting = false;
|
95
|
+
}
|
96
|
+
}
|
97
|
+
|
98
|
+
this.registerCallback();
|
99
|
+
}
|
100
|
+
}
|
101
|
+
|
102
|
+
/*--------------------------------------------------------------------------*/
|
103
|
+
|
104
|
+
function $() {
|
105
|
+
var elements = new Array();
|
106
|
+
|
107
|
+
for (var i = 0; i < arguments.length; i++) {
|
108
|
+
var element = arguments[i];
|
109
|
+
if (typeof element == 'string')
|
110
|
+
element = document.getElementById(element);
|
111
|
+
|
112
|
+
if (arguments.length == 1)
|
113
|
+
return element;
|
114
|
+
|
115
|
+
elements.push(element);
|
116
|
+
}
|
117
|
+
|
118
|
+
return elements;
|
119
|
+
}
|
120
|
+
|
121
|
+
/*--------------------------------------------------------------------------*/
|
122
|
+
|
123
|
+
if (!Array.prototype.push) {
|
124
|
+
Array.prototype.push = function() {
|
125
|
+
var startLength = this.length;
|
126
|
+
for (var i = 0; i < arguments.length; i++)
|
127
|
+
this[startLength + i] = arguments[i];
|
128
|
+
return this.length;
|
129
|
+
}
|
130
|
+
}
|
131
|
+
|
132
|
+
if (!Function.prototype.apply) {
|
133
|
+
// Based on code from http://www.youngpup.net/
|
134
|
+
Function.prototype.apply = function(object, parameters) {
|
135
|
+
var parameterStrings = new Array();
|
136
|
+
if (!object) object = window;
|
137
|
+
if (!parameters) parameters = new Array();
|
138
|
+
|
139
|
+
for (var i = 0; i < parameters.length; i++)
|
140
|
+
parameterStrings[i] = 'x[' + i + ']';
|
141
|
+
|
142
|
+
object.__apply__ = this;
|
143
|
+
var result = eval('obj.__apply__(' +
|
144
|
+
parameterStrings[i].join(', ') + ')');
|
145
|
+
object.__apply__ = null;
|
146
|
+
|
147
|
+
return result;
|
148
|
+
}
|
149
|
+
}
|
150
|
+
|
151
|
+
/*--------------------------------------------------------------------------*/
|
152
|
+
|
153
|
+
var Ajax = {
|
154
|
+
getTransport: function() {
|
155
|
+
return Try.these(
|
156
|
+
function() {return new ActiveXObject('Msxml2.XMLHTTP')},
|
157
|
+
function() {return new ActiveXObject('Microsoft.XMLHTTP')},
|
158
|
+
function() {return new XMLHttpRequest()}
|
159
|
+
) || false;
|
160
|
+
},
|
161
|
+
|
162
|
+
emptyFunction: function() {}
|
163
|
+
}
|
164
|
+
|
165
|
+
Ajax.Base = function() {};
|
166
|
+
Ajax.Base.prototype = {
|
167
|
+
setOptions: function(options) {
|
168
|
+
this.options = {
|
169
|
+
method: 'post',
|
170
|
+
asynchronous: true,
|
171
|
+
parameters: ''
|
172
|
+
}.extend(options || {});
|
173
|
+
}
|
174
|
+
}
|
175
|
+
|
176
|
+
Ajax.Request = Class.create();
|
177
|
+
Ajax.Request.Events =
|
178
|
+
['Uninitialized', 'Loading', 'Loaded', 'Interactive', 'Complete'];
|
179
|
+
|
180
|
+
Ajax.Request.prototype = (new Ajax.Base()).extend({
|
181
|
+
initialize: function(url, options) {
|
182
|
+
this.transport = Ajax.getTransport();
|
183
|
+
this.setOptions(options);
|
184
|
+
|
185
|
+
try {
|
186
|
+
if (this.options.method == 'get')
|
187
|
+
url += '?' + this.options.parameters + '&_=';
|
188
|
+
|
189
|
+
this.transport.open(this.options.method, url, true);
|
190
|
+
|
191
|
+
if (this.options.asynchronous) {
|
192
|
+
this.transport.onreadystatechange = this.onStateChange.bind(this);
|
193
|
+
setTimeout((function() {this.respondToReadyState(1)}).bind(this), 10);
|
194
|
+
}
|
195
|
+
|
196
|
+
this.transport.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
|
197
|
+
this.transport.setRequestHeader('X-Prototype-Version', Prototype.Version);
|
198
|
+
|
199
|
+
if (this.options.method == 'post') {
|
200
|
+
this.transport.setRequestHeader('Connection', 'close');
|
201
|
+
this.transport.setRequestHeader('Content-type',
|
202
|
+
'application/x-www-form-urlencoded');
|
203
|
+
}
|
204
|
+
|
205
|
+
this.transport.send(this.options.method == 'post' ?
|
206
|
+
this.options.parameters + '&_=' : null);
|
207
|
+
|
208
|
+
} catch (e) {
|
209
|
+
}
|
210
|
+
},
|
211
|
+
|
212
|
+
onStateChange: function() {
|
213
|
+
var readyState = this.transport.readyState;
|
214
|
+
if (readyState != 1)
|
215
|
+
this.respondToReadyState(this.transport.readyState);
|
216
|
+
},
|
217
|
+
|
218
|
+
respondToReadyState: function(readyState) {
|
219
|
+
var event = Ajax.Request.Events[readyState];
|
220
|
+
(this.options['on' + event] || Ajax.emptyFunction)(this.transport);
|
221
|
+
}
|
222
|
+
});
|
223
|
+
|
224
|
+
Ajax.Updater = Class.create();
|
225
|
+
Ajax.Updater.prototype = (new Ajax.Base()).extend({
|
226
|
+
initialize: function(container, url, options) {
|
227
|
+
this.container = $(container);
|
228
|
+
this.setOptions(options);
|
229
|
+
|
230
|
+
if (this.options.asynchronous) {
|
231
|
+
this.onComplete = this.options.onComplete;
|
232
|
+
this.options.onComplete = this.updateContent.bind(this);
|
233
|
+
}
|
234
|
+
|
235
|
+
this.request = new Ajax.Request(url, this.options);
|
236
|
+
|
237
|
+
if (!this.options.asynchronous)
|
238
|
+
this.updateContent();
|
239
|
+
},
|
240
|
+
|
241
|
+
updateContent: function() {
|
242
|
+
if (this.options.insertion) {
|
243
|
+
new this.options.insertion(this.container,
|
244
|
+
this.request.transport.responseText);
|
245
|
+
} else {
|
246
|
+
this.container.innerHTML = this.request.transport.responseText;
|
247
|
+
}
|
248
|
+
|
249
|
+
if (this.onComplete) {
|
250
|
+
setTimeout((function() {this.onComplete(this.request)}).bind(this), 10);
|
251
|
+
}
|
252
|
+
}
|
253
|
+
});
|
254
|
+
|
255
|
+
/*--------------------------------------------------------------------------*/
|
256
|
+
|
257
|
+
var Field = {
|
258
|
+
clear: function() {
|
259
|
+
for (var i = 0; i < arguments.length; i++)
|
260
|
+
$(arguments[i]).value = '';
|
261
|
+
},
|
262
|
+
|
263
|
+
focus: function(element) {
|
264
|
+
$(element).focus();
|
265
|
+
},
|
266
|
+
|
267
|
+
present: function() {
|
268
|
+
for (var i = 0; i < arguments.length; i++)
|
269
|
+
if ($(arguments[i]).value == '') return false;
|
270
|
+
return true;
|
271
|
+
},
|
272
|
+
|
273
|
+
select: function(element) {
|
274
|
+
$(element).select();
|
275
|
+
},
|
276
|
+
|
277
|
+
activate: function(element) {
|
278
|
+
$(element).focus();
|
279
|
+
$(element).select();
|
280
|
+
}
|
281
|
+
}
|
282
|
+
|
283
|
+
/*--------------------------------------------------------------------------*/
|
284
|
+
|
285
|
+
var Form = {
|
286
|
+
serialize: function(form) {
|
287
|
+
var elements = Form.getElements($(form));
|
288
|
+
var queryComponents = new Array();
|
289
|
+
|
290
|
+
for (var i = 0; i < elements.length; i++) {
|
291
|
+
var queryComponent = Form.Element.serialize(elements[i]);
|
292
|
+
if (queryComponent)
|
293
|
+
queryComponents.push(queryComponent);
|
294
|
+
}
|
295
|
+
|
296
|
+
return queryComponents.join('&');
|
297
|
+
},
|
298
|
+
|
299
|
+
getElements: function(form) {
|
300
|
+
form = $(form);
|
301
|
+
var elements = new Array();
|
302
|
+
|
303
|
+
for (tagName in Form.Element.Serializers) {
|
304
|
+
var tagElements = form.getElementsByTagName(tagName);
|
305
|
+
for (var j = 0; j < tagElements.length; j++)
|
306
|
+
elements.push(tagElements[j]);
|
307
|
+
}
|
308
|
+
return elements;
|
309
|
+
},
|
310
|
+
|
311
|
+
disable: function(form) {
|
312
|
+
var elements = Form.getElements(form);
|
313
|
+
for (var i = 0; i < elements.length; i++) {
|
314
|
+
var element = elements[i];
|
315
|
+
element.blur();
|
316
|
+
element.disable = 'true';
|
317
|
+
}
|
318
|
+
},
|
319
|
+
|
320
|
+
focusFirstElement: function(form) {
|
321
|
+
form = $(form);
|
322
|
+
var elements = Form.getElements(form);
|
323
|
+
for (var i = 0; i < elements.length; i++) {
|
324
|
+
var element = elements[i];
|
325
|
+
if (element.type != 'hidden' && !element.disabled) {
|
326
|
+
Field.activate(element);
|
327
|
+
break;
|
328
|
+
}
|
329
|
+
}
|
330
|
+
},
|
331
|
+
|
332
|
+
reset: function(form) {
|
333
|
+
$(form).reset();
|
334
|
+
}
|
335
|
+
}
|
336
|
+
|
337
|
+
Form.Element = {
|
338
|
+
serialize: function(element) {
|
339
|
+
element = $(element);
|
340
|
+
var method = element.tagName.toLowerCase();
|
341
|
+
var parameter = Form.Element.Serializers[method](element);
|
342
|
+
|
343
|
+
if (parameter)
|
344
|
+
return encodeURIComponent(parameter[0]) + '=' +
|
345
|
+
encodeURIComponent(parameter[1]);
|
346
|
+
},
|
347
|
+
|
348
|
+
getValue: function(element) {
|
349
|
+
element = $(element);
|
350
|
+
var method = element.tagName.toLowerCase();
|
351
|
+
var parameter = Form.Element.Serializers[method](element);
|
352
|
+
|
353
|
+
if (parameter)
|
354
|
+
return parameter[1];
|
355
|
+
}
|
356
|
+
}
|
357
|
+
|
358
|
+
Form.Element.Serializers = {
|
359
|
+
input: function(element) {
|
360
|
+
switch (element.type.toLowerCase()) {
|
361
|
+
case 'hidden':
|
362
|
+
case 'password':
|
363
|
+
case 'text':
|
364
|
+
return Form.Element.Serializers.textarea(element);
|
365
|
+
case 'checkbox':
|
366
|
+
case 'radio':
|
367
|
+
return Form.Element.Serializers.inputSelector(element);
|
368
|
+
}
|
369
|
+
return false;
|
370
|
+
},
|
371
|
+
|
372
|
+
inputSelector: function(element) {
|
373
|
+
if (element.checked)
|
374
|
+
return [element.name, element.value];
|
375
|
+
},
|
376
|
+
|
377
|
+
textarea: function(element) {
|
378
|
+
return [element.name, element.value];
|
379
|
+
},
|
380
|
+
|
381
|
+
select: function(element) {
|
382
|
+
var index = element.selectedIndex;
|
383
|
+
var value = element.options[index].value || element.options[index].text;
|
384
|
+
return [element.name, (index >= 0) ? value : ''];
|
385
|
+
}
|
386
|
+
}
|
387
|
+
|
388
|
+
/*--------------------------------------------------------------------------*/
|
389
|
+
|
390
|
+
var $F = Form.Element.getValue;
|
391
|
+
|
392
|
+
/*--------------------------------------------------------------------------*/
|
393
|
+
|
394
|
+
Abstract.TimedObserver = function() {}
|
395
|
+
Abstract.TimedObserver.prototype = {
|
396
|
+
initialize: function(element, frequency, callback) {
|
397
|
+
this.frequency = frequency;
|
398
|
+
this.element = $(element);
|
399
|
+
this.callback = callback;
|
400
|
+
|
401
|
+
this.lastValue = this.getValue();
|
402
|
+
this.registerCallback();
|
403
|
+
},
|
404
|
+
|
405
|
+
registerCallback: function() {
|
406
|
+
setTimeout(this.onTimerEvent.bind(this), this.frequency * 1000);
|
407
|
+
},
|
408
|
+
|
409
|
+
onTimerEvent: function() {
|
410
|
+
var value = this.getValue();
|
411
|
+
if (this.lastValue != value) {
|
412
|
+
this.callback(this.element, value);
|
413
|
+
this.lastValue = value;
|
414
|
+
}
|
415
|
+
|
416
|
+
this.registerCallback();
|
417
|
+
}
|
418
|
+
}
|
419
|
+
|
420
|
+
Form.Element.Observer = Class.create();
|
421
|
+
Form.Element.Observer.prototype = (new Abstract.TimedObserver()).extend({
|
422
|
+
getValue: function() {
|
423
|
+
return Form.Element.getValue(this.element);
|
424
|
+
}
|
425
|
+
});
|
426
|
+
|
427
|
+
Form.Observer = Class.create();
|
428
|
+
Form.Observer.prototype = (new Abstract.TimedObserver()).extend({
|
429
|
+
getValue: function() {
|
430
|
+
return Form.serialize(this.element);
|
431
|
+
}
|
432
|
+
});
|
433
|
+
|
434
|
+
|
435
|
+
/*--------------------------------------------------------------------------*/
|
436
|
+
|
437
|
+
document.getElementsByClassName = function(className) {
|
438
|
+
var children = document.getElementsByTagName('*') || document.all;
|
439
|
+
var elements = new Array();
|
440
|
+
|
441
|
+
for (var i = 0; i < children.length; i++) {
|
442
|
+
var child = children[i];
|
443
|
+
var classNames = child.className.split(' ');
|
444
|
+
for (var j = 0; j < classNames.length; j++) {
|
445
|
+
if (classNames[j] == className) {
|
446
|
+
elements.push(child);
|
447
|
+
break;
|
448
|
+
}
|
449
|
+
}
|
450
|
+
}
|
451
|
+
|
452
|
+
return elements;
|
453
|
+
}
|
454
|
+
|
455
|
+
/*--------------------------------------------------------------------------*/
|
456
|
+
|
457
|
+
var Element = {
|
458
|
+
toggle: function() {
|
459
|
+
for (var i = 0; i < arguments.length; i++) {
|
460
|
+
var element = $(arguments[i]);
|
461
|
+
element.style.display =
|
462
|
+
(element.style.display == 'none' ? '' : 'none');
|
463
|
+
}
|
464
|
+
},
|
465
|
+
|
466
|
+
hide: function() {
|
467
|
+
for (var i = 0; i < arguments.length; i++) {
|
468
|
+
var element = $(arguments[i]);
|
469
|
+
element.style.display = 'none';
|
470
|
+
}
|
471
|
+
},
|
472
|
+
|
473
|
+
show: function() {
|
474
|
+
for (var i = 0; i < arguments.length; i++) {
|
475
|
+
var element = $(arguments[i]);
|
476
|
+
element.style.display = '';
|
477
|
+
}
|
478
|
+
},
|
479
|
+
|
480
|
+
remove: function(element) {
|
481
|
+
element = $(element);
|
482
|
+
element.parentNode.removeChild(element);
|
483
|
+
},
|
484
|
+
|
485
|
+
getHeight: function(element) {
|
486
|
+
element = $(element);
|
487
|
+
return element.offsetHeight;
|
488
|
+
}
|
489
|
+
}
|
490
|
+
|
491
|
+
var Toggle = new Object();
|
492
|
+
Toggle.display = Element.toggle;
|
493
|
+
|
494
|
+
/*--------------------------------------------------------------------------*/
|
495
|
+
|
496
|
+
Abstract.Insertion = function(adjacency) {
|
497
|
+
this.adjacency = adjacency;
|
498
|
+
}
|
499
|
+
|
500
|
+
Abstract.Insertion.prototype = {
|
501
|
+
initialize: function(element, content) {
|
502
|
+
this.element = $(element);
|
503
|
+
this.content = content;
|
504
|
+
|
505
|
+
if (this.adjacency && this.element.insertAdjacentHTML) {
|
506
|
+
this.element.insertAdjacentHTML(this.adjacency, this.content);
|
507
|
+
} else {
|
508
|
+
this.range = this.element.ownerDocument.createRange();
|
509
|
+
if (this.initializeRange) this.initializeRange();
|
510
|
+
this.fragment = this.range.createContextualFragment(this.content);
|
511
|
+
this.insertContent();
|
512
|
+
}
|
513
|
+
}
|
514
|
+
}
|
515
|
+
|
516
|
+
var Insertion = new Object();
|
517
|
+
|
518
|
+
Insertion.Before = Class.create();
|
519
|
+
Insertion.Before.prototype = (new Abstract.Insertion('beforeBegin')).extend({
|
520
|
+
initializeRange: function() {
|
521
|
+
this.range.setStartBefore(this.element);
|
522
|
+
},
|
523
|
+
|
524
|
+
insertContent: function() {
|
525
|
+
this.element.parentNode.insertBefore(this.fragment, this.element);
|
526
|
+
}
|
527
|
+
});
|
528
|
+
|
529
|
+
Insertion.Top = Class.create();
|
530
|
+
Insertion.Top.prototype = (new Abstract.Insertion('afterBegin')).extend({
|
531
|
+
initializeRange: function() {
|
532
|
+
this.range.selectNodeContents(this.element);
|
533
|
+
this.range.collapse(true);
|
534
|
+
},
|
535
|
+
|
536
|
+
insertContent: function() {
|
537
|
+
this.element.insertBefore(this.fragment, this.element.firstChild);
|
538
|
+
}
|
539
|
+
});
|
540
|
+
|
541
|
+
Insertion.Bottom = Class.create();
|
542
|
+
Insertion.Bottom.prototype = (new Abstract.Insertion('beforeEnd')).extend({
|
543
|
+
initializeRange: function() {
|
544
|
+
this.range.selectNodeContents(this.element);
|
545
|
+
this.range.collapse(this.element);
|
546
|
+
},
|
547
|
+
|
548
|
+
insertContent: function() {
|
549
|
+
this.element.appendChild(this.fragment);
|
550
|
+
}
|
551
|
+
});
|
552
|
+
|
553
|
+
Insertion.After = Class.create();
|
554
|
+
Insertion.After.prototype = (new Abstract.Insertion('afterEnd')).extend({
|
555
|
+
initializeRange: function() {
|
556
|
+
this.range.setStartAfter(this.element);
|
557
|
+
},
|
558
|
+
|
559
|
+
insertContent: function() {
|
560
|
+
this.element.parentNode.insertBefore(this.fragment,
|
561
|
+
this.element.nextSibling);
|
562
|
+
}
|
563
|
+
});
|
564
|
+
|
565
|
+
/*--------------------------------------------------------------------------*/
|
566
|
+
|
567
|
+
var Effect = new Object();
|
568
|
+
|
569
|
+
Effect.Highlight = Class.create();
|
570
|
+
Effect.Highlight.prototype = {
|
571
|
+
initialize: function(element) {
|
572
|
+
this.element = $(element);
|
573
|
+
this.start = 153;
|
574
|
+
this.finish = 255;
|
575
|
+
this.current = this.start;
|
576
|
+
this.fade();
|
577
|
+
},
|
578
|
+
|
579
|
+
fade: function() {
|
580
|
+
if (this.isFinished()) return;
|
581
|
+
if (this.timer) clearTimeout(this.timer);
|
582
|
+
this.highlight(this.element, this.current);
|
583
|
+
this.current += 17;
|
584
|
+
this.timer = setTimeout(this.fade.bind(this), 250);
|
585
|
+
},
|
586
|
+
|
587
|
+
isFinished: function() {
|
588
|
+
return this.current > this.finish;
|
589
|
+
},
|
590
|
+
|
591
|
+
highlight: function(element, current) {
|
592
|
+
element.style.backgroundColor = "#ffff" + current.toColorPart();
|
593
|
+
}
|
594
|
+
}
|
595
|
+
|
596
|
+
|
597
|
+
Effect.Fade = Class.create();
|
598
|
+
Effect.Fade.prototype = {
|
599
|
+
initialize: function(element) {
|
600
|
+
this.element = $(element);
|
601
|
+
this.start = 100;
|
602
|
+
this.finish = 0;
|
603
|
+
this.current = this.start;
|
604
|
+
this.fade();
|
605
|
+
},
|
606
|
+
|
607
|
+
fade: function() {
|
608
|
+
if (this.isFinished()) { this.element.style.display = 'none'; return; }
|
609
|
+
if (this.timer) clearTimeout(this.timer);
|
610
|
+
this.setOpacity(this.element, this.current);
|
611
|
+
this.current -= 10;
|
612
|
+
this.timer = setTimeout(this.fade.bind(this), 50);
|
613
|
+
},
|
614
|
+
|
615
|
+
isFinished: function() {
|
616
|
+
return this.current <= this.finish;
|
617
|
+
},
|
618
|
+
|
619
|
+
setOpacity: function(element, opacity) {
|
620
|
+
opacity = (opacity == 100) ? 99.999 : opacity;
|
621
|
+
element.style.filter = "alpha(opacity:"+opacity+")";
|
622
|
+
element.style.opacity = opacity/100 /*//*/;
|
623
|
+
}
|
624
|
+
}
|
625
|
+
|
626
|
+
Effect.Scale = Class.create();
|
627
|
+
Effect.Scale.prototype = {
|
628
|
+
initialize: function(element, percent) {
|
629
|
+
this.element = $(element);
|
630
|
+
this.startScale = 1.0;
|
631
|
+
this.startHeight = this.element.offsetHeight;
|
632
|
+
this.startWidth = this.element.offsetWidth;
|
633
|
+
this.currentHeight = this.startHeight;
|
634
|
+
this.currentWidth = this.startWidth;
|
635
|
+
this.finishScale = (percent/100) /*//*/;
|
636
|
+
if (this.element.style.fontSize=="") this.sizeEm = 1.0;
|
637
|
+
if (this.element.style.fontSize.indexOf("em")>0)
|
638
|
+
this.sizeEm = parseFloat(this.element.style.fontSize);
|
639
|
+
if(this.element.effect_scale) {
|
640
|
+
clearTimeout(this.element.effect_scale.timer);
|
641
|
+
this.startScale = this.element.effect_scale.currentScale;
|
642
|
+
this.startHeight = this.element.effect_scale.startHeight;
|
643
|
+
this.startWidth = this.element.effect_scale.startWidth;
|
644
|
+
if(this.element.effect_scale.sizeEm)
|
645
|
+
this.sizeEm = this.element.effect_scale.sizeEm;
|
646
|
+
}
|
647
|
+
this.element.effect_scale = this;
|
648
|
+
this.currentScale = this.startScale;
|
649
|
+
this.factor = this.finishScale - this.startScale;
|
650
|
+
this.options = arguments[2] || {};
|
651
|
+
this.scale();
|
652
|
+
},
|
653
|
+
|
654
|
+
scale: function() {
|
655
|
+
if (this.isFinished()) {
|
656
|
+
this.setDimensions(this.element, this.startWidth*this.finishScale, this.startHeight*this.finishScale);
|
657
|
+
if(this.sizeEm) this.element.style.fontSize = this.sizeEm*this.finishScale + "em";
|
658
|
+
if(this.options.complete) this.options.complete(this);
|
659
|
+
return;
|
660
|
+
}
|
661
|
+
if (this.timer) clearTimeout(this.timer);
|
662
|
+
if (this.options.step) this.options.step(this);
|
663
|
+
this.setDimensions(this.element, this.currentWidth, this.currentHeight);
|
664
|
+
if(this.sizeEm) this.element.style.fontSize = this.sizeEm*this.currentScale + "em";
|
665
|
+
this.currentScale += (this.factor/10) /*//*/;
|
666
|
+
this.currentWidth = this.startWidth * this.currentScale;
|
667
|
+
this.currentHeight = this.startHeight * this.currentScale;
|
668
|
+
this.timer = setTimeout(this.scale.bind(this), 50);
|
669
|
+
},
|
670
|
+
|
671
|
+
isFinished: function() {
|
672
|
+
return (this.factor < 0) ?
|
673
|
+
this.currentScale <= this.finishScale : this.currentScale >= this.finishScale;
|
674
|
+
},
|
675
|
+
|
676
|
+
setDimensions: function(element, width, height) {
|
677
|
+
element.style.width = width + 'px';
|
678
|
+
element.style.height = height + 'px';
|
679
|
+
}
|
680
|
+
}
|
681
|
+
|
682
|
+
Effect.Squish = Class.create();
|
683
|
+
Effect.Squish.prototype = {
|
684
|
+
initialize: function(element) {
|
685
|
+
this.element = $(element);
|
686
|
+
new Effect.Scale(this.element, 1, { complete: this.hide.bind(this) } );
|
687
|
+
},
|
688
|
+
hide: function() {
|
689
|
+
this.element.style.display = 'none';
|
690
|
+
}
|
691
|
+
}
|
692
|
+
|
693
|
+
Effect.Puff = Class.create();
|
694
|
+
Effect.Puff.prototype = {
|
695
|
+
initialize: function(element) {
|
696
|
+
this.element = $(element);
|
697
|
+
this.opacity = 100;
|
698
|
+
this.startTop = this.element.top || this.element.offsetTop;
|
699
|
+
this.startLeft = this.element.left || this.element.offsetLeft;
|
700
|
+
new Effect.Scale(this.element, 200, { step: this.fade.bind(this), complete: this.hide.bind(this) } );
|
701
|
+
},
|
702
|
+
fade: function(effect) {
|
703
|
+
topd = (((effect.currentScale)*effect.startHeight) - effect.startHeight)/2;
|
704
|
+
leftd = (((effect.currentScale)*effect.startWidth) - effect.startWidth)/2;
|
705
|
+
this.element.style.position='absolute';
|
706
|
+
this.element.style.top = this.startTop-topd + "px";
|
707
|
+
this.element.style.left = this.startLeft-leftd + "px";
|
708
|
+
this.opacity -= 10;
|
709
|
+
this.setOpacity(this.element, this.opacity);
|
710
|
+
if(navigator.appVersion.indexOf('AppleWebKit')>0) this.element.innerHTML += ''; //force redraw on safari
|
711
|
+
},
|
712
|
+
hide: function() {
|
713
|
+
this.element.style.display = 'none';
|
714
|
+
},
|
715
|
+
setOpacity: function(element, opacity) {
|
716
|
+
opacity = (opacity == 100) ? 99.999 : opacity;
|
717
|
+
element.style.filter = "alpha(opacity:"+opacity+")";
|
718
|
+
element.style.opacity = opacity/100 /*//*/;
|
719
|
+
}
|
720
|
+
}
|
721
|
+
|
722
|
+
Effect.Appear = Class.create();
|
723
|
+
Effect.Appear.prototype = {
|
724
|
+
initialize: function(element) {
|
725
|
+
this.element = $(element);
|
726
|
+
this.start = 0;
|
727
|
+
this.finish = 100;
|
728
|
+
this.current = this.start;
|
729
|
+
this.fade();
|
730
|
+
},
|
731
|
+
|
732
|
+
fade: function() {
|
733
|
+
if (this.isFinished()) return;
|
734
|
+
if (this.timer) clearTimeout(this.timer);
|
735
|
+
this.setOpacity(this.element, this.current);
|
736
|
+
this.current += 10;
|
737
|
+
this.timer = setTimeout(this.fade.bind(this), 50);
|
738
|
+
},
|
739
|
+
|
740
|
+
isFinished: function() {
|
741
|
+
return this.current > this.finish;
|
742
|
+
},
|
743
|
+
|
744
|
+
setOpacity: function(element, opacity) {
|
745
|
+
opacity = (opacity == 100) ? 99.999 : opacity;
|
746
|
+
element.style.filter = "alpha(opacity:"+opacity+")";
|
747
|
+
element.style.opacity = opacity/100 /*//*/;
|
748
|
+
element.style.display = '';
|
749
|
+
}
|
750
|
+
}
|
751
|
+
|
752
|
+
Effect.ContentZoom = Class.create();
|
753
|
+
Effect.ContentZoom.prototype = {
|
754
|
+
initialize: function(element, percent) {
|
755
|
+
this.element = $(element);
|
756
|
+
if (this.element.style.fontSize=="") this.sizeEm = 1.0;
|
757
|
+
if (this.element.style.fontSize.indexOf("em")>0)
|
758
|
+
this.sizeEm = parseFloat(this.element.style.fontSize);
|
759
|
+
if(this.element.effect_contentzoom) {
|
760
|
+
this.sizeEm = this.element.effect_contentzoom.sizeEm;
|
761
|
+
}
|
762
|
+
this.element.effect_contentzoom = this;
|
763
|
+
this.element.style.fontSize = this.sizeEm*(percent/100) + "em" /*//*/;
|
764
|
+
if(navigator.appVersion.indexOf('AppleWebKit')>0) { this.element.scrollTop -= 1; };
|
765
|
+
}
|
766
|
+
}
|