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
This commit is contained in:
Sam Minnee 2007-08-28 22:03:18 +00:00
parent 6c4a2e24aa
commit 62c2237773

View File

@ -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;
}
/**