new mooreadall
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:
- mooreadall.js, line 82
Example
var mr = new ajs.tools.mooreadall({
action: 'inplace'
});
mr.add('.expand');
Methods
-
actionLink
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:
- mooreadall.js, line 366
Returns:
The action controller- Type
- String
-
add
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:
- mooreadall.js, line 172
Returns:
void -
apply
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:
- mooreadall.js, line 191
Returns:
void -
closeLayer
Closes the layer.
-
- Source:
- mooreadall.js, line 501
Returns:
void -
cut
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:
- mooreadall.js, line 251
Returns:
The truncated html text- Type
- String
-
<protected> disableObjects
Disables document objects.
-
- Source:
- mooreadall.js, line 598
Returns:
void -
<protected> enableObjects
Enables document objects.
-
- Source:
- mooreadall.js, line 619
Returns:
void -
<protected> hideElement
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:
- mooreadall.js, line 223
Returns:
void -
<protected> layerBody
Sets the layer content.
-
Parameters:
Name Type Description html
String The html content - Source:
- mooreadall.js, line 491
Returns:
void -
<protected> layerTitle
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:
- mooreadall.js, line 475
Returns:
void -
<protected> makeDraggable
Makes the layer draggable.
-
- Source:
- mooreadall.js, line 513
Returns:
void -
<protected> makeResizable
Makes the layer resizable.
-
- Source:
- mooreadall.js, line 532
Returns:
void -
<protected> makeTextResizable
Makes the layer text resizable.
-
- Source:
- mooreadall.js, line 551
Returns:
void -
renderLayer
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:
- mooreadall.js, line 433
Returns:
void -
<protected> renderOverlay
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:
- mooreadall.js, line 643
Returns:
void -
<protected> sameDomain
Checks if a window object is of the same domain as the main one.
-
Parameters:
Name Type Description win
{Element} The window object - Source:
- mooreadall.js, line 580
Returns:
Whether or not the given window has the same domain- Type
- Boolean
-
<protected> setProperties
Creates the object used to apply the tool, merging global options and local options (passed to the add or apply methods)
-
- Source:
- mooreadall.js, line 102
Returns:
The final options object- Type
- Object
-
<protected> showElement
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:
- mooreadall.js, line 238
Returns:
void -
showInLayer
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:
- mooreadall.js, line 417
Returns:
void