-
Notifications
You must be signed in to change notification settings - Fork 23
/
faq.html
104 lines (92 loc) · 3.79 KB
/
faq.html
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
---
title: FAQ
longTitle: Frequently Asked Questions
layout: page
edit_link:
template: faq
data: _data/faq.yml
---
{% assign languages = "en de" | split: ' ' %}
<script>
const languages = ["{{ languages | join: '", "' }}"]
function switchLanguage(lang) {
if ($.inArray(userLang, languages) > -1) {
$('.faq-item div[lang], .faq-category-header[lang], .faq-navigation[lang]').hide()
$(`.faq-item div[lang="${lang}"], .faq-category-header[lang="${lang}"], .faq-navigation[lang="${lang}"]`).show()
// Jump to anchor again because page length might have changed
if (location.hash) {
location.hash = location.hash
}
}
}
</script>
<div id="faq-language-selection" style="display: none;">
<span onclick="switchLanguage('en')">English</span>
<span onclick="switchLanguage('de')">Deutsch</span>
</div>
<h1>FAQ</h1>
<p>Welcome to our FAQ where we collect and answer frequently asked questions.
To quickly find an answer to your question, use the <strong>Find in page</strong>
feature of your browser - usually accessible by pressing <kbd>Ctrl+F</kbd>.</p>
<p>If you still don't find the answer you're looking for, check out our <a href="https://manual.cgeo.org">User Guide</a>.</p>
{% for language in languages %}
<div class="faq-navigation" lang="{{ language }}">
{% for category in site.data.faq %}
{% if category.title[language] == nil %}
{% assign lang = "en" %}
{% else %}
{% assign lang = language %}
{% endif %}
<div class="faq-navigation-category">
<div class="faq-navigation-category-title">{{ category.title[lang] }}</div>
{% for item in category.items %}
{% if item[language] == nil %}
{% assign lang = "en" %}
{% else %}
{% assign lang = language %}
{% endif %}
<a class="faq-navigation-link" href="#{{ item.id }}">{{ item[lang].title }}</a>
{% endfor %}
</div>
{% endfor %}
</div>
{% endfor %}
<div class="faq-container">
{% for category in site.data.faq %}
<div class="faq-category">
{% for language in languages %}
{% if category.title[language] == nil %}
{% assign lang = "en" %}
{% else %}
{% assign lang = language %}
{% endif %}
<div class="faq-category-header" lang="{{ language }}">{{ category.title[lang] }}</div>
{% endfor %}
{% for item in category.items %}
<div class="faq-item" id="{{ item.id }}">
<div class="faq-item-content">
{% for language in languages %}
{% if item[language] == nil %}
{% assign lang = "en" %}
{% else %}
{% assign lang = language %}
{% endif %}
<div lang="{{ language }}">
<div class="question">
<div class="icon"><div class="mdi mdi-help"></div></div>
<div class="text"><a href="#{{ item.id }}">{{ item[lang].title }}</a></div>
</div>
<div class="answer">{{ item[lang].content | markdownify }}</div>
</div>
{% endfor %}
</div>
</div>
{% endfor %}
</div>
{% endfor %}
</div>
<script type="text/javascript">
$('#faq-language-selection').show();
var userLang = (navigator.language || navigator.userLanguage).split('-')[0];
switchLanguage(userLang);
</script>