o: ActiveSupport::Cache::Entry :@compressedF:@expires_in0:@created_atf1364311661.172352:@value"{I" class:EFI"ProcessedAsset; FI"logical_path; FI""jquery/jquery.textTruncate.js; TI" pathname; FI"/Users/johanfrolich/.rvm/gems/ruby-1.9.3-p327@refinerycms-menus/gems/refinerycms-core-2.0.9/app/assets/javascripts/jquery/jquery.textTruncate.js; TI"content_type; FI"application/javascript; FI" mtime; FI"2013-02-04T15:34:04+01:00; FI"length; FiI"digest; F"%edab5932930c3dec15f49f5391009fc9I"source; FI"{ // a dummy block, so I can collapse all the meta stuff in the editor /**************************************************************************** * jQuery 1.3.x plugin to shorten styled text to fit in a block, appending * an ellipsis ("...", …, Unicode: 2026) or other text. * (Only supports ltr text for now.) * * This is achieved by placing the text of the 'selected' element (eg. span or * div) inside a table and measuring its width. If it's too big to big to fit in * the element's parent block it's shortened and measured again until it (and * appended ellipsis or text) fits inside the block. A tooltip on the 'selected' * element displays the full original text. * * If the browser supports truncating text using the 'text-overflow:ellipsis' * CSS property then that will be used (if the text to append is the default * ellipsis). * * If the text is truncated by the plugin any markup in the text will be * stripped (eg: " * By default the plugin will use the parent block's width as maximum width and * an ellipsis as appended text when truncating. * * There are three ways of configuring the plugin: * * 1) Passing a configuration hash as the plugin's argument, eg: .textTruncate({ width: 300, tail: ' more', tooltip: false }); * 2) Using two optional arguments (deprecated!): * width = the desired pixel width, integer * tail = text/html to append when truncating * * 3) By changing the plugin defaults, eg: $.fn.textTruncate.defaults.tail = ' more'; * Note: there is no default width (unless you create one). * * You may want to set the element's css to {visibility:hidden;} so it won't * initially flash at full width. * * * Created by M. David Green (www.mdavidgreen.com) in 2009. Free to use for * personal or commercial purposes under MIT (X11) license with no warranty * * Heavily modified/simplified/improved by Marc Diethelm (http://web5.me/). * ****************************************************************************/ } (function ($) { $.fn.textTruncate = function() { var userOptions = {}; var args = arguments; // for better minification var func = args.callee // dito; and much shorter than $.fn.textTruncate if ( args.length ) { if ( args[0].constructor == Object ) { userOptions = args[0]; } else if ( args[0] == "options" ) { return $(this).eq(0).data("options-truncate"); } else { userOptions = { width: parseInt(args[0]), tail: args[1] } } } this.css("visibility","hidden"); // Hide the element(s) while manipulating them // apply options vs. defaults var options = $.extend({}, func.defaults, userOptions); /** * HERE WE GO! **/ return this.each(function () { var $this = $(this); $this.data("options-truncate", options); /** * If browser implements text-overflow:ellipsis in CSS and tail is "...", use it! **/ if ( options.tail == "..." && func._native ) { this.style[func._native] = "ellipsis"; /*var css_obj = {} css_obj[func._native] = "ellipsis"; $this.css(css_obj);*/ $this.css("visibility","visible"); return true; } var width = options.width || $this.parent().width(); var text = $this.text(); var textlength = text.length; var css = "padding:0; margin:0; border:none; font:inherit;"; var $table = $('
' + options.tail + ' |