aboutsummaryrefslogtreecommitdiff
path: root/assets/js/ps-app.js
blob: 7675ec48de1819195f40dac9518d03f90d10b267 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
(function($) {

    $(document).ready(function() {

	// Make each .media section clickable to reach ./<id>/
	[ 'gfx', 'txt', 'vdo' ].forEach(function(id) {
	    $('#' + id)
		.click(function(e) {
		    window.location = `/${id}/`;
		    return false
		})
		.mouseover(function(e) {
		    e.target.style.cursor = 'pointer'
		    return false
		})
		.mouseout(function(e) {
		    e.target.style.cursor = 'not-allowed'
		    return false
		})
	})
	$('.media').mouseout(function(e) {
	    e.target.style.cursor = 'auto'
	    return false
	})

	// EN/FR switch
	$('footer')
	    .append('<button id="lang-switch" title="Read in English">EN</button>')
	$('#lang-switch').click(function(e) {
	    var lang = $('html').attr('lang')
	    if (lang == 'fr') {
		$('html').attr('lang', 'en')
		$(e.target).html('FR').attr('title', 'Lire en français')
	    } else {
		$('html').attr('lang', 'fr')
		$(e.target).html('EN').attr('title', 'Read in English')
	    }
	    return false
	})

    });

})($)