@browserless.io/browserless 2.5.0-beta-4 → 2.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (191) hide show
  1. package/CHANGELOG.md +14 -2
  2. package/README.md +65 -34
  3. package/build/config.d.ts +2 -2
  4. package/build/config.js +3 -3
  5. package/build/data/classes.json +1 -1
  6. package/build/data/selectors.json +1 -1
  7. package/build/http.d.ts +1 -0
  8. package/build/http.js +1 -0
  9. package/build/routes/chrome/http/content.post.body.json +8 -8
  10. package/build/routes/chrome/http/pdf.post.body.json +8 -8
  11. package/build/routes/chrome/http/scrape.post.body.json +8 -8
  12. package/build/routes/chrome/http/screenshot.post.body.json +9 -9
  13. package/build/routes/chromium/http/content.post.body.json +8 -8
  14. package/build/routes/chromium/http/pdf.post.body.json +8 -8
  15. package/build/routes/chromium/http/scrape.post.body.json +8 -8
  16. package/build/routes/chromium/http/screenshot.post.body.json +9 -9
  17. package/build/routes/management/http/active.get.d.ts +16 -0
  18. package/build/routes/management/http/active.get.js +17 -0
  19. package/build/routes/management/tests/management.spec.js +7 -0
  20. package/build/server.js +1 -1
  21. package/build/types.d.ts +6 -4
  22. package/build/types.js +1 -0
  23. package/build/utils.d.ts +1 -1
  24. package/docker/base/Dockerfile +1 -1
  25. package/extensions/ublock/1p-filters.html +4 -3
  26. package/extensions/ublock/3p-filters.html +3 -3
  27. package/extensions/ublock/_locales/ar/messages.json +16 -4
  28. package/extensions/ublock/_locales/az/messages.json +16 -4
  29. package/extensions/ublock/_locales/be/messages.json +19 -7
  30. package/extensions/ublock/_locales/bg/messages.json +16 -4
  31. package/extensions/ublock/_locales/bn/messages.json +33 -21
  32. package/extensions/ublock/_locales/br_FR/messages.json +33 -21
  33. package/extensions/ublock/_locales/bs/messages.json +16 -4
  34. package/extensions/ublock/_locales/ca/messages.json +16 -4
  35. package/extensions/ublock/_locales/cs/messages.json +16 -4
  36. package/extensions/ublock/_locales/cv/messages.json +16 -4
  37. package/extensions/ublock/_locales/cy/messages.json +16 -4
  38. package/extensions/ublock/_locales/da/messages.json +21 -9
  39. package/extensions/ublock/_locales/de/messages.json +17 -5
  40. package/extensions/ublock/_locales/el/messages.json +16 -4
  41. package/extensions/ublock/_locales/en/messages.json +16 -4
  42. package/extensions/ublock/_locales/en_GB/messages.json +16 -4
  43. package/extensions/ublock/_locales/eo/messages.json +17 -5
  44. package/extensions/ublock/_locales/es/messages.json +16 -4
  45. package/extensions/ublock/_locales/et/messages.json +16 -4
  46. package/extensions/ublock/_locales/eu/messages.json +16 -4
  47. package/extensions/ublock/_locales/fa/messages.json +24 -12
  48. package/extensions/ublock/_locales/fi/messages.json +16 -4
  49. package/extensions/ublock/_locales/fil/messages.json +16 -4
  50. package/extensions/ublock/_locales/fr/messages.json +16 -4
  51. package/extensions/ublock/_locales/fy/messages.json +16 -4
  52. package/extensions/ublock/_locales/gl/messages.json +16 -4
  53. package/extensions/ublock/_locales/gu/messages.json +16 -4
  54. package/extensions/ublock/_locales/he/messages.json +25 -13
  55. package/extensions/ublock/_locales/hi/messages.json +31 -19
  56. package/extensions/ublock/_locales/hr/messages.json +16 -4
  57. package/extensions/ublock/_locales/hu/messages.json +16 -4
  58. package/extensions/ublock/_locales/hy/messages.json +17 -5
  59. package/extensions/ublock/_locales/id/messages.json +16 -4
  60. package/extensions/ublock/_locales/it/messages.json +17 -5
  61. package/extensions/ublock/_locales/ja/messages.json +16 -4
  62. package/extensions/ublock/_locales/ka/messages.json +16 -4
  63. package/extensions/ublock/_locales/kk/messages.json +16 -4
  64. package/extensions/ublock/_locales/kn/messages.json +74 -62
  65. package/extensions/ublock/_locales/ko/messages.json +16 -4
  66. package/extensions/ublock/_locales/lt/messages.json +23 -11
  67. package/extensions/ublock/_locales/lv/messages.json +16 -4
  68. package/extensions/ublock/_locales/mk/messages.json +16 -4
  69. package/extensions/ublock/_locales/ml/messages.json +19 -7
  70. package/extensions/ublock/_locales/mr/messages.json +16 -4
  71. package/extensions/ublock/_locales/ms/messages.json +16 -4
  72. package/extensions/ublock/_locales/nb/messages.json +16 -4
  73. package/extensions/ublock/_locales/nl/messages.json +16 -4
  74. package/extensions/ublock/_locales/no/messages.json +16 -4
  75. package/extensions/ublock/_locales/oc/messages.json +16 -4
  76. package/extensions/ublock/_locales/pa/messages.json +16 -4
  77. package/extensions/ublock/_locales/pl/messages.json +17 -5
  78. package/extensions/ublock/_locales/pt_BR/messages.json +16 -4
  79. package/extensions/ublock/_locales/pt_PT/messages.json +16 -4
  80. package/extensions/ublock/_locales/ro/messages.json +17 -5
  81. package/extensions/ublock/_locales/ru/messages.json +16 -4
  82. package/extensions/ublock/_locales/si/messages.json +16 -4
  83. package/extensions/ublock/_locales/sk/messages.json +16 -4
  84. package/extensions/ublock/_locales/sl/messages.json +16 -4
  85. package/extensions/ublock/_locales/so/messages.json +16 -4
  86. package/extensions/ublock/_locales/sq/messages.json +16 -4
  87. package/extensions/ublock/_locales/sr/messages.json +16 -4
  88. package/extensions/ublock/_locales/sv/messages.json +20 -8
  89. package/extensions/ublock/_locales/sw/messages.json +16 -4
  90. package/extensions/ublock/_locales/ta/messages.json +16 -4
  91. package/extensions/ublock/_locales/te/messages.json +16 -4
  92. package/extensions/ublock/_locales/th/messages.json +42 -30
  93. package/extensions/ublock/_locales/tr/messages.json +19 -7
  94. package/extensions/ublock/_locales/uk/messages.json +16 -4
  95. package/extensions/ublock/_locales/ur/messages.json +16 -4
  96. package/extensions/ublock/_locales/vi/messages.json +16 -4
  97. package/extensions/ublock/_locales/zh_CN/messages.json +16 -4
  98. package/extensions/ublock/_locales/zh_TW/messages.json +42 -30
  99. package/extensions/ublock/assets/assets.json +95 -78
  100. package/extensions/ublock/assets/resources/scriptlets.js +70 -24
  101. package/extensions/ublock/assets/thirdparties/easylist/easylist.txt +6258 -3453
  102. package/extensions/ublock/assets/thirdparties/easylist/easyprivacy.txt +277 -40
  103. package/extensions/ublock/assets/thirdparties/pgl.yoyo.org/as/serverlist +8 -32
  104. package/extensions/ublock/assets/thirdparties/publicsuffix.org/list/effective_tld_names.dat +107 -12
  105. package/extensions/ublock/assets/thirdparties/urlhaus-filter/urlhaus-filter-online.txt +1160 -954
  106. package/extensions/ublock/assets/ublock/badlists.txt +1 -2
  107. package/extensions/ublock/assets/ublock/badware.min.txt +395 -270
  108. package/extensions/ublock/assets/ublock/filters.min.txt +1176 -1238
  109. package/extensions/ublock/assets/ublock/privacy.min.txt +32 -31
  110. package/extensions/ublock/assets/ublock/quick-fixes.min.txt +120 -110
  111. package/extensions/ublock/assets/ublock/unbreak.min.txt +75 -36
  112. package/extensions/ublock/css/1p-filters.css +2 -1
  113. package/extensions/ublock/css/3p-filters.css +1 -16
  114. package/extensions/ublock/css/advanced-settings.css +1 -0
  115. package/extensions/ublock/css/asset-viewer.css +1 -0
  116. package/extensions/ublock/css/code-viewer.css +1 -0
  117. package/extensions/ublock/css/codemirror.css +37 -10
  118. package/extensions/ublock/css/common.css +36 -2
  119. package/extensions/ublock/css/dashboard.css +9 -3
  120. package/extensions/ublock/css/devtools.css +1 -0
  121. package/extensions/ublock/css/document-blocked.css +3 -3
  122. package/extensions/ublock/css/dom-inspector.css +1 -0
  123. package/extensions/ublock/css/dyna-rules.css +1 -0
  124. package/extensions/ublock/css/epicker-ui.css +76 -66
  125. package/extensions/ublock/css/fa-icons.css +1 -0
  126. package/extensions/ublock/css/logger-ui.css +2 -0
  127. package/extensions/ublock/css/popup-fenix.css +1 -0
  128. package/extensions/ublock/css/whitelist.css +1 -0
  129. package/extensions/ublock/dashboard.html +20 -13
  130. package/extensions/ublock/devtools.html +2 -0
  131. package/extensions/ublock/dyna-rules.html +2 -2
  132. package/extensions/ublock/img/flags-of-the-world/np.png +0 -0
  133. package/extensions/ublock/img/fontawesome/fontawesome-defs.svg +1 -0
  134. package/extensions/ublock/js/1p-filters.js +72 -23
  135. package/extensions/ublock/js/3p-filters.js +71 -25
  136. package/extensions/ublock/js/asset-viewer.js +1 -0
  137. package/extensions/ublock/js/assets.js +83 -89
  138. package/extensions/ublock/js/background.js +20 -27
  139. package/extensions/ublock/js/base64-custom.js +1 -102
  140. package/extensions/ublock/js/benchmarks.js +36 -21
  141. package/extensions/ublock/js/biditrie.js +8 -23
  142. package/extensions/ublock/js/broadcast.js +2 -4
  143. package/extensions/ublock/js/cachestorage.js +594 -396
  144. package/extensions/ublock/js/codemirror/search.js +49 -37
  145. package/extensions/ublock/js/codemirror/ubo-static-filtering.js +233 -215
  146. package/extensions/ublock/js/contentscript-extra.js +31 -1
  147. package/extensions/ublock/js/cosmetic-filtering.js +35 -33
  148. package/extensions/ublock/js/dashboard.js +11 -7
  149. package/extensions/ublock/js/devtools.js +22 -0
  150. package/extensions/ublock/js/dom.js +2 -2
  151. package/extensions/ublock/js/dyna-rules.js +17 -16
  152. package/extensions/ublock/js/epicker-ui.js +41 -16
  153. package/extensions/ublock/js/fa-icons.js +1 -0
  154. package/extensions/ublock/js/hntrie.js +10 -25
  155. package/extensions/ublock/js/i18n.js +15 -15
  156. package/extensions/ublock/js/logger-ui.js +9 -6
  157. package/extensions/ublock/js/messaging.js +51 -26
  158. package/extensions/ublock/js/pagestore.js +21 -23
  159. package/extensions/ublock/js/popup-fenix.js +35 -22
  160. package/extensions/ublock/js/redirect-engine.js +15 -30
  161. package/extensions/ublock/js/reverselookup.js +1 -1
  162. package/extensions/ublock/js/s14e-serializer.js +1405 -0
  163. package/extensions/ublock/js/scriptlet-filtering-core.js +1 -1
  164. package/extensions/ublock/js/scriptlets/epicker.js +27 -18
  165. package/extensions/ublock/js/settings.js +32 -21
  166. package/extensions/ublock/js/start.js +121 -62
  167. package/extensions/ublock/js/static-ext-filtering-db.js +6 -6
  168. package/extensions/ublock/js/static-ext-filtering.js +17 -28
  169. package/extensions/ublock/js/static-filtering-parser.js +26 -4
  170. package/extensions/ublock/js/static-net-filtering.js +69 -168
  171. package/extensions/ublock/js/storage.js +178 -155
  172. package/extensions/ublock/js/traffic.js +11 -7
  173. package/extensions/ublock/js/vapi-background.js +49 -62
  174. package/extensions/ublock/js/vapi-client.js +13 -16
  175. package/extensions/ublock/js/webext.js +10 -2
  176. package/extensions/ublock/js/whitelist.js +27 -25
  177. package/extensions/ublock/lib/publicsuffixlist/publicsuffixlist.js +3 -7
  178. package/extensions/ublock/manifest.json +2 -1
  179. package/extensions/ublock/web_accessible_resources/epicker-ui.html +5 -8
  180. package/extensions/ublock/whitelist.html +3 -4
  181. package/package.json +13 -13
  182. package/src/config.ts +3 -4
  183. package/src/http.ts +1 -0
  184. package/src/routes/management/http/active.get.ts +30 -0
  185. package/src/routes/management/tests/management.spec.ts +13 -0
  186. package/src/server.ts +1 -1
  187. package/src/types.ts +2 -1
  188. package/static/docs/swagger.json +57 -11
  189. package/static/docs/swagger.min.json +56 -10
  190. package/static/function/client.js +4155 -3350
  191. package/extensions/ublock/_locales/ku/messages.json +0 -1294
