Skip to content

Commit

Permalink
Improved ingize() support so that it works on multi-word verbs
Browse files Browse the repository at this point in the history
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@40997 467b73ca-7a2a-4603-9d3b-597d59a354a9
  • Loading branch information
Sam Minnee committed Aug 28, 2007
1 parent 6c4a2e2 commit 62c2237
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions javascript/LeftAndMain.js
Expand Up @@ -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;
}

/**
Expand Down

0 comments on commit 62c2237

Please sign in to comment.