about summary refs log tree commit diff
path: root/usth/ICT3.2/prac/1/task11.js
blob: 55d7eba4859a0bd267900f4cb28041c26e86cde6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
const files = {'cat': ['lick-vet-penis.png', 'lsd-dragon.jpg',
                       'nailed-moonwalk.gif', 'not-exist.jpg',
                       'oh.gif', 'ooer.jpg', 'pan.jpg'],
               'communist': ['black-hole.png', 'harry.jpg',
                             'nike.jpg', 'propaganda.jpg', 'sky.jpg'],
               'dog': ['centipede.png', 'couple.jpg', 'deliver.jpg',
                       'fight.gif', 'hit-karate-dad.jpg', 'pic.jpg']}

function cb(id) {
    let content = '<p>My name is Nguyễn Gia Phong<p>';
    if (id != 'about')
        content = files[id].map(file => `
            <a href='images/${id}/${file}' target='_blank'>
              <img src='images/${id}/${file}'>
            </a>`).join('');
    return () => document.getElementById('foobar').innerHTML = content;
}