-
Notifications
You must be signed in to change notification settings - Fork 14
/
site.js
49 lines (49 loc) · 1.7 KB
/
site.js
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
44
45
46
47
48
49
---
---
$(function() {
var app = window.app;
$('.dropdown.language-switcher').hover(
function() {
$('.dropdown-content.language-switcher').addClass('active');
},
function() {
$('.dropdown-content.language-switcher').removeClass('active');
}
);
$('.dropdown.quick-access').hover(
function() {
$('.dropdown-content.quick-access').addClass('active');
},
function() {
$('.dropdown-content.quick-access').removeClass('active');
}
);
$('.dropdown.language-switcher > a').on('touchstart', function(e) {
e.preventDefault();
$('.dropdown-content.language-switcher').toggleClass('active');
});
$('.dropdown.quick-access > a').on('touchstart', function(e) {
e.preventDefault();
$('.dropdown-content.quick-access').toggleClass('active');
});
$('.language-switcher a').each(function(i, e) {
if (app.permalink.length < 3) return;
var remainder = app.permalink.match(/(\/[^\/]+)(\/.*)/)[2];
var new_url = app.baseurl + '/' + $(e).attr('lang') + remainder;
$(e).attr('href', new_url);
});
$('.language-switcher a[lang=' + app.lang + ']').addClass('active');
// contribute banner pops out when hovered over
$('.banner').hover(
function() {
$(this).addClass('active').attr('href',window.app.baseurl + '/' + window.app.lang +'/contribute/');
setTimeout(function(){
$('.banner span').addClass('active');
},300);
},
function() {
$(this).removeClass('active').attr('href','');
$('.banner span').removeClass('active');
}
);
});