summaryrefslogtreecommitdiff
path: root/qutebrowser/html/settings.html
blob: dfbc5c168939bed902bfa8b3d3f76796320340e7 (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
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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
{% extends "base.html" %}

{% block script %}
var cset = function(option, value) {
  // FIXME:conf we might want some error handling here?
  var url = "qute://user:{{csrf_token}}@settings/set"
  url += "?option=" + encodeURIComponent(option);
  url += "&value=" + encodeURIComponent(value);
  var xhr = new XMLHttpRequest();
  xhr.open("GET", url);
  xhr.send();
}
{% endblock %}

{% block style %}
table {
    border-spacing: 10px;
}

tbody tr:nth-child(odd) {
    background: #eaf4fb;
}

pre {
    margin: 2px;
}

th {
    padding: 10px;
    border-radius: 5px;
    background: #a6dfff;
    text-align: left;
    font-weight: normal;
    font-size: 1.5rem;
    color: #084c88;
}

td {
    padding: 5px 5px;
}

th pre {
    color: grey;
    text-align: left;
}

input {
    padding: 8px;
    width: 98%;
    box-sizing: border-box;
    border-radius: 4px;
    border: 1px solid #01cdd0;
    font-size: 0.9rem;
    font-family: DejaVu, serif;
}

input:focus {
    outline: none;
    border: 2px solid #7a589ea6;
}

input[type="radio"] {
    position: absolute; /* Positions the radio button relative to the edges of its containing element */
    -webkit-appearance: none; /* Removes its native styling */
    width: min-content;
    margin: 0;
    border: none;
}

label {
    cursor: pointer;
    margin-bottom: 2px;
    padding: 5px 10px;
    border-radius: 5px;
    background-color: #dddddd;
    color: #666666;
}

input[type="radio"]:checked + label {
    background-color: #a6dfff;
    color: #084c88;
}

.setting {
    width: 60%;
}

.value {
    width: 25%;
    text-align: center;
}

.valid-value {
    text-align: center;
}

.noscript, .noscript-text {
    color: red;
}

.noscript-text {
    margin-bottom: 5cm;
}

.option-description {
    margin: .5ex 0;
    color: #635d5dcf;
    font-size: 80%;
    font-style: italic;
    white-space: pre-line;
}

.radio-button {
    position: relative; /* The absolutely positioned element inside this tag (the radio button) gets positioned relative to it. */
    display: inline-flex;
    margin: 3px 1px;
}
{% endblock %}

{% block content %}
<noscript><h1 class="noscript">View Only</h1><p class="noscript-text">Changing settings requires javascript to be enabled!</p></noscript>
<table>
    <tr>
        <th>Setting</th>
        <th>Value</th>
    </tr>
  {% for option in configdata.DATA.values()|sort(attribute='name') if not option.no_autoconfig %}
    <tr>
      <!-- FIXME: convert to string properly -->
      <td class="setting">{{ option.name }}
        {% if option.description %}
          <p class="option-description">{{ option.description|e }}</p>
        {% endif %}
      </td>
      {% if option.typ.valid_values is not none %}
        <td class="valid-value">
          {% for value in option.typ.valid_values.values %}
	    <div class="radio-button">
	      <input type="radio" id="input-{{ option.name }}-{{ loop.index0 }}"
	        name="{{ option.name }}" value="{{ value }}"
	        onclick="cset('{{ option.name }}', this.value)"
	        {% if confget(option.name) == value %}
		  checked
		{% endif %}>
	      <label for="input-{{ option.name }}-{{ loop.index0 }}">
	        {{ value }}
	      </label>
	      </div>
	  {% endfor %}
	</td>
      {% else %}
        <td class="value">
	  <input type="text"
	    id="input-{{ option.name }}"
	    onblur="cset('{{ option.name }}', this.value)"
	    value="{{ confget(option.name) }}">
	  </input>
        </td>
      {% endif %}
    </tr>
  {% endfor %}
</table>

{% endblock %}