@@ -3,6 +3,7 @@ html#ublock0-epicker,
3
3
  background: transparent;
4
4
  cursor: not-allowed;
5
5
  height: 100vh;
6
+ height: 100svh;
6
7
  margin: 0;
7
8
  overflow: hidden;
8
9
  width: 100vw;
@@ -13,29 +14,41 @@ html#ublock0-epicker,
13
14
  #ublock0-epicker aside {
14
15
  background-color: var(--surface-1);
15
16
  border: 1px solid var(--border-2);
16
- bottom: 2px;
17
17
  box-sizing: border-box;
18
18
  cursor: default;
19
19
  display: none;
20
- max-height: calc(100vh - 4px);
21
- max-width: 36rem;
22
- min-width: 24rem;
20
+ flex-direction: column;
21
+ max-width: min(32rem, 100vw - 4px);
22
+ min-width: min(24rem, 100vw - 4px);
23
23
  overflow-y: auto;
24
- padding: 4px;
25
24
  position: fixed;
26
- right: 2px;
27
- width: calc(40% - 2px);
25
+ width: min(32rem, 100vw - 4px);
26
+ z-index: 100;
28
27
  }
29
- /* https://github.com/uBlockOrigin/uBlock-issues/discussions/2114 */
30
- #ublock0-epicker aside {
31
- min-width: min(24rem, 100vw - 4px);
28
+ #ublock0-epicker:not(.zap) aside {
29
+ display: flex;
30
+ }
31
+ #ublock0-epicker:not(.paused) aside,
32
+ #ublock0-epicker.minimized aside {
33
+ min-width: min(16rem, 100vw - 4px);
34
+ overflow: hidden;
35
+ width: min(16rem, 100vw - 4px);
36
+ }
37
+ #ublock0-epicker:not(.paused) aside > *:not(#windowbar),
38
+ #ublock0-epicker.minimized aside > *:not(#windowbar) {
39
+ display: none;
32
40
  }
