NF.replicator
(
type
,
config
)
- Parameters:
-
type <string>The type of object to replicate. Valid settings include... "content", "inlineStyle", "animation". -
config <Object>Object literal containing configuration properties for the replicator...- {master:Object | String} The master object to replicate. The type of object to use depends upon the type of replicator defined with the type paramater. The following are appropriate objects for each replicator type...
- "content" - A string containing the HTML to replicate. Clone Nodes are produced from the HTML string and added to the document.
- "inlineStyle" - An object literal containing script style name and value pairs, e.g. {borderWidth:1px,color:#00f}
- "animation" - A NF.anim.timeline or NF.anim.clip object. Widget clones play the timeline or clip based on the hooks you define.
- {widgetClass:String} Widgets with added replicators will create clones for Nodes with the same class name. The node to target may be futher specified using the 'targetClass' property. To target menu links ('nfLink') set the widgetClass property to 'nfItem' and the targetClass property to 'nfLink'. The target can be an array of strings with different search options allowing for complex targeting, see the targetClass property below for more delails. Valid widgetClass names for the menu widget include...
- "nfSubC" - A sub menu container.
- "nfItem" - A menu item.
- {widgetLevel:Int | String} Target specific levels for widgets using hierarchial structures such as the menu. Use an int value representing the level to target or an expression to evaluate which includes the keyword 'level'...
- widgetLevel:0 - Targets the main menu or main items.
- widgetLevel:1 - Targets all level 1 subs or items.
- widgetLevel:"level>0" - Targets all subs or sub items.
- widgetLevel:"level==2 && level==3" - Targets level 2 and 3 subs or items.
- {targetClass:String | String Array} Target child Nodes with matching classNames. When using the replicators addNode method, the child search starts at the supplied parent Node. When the replicator is added to a widget the child search starts at the matching widgetClass Node.
Multiple searches may be combined by using an array of classNames and nested Array objects which specify special search features. The search is performed in order starting with the first item in the Array. Each array item may include one of the following... - String - className: Targets the root or first descendant Node with a matching className.
- 1-3 Item Array - [1 - type: (string | int), 2 - className: (string | string Array), 3 - matchAll: (boolean)]: - Array containing 1-3 items. 1 - Type: The type may be "first-child", "last-child", or a number (N'th child). 2 - ClassName: The optional className specifies the child className filter to use, this may be a single class or an Array of classes. 3 - matchAll: The optional third item specifies how to filter multiple classNames, match them all, or match one.
- {excludeClass:String} Use in conjunction with the 'targetClass' property to exclude target nodes with a specific class name. A popular use with the menu widget is to set the targetClass to 'nfLink' and the excludeClass to 'nfParentLink'. This example would replicate clones on all menu items except for items with child sub menus.
- {addWhere:String} With a 'content' type replicator this property specifies where the new cloned Nodes will be added relative to the supplied Node (when using addClone), the targeted widgetClass Node, or targeted targetClass Node. Valid setting options include... "first-child", "last-child", "replace-child", "before", "after", "replace", "wrap"
- {wrapTargetClass:String} When using an 'addWhere' value of 'wrap' this property specifies a specific container within your content to use as the wrapper. Specify a className string value which matches a unique className for the node.
- {master:Object | String} The master object to replicate. The type of object to use depends upon the type of replicator defined with the type paramater. The following are appropriate objects for each replicator type...