summaryrefslogtreecommitdiff
path: root/html/options.html
blob: bfb9e52dfe3065ad006c169e260fa3b5dc5a35ea (about) (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
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
<!doctype html>
<!--
    Copyright (C) 2021 Wojtek Kosior
    Copyright (C) 2021 Nicholas Johnson
    Redistribution terms are gathered in the `copyright' file.
  -->
<html>
  <head>
    <meta charset="utf-8"/>
    <title>Hachette options</title>
    <style>
      input[type="checkbox"], input[type="radio"], .hide, .popup.hide {
	  display: none;
      }

      /* pages list */
      #page_components_ul {
	  max-height: 80vh;
	  overflow-y: auto;
      }
      #page_components_ul li.dragover_li {
	  border-top: 2px solid blue;
      }
      #page_components_ul li {
	  border-top: 2px solid white;
      }
      li[draggable=true] * {
	  pointer-events: none;
      }
      li[draggable=true] label,
      li[draggable=true] button {
	  pointer-events: auto;
      }

      /* tabbed view */
      #show_pages:not(:checked) ~ #pages,
      #show_bags:not(:checked) ~ #bags,
      #show_scripts:not(:checked) ~ #scripts {
	  display: none;
      }

      #show_pages:checked ~ #pages_lbl,
      #show_bags:checked ~ #bags_lbl,
      #show_scripts:checked ~ #scripts_lbl {
	  background: #4CAF50;
          color: white;
      }

      body > div {
	  border-top: 6px solid #4CAF50;
      }

      .tab_head {
	  display: inline-block;
      }

      /* popup window with list of selectable components */
      .popup {
	  position: fixed;
	  width: 100vw;
	  height: 100vh;
	  left: 0;
	  top: 0;
	  background-color: rgba(0,0,0,0.4);
	  z-index: 1;
	  overflow: auto;
	  vertical-align: center;
	  horizontal-align: center;
      }

      .popup_frame {
	  background-color: white;
	  width: 50vw;
      }

      input[type="radio"]:not(:checked)+.import_window_content {
	  display: none;
      }

      /* buttons */
      button {
          background-color: #4CAF50;
          border: none;
          border-radius: 8px;
          color: white;
          padding: 6px 12px;
          text-align: center;
          text-decoration: none;
          display: inline-block;
          margin: 2px 0px;
      }

    button:hover {
        box-shadow: 0 6px 8px 0 rgba(0,0,0,0.24), 0 17px 50px 0 rgba(0,0,0,0.19);
    }
    </style>
  </head>
  <body>
    <!-- The invisible div below is for elements that will be cloned. -->
    <div class="hide">
      <li id="item_li_template">
	<span></span>
	<button> Edit </button>
	<button> Remove </button>
	<button> Export </button>
      </li>
      <li id="bag_component_li_template">
	<span></span>
	<button> Remove </button>
      </li>
      <li id="chbx_component_li_template">
	<input type="checkbox" style="display: inline;"></input>
	<span></span>
      </li>
      <li id="radio_component_li_template">
	<input type="radio" style="display: inline;" name="page_components"></input>
	<span></span>
      </li>
      <li id="import_li_template">
	<span></span>
	<input type="checkbox" style="display: inline;" checked></input>
	<span></span>
      </li>
    </div>

    <!-- Mind the show_*s ids below - their format is assumed in js code -->
    <input type="radio" name="tabs" id="show_pages" checked></input>
    <input type="radio" name="tabs" id="show_bags"></input>
    <input type="radio" name="tabs" id="show_scripts"></input>
    <label for="show_pages" id="pages_lbl"
	   class="tab_head"> Pages </label>
    <label for="show_bags" id="bags_lbl"
	   class="tab_head"> Bags </label>
    <label for="show_scripts" id="scripts_lbl"
	   class="tab_head"> Scripts </label>

    <div id="pages">
      <ul id="pages_ul">
	<li id="work_page_li" class="hide">
	  <label for="page_url_field">URL: </label>
	  <input id="page_url_field"></input>
	  <br/>
	  <label>Payload: </label>
	  <span id="page_payload"></span>
	  <button id="select_page_components_but">
	    Choose payload
	  </button>
	  <br/>
	  <input id="page_allow_chbx" type="checkbox" style="display: inline;"></input>
	  <label for="page_allow_chbx">Allow native scripts</label>
	  <br/>
	  <button id="save_page_but" type="button"> Save </button>
	  <button id="discard_page_but" type="button"> Cancel </button>
	</li>
      </ul>
      <button id="add_page_but" type="button"> Add page </button>
    </div>

    <div id="bags">
      <ul id="bags_ul">
	<li id="work_bag_li" class="hide">
	  <label for="bag_name_field"> Name: </label>
	  <input id="bag_name_field"></input>
	  <ul id="bag_components_ul">
	    <li id="empty_bag_component_li" class="hide"></li>
	  </ul>
	  <button id="select_bag_components_but">
	    Add scripts
	  </button>
	  <br/>
	  <button id="save_bag_but"> Save </button>
	  <button id="discard_bag_but"> Cancel </button>
	</li>
      </ul>
      <button id="add_bag_but" type="button"> Add bag </button>
    </div>

    <div id="scripts">
      <ul id="scripts_ul">
	<li id="work_script_li" class="hide">
	  <label for="script_name_field"> Name: </label>
	  <input id="script_name_field"></input>
	  <br/>
	  <label for="script_url_field"> URL: </label>
	  <input id="script_url_field"></input>
	  <br/>
	  <label for="script_sha256_field"> sha256: </label>
	  <input id="script_sha256_field"></input>
	  <br/>
	  <label for="script_contents_field"> contents: </label>
	  <textarea id="script_contents_field" rows="20" cols="80"></textarea>
	  <br/>
	  <button id="save_script_but"> Save </button>
	  <button id="discard_script_but"> Cancel </button>
	</li>
      </ul>
      <button id="add_script_but" type="button"> Add script </button>
    </div>

    <button id="import_but" style="margin-top: 40px;"> Import </button>

    <div id="chbx_components_window" class="hide popup" position="absolute">
      <div class="popup_frame">
	<ul id="chbx_components_ul">

	</ul>
	<button id="commit_bag_components_but"> Add </button>
	<button id="cancel_bag_components_but"> Cancel </button>
      </div>
    </div>

    <div id="radio_components_window" class="hide popup" position="absolute">
      <div class="popup_frame">
	<ul id="radio_components_ul">

	  <li id="radio_component_none_li">
	    <input id="radio_component_none_input" type="radio" style="display: inline;" name="page_components"></input>
	    <span>(None)</span>
	  </li>
	</ul>
	<button id="commit_page_components_but"> Choose </button>
	<button id="cancel_page_components_but"> Cancel </button>
      </div>
    </div>

    <div id="import_window" class="hide popup" position="absolute">
      <div class="popup_frame">
	<h2> Settings import </h2>
	<input id="import_loading_radio" type="radio" name="import_window_content"></input>
	<span class="import_window_content"> Loading... </span>
	<input id="import_failed_radio" type="radio" name="import_window_content"></input>
	<div class="import_window_content">
	  <span> Bad file :( </span>
	  <pre id="bad_file_errormsg"></pre>
	  <button id="import_failok_but"> OK </button>
	</div>
	<input id="import_selection_radio" type="radio" name="import_window_content"></input>
	<div class="import_window_content">
	  <button id="check_all_import_but"> Check all </button>
	  <button id="uncheck_all_import_but"> Uncheck all </button>
	  <button id="uncheck_colliding_import_but"> Uncheck existing </button>
	  <ul id="import_ul">
	  </ul>
	  <button id="commit_import_but"> OK </button>
	  <button id="cancel_import_but"> Cancel </button>
	</div>
      </div>
    </div>

    <a id="file_downloader" class="hide"></a>
    <form id="file_opener_form" style="visibility: hidden;">
      <input type="file" id="file_opener"></input>
    </form>_OPTIONSSCRIPTS_
  </body>
</html>