Skip to content

Commit

Permalink
minor optimization in ellipsis function
Browse files Browse the repository at this point in the history
  • Loading branch information
haarg committed Jul 9, 2015
1 parent a1c2975 commit e057900
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion root/static/js/cpan.js
Expand Up @@ -282,9 +282,9 @@ $(document).ready(function() {
var element = $(items[i]);
var boxWidth = element.width();
var textWidth = element.textWidth();
if (textWidth <= boxWidth) continue;
var text = element.text();
var textLength = text.length;
if (textWidth <= boxWidth) continue;
var parts = [text.substr(0, Math.floor(textLength / 2)), text.substr(Math.floor(textLength / 2), textLength)];
while (element.textWidth() > boxWidth) {
if (textLength % 2) {
Expand Down

0 comments on commit e057900

Please sign in to comment.