Skip to content

Commit

Permalink
Adding the Unit Testing and changes in README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
tcorral committed Jul 31, 2011
1 parent a8609f3 commit 64c3532
Show file tree
Hide file tree
Showing 7 changed files with 4,541 additions and 0 deletions.
11 changes: 11 additions & 0 deletions .project
@@ -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>
66 changes: 66 additions & 0 deletions README.md
@@ -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.
6 changes: 6 additions & 0 deletions jsTestDriver.conf
@@ -0,0 +1,6 @@
server: http://localhost:4424

load:
- lib/*.js
- src/*.js
- test/*.js

0 comments on commit 64c3532

Please sign in to comment.