33
- #ublock0-epicker.paused:not(.zap) aside {
34
- display: block;
41
+ #ublock0-epicker aside > *:not(:first-child) {
42
+ padding: 0 2px;
35
43
  }
44
+
36
45
  #ublock0-epicker #toolbar {
37
46
  display: flex;
47
+ justify-content: space-between;
38
48
  }
49
+ #ublock0-epicker #toolbar button {
50
+ min-width: 5em;
51
+ }
39
52
  #ublock0-epicker ul {
40
53
  margin: 0.25em 0 0 0;
41
54
  }
@@ -43,16 +56,6 @@ html#ublock0-epicker,
43
56
  background-color: var(--button-preferred-surface);
44
57
  color: var(--button-preferred-ink);
45
58
  }
46
- #ublock0-epicker #move {
47
- background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAYAAAAECAYAAACtBE5DAAAAFElEQVQI12NgwAfKy8v/M5ANYLoBshgEyQo6H9UAAAAASUVORK5CYII=');
48
- cursor: grab;
49
- flex-grow: 1;
50
- margin: 2px 4px;
51
- opacity: 0.8;
52
- }
53
- #ublock0-epicker aside.moving #move {
54
- cursor: grabbing;
55
- }
56
59
  #ublock0-epicker section {
57
60
  border: 0;
58
61
  box-sizing: border-box;
@@ -70,8 +73,8 @@ html#ublock0-epicker,
70
73
  #ublock0-epicker section .codeMirrorContainer {
71
74
  border: none;
72
75
  box-sizing: border-box;
73
- height: 8em;
74
- max-height: 50vh;
76
+ height: 6em;
77
+ max-height: min(6em, 10vh);
75
78
  min-height: 1em;
76
79
  padding: 2px;
77
80
  width: 100%;
