File tree Expand file tree Collapse file tree 2 files changed +43
-5
lines changed
Expand file tree Collapse file tree 2 files changed +43
-5
lines changed Original file line number Diff line number Diff line change 1010 document . getElementById ( 'photos_' + g ) . appendChild ( thephoto ) ;
1111 } ;
1212
13+ var menNums = randomNums ( 95 ) ;
14+ var womenNums = randomNums ( 95 ) ;
15+ var legoNums = randomNums ( 9 ) ; // Legos are people too
16+
1317 for ( var i = 0 ; i <= 99 ; i ++ ) {
14- createImage ( i , 'men' ) ;
18+ createImage ( menNums [ i ] , 'men' ) ;
1519 }
20+
1621 for ( var i = 0 ; i <= 95 ; i ++ ) {
17- createImage ( i , 'women' ) ;
22+ createImage ( womenNums [ i ] , 'women' ) ;
1823 }
24+
1925 for ( var i = 0 ; i <= 9 ; i ++ ) {
20- createImage ( i , 'lego' ) ;
26+ createImage ( legoNums [ i ] , 'lego' ) ;
2127 }
2228
2329 Array . prototype . slice . call ( document . getElementsByTagName ( 'img' ) ) . forEach ( function ( el ) {
6773 }
6874 } ) ( ) ;
6975 }
76+
77+ // It's <insert year here>, gotta be PC
78+ function randomNums ( amt ) {
79+ function shuffle ( array ) {
80+ var m = array . length , t , i ;
81+
82+ // While there remain elements to shuffle…
83+ while ( m ) {
84+
85+ // Pick a remaining element
86+ i = Math . floor ( Math . random ( ) * m -- ) ;
87+
88+ // And swap it with the current element.
89+ t = array [ m ] ;
90+ array [ m ] = array [ i ] ;
91+ array [ i ] = t ;
92+ }
93+
94+ return array ;
95+ }
96+ return shuffle ( new Array ( amt ) . fill ( 0 ) . map ( function ( v , i ) { return i ; } ) ) ;
97+ }
7098} ) ( ) ;
Original file line number Diff line number Diff line change 1414
1515 <div class =" frame" >
1616
17+ <% if (Math .floor (Math .random () * 2 ) === 1 ) { % >
18+ < section id= " women" >
19+ < h2> Ladies< / h2>
20+ < div id= " photos_women" >< / div>
21+ < / section>
22+ < section id= " men" >
23+ < h2> Gentlemen< / h2>
24+ < div id= " photos_men" >< / div>
25+ < / section>
26+ < % } else { % >
1727 < section id= " men" >
1828 < h2> Gentlemen< / h2>
1929 < div id= " photos_men" >< / div>
2030 < / section>
21-
2231 < section id= " women" >
2332 < h2> Ladies< / h2>
2433 < div id= " photos_women" >< / div>
2534 < / section>
26-
35+ < % } %>
2736 <section id =" lego" >
2837 <h2 >Lego</h2 >
2938 <div id =" photos_lego" ></div >
3039 </section >
40+
3141 <% include ../ snippets/ ads %>
3242 </div >
3343 <% include ../ snippets/ footer %>
You can’t perform that action at this time.
0 commit comments