new mooreadall(options)
Tool designed to cut html string preserving the html structure, without breaking tags.
Parameters:
Name | Type | Argument | Description | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object |
<optional> |
A class options object
Properties
|
- Source:
- src/tools/mooreadall.js, line 82
Example
var mr = new ajs.tools.mooreadall({
action: 'inplace'
});
mr.add('.expand');
Methods
-
actionLink(element, html, cut_html, prop) → {String}
Returns the anchor/span "read all" link, depending on the action option.
-
Parameters:
Name Type Description element
Element The dom element which contains the text to truncate html
String The whole content cut_html
String The truncated content prop
Object The definitive option object - Source:
- src/tools/mooreadall.js, line 366
Returns:
The action controller- Type
- String
-
add(elements, opts)
Applies the text truncation to the given elements with the given options
-
Parameters:
Name Type Description elements
Mixed The elements whose content has to be truncated. Possible values are: - A css selector
- An array of dom elements
- A dom element
opts
Object The options to use when performing the cut action, see the constructor for the available options - Source:
- src/tools/mooreadall.js, line 172
Returns:
void -
apply(element, opts)
Applies the text truncation to the given element with the given options
-
Parameters:
Name Type Description element
Element The dom element opts
Object The options to use when performing the cut action - Source:
- src/tools/mooreadall.js, line 191
Returns:
void -
closeLayer()
Closes the layer.
-
- Source:
- src/tools/mooreadall.js, line 501
Returns:
void -
cut(html, prop) → {String}
Performs the cut of the html content preserving the html structure and good formatting
-
Parameters:
Name Type Description html
String The whole html content to cut. Global or local options are used (number of words, remove_tags) prop
Object The definitive option object - Source:
- src/tools/mooreadall.js, line 251
Returns:
The truncated html text- Type
- String
-
<protected> disableObjects()
Disables document objects.
-
- Source:
- src/tools/mooreadall.js, line 598
Returns:
void -
<protected> enableObjects()
Enables document objects.
-
- Source:
- src/tools/mooreadall.js, line 619
Returns:
void -
<protected> hideElement(element, prop)
Hides the element which contains the text to truncate basing upon the display_style option
-
Parameters:
Name Type Description element
Element The dom element prop
Object The definitive option object - Source:
- src/tools/mooreadall.js, line 223
Returns:
void -
<protected> layerBody(html)
Sets the layer content.
-
Parameters:
Name Type Description html
String The html content - Source:
- src/tools/mooreadall.js, line 491
Returns:
void -
<protected> layerTitle(element)
Creates the layer title taking the data-title element attribute.
-
Parameters:
Name Type Description element
Element The dom element which contains the text to truncate - Source:
- src/tools/mooreadall.js, line 475
Returns:
void -
<protected> makeDraggable()
Makes the layer draggable.
-
- Source:
- src/tools/mooreadall.js, line 513
Returns:
void -
<protected> makeResizable()
Makes the layer resizable.
-
- Source:
- src/tools/mooreadall.js, line 532
Returns:
void -
<protected> makeTextResizable()
Makes the layer text resizable.
-
- Source:
- src/tools/mooreadall.js, line 551
Returns:
void -
renderLayer(element, html, prop)
Renders the layer.
-
Parameters:
Name Type Description element
Element The dom element which contains the text to truncate html
String The whole content prop
Object The definitive option object - Source:
- src/tools/mooreadall.js, line 433
Returns:
void -
<protected> renderOverlay(element, html, prop)
Renders an overlay (lightbox style).
-
Parameters:
Name Type Description element
Element The dom element which contains the text to truncate html
String The whole content prop
Object The definitive option object - Source:
- src/tools/mooreadall.js, line 643
Returns:
void -
<protected> sameDomain(win) → {Boolean}
Checks if a window object is of the same domain as the main one.
-
Parameters:
Name Type Description win
Element The window object - Source:
- src/tools/mooreadall.js, line 580
Returns:
Whether or not the given window has the same domain- Type
- Boolean
-
<protected> setProperties() → {Object}
Creates the object used to apply the tool, merging global options and local options (passed to the add or apply methods)
-
- Source:
- src/tools/mooreadall.js, line 102
Returns:
The final options object- Type
- Object
-
<protected> showElement(element, prop)
Shows the element which contains the text to truncate basing upon the display_style option
-
Parameters:
Name Type Description element
Element The dom element prop
Object The definitive option object - Source:
- src/tools/mooreadall.js, line 238
Returns:
void -
showInLayer(element, html, prop)
Shows the entire html text in a layer (lightbox style).
-
Parameters:
Name Type Description element
Element The dom element which contains the text to truncate html
String The whole content prop
Object The definitive option object - Source:
- src/tools/mooreadall.js, line 417
Returns:
void