@@ -129,8 +132,8 @@ html#ublock0-epicker,
129
132
  );
130
133
  display: inline-block;
131
134
  flex-shrink: 0;
132
- height: 16px;
133
- width: 16px;
135
+ height: 20px;
136
+ width: 20px;
134
137
  }
135
138
  .resultsetModifier > span > span:nth-of-type(3) {
136
139
  background-color: var(--surface-3);
@@ -174,12 +177,9 @@ html#ublock0-epicker,
174
177
  overflow: hidden;
175
178
  }
176
179
  #ublock0-epicker #candidateFilters {
177
- max-height: 14em;
180
+ max-height: min(12em, 18vh);
178
181
  overflow-y: auto;
179
182
  }
180
- #ublock0-epicker #candidateFilters > li:first-of-type {
181
- margin-bottom: 0.5em;
182
- }
183
183
  #ublock0-epicker .changeFilter > li > span:nth-of-type(1) {
184
184
  font-weight: bold;
185
185
  }
@@ -187,6 +187,9 @@ html#ublock0-epicker,
187
187
  font-size: smaller;
188
188
  color: gray;
189
189
  }
190
+ #ublock0-epicker #candidateFilters [data-i18n] {
191
+ font-size: 90%;
192
+ }
190
193
  #ublock0-epicker #candidateFilters .changeFilter {
191
194
  list-style-type: none;
192
195
  margin: 0 0 0 1em;
@@ -207,36 +210,7 @@ html#ublock0-epicker,
207
210
  background-color: var(--surface-2);
208
211
  }
209
212
 
210
- /**
211
- https://github.com/gorhill/uBlock/issues/3449
212
- https://github.com/uBlockOrigin/uBlock-issues/issues/55
213
- **/
214
- @keyframes startDialog {
215
- 0% { opacity: 1.0; }
216
- 60% { opacity: 1.0; }
217
- 100% { opacity: 0.1; }
218
- }
219
- #ublock0-epicker.paused aside {
220
- opacity: 0.1;
221
- visibility: visible;
222
- z-index: 100;
223
- }
224
- #ublock0-epicker.paused:not(.show):not(.hide) aside:not(:hover) {
225
- animation-duration: 1.6s;
226
- animation-name: startDialog;
227
- animation-timing-function: linear;
228
- }
229
- #ublock0-epicker.paused aside:hover {
230
- opacity: 1;
231
- }
232
- #ublock0-epicker.paused.show aside {
233
- opacity: 1;
234
- }
235
- #ublock0-epicker.paused.hide aside {
236
- opacity: 0.1;
237
- }
238
-
239
- #ublock0-epicker svg {
213
+ #ublock0-epicker svg#sea {
240
214
  cursor: crosshair;
241
215
  box-sizing: border-box;
242
216
  height: 100%;
@@ -245,26 +219,62 @@ html#ublock0-epicker,
245
219
  top: 0;
246
220
  width: 100%;
247
221
  }
248
- #ublock0-epicker.paused svg {
222
+ #ublock0-epicker.paused svg#sea {
249
223
  cursor: not-allowed;
250
224
  }
251
- #ublock0-epicker svg > path:first-child {
225
+ #ublock0-epicker svg#sea > path:first-child {
252
226
  fill: rgba(0,0,0,0.5);
253
227
  fill-rule: evenodd;
254
228
  }
255
- #ublock0-epicker svg > path + path {
229
+ #ublock0-epicker svg#sea > path + path {
256
230
  stroke: #F00;
257
231
  stroke-width: 0.5px;
258
232
  fill: rgba(255,63,63,0.20);
259
233
  }
260
- #ublock0-epicker.zap svg > path + path {
234
+ #ublock0-epicker.zap svg#sea > path + path {
261
235
  stroke: #FF0;
262
236
  stroke-width: 0.5px;
263
237
  fill: rgba(255,255,63,0.20);
264
238
  }
265
- #ublock0-epicker.preview svg > path {
239
+ #ublock0-epicker.preview svg#sea > path {
266
240
  fill: rgba(0,0,0,0.10);
267
241
  }
268
- #ublock0-epicker.preview svg > path + path {
242
+ #ublock0-epicker.preview svg#sea > path + path {
269
243
  stroke: none;
270
244
  }
245
+
246
+
247
+ #ublock0-epicker #windowbar {
248
+ display: flex;
249
+ }
250
+ #ublock0-epicker #windowbar svg {
251
+ fill: none;
252
+ pointer-events: none;
253
+ stroke: var(--ink-1);
254
+ stroke-width: 3px;
255
+ }
256
+ #ublock0-epicker #windowbar #move {
257
+ background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAYAAAAECAYAAACtBE5DAAAAFElEQVQI12NgwAfKy8v/M5ANYLoBshgEyQo6H9UAAAAASUVORK5CYII=');
258
+ cursor: grab;
259
+ flex-grow: 1;
260
+ opacity: 0.8;
261
+ }
262
+ #ublock0-epicker aside.moving #windowbar #move {
263
+ cursor: grabbing;
264
+ }
265
+ #windowbar #quit,
266
+ #windowbar #minimize {
267
+ height: 2em;
268
+ width: 2em;
269
+ }
270
+ #windowbar #quit:hover,
271
+ #windowbar #minimize:hover {
272
+ background-color: var(--surface-2)
273
+ }
274
+ #ublock0-epicker.minimized #windowbar #minimize svg > path,
275
+ #windowbar #minimize svg > rect {
276
+ display: none;
277
+ }
278
+ #ublock0-epicker.minimized #windowbar #minimize svg > rect {
279
+ display: initial;
280
+ }
@@ -89,6 +89,7 @@
89
89
  .fa-icon > .fa-icon_sun-o {
90
90
  width: calc(1em * 1708 / 1792);
91
91
  }
92
+ .fa-icon > .fa-icon_book,
92
93
  .fa-icon > .fa-icon_download-alt,
