source: trunk/web/addons/job_monarch/lib/extjs-30/examples/grid/gen-names.js @ 625

Last change on this file since 625 was 625, checked in by ramonb, 15 years ago

lib/extjs-30:

  • new ExtJS 3.0
File size: 981 bytes
Line 
1/*!
2 * Ext JS Library 3.0.0
3 * Copyright(c) 2006-2009 Ext JS, LLC
4 * licensing@extjs.com
5 * http://www.extjs.com/license
6 */
7(function(){
8    var lasts = ['Jones', 'Smith', 'Lee', 'Wilson', 'Black', 'Williams', 'Lewis', 'Johnson', 'Foot', 'Little', 'Vee', 'Train', 'Hot', 'Mutt'];
9    var firsts = ['Fred', 'Julie', 'Bill', 'Ted', 'Jack', 'John', 'Mark', 'Mike', 'Chris', 'Bob', 'Travis', 'Kelly', 'Sara'];
10    var lastLen = lasts.length, firstLen = firsts.length;
11
12    Ext.ux.getRandomInt = function(min, max){
13        return Math.floor(Math.random() * (max - min + 1)) + min;
14    }
15
16    Ext.ux.generateName = function(){
17        var name = firsts[Ext.ux.getRandomInt(0, firstLen-1)] + ' ' + lasts[Ext.ux.getRandomInt(0, lastLen-1)];
18        if(Ext.ux.generateName.usedNames[name]){
19            return Ext.ux.generateName();
20        }
21        Ext.ux.generateName.usedNames[name] = true;
22        return name;
23    }
24    Ext.ux.generateName.usedNames = {};
25
26})();
Note: See TracBrowser for help on using the repository browser.