Init
Manipulator is designed to utilize the object nature of the DOM. Your HTML-page is already a wellformed object structure, and Util.init provides a simple way to extend your HTML nodes to meet the design and functionality requirements.
By adding initializer-classes to appropriate nodes, those nodes will be extended, if your current segment code contains a matching Manipulator-module. Otherwise it will be ignored. This behavior allows you to seamlessly apply different interfaces and functionality for different Detector segments - IE. a desktop segment may look and work different than a mobile segment.
This is how you create a Manipulator Object:
Util.Modules["object_name"] = new Function() {
this.init = function(node) {
// extend your node here
}
}
Apply your initializer classes to your HTML and call Util.init when needed, to create the site experience you want. Ie. call Util.init on load, to extend all nodes at the same time, or more specifically invoke scopes of your page as they become relevant.
Functions
Util.init
Definition
- Name
- Util.init
- Shorthand
- u.init
- Syntax
- Void = Util.init( [Node scope] );
Description
Manipulator object initializer. Finds all nodes in scope, with classname i:[objectname] and invokes Util.Modules[objectname].init(node) if available.
Parameters
- scope
-
Node Optional initialization scope. Default document.
Return values
Void
Examples
<div class="scene">
<div class="header i:header"></div>
<div class="footer"></div>
</div>
<script>
Util.init();
</script>
Finds div.header and invokes Util.Modules["header"].init(div.header), if it exists.
Dependencies
JavaScript
- typeof
Manipulator
- Util.getElements
- Util.classVar
- Util.removeClass
Files
Main file
- u-init.js
Segment support files
- none
Segment dependencies
- desktop_edge
- u-init.js + u-dom.js
- desktop_ie11
- u-init.js + u-dom.js
- desktop
- u-init.js + u-dom.js
- desktop_ie10
- u-init.js + u-dom.js + u-dom-desktop_ie.js
- desktop_ie9
- u-init.js + u-dom.js + u-dom-desktop_ie.js
- desktop_light
- u-init.js + u-dom.js + u-dom-desktop_light.js
- tablet
- u-init.js + u-dom.js
- tablet_light
- u-init.js + u-dom.js
- smartphone
- u-init.js + u-dom.js
- mobile
- not tested
- mobile_light
- not tested
- tv
- u-init.js + u-dom.js + u-dom-desktop_light.js
- seo
- not supported