93
94
  .fa-icon > .fa-icon_font,
94
95
  .fa-icon > .fa-icon_search,
@@ -2,6 +2,7 @@ body {
2
2
  display: flex;
3
3
  flex-direction: column;
4
4
  height: 100vh;
5
+ height: 100svh;
5
6
  overflow: hidden;
6
7
  width: 100vw;
7
8
  }
@@ -512,6 +513,7 @@ body[dir="rtl"] .closeButton {
512
513
  bottom: 0;
513
514
  display: none;
514
515
  max-height: min(800px, calc(100vh - 2rem));
516
+ max-height: min(800px, calc(100svh - 2rem));
515
517
  min-width: 360px;
516
518
  overflow: hidden;
517
519
  position: fixed;
@@ -300,6 +300,7 @@ body.needSave #revertRules {
300
300
  }
301
301
  :root.desktop body.vMin #firewall {
302
302
  max-height: 100vh;
303
+ max-height: 100svh;
303
304
  }
304
305
  #firewall > * {
305
306
  direction: ltr;
@@ -1,5 +1,6 @@
1
1
  html {
2
2
  height: 100vh;
3
+ height: 100svh;
3
4
  overflow: hidden;
4
5
  width: 100vw;
5
6
  }
@@ -4,24 +4,28 @@
4
4
  <meta charset="utf-8">
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1">
6
6
  <title data-i18n="dashboardName"></title>
7
- <link href="css/themes/default.css" rel="stylesheet" type="text/css">
8
- <link href="css/common.css" rel="stylesheet" type="text/css">
9
- <link href="css/dashboard.css" rel="stylesheet" type="text/css">
7
+ <link rel="stylesheet" href="css/themes/default.css">
8
+ <link rel="stylesheet" href="css/fa-icons.css">
9
+ <link rel="stylesheet" href="css/common.css">
10
+ <link rel="stylesheet" href="css/dashboard.css">
10
11
  <link rel="shortcut icon" type="image/png" href="img/icon_64.png">
11
12
  </head>
12
13
 
13
14
  <body class="notReady">
14
15
 
15
16
  <div id="dashboard-nav">
16
- <span class="logo"><img data-i18n-title="extName" src="img/ublock.svg"></span><!--
17
- --><button class="tabButton" type="button" data-pane="settings.html" data-i18n="settingsPageName" tabindex="0"></button><!--
18
- --><button class="tabButton" type="button" data-pane="3p-filters.html" data-i18n="3pPageName" tabindex="0"></button><!--
19
- --><button class="tabButton" type="button" data-pane="1p-filters.html" data-i18n="1pPageName" tabindex="0"></button><!--
20
- --><button class="tabButton" type="button" data-pane="dyna-rules.html" data-i18n="rulesPageName" tabindex="0"></button><!--
21
- --><button class="tabButton" type="button" data-pane="whitelist.html" data-i18n="whitelistPageName" tabindex="0"></button><!--
22
- --><button class="tabButton" type="button" data-pane="support.html" data-i18n="supportPageName" tabindex="0"></button><!--
23
- --><button class="tabButton" type="button" data-pane="about.html" data-i18n="aboutPageName" tabindex="0"></button><!--
24
- --><button class="tabButton" type="button" data-pane="no-dashboard.html"></button>
17
+ <span>
18
+ <span class="logo"><img data-i18n-title="extName" src="img/ublock.svg" alt="uBlock Origin"></span><!--
19
+ --><button class="tabButton" type="button" data-pane="settings.html" data-i18n="settingsPageName" tabindex="0"></button><!--
20
+ --><button class="tabButton" type="button" data-pane="3p-filters.html" data-i18n="3pPageName" tabindex="0"></button><!--
21
+ --><button class="tabButton" type="button" data-pane="1p-filters.html" data-i18n="1pPageName" tabindex="0"></button><!--
22
+ --><button class="tabButton" type="button" data-pane="dyna-rules.html" data-i18n="rulesPageName" tabindex="0"></button><!--
23
+ --><button class="tabButton" type="button" data-pane="whitelist.html" data-i18n="whitelistPageName" tabindex="0"></button><!--
24
+ --><button class="tabButton" type="button" data-pane="support.html" data-i18n="supportPageName" tabindex="0"></button><!--
25
+ --><button class="tabButton" type="button" data-pane="about.html" data-i18n="aboutPageName" tabindex="0"></button><!--
26
+ --><button class="tabButton" type="button" data-pane="no-dashboard.html"></button>
27
+ </span>
28
+ <a class="wikilink fa-icon" href="https://github.com/gorhill/uBlock/wiki/Dashboard:-My-filters">book</a>
25
29
  </div>
26
30
  <section id="unsavedWarning" class="notice">
27
31
  <div>
@@ -32,16 +36,19 @@
32
36
  <div></div>
33
37
  </section>
34
38
 
35
- <iframe id="iframe" src=""></iframe>
39
+ <iframe id="iframe" src="about:blank"></iframe>
36
40
 
37
41
  <script src="lib/hsluv/hsluv-0.1.0.min.js"></script>
38
42
 
39
43
  <script src="js/vapi.js"></script>
40
44
  <script src="js/vapi-common.js"></script>
41
45
  <script src="js/vapi-client.js"></script>
46
+
47
+ <script src="js/fa-icons.js" type="module"></script>
42
48
  <script src="js/theme.js" type="module"></script>
43
49
  <script src="js/i18n.js" type="module"></script>
44
50
  <script src="js/dashboard.js" type="module"></script>
51
+ <script src="js/dashboard-common.js" type="module"></script>
45
52
 
46
53
  </body>
47
54
  </html>
@@ -29,6 +29,8 @@
29
29
  <button id="snfe-todnr" type="button">SNFE: DNR<span class="hover"></span></button>
