// Browser detection for when you get desparate. A measure of last resort. // http://rog.ie/post/9089341529/html5boilerplatejs // var b = document.documentElement; // b.setAttribute('data-useragent', navigator.userAgent); // b.setAttribute('data-platform', navigator.platform); // sample CSS: html[data-useragent*='Chrome/13.0'] { ... } // remap jQuery to $ (function($){ /* trigger when page is ready */ $(document).ready(function (){ function trimText(text, max_length){ if(typeof max_length != 'number') max_length = 600; else max_length = parseInt(max_length); text = text.trim().replace(/ +(?= )/g,''); if (text.length <=max_length ) return text; var split_text = text.match(/.{1,max_length}/g); var last_text = ''; for(var i=0; i max) max = tmp; } return max; } }); /* optional triggers $(window).load(function() { }); $(window).resize(function() { }); */ })(window.jQuery);