0
|
1 |
var programs = 'commercial urbanism public-space culture body-culture health education housing hotel media'.split(' '), |
|
2 |
programsLen = programs.length, |
|
3 |
statuses = 'idea in-progress under-construction completed'.split(' '), |
|
4 |
statusesLen = statuses.length; |
|
5 |
|
|
6 |
function randInt(num) { |
|
7 |
return Math.floor( Math.random() * num ); |
|
8 |
} |
|
9 |
|
|
10 |
function getChar() { |
|
11 |
var code; |
|
12 |
if ( Math.random() < 0.05 ) { |
|
13 |
// number |
|
14 |
code = randInt(10) + 48; |
|
15 |
} else { |
|
16 |
// alpha |
|
17 |
code = randInt(24) + 65; |
|
18 |
} |
|
19 |
return String.fromCharCode(code); |
|
20 |
} |
|
21 |
|
|
22 |
function makeBigGraphProject() { |
|
23 |
var year = 2001 + randInt(11), |
|
24 |
i = Math.floor( Math.random() * 2 + 3 ), |
|
25 |
title = ''; |
|
26 |
while (i--) { |
|
27 |
title += getChar(); |
|
28 |
} |
|
29 |
var program = programs[ randInt( programsLen ) ]; |
|
30 |
status = statuses[ randInt( statusesLen ) ]; |
|
31 |
scale = randInt(20); |
|
32 |
|
|
33 |
project = '<div class="project ' + program + '" ' + |
|
34 |
'data-year="' + year + '" ' + |
|
35 |
'data-program="' + program + '" ' + |
|
36 |
'data-scale="' + scale + '" ' + |
|
37 |
'data-status="' + status + '" ' + |
|
38 |
'><div class="icon"></div>' + |
|
39 |
'<p class="title">' + title + '</p>' + |
|
40 |
'</div>'; |
|
41 |
|
|
42 |
return project; |
|
43 |
} |