Sha256: d6f869d6badb1607c317ae3a091365ebcc3c26142a09d4b14cb7676bd1016ee8
Contents?: true
Size: 955 Bytes
Versions: 1
Compression:
Stored size: 955 Bytes
Contents
/** * Shortens DOM text strings and stores full string in title attribute * @Require util.truncate_string */ sadui.short_text = function(conf){ var opts = { // $el: $() state: 'closed',//open truncate: 25, ellipses: '…', method: 'words' }; $.extend(opts,conf); var init = function(){ conf.$el.each(function(){ var $this = $(this), text = $this.text(); var truncate = sadui.util.truncate_string(text, { sizes: { short: opts.truncate } }); if (truncate.truncate.short[1].length > 0) { $this.html( truncate.truncate.short[0] + opts.ellipses ) .attr('title', truncate.truncate.original); } else { $this.html( truncate.truncate.short[0] ); } }); }; init(); };
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
sadui-0.0.4 | vendor/assets/javascripts/sadui/components/short_text.js |