30
30
  <button id="snfe-benchmark" type="button" disabled>SNFE: Benchmark<span class="hover"></span></button>
31
31
  <button id="cfe-dump" type="button">CFE: Dump<span class="hover"></span></button>
32
+ <button id="cfe-benchmark" type="button" disabled>CFE: Benchmark<span class="hover"></span></button>
33
+ <button id="sfe-benchmark" type="button" disabled>SFE: Benchmark<span class="hover"></span></button>
32
34
  <button id="purge-all-caches" type="button" data-i18n-title="3pPurgeAll"><span data-i18n="3pPurgeAll">_</span><span class="hover"></span></button>
33
35
  </div>
34
36
  <div id="console" class="codeMirrorContainer"></div>
@@ -20,7 +20,7 @@
20
20
 
21
21
  <div class="body">
22
22
  <div id="cloudWidget" class="hide" data-cloud-entry="myRulesPane"></div>
23
- <p class="vverbose"><span data-i18n="rulesHint"></span> <a class="fa-icon info" href="https://github.com/gorhill/uBlock/wiki/Dynamic-filtering:-rule-syntax" target="_blank">info-circle</a></p>
23
+ <p class="vverbose"><span data-i18n="rulesHint"></span></p>
24
24
  <div id="diff">
25
25
  <div class="tools">
26
26
  <div class="ruleActions">
@@ -40,7 +40,7 @@
40
40
  <div id="ruleFilter">
41
41
  <span><span class="fa-icon">filter</span>&nbsp;<input type="search" size="16"></span>&emsp;<span data-i18n="rulesSort"></span>&nbsp;<select><option value="0" selected data-i18n="rulesSortByType"><option value="1" data-i18n="rulesSortBySource"><option value="2" data-i18n="rulesSortByDestination"></select>&emsp;<span id="diffCollapse" class="fa-icon">double-angle-up</span>
42
42
  </div>
43
- <div class="codeMirrorContainer codeMirrorMergeContainer"></div>
43
+ <div class="codeMirrorContainer codeMirrorMergeContainer cm-theme-override"></div>
44
44
 
45
45
  <div id="templates" style="display: none;">
46
46
  <input class="hidden" id="importFilePicker" type="file" accept="text/plain">
@@ -30,6 +30,7 @@ License - https://github.com/FortAwesome/Font-Awesome/tree/a8386aae19e200ddb0f68
30
30
  <symbol id="arrow-right" viewBox="0 0 1472 1558"><path d="m 1472,779 q 0,54 -37,91 l -651,651 q -39,37 -91,37 -51,0 -90,-37 l -75,-75 q -38,-38 -38,-91 0,-53 38,-91 L 821,971 H 117 Q 65,971 32.5,933.5 0,896 0,843 V 715 Q 0,662 32.5,624.5 65,587 117,587 H 821 L 528,293 q -38,-36 -38,-90 0,-54 38,-90 l 75,-75 q 38,-38 90,-38 53,0 91,38 l 651,651 q 37,35 37,90 z"/></symbol>
31
31
  <symbol id="bar-chart" viewBox="0 0 2048 1536"><path d="m 640,768 0,512 -256,0 0,-512 256,0 z m 384,-512 0,1024 -256,0 0,-1024 256,0 z m 1024,1152 0,128 L 0,1536 0,0 l 128,0 0,1408 1920,0 z m -640,-896 0,768 -256,0 0,-768 256,0 z m 384,-384 0,1152 -256,0 0,-1152 256,0 z"/></symbol>
32
32
  <symbol id="bolt" viewBox="0 0 896 1664"><path d="m 885.08696,438 q 18,20 7,44 l -540,1157 q -13,25 -42,25 -4,0 -14,-2 -17,-5 -25.5,-19 -8.5,-14 -4.5,-30 l 197,-808 -406,101 q -4,1 -12,1 -18,0 -31,-11 Q -3.9130435,881 1.0869565,857 L 202.08696,32 q 4,-14 16,-23 12,-9 28,-9 l 328,0 q 19,0 32,12.5 13,12.5 13,29.5 0,8 -5,18 l -171,463 396,-98 q 8,-2 12,-2 19,0 34,15 z"/></symbol>
33
+ <symbol id="book" viewBox="0 0 1664 1536"><path d="m 1639.2625,350 c 25,36 32,83 18,129 l -275,906 c -25,85 -113,151 -199,151 H 260.26251 c -102,0 -211,-81 -248,-185 -16,-45 -16,-89 -2,-127 2,-20 6,-40 7,-64 1,-16 -8,-29 -6,-41 4,-24 25,-41 41,-68 30,-50 64,-131 75,-183 5,-19 -5,-41 0,-58 5,-19 24,-33 34,-51 27,-46 62,-135 67,-182 2,-21 -8,-44 -2,-60 7,-23 29,-33 44,-53 24,-33 64,-128 70,-181 2,-17 -8,-34 -5,-52 4,-19 28,-39 44,-62 42,-62 50,-199 177,-163 l -1,3 c 17,-4 34,-9 51,-9 h 761 c 47,0 89,21 114,56 26,36 32,83 18,130 l -274,906 c -47,154 -73,188 -200,188 H 156.26251 c -13,0 -29,3 -38,15 -8,12 -9,21 -1,43 20,58 89,70 144,70 h 923 c 37,0 80,-21 91,-57 l 300,-987 c 6,-19 6,-39 5,-57 23,9 44,23 59,43 z m -1064,2 c -6,18 4,32 22,32 h 608 c 17,0 36,-14 42,-32 l 21,-64 c 6,-18 -4,-32 -22,-32 H 638.26251 c -17,0 -36,14 -42,32 z m -83,256 c -6,18 4,32 22,32 h 608 c 17,0 36,-14 42,-32 l 21,-64 c 6,-18 -4,-32 -22,-32 H 555.26251 c -17,0 -36,14 -42,32 z"/></symbol>
33
34
  <symbol id="clipboard" viewBox="0 0 1792 1792"><path d="m 768,1664 896,0 0,-640 -416,0 q -40,0 -68,-28 -28,-28 -28,-68 l 0,-416 -384,0 0,1152 z m 256,-1440 0,-64 q 0,-13 -9.5,-22.5 Q 1005,128 992,128 l -704,0 q -13,0 -22.5,9.5 Q 256,147 256,160 l 0,64 q 0,13 9.5,22.5 9.5,9.5 22.5,9.5 l 704,0 q 13,0 22.5,-9.5 9.5,-9.5 9.5,-22.5 z m 256,672 299,0 -299,-299 0,299 z m 512,128 0,672 q 0,40 -28,68 -28,28 -68,28 l -960,0 q -40,0 -68,-28 -28,-28 -28,-68 l 0,-160 -544,0 Q 56,1536 28,1508 0,1480 0,1440 L 0,96 Q 0,56 28,28 56,0 96,0 l 1088,0 q 40,0 68,28 28,28 28,68 l 0,328 q 21,13 36,28 l 408,408 q 28,28 48,76 20,48 20,88 z"/></symbol>
34
35
  <symbol id="clock-o" viewBox="0 0 1536 1536"><path d="m 896,416 v 448 q 0,14 -9,23 -9,9 -23,9 H 544 q -14,0 -23,-9 -9,-9 -9,-23 v -64 q 0,-14 9,-23 9,-9 23,-9 H 768 V 416 q 0,-14 9,-23 9,-9 23,-9 h 64 q 14,0 23,9 9,9 9,23 z m 416,352 q 0,-148 -73,-273 -73,-125 -198,-198 -125,-73 -273,-73 -148,0 -273,73 -125,73 -198,198 -73,125 -73,273 0,148 73,273 73,125 198,198 125,73 273,73 148,0 273,-73 125,-73 198,-198 73,-125 73,-273 z m 224,0 q 0,209 -103,385.5 Q 1330,1330 1153.5,1433 977,1536 768,1536 559,1536 382.5,1433 206,1330 103,1153.5 0,977 0,768 0,559 103,382.5 206,206 382.5,103 559,0 768,0 977,0 1153.5,103 1330,206 1433,382.5 1536,559 1536,768 Z"/></symbol>
35
36
  <symbol id="cloud-download" viewBox="0 0 1920 1408"><path d="m 1280,800 q 0,-14 -9,-23 -9,-9 -23,-9 l -224,0 0,-352 q 0,-13 -9.5,-22.5 Q 1005,384 992,384 l -192,0 q -13,0 -22.5,9.5 Q 768,403 768,416 l 0,352 -224,0 q -13,0 -22.5,9.5 -9.5,9.5 -9.5,22.5 0,14 9,23 l 352,352 q 9,9 23,9 14,0 23,-9 l 351,-351 q 10,-12 10,-24 z m 640,224 q 0,159 -112.5,271.5 Q 1695,1408 1536,1408 l -1088,0 Q 263,1408 131.5,1276.5 0,1145 0,960 0,830 70,720 140,610 258,555 256,525 256,512 256,300 406,150 556,0 768,0 q 156,0 285.5,87 129.5,87 188.5,231 71,-62 166,-62 106,0 181,75 75,75 75,181 0,76 -41,138 130,31 213.5,135.5 Q 1920,890 1920,1024 Z"/></symbol>
@@ -21,12 +21,10 @@
21
21
 
22
22
  /* global CodeMirror, uBlockDashboard */
23
23
 
24
- 'use strict';
25
-
26
- import { onBroadcast } from './broadcast.js';
24
+ import './codemirror/ubo-static-filtering.js';
27
25
  import { dom, qs$ } from './dom.js';
28
26
  import { i18n$ } from './i18n.js';
29
- import './codemirror/ubo-static-filtering.js';
27
+ import { onBroadcast } from './broadcast.js';
30
28
 
31
29
  /******************************************************************************/
32
30
 
@@ -53,8 +51,6 @@ const cmEditor = new CodeMirror(qs$('#userFilters'), {
53
51
 
54
52
  uBlockDashboard.patchCodeMirrorEditor(cmEditor);
55
53
 
56
- let cachedUserFilters = '';
57
-
58
54
  /******************************************************************************/
59
55
 
60
56
  // Add auto-complete ability to the editor. Polling is used as the suggested
@@ -91,9 +87,32 @@ vAPI.messaging.send('dashboard', {
91
87
 
92
88
  /******************************************************************************/
93
89
 
90
+ let originalState = {
91
+ enabled: true,
92
+ trusted: false,
93
+ filters: '',
94
+ };
95
+
96
+ function getCurrentState() {
97
+ const enabled = qs$('#enableMyFilters input').checked;
98
+ return {
99
+ enabled,
100
+ trusted: enabled && qs$('#trustMyFilters input').checked,
101
+ filters: getEditorText(),
102
+ };
103
+ }
104
+
105
+ function rememberCurrentState() {
106
+ originalState = getCurrentState();
107
+ }
108
+
109
+ function currentStateChanged() {
110
+ return JSON.stringify(getCurrentState()) !== JSON.stringify(originalState);
111
+ }
112
+
94
113
  function getEditorText() {
95
114
  const text = cmEditor.getValue().replace(/\s+$/, '');
96
- return text === '' ? text : text + '\n';
115
+ return text === '' ? text : `${text}\n`;
97
116
  }
98
117
 
99
118
  function setEditorText(text) {
@@ -102,12 +121,30 @@ function setEditorText(text) {
102
121
 
103
122
  /******************************************************************************/
104
123
 
105
- function userFiltersChanged(changed) {
106
- if ( typeof changed !== 'boolean' ) {
107
- changed = self.hasUnsavedData();
108
- }
124
+ function userFiltersChanged(details = {}) {
125
+ const changed = typeof details.changed === 'boolean'
126
+ ? details.changed
127
+ : self.hasUnsavedData();
109
128
  qs$('#userFiltersApply').disabled = !changed;
110
129
  qs$('#userFiltersRevert').disabled = !changed;
130
+ const enabled = qs$('#enableMyFilters input').checked;
131
+ dom.attr('#trustMyFilters .input.checkbox', 'disabled', enabled ? null : '');
132
+ const trustedbefore = cmEditor.getOption('trustedSource');
133
+ const trustedAfter = enabled && qs$('#trustMyFilters input').checked;
134
+ if ( trustedAfter === trustedbefore ) { return; }
135
+ cmEditor.startOperation();
136
+ cmEditor.setOption('trustedSource', trustedAfter);
137
+ const doc = cmEditor.getDoc();
138
+ const history = doc.getHistory();
139
+ const selections = doc.listSelections();
140
+ doc.replaceRange(doc.getValue(),
141
+ { line: 0, ch: 0 },
142
+ { line: doc.lineCount(), ch: 0 }
143
+ );
144
+ doc.setSelections(selections);
145
+ doc.setHistory(history);
146
+ cmEditor.endOperation();
147
+ cmEditor.focus();
111
148
  }
112
149
 
113
150
  /******************************************************************************/
@@ -118,7 +155,7 @@ function userFiltersChanged(changed) {
118
155
  // background.
119
156
 
120
157
  function threeWayMerge(newContent) {
121
- const prvContent = cachedUserFilters.trim().split(/\n/);
158
+ const prvContent = originalState.filters.trim().split(/\n/);
122
159
  const differ = new self.diff_match_patch();
123
160
  const newChanges = differ.diff(
124
161
  prvContent,
@@ -167,19 +204,22 @@ async function renderUserFilters(merge = false) {
167
204
  });
168
205
  if ( details instanceof Object === false || details.error ) { return; }
169
206
 
170
- cmEditor.setOption('trustedSource', details.trustedSource === true);
207
+ cmEditor.setOption('trustedSource', details.trusted);
208
+
209
+ qs$('#enableMyFilters input').checked = details.enabled;
210
+ qs$('#trustMyFilters input').checked = details.trusted;
171
211
 
172
212
  const newContent = details.content.trim();
173
213
 
174
214
  if ( merge && self.hasUnsavedData() ) {
175
215
  setEditorText(threeWayMerge(newContent));
176
- userFiltersChanged(true);
216
+ userFiltersChanged({ changed: true });
177
217
  } else {
178
218
  setEditorText(newContent);
179
- userFiltersChanged(false);
219
+ userFiltersChanged({ changed: false });
180
220
  }
181
221
 
182
- cachedUserFilters = newContent;
222
+ rememberCurrentState();
183
223
  }
184
224
 
185
225
  /******************************************************************************/
@@ -224,7 +264,7 @@ function exportUserFiltersToFile() {
224
264
  .replace('{{datetime}}', uBlockDashboard.dateNowToSensibleString())
225
265
  .replace(/ +/g, '_');
226
266
  vAPI.download({
227
- 'url': 'data:text/plain;charset=utf-8,' + encodeURIComponent(val + '\n'),
267
+ 'url': `data:text/plain;charset=utf-8,${encodeURIComponent(val)}`,
228
268
  'filename': filename
229
269
  });
230
270
  }
@@ -232,21 +272,26 @@ function exportUserFiltersToFile() {
232
272
  /******************************************************************************/
233
273
 
234
274
  async function applyChanges() {
275
+ const state = getCurrentState();
235
276
  const details = await vAPI.messaging.send('dashboard', {
236
277
  what: 'writeUserFilters',
237
- content: getEditorText(),
278
+ content: state.filters,
279
+ enabled: state.enabled,
280
+ trusted: state.trusted,
238
281
  });
239
282
  if ( details instanceof Object === false || details.error ) { return; }
240
-
241
- cachedUserFilters = details.content.trim();
242
- userFiltersChanged(false);
283
+ rememberCurrentState();
284
+ userFiltersChanged({ changed: false });
243
285
  vAPI.messaging.send('dashboard', {
244
286
  what: 'reloadAllFilters',
245
287
  });
246
288
  }
247
289
 
248
290
  function revertChanges() {
249
- setEditorText(cachedUserFilters);
291
+ qs$('#enableMyFilters input').checked = originalState.enabled;
292
+ qs$('#trustMyFilters input').checked = originalState.trusted;
293
+ setEditorText(originalState.filters);
294
+ userFiltersChanged();
250
295
  }
251
296
 
252
297
  /******************************************************************************/
@@ -268,8 +313,10 @@ self.cloud.onPull = setCloudData;
268
313
 
269
314
  /******************************************************************************/
270
315
 
316
+ self.wikilink = 'https://github.com/gorhill/uBlock/wiki/Dashboard:-My-filters';
317
+
271
318
  self.hasUnsavedData = function() {
272
- return getEditorText().trim() !== cachedUserFilters;
319
+ return currentStateChanged();
273
320
  };
274
321
 
275
322
  /******************************************************************************/
@@ -278,6 +325,8 @@ self.hasUnsavedData = function() {
278
325
  dom.on('#exportUserFiltersToFile', 'click', exportUserFiltersToFile);
279
326
  dom.on('#userFiltersApply', 'click', ( ) => { applyChanges(); });
280
327
  dom.on('#userFiltersRevert', 'click', revertChanges);
328
+ dom.on('#enableMyFilters input', 'change', userFiltersChanged);
329
+ dom.on('#trustMyFilters input', 'change', userFiltersChanged);
281
330
 
282
331
  (async ( ) => {
283
332
  await renderUserFilters();