Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding the Unit Testing and changes in README.md
- Loading branch information
Showing
7 changed files
with
4,541 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<projectDescription> | ||
<name>Cutter.js</name> | ||
<comment></comment> | ||
<projects> | ||
</projects> | ||
<buildSpec> | ||
</buildSpec> | ||
<natures> | ||
</natures> | ||
</projectDescription> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
# Cutter.js | ||
Cutter.js is a class to truncate HTML code to limit its length, by words number, without losing the markup. | ||
|
||
## Description | ||
|
||
Cutter solves the problem when its needed to cut some content by a number of words but its mandatory no lose any markup. | ||
Cutter cuts the content to the number of requested words and if needed puts a link to open the full content again. | ||
|
||
### Some benefits: | ||
|
||
* No markup is lost. | ||
* The content can be written without take care about the full content. | ||
* Not needed to have two different contents. | ||
* Crossbrowsing | ||
* Tested on: | ||
* IE > 6 | ||
* Firefox > 3 | ||
* Safari > 4 | ||
* Google Chrome | ||
* Opera > 9 | ||
* Only 1.4kb when Gzipped. | ||
|
||
|
||
[API documentation](https://github.com/tcorral/Cutter.js/examples_and_documents/jsdoc/index.html) | ||
|
||
[Examples](https://github.com/tcorral/Cutter.js/examples_and_documents/index.html) to see for yourself! | ||
|
||
## Usage | ||
|
||
### Before using it: | ||
Insert in your code: | ||
|
||
<script type="text/javascript" src="/path/to/your/js/libs/Cutter.js"></script> | ||
|
||
### Simple execution: | ||
|
||
Cutter.run(oApplyTo, oTarget, nWords, [oTexts, oClasses]); | ||
|
||
Mandatory | ||
|
||
oAplyTo: The element where the cutter will cut the content | ||
|
||
oTarget: The element where the content will be attached after cut it. | ||
|
||
nWords: Number of words to cut the content. | ||
|
||
Optional | ||
|
||
oTexts: The texts config object with the text that will be showed if the link, to open the full content,is needed | ||
oTexts by default: { more: "View more"}. | ||
|
||
oClasses: The style config object with the class to style the link if needed. | ||
oClasses by default: { more: "more"}. | ||
|
||
*Tip: oTarget Could be the same oApplyTo element if we want to replace the full content with the cut content* | ||
*Tip: If you only need to change the style you can * | ||
|
||
## Documentation | ||
|
||
[API documentation](https://github.com/tcorral/Cutter.js/examples_and_documents/jsdoc/index.html) | ||
|
||
[Examples](https://github.com/tcorral/Cutter.js/examples_and_documents/index.html) to see for yourself! | ||
|
||
## License | ||
|
||
Cutter.js is licensed under the MIT license. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
server: http://localhost:4424 | ||
|
||
load: | ||
- lib/*.js | ||
- src/*.js | ||
- test/*.js |
Oops, something went wrong.