-
Notifications
You must be signed in to change notification settings - Fork 6
/
site.js
58 lines (50 loc) · 1.53 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
50
51
52
53
54
55
56
57
58
function is(os) {
return navigator.userAgent.search(os) >= 0;
}
function detectOS() {
if (is('Debian') || is('Ubuntu')) { return 'linux-debian'; }
if (is('Fedora')) { return 'linux-fedora'; }
if (is('Red Hat')) { return 'linux-redhat'; }
if (is('SUSE')) { return 'linux-suse'; }
if (is('Arch')) { return 'linux-arch'; }
if (is('Linux')) { return 'linux-generic'; }
if (is('OS X')) { return 'mac-homebrew'; }
if (is('Windows')) { return 'windows'; }
return null;
}
function hideTabs() {
$('.nav-tabs a.nav-link').removeClass('active');
$('.tab-body').hide();
}
function showTab(name) {
$('.nav-tabs a.nav-link[href="#' + name + '"]').addClass('active');
$('#' + name + '-tab').show();
}
function updateTabs() {
hideTabs();
if (window.location.hash) {
tabName = window.location.hash.slice(1);
if (tabName == 'linux') { tabName = 'linux-generic'; }
if (tabName == 'mac') { tabName = 'mac-homebrew'; }
} else {
tabName = detectOS();
if (tabName == null) return;
}
history.replaceState({}, '', '#' + tabName);
showTab(tabName.split('-')[0]);
showTab(tabName);
}
function copy(id) {
$('#' + id).select();
document.execCommand('copy');
}
$(window).bind('hashchange', updateTabs);
$(function() {
updateTabs();
if (is('Windows NT 6.2') || is('Windows NT 6.3') || is('Windows NT 10.0')) {
$('#windows-tls-notice').hide();
}
if (is('Windows NT 10.0')) {
$('#windows-netframework-notice').hide();
}
});