Skip to content

Commit

Permalink
function for height option, bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
FrDH committed Jul 18, 2015
1 parent 77b9618 commit a4e7172
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 12 deletions.
9 changes: 9 additions & 0 deletions LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
The MIT License (MIT)

Copyright (c) 2015 Fred Heusschen

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "jQuery.dotdotdot",
"main": "src/js/jquery.dotdotdot.js",
"version": "1.7.3",
"version": "1.7.4",
"homepage": "http://dotdotdot.frebsite.nl/",
"authors": [
"Fred Heusschen <[email protected]>"
Expand Down
2 changes: 1 addition & 1 deletion dotdotdot.jquery.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "dotdotdot",
"version": "1.7.3",
"version": "1.7.4",
"title": "jQuery dotdotdot",
"description": "A jQuery plugin for advanced cross-browser ellipsis on multiple line content.",
"homepage": "http://dotdotdot.frebsite.nl",
Expand Down
6 changes: 3 additions & 3 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@
watch: 'window'
});


var $dot5 = $('#dot5');
$dot5.append( ' <a class="toggle" href="#"><span class="open">[ + ]</span><span class="close">[ - ]</span></a>' );



function createDots()
{
$dot5.dotdotdot({
Expand All @@ -52,7 +52,6 @@
}
);


$('#dot6 .pathname').each(function() {
var path = $(this).html().split( '/' );
if ( path.length > 1 ) {
Expand All @@ -64,6 +63,7 @@
});
}
});

});
</script>
<style type="text/css" media="all">
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "jQuery.dotdotdot",
"main": "src/js/jquery.dotdotdot.js",
"version": "1.7.3",
"version": "1.7.4",
"homepage": "http://dotdotdot.frebsite.nl/",
"author": "Fred Heusschen <[email protected]>",
"description": "A jQuery plugin for advanced cross-browser ellipsis on multiple line content.",
Expand Down
26 changes: 22 additions & 4 deletions src/js/jquery.dotdotdot.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* jQuery dotdotdot 1.7.3
* jQuery dotdotdot 1.7.4
*
* Copyright (c) Fred Heusschen
* www.frebsite.nl
Expand Down Expand Up @@ -60,9 +60,20 @@
e.preventDefault();
e.stopPropagation();

opts.maxHeight = ( typeof opts.height == 'number' )
? opts.height
: getTrueInnerHeight( $dot );
switch( typeof opts.height )
{
case 'number':
opts.maxHeight = opts.height;
break;

case 'function':
opts.maxHeight = opts.height.call( $dot[ 0 ] );
break;

default:
opts.maxHeight = getTrueInnerHeight( $dot );
break;
}

opts.maxHeight += opts.tolerance;

Expand Down Expand Up @@ -443,6 +454,13 @@
midPos = m;

setTextContent( e, textArr.slice( 0, midPos + 1 ).join( separator ) + o.ellipsis );
$i.children()
.each(
function()
{
$(this).toggle().toggle();
}
);

if ( !test( $i, o ) )
{
Expand Down
4 changes: 2 additions & 2 deletions src/js/jquery.dotdotdot.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit a4e7172

Please sign in to comment.