aboutsummaryrefslogtreecommitdiff
path: root/html/settings.html
blob: e33f11231b9260597027e7900d0a48c89938587d (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
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
<!DOCTYPE html>
<!--
    SPDX-License-Identifier: GPL-3.0-or-later OR CC-BY-SA-4.0

    Haketilo's settings page

    This file is part of Haketilo.

    Copyright (C) 2022 Wojtek Kosior <koszko@koszko.org>

    File is dual-licensed. You can choose either GPLv3+, CC BY-SA or both.

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <https://www.gnu.org/licenses/>.

    I, Wojtek Kosior, thereby promise not to sue for violation of this file's
    licenses. Although I request that you do not make use of this code in a
    proprietary program, I am not going to enforce this in court.
  -->
<html>
  <head>
    <meta charset="utf-8"/>
    <title>Haketilo options</title>
#LOADCSS html/reset.css
#LOADCSS html/base.css
#LOADCSS html/grid.css
    <style>
      #loader, #indexeddb_error {
	  margin: auto;
	  padding: 1em;
	  max-width: 800px;
      }
      #indexeddb_error p {
	  margin-bottom: 1em;
      }

      /* Style top menu items. */
      #tab_heads>* {
	  background-color: #70AF70;
	  font-size: 115%;
	  padding: 0.6em;
	  display: inline-block;
	  cursor: pointer;
	  margin: 0.25em 0 0 0;
      }
      body {
	  /* 0.25em margin + 1em height + 2*0.6em padding, multiple font size */
	  --heading-height: calc(2.45em * 1.15);
	  --tab-content-height: calc(100vh - var(--heading-height));
      }
      #tab_heads>:hover {
	  box-shadow: 0 6px 8px 0 rgba(0,0,0,0.24), 0 17px 50px 0 rgba(0,0,0,0.19);
      }
      #tab_heads>.active_head {
	  background-color: #65A065;
	  color: #222;
	  box-shadow: none;
	  cursor: default;
      }

      /* Style the top menu itself. */
      #tab_heads {
	  -moz-user-select: none;
	  user-select: none;
	  background-color: #e0e0e0;
      }
      #top_menu_line {
	  position: absolute;
	  width: 100vw;
	  z-index: 1;
      }

      /* Style content */
      body {
	  --content-max-width: 1000px;
	  height: 100vh;
	  overflow-x: hidden;
	  overflow-y: hidden;
      }
      div.tab {
	  display: none;
      }
      div.tab.active_tab {
	  display: block;
      }

      /* Style the Script blocking and Repositories tabs. */
      #blocking_list_container, #allowing_list_container,
      #default_policy_dialog, #blocking_dialog_container,
      #repos_list_container, #repos_dialog_container {
	  padding: 0.8em 0.4em 0.4em 0.4em;
      }
      #blocking_editable_container, #blocking_dialog_container,
      #repos_list_container, #repos_dialog_container {
	  max-width: var(--content-max-width);
	  margin: 0 auto;
      }
      #blocking_editable_container {
	  /* Leave space for default policy dialog and headings. */
	  --content-height: calc(var(--tab-content-height) - 3em);
      }

      /* Pass height information to html in all tabs. */
      .tab {
	  --content-height: var(--tab-content-height);
      }
    </style>
  </head>
  <body>
    <!-- Those contain just templates, we can include them at the top -->
#INCLUDE html/dialog.html
#INCLUDE html/item_list.html
#INCLUDE html/item_preview.html
#INCLUDE html/text_entry_list.html
#INCLUDE html/payload_create.html
    <div id="loader">
      Loading settings page...
    </div>
    <div id="indexeddb_error" class="hide">
      <p>
	Cannot display settings page.
      </p>
      <p>
	Haketilo could not access IndexedDB. IndexedDB is an in-browser
	database in which Haketilo stores all its configuration. Without it, the
	settings page is non-operational.
      <p>
#IF MOZILLA
	<div id="indexeddb_private_mode_explanation" class="hide">
	  <p>
	    This issue is the result of using Haketilo in Private Browsing mode.
	    For privacy reasons your browser blocks access to IndexedDB in
	    private windows and this unfortunately also affects Haketilo's
	    settings page.
	  </p>
	  <p>
	    You can sacrifice this single privacy feature and enable IndexedDB
	    access in private windows by navigating to "about:config" in the URL
	    bar, agreeing to accept the risk and setting the
	    "dom.indexedDB.privateBrowsing.enabled" preference to "true". Those
	    pages that have their scripts blocked will still be unable to access
	    IndexedDB.
	  </p>
	  <p>
	    Alternatively, you can open Haketilo's settings in a separate,
	    non-private window. The configuration you make there will take
	    effect on pages opened in Private Browsing mode as well.
	  </p>
	</div>
#ENDIF
    </div>
    <div id="main_view" class="hide">
      <ul id="tab_heads">
	<li id="blocking_head"> Blocking </li>
	<li id="mappings_head"> Mappings </li>
	<li id="resources_head"> Resources </li>
	<li id="new_payload_head" class="active_head"> New payload </li>
	<li id="repos_head"> Repositories </li>
      </ul>
      <div id="top_menu_line" class="top_line"></div>
      <div id="blocking_tab" class="tab">
	<div id="blocking_editable_container" class="grid_2">
	  <div id="blocking_list_container">
	    <h3>Block scripts on</h3>
	  </div>
	  <div id="allowing_list_container">
	    <h3>Allow scripts on</h3>
	  </div>
	  <div id="default_policy_dialog" class="grid_col_both text_center">
#INCLUDE html/default_blocking_policy.html
	  </div>
	</div>
	<div id="blocking_dialog_container" class="hide"></div>
      </div>
      <div id="mappings_tab" class="tab"></div>
      <div id="resources_tab" class="tab"></div>
      <div id="new_payload_tab" class="tab active_tab"></div>
      <div id="repos_tab" class="tab">
	<div id="repos_list_container"></div>
	<div id="repos_dialog_container" class="hide"></div>
      </div>
    </div>
#LOADJS html/settings.js
  </body>
</html>