From 62c22377739c4ec7858099965d10d423ef03f20e Mon Sep 17 00:00:00 2001 From: Sam Minnee Date: Tue, 28 Aug 2007 22:03:18 +0000 Subject: [PATCH] Improved ingize() support so that it works on multi-word verbs git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@40997 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- javascript/LeftAndMain.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/javascript/LeftAndMain.js b/javascript/LeftAndMain.js index af659019..f755d65d 100644 --- a/javascript/LeftAndMain.js +++ b/javascript/LeftAndMain.js @@ -234,9 +234,19 @@ function prepareAjaxActions(actions, formName, tabName) { } function ingize(val) { + var ingWord, suffix; if(!val) val = "process"; - if(val.substr(val.length-1) == 'e') return val.substr(0, val.length-1) + 'ing...'; - else return val + 'ing...'; + + if(val.match(/^([^ ]+) +(.*)$/)) { + ingWord = RegExp.$1; + suffix = ' ' + RegExp.$2 + '...'; + } else { + ingWord = val; + suffix = '...'; + } + + if(ingWord.match(/^(.*)e$/)) return RegExp.$1 + 'ing' + suffix; + else return ingWord + 'ing' + suffix; } /**