Skip to content

Commit e858f70

Browse files
author
David Luecke
committed
Updated documentation
1 parent b352545 commit e858f70

13 files changed

+184
-74
lines changed

build/build.properties

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ doc.out = doc/generated/
77
doc.project = build/docdata/
88
doc.txt =.
99
doc.format = HTML
10+
doc.stylesheet = style
1011

1112
# Compression seetings
1213
min.compiler.url = http://closure-compiler.googlecode.com/files/compiler-latest.zip

build/build.xml

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
<arg line="-i ${doc.txt}" />
1515
<arg line="-o ${doc.format} ${doc.out}" />
1616
<arg line="-p ${doc.project}" />
17+
<arg line="-s ${doc.stylesheet}" />
1718
</exec>
1819
</target>
1920

build/docdata/Data/ConfigFileInfo.nd

0 Bytes
Binary file not shown.

build/docdata/Data/FileInfo.nd

+3-3
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@ JavaScript
66
/home/daff/Development/workspace/jquery.dform/doc/resources/highlighter/scripts/shBrushDelphi.js 1283892735 0 /home/daff/Development/workspace/jquery.dform/doc/resources/highlighter/scripts/shBrushDelphi.js
77
/home/daff/Development/workspace/jquery.dform/doc/resources/highlighter/scripts/shCore.js 1283892735 0 /home/daff/Development/workspace/jquery.dform/doc/resources/highlighter/scripts/shCore.js
88
/home/daff/Development/workspace/jquery.dform/doc/resources/highlighter/scripts/shBrushJavaFX.js 1283892735 0 /home/daff/Development/workspace/jquery.dform/doc/resources/highlighter/scripts/shBrushJavaFX.js
9+
/home/daff/Development/workspace/jquery.dform/src/dform.subscribers.js 1285795337 1 Subscribers
910
/home/daff/Development/workspace/jquery.dform/license.txt 1285781703 1 License
1011
/home/daff/Development/workspace/jquery.dform/doc/resources/highlighter/scripts/shBrushXml.js 1283892735 0 /home/daff/Development/workspace/jquery.dform/doc/resources/highlighter/scripts/shBrushXml.js
1112
/home/daff/Development/workspace/jquery.dform/doc/resources/highlighter/scripts/shBrushCSharp.js 1283892735 0 /home/daff/Development/workspace/jquery.dform/doc/resources/highlighter/scripts/shBrushCSharp.js
1213
/home/daff/Development/workspace/jquery.dform/doc/resources/highlighter/scripts/shAutoloader.js 1283892735 0 /home/daff/Development/workspace/jquery.dform/doc/resources/highlighter/scripts/shAutoloader.js
1314
/home/daff/Development/workspace/jquery.dform/doc/resources/highlighter/src/shCore.js 1283892735 0 /home/daff/Development/workspace/jquery.dform/doc/resources/highlighter/src/shCore.js
1415
/home/daff/Development/workspace/jquery.dform/doc/resources/highlighter/scripts/shBrushSass.js 1283892735 0 /home/daff/Development/workspace/jquery.dform/doc/resources/highlighter/scripts/shBrushSass.js
1516
/home/daff/Development/workspace/jquery.dform/readme.txt 1285782035 1 The Plugin
16-
/home/daff/Development/workspace/jquery.dform/src/jquery.dform.ext.js 1285778543 1 Extensions
1717
/home/daff/Development/workspace/jquery.dform/doc/resources/highlighter/scripts/shBrushAppleScript.js 1283892735 0 /home/daff/Development/workspace/jquery.dform/doc/resources/highlighter/scripts/shBrushAppleScript.js
1818
/home/daff/Development/workspace/jquery.dform/doc/resources/highlighter/scripts/shLegacy.js 1283892735 0 /home/daff/Development/workspace/jquery.dform/doc/resources/highlighter/scripts/shLegacy.js
1919
/home/daff/Development/workspace/jquery.dform/doc/resources/highlighter/scripts/shBrushCpp.js 1283892735 0 /home/daff/Development/workspace/jquery.dform/doc/resources/highlighter/scripts/shBrushCpp.js
@@ -24,7 +24,6 @@ JavaScript
2424
/home/daff/Development/workspace/jquery.dform/doc/resources/highlighter/scripts/shBrushColdFusion.js 1283892735 0 /home/daff/Development/workspace/jquery.dform/doc/resources/highlighter/scripts/shBrushColdFusion.js
2525
/home/daff/Development/workspace/jquery.dform/doc/resources/highlighter/scripts/shBrushBash.js 1283892735 0 /home/daff/Development/workspace/jquery.dform/doc/resources/highlighter/scripts/shBrushBash.js
2626
/home/daff/Development/workspace/jquery.dform/doc/resources/highlighter/scripts/shBrushRuby.js 1283892735 0 /home/daff/Development/workspace/jquery.dform/doc/resources/highlighter/scripts/shBrushRuby.js
27-
/home/daff/Development/workspace/jquery.dform/src/jquery.dform.subscriptions.js 1285782129 1 Subscribers
2827
/home/daff/Development/workspace/jquery.dform/doc/resources/highlighter/scripts/shBrushPlain.js 1283892735 0 /home/daff/Development/workspace/jquery.dform/doc/resources/highlighter/scripts/shBrushPlain.js
2928
/home/daff/Development/workspace/jquery.dform/doc/resources/highlighter/src/shAutoloader.js 1283892735 0 /home/daff/Development/workspace/jquery.dform/doc/resources/highlighter/src/shAutoloader.js
3029
/home/daff/Development/workspace/jquery.dform/doc/resources/highlighter/scripts/shBrushCss.js 1283892735 0 /home/daff/Development/workspace/jquery.dform/doc/resources/highlighter/scripts/shBrushCss.js
@@ -34,7 +33,8 @@ JavaScript
3433
/home/daff/Development/workspace/jquery.dform/doc/resources/highlighter/compass/config.rb 1283892735 0 /home/daff/Development/workspace/jquery.dform/doc/resources/highlighter/compass/config.rb
3534
/home/daff/Development/workspace/jquery.dform/doc/resources/highlighter/scripts/shBrushPython.js 1283892735 0 /home/daff/Development/workspace/jquery.dform/doc/resources/highlighter/scripts/shBrushPython.js
3635
/home/daff/Development/workspace/jquery.dform/doc/resources/highlighter/scripts/shBrushAS3.js 1283892735 0 /home/daff/Development/workspace/jquery.dform/doc/resources/highlighter/scripts/shBrushAS3.js
37-
/home/daff/Development/workspace/jquery.dform/src/jquery.dform.js 1285782140 1 Plugin Documentation
36+
/home/daff/Development/workspace/jquery.dform/src/dform.js 1285793231 1 Plugin Documentation
37+
/home/daff/Development/workspace/jquery.dform/src/dform.extensions.js 1285793060 1 Extensions
3838
/home/daff/Development/workspace/jquery.dform/doc/resources/highlighter/scripts/shBrushVb.js 1283892735 0 /home/daff/Development/workspace/jquery.dform/doc/resources/highlighter/scripts/shBrushVb.js
3939
/home/daff/Development/workspace/jquery.dform/doc/resources/highlighter/scripts/shBrushPerl.js 1283892735 0 /home/daff/Development/workspace/jquery.dform/doc/resources/highlighter/scripts/shBrushPerl.js
4040
/home/daff/Development/workspace/jquery.dform/doc/resources/highlighter/scripts/shBrushErlang.js 1283892735 0 /home/daff/Development/workspace/jquery.dform/doc/resources/highlighter/scripts/shBrushErlang.js

build/docdata/Data/IndexInfo.nd

0 Bytes
Binary file not shown.
-16 Bytes
Binary file not shown.

build/docdata/Data/SymbolTable.nd

-154 Bytes
Binary file not shown.

build/docdata/Menu.txt

+3-3
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,11 @@ Footer: Copyright (C) 2010 - David Luecke - daff@neyeon.de
5050

5151

5252
File: The Plugin (/home/daff/Development/workspace/jquery.dform/readme.txt)
53-
File: Subscribers (/home/daff/Development/workspace/jquery.dform/src/jquery.dform.subscriptions.js)
54-
File: Extensions (/home/daff/Development/workspace/jquery.dform/src/jquery.dform.ext.js)
55-
File: Plugin Documentation (/home/daff/Development/workspace/jquery.dform/src/jquery.dform.js)
5653
File: Customization (/home/daff/Development/workspace/jquery.dform/customize.txt)
5754
File: License (/home/daff/Development/workspace/jquery.dform/license.txt)
55+
File: Plugin Documentation (/home/daff/Development/workspace/jquery.dform/src/dform.js)
56+
File: Extensions (/home/daff/Development/workspace/jquery.dform/src/dform.extensions.js)
57+
File: Subscribers (/home/daff/Development/workspace/jquery.dform/src/dform.subscribers.js)
5858

5959
Group: Index {
6060

doc/index.html

+1
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,7 @@ <h3>Registration form</h3>
282282
"value" : "Europe"
283283
},
284284
"asia" : "Asia",
285+
"africa" : "Africa",
285286
"australia" : "Australia"
286287
}
287288
}

license.txt

+2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ Title: License
22

33
Copyright (C) 2010 <David Luecke at daff@neyeon.de>, http://neyeon.com/p/dform/
44

5+
The MIT license:
6+
57
Permission is hereby granted, free of charge, to any person obtaining
68
a copy of this software and associated documentation files (the
79
"Software"), to deal in the Software without restriction, including

src/dform.extensions.js

+17-12
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,19 @@
88
/**
99
* file: Extensions
1010
*
11-
* About:
12-
* Subscribers for supporting external jQuery Plugins
13-
* (like <jQuery UI at http://jquerui.com> and the <validation plugin
14-
* at http://bassistance.de/jquery-plugins/jquery-plugin-validation/>).
11+
* There are many great form related jQuery Plugins out there. The extension package
12+
* provides out of the box support for some of these plugins.
1513
*
16-
* Only subscribes if the elements (like validate, tabs, slider, progressbar etc.)
17-
* are actually available (in case you are using customs builds).
18-
* Make sure, that these plugins have been loaded before.
14+
* Currently supported plugins:
15+
* - <jQuery UI>
16+
* - The <Validation Plugin>
17+
*
18+
* The corresponding subscribers will only be added if the plugin or the part of the plugin
19+
* (e.g. with jQuery UI custom builds that don't include all the widgets)
20+
* is actually available, so make sure, these plugins are loaded before the dform plugin.
21+
*
22+
* Read in the <Customization> chapter, how you can extend the dForm Plugin with your own
23+
* element types and subscribers.
1924
*
2025
* Author:
2126
* David Luecke (daff@neyeon.de)
@@ -36,7 +41,7 @@
3641
* options - As specified in the <jQuery UI progressbar documentation at
3742
* http://jqueryui.com/demos/progressbar/>
3843
*/
39-
$.dform.subscribeIf($.isFunction($.fn.progressbar), "[type=progressbar]",
44+
$.dform.addTypeIf($.isFunction($.fn.progressbar), "progressbar",
4045
function(options)
4146
{
4247
var ops = _getOptions("progressbar", options);
@@ -52,7 +57,7 @@
5257
* options - As specified in the <jQuery UI slider documentation at
5358
* http://jqueryui.com/demos/slider/>
5459
*/
55-
$.dform.subscribeIf($.isFunction($.fn.slider), "[type=slider]",
60+
$.dform.addTypeIf($.isFunction($.fn.slider), "slider",
5661
function(options)
5762
{
5863
var ops = _getOptions("slider", options);
@@ -71,7 +76,7 @@
7176
* Todo:
7277
* Not finished yet
7378
*/
74-
$.dform.subscribeIf($.isFunction($.fn.accordion), "[type=accordion]",
79+
$.dform.addTypeIf($.isFunction($.fn.accordion), "accordion",
7580
/**
7681
* Creates a container for the jQuery UI accordion.
7782
* @param options object All parameters for this type
@@ -92,8 +97,8 @@
9297
* options - As specified in the <jQuery UI tabs documentation at
9398
* http://jqueryui.com/demos/tabs/>
9499
*/
95-
$.dform.subscribeIf($.isFunction($.fn.tabs),
96-
"[type=tabs]", function(options)
100+
$.dform.addTypeIf($.isFunction($.fn.tabs),
101+
"tabs", function(options)
97102
{
98103
var ops = _getOptions("tabs", options);
99104
return $("<div>").attr(ops.attributes);

src/dform.js

+81-21
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,32 @@
88
/**
99
* file: Plugin Documentation
1010
*
11-
* About:
12-
* The dForm core jQuery plugin, providing helper and the jQuery plugin
13-
* functions.
11+
* This is the documentation for the plugin functions itself.
1412
*
1513
* Author:
1614
* David Luecke (daff@neyeon.de)
1715
*/
1816
(function($)
1917
{
2018
var _subscriptions = {};
19+
var _types = {};
20+
21+
function _addToObject(obj, data, fn)
22+
{
23+
if (typeof (data) == "string")
24+
{
25+
if (!$.isArray(obj[data])) {
26+
obj[data] = [];
27+
}
28+
obj[data].push(fn);
29+
} else if (typeof (data) == "object")
30+
{
31+
$.each(data, function(name, fn)
32+
{
33+
_addToObject(obj, name, fn);
34+
});
35+
}
36+
}
2137

2238
/**
2339
* section: Global helper functions
@@ -125,6 +141,63 @@
125141
}
126142
return $.withoutKeys(object, ignores);
127143
},
144+
/**
145+
* function: removeType
146+
*
147+
* Delete an element type.
148+
*
149+
* Parameters:
150+
* name - The name of the type to delete
151+
*/
152+
removeType : function(name)
153+
{
154+
delete _types[name];
155+
},
156+
/**
157+
* function: typeNames
158+
*
159+
* Returns the names of all types registered
160+
*/
161+
typeNames : function()
162+
{
163+
return $.keyset(_types);
164+
},
165+
/**
166+
* function: type
167+
*
168+
* Register a element type function.
169+
*
170+
* Parameters:
171+
* data - Can either be the name of the type
172+
* function or an object that contains name : type function
173+
* pairs
174+
* fn - The function that creates a new type element
175+
*/
176+
addType : function(data, fn)
177+
{
178+
_addToObject(_types, data, fn);
179+
},
180+
/**
181+
* function: addTypeIf
182+
*
183+
* Register a element type function.
184+
*
185+
* Parameters:
186+
* condition - The condition under which to subscribe
187+
* data - Can either be the name of the type builder
188+
* function or an object that contains name : type function
189+
* pairs
190+
* fn - The function to subscribe or nothing if an object is passed for data
191+
*
192+
* See also:
193+
* <addType>
194+
*/
195+
addTypeIf : function(condition, data, fn)
196+
{
197+
if(condition) {
198+
$.dform.addType(data, fn);
199+
}
200+
},
128201
/**
129202
* function: subscriberNames
130203
*
@@ -147,19 +220,7 @@
147220
*/
148221
subscribe : function(data, fn)
149222
{
150-
if (typeof (data) == "string")
151-
{
152-
if (!$.isArray(_subscriptions[data])) {
153-
_subscriptions[data] = [];
154-
}
155-
_subscriptions[data].push(fn);
156-
} else if (typeof (data) == "object")
157-
{
158-
$.each(data, function(name, fn)
159-
{
160-
$.dform.subscribe(name, fn);
161-
});
162-
}
223+
_addToObject(_subscriptions, data, fn);
163224
},
164225
/**
165226
* function: subscribeIf
@@ -231,14 +292,13 @@
231292
if (!type) {
232293
throw "No element type given! Must always exist.";
233294
}
234-
var name = "[type=" + options.type + "]";
235295
var element = null;
236296
// We don't need the type key in the options
237297
var ops = $.withoutKeys(options, "type");
238-
if (_subscriptions[name])
298+
if (_types[type])
239299
{
240-
// Run all builder functions called [type=<typename>]
241-
$.each(_subscriptions[name], function(i, sfn) {
300+
// Run all type element builder functions called typename
301+
$.each(_types[type], function(i, sfn) {
242302
element = sfn.call(element, ops);
243303
});
244304
}
@@ -334,7 +394,7 @@
334394
/**
335395
* function: formElement
336396
*
337-
* Creates a form element on a element with given options
397+
* Creates a form element on an element with given options
338398
*
339399
* Parameters:
340400
* options - The options to use

0 commit comments

Comments
 (0)