# HG changeset patch # User hamidouk # Date 1327058451 -3600 # Node ID f1dbe6a6e740453c208177ebaf3990975e9a3a26 # Parent 973d9a495d11a9ade35748a7ed0f7faea8136dc2 made a function to cleanly cut a string. diff -r 973d9a495d11 -r f1dbe6a6e740 src/js/utils.js --- a/src/js/utils.js Fri Jan 20 12:20:36 2012 +0100 +++ b/src/js/utils.js Fri Jan 20 12:20:51 2012 +0100 @@ -165,6 +165,14 @@ return url; }; +/** Similar to substr but remove the last word if + we're breaking a word in two. + */ +IriSP.clean_substr = function(str, start, end) { + var s = str.substr(start, end).substr(start, end).split(" "); + s.pop(); + return s.join(" "); +}; /* for ie compatibility if (Object.prototype.__defineGetter__&&!Object.defineProperty) { Object.defineProperty=function(obj,prop,desc) {