Skip to content

Commit 1a9a19a

Browse files
committed
[mv3] Open options page at first install
To be sure first time users are properly informed about the possibility to enable broad permissions for better filtering.
1 parent 6210a85 commit 1a9a19a

File tree

11 files changed

+164
-21
lines changed

11 files changed

+164
-21
lines changed

platform/mv3/extension/3p-filters.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@
1616
<div class="body">
1717

1818
<div id="actions">
19-
<p>
19+
<p class="firstRun">
2020
<label id="omnipotenceWidget"><span class="input checkbox"><input type="checkbox"><svg viewBox="0 0 24 24"><path d="M1.73,12.91 8.1,19.28 22.79,4.59"/></svg></span><span data-i18n="omnipotenceLabel">_</span></label>
2121
<legend data-i18n="omnipotenceLegend">_</legend>
2222
</p>
2323
<hr>
24-
<p><button id="buttonApply" class="preferred disabled iconified" type="button" data-i18n-title="genericApplyChanges"><span class="fa-icon">check</span><span data-i18n="genericApplyChanges">_</span><span class="hover"></span></button>
2524
<p id="listsOfBlockedHostsPrompt">
25+
<p><button id="buttonApply" class="preferred disabled iconified" type="button" data-i18n-title="genericApplyChanges"><span class="fa-icon">check</span><span data-i18n="genericApplyChanges">_</span><span class="hover"></span></button>
2626
</div>
2727

2828
<div>

platform/mv3/extension/css/3p-filters.css

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@ legend {
1717
top: 0;
1818
z-index: 10;
1919
}
20+
body.firstRun .firstRun {
21+
background-color: rgb(var(--dashboard-highlight-surface-rgb));
22+
padding: 8px;
23+
zoom: 1.1;
24+
}
2025
#buttonUpdate.active {
2126
pointer-events: none;
2227
}

platform/mv3/extension/css/dashboard-common.css

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
body > div.body {
22
margin: 0 1em;
3-
max-width: min(600px, 100vw);
43
}
54
h2, h3 {
65
margin: 1em 0;
Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
html, body {
2+
align-items: center;
3+
display: flex;
4+
flex-direction: column;
5+
height: 100vh;
6+
justify-content: stretch;
7+
overflow: hidden;
8+
position: relative;
9+
width: 100vw;
10+
}
11+
body > * {
12+
width: min(641px, 100vw);
13+
}
14+
#dashboard-nav {
15+
border: 0;
16+
border-bottom: 1px solid var(--border-1);
17+
display: flex;
18+
flex-shrink: 0;
19+
flex-wrap: wrap;
20+
overflow-x: hidden;
21+
padding: 0;
22+
position: sticky;
23+
top: 0;
24+
z-index: 10;
25+
}
26+
.tabButton {
27+
background-color: transparent;
28+
border: 0;
29+
border-bottom: 3px solid transparent;
30+
border-radius: 0;
31+
color: var(--dashboard-tab-ink);
32+
fill: var(--dashboard-tab-ink);
33+
font-family: var(--font-family);
34+
font-size: var(--font-size);
35+
padding: 0.7em 1.4em calc(0.7em - 3px);
36+
text-decoration: none;
37+
white-space: nowrap;
38+
}
39+
.tabButton:focus {
40+
outline: 0;
41+
}
42+
/*
43+
* TODO: support keyboard-driven navigation
44+
*
45+
.tabButton:not(:active):focus {
46+
background-color: var(--dashboard-tab-focus-surface);
47+
}
48+
*/
49+
.tabButton.selected {
50+
background-color: var(--dashboard-tab-active-surface);
51+
border-bottom: 3px solid var(--dashboard-tab-active-ink);
52+
color: var(--dashboard-tab-active-ink);
53+
fill: var(--dashboard-tab-active-ink);
54+
}
55+
iframe {
56+
background-color: transparent;
57+
border: 0;
58+
flex-grow: 1;
59+
margin: 0;
60+
padding: 0;
61+
}
62+
#unsavedWarning {
63+
display: none;
64+
left: 0;
65+
position: absolute;
66+
width: 100%;
67+
z-index: 20;
68+
}
69+
#unsavedWarning.on {
70+
display: initial;
71+
}
72+
#unsavedWarning > div:first-of-type {
73+
padding: 0.5em;
74+
}
75+
#unsavedWarning > div:last-of-type {
76+
height: 100vh;
77+
position: absolute;
78+
}
79+
80+
body:not(.canUpdateShortcuts) .tabButton[data-pane="shortcuts.html"] {
81+
display: none;
82+
}
83+
body .tabButton[data-pane="no-dashboard.html"] {
84+
display: none;
85+
}
86+
body.noDashboard #dashboard-nav {
87+
display: none;
88+
}
89+
90+
/* high dpi devices */
91+
:root.hidpi .tabButton {
92+
font-family: Metropolis, sans-serif;
93+
font-weight: 600;
94+
letter-spacing: 0.5px;
95+
}
96+
97+
/* hover-able devices */
98+
:root.desktop .tabButton {
99+
cursor: default;
100+
}
101+
:root.desktop .tabButton:not(.selected) {
102+
cursor: pointer;
103+
}
104+
:root.desktop .tabButton:not(.selected):hover {
105+
background-color: var(--dashboard-tab-hover-surface);
106+
border-bottom-color: var(--dashboard-tab-hover-border);
107+
}
108+
109+
/* touch-screen devices */
110+
:root.mobile #dashboard-nav {
111+
flex-wrap: nowrap;
112+
overflow-x: auto;
113+
}
114+
:root.mobile #dashboard-nav .logo {
115+
display: none;
116+
}

platform/mv3/extension/dashboard.html

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,22 +12,24 @@
1212
</head>
1313

1414
<body>
15-
<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="3p-filters.html" data-i18n="3pPageName" tabindex="0"></button><!--
18-
--><button class="tabButton" type="button" data-pane="about.html" data-i18n="aboutPageName" tabindex="0"></button>
19-
</div>
20-
<section id="unsavedWarning" class="notice">
21-
<div>
22-
<span data-i18n="dashboardUnsavedWarning"></span>&emsp;
23-
<button type="button" data-i18n="dashboardUnsavedWarningStay">_<span class="hover"></span></button>&ensp;
24-
<button type="button" data-i18n="dashboardUnsavedWarningIgnore">_<span class="hover"></span></button>
15+
<!-- -------- -->
16+
<div id="dashboard-nav">
17+
<span class="logo"><img data-i18n-title="extName" src="img/ublock.svg"></span><!--
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="about.html" data-i18n="aboutPageName" tabindex="0"></button>
2520
</div>
26-
<div></div>
27-
</section>
28-
29-
<iframe id="iframe" src=""></iframe>
30-
21+
<!-- -------- -->
22+
<section id="unsavedWarning" class="notice">
23+
<div>
24+
<span data-i18n="dashboardUnsavedWarning"></span>&emsp;
25+
<button type="button" data-i18n="dashboardUnsavedWarningStay">_<span class="hover"></span></button>&ensp;
26+
<button type="button" data-i18n="dashboardUnsavedWarningIgnore">_<span class="hover"></span></button>
27+
</div>
28+
<div></div>
29+
</section>
30+
<!-- -------- -->
31+
<iframe id="iframe" src=""></iframe>
32+
<!-- -------- -->
3133
<script src="js/i18n.js" type="module"></script>
3234
<script src="js/dashboard.js" type="module"></script>
3335

platform/mv3/extension/js/3p-filters.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,8 @@ function renderFilterLists(soft = false) {
214214
/******************************************************************************/
215215

216216
const renderWidgets = function() {
217+
dom.cl.toggle(dom.body, 'firstRun', cachedRulesetData.firstRun === true);
218+
217219
qs$('#omnipotenceWidget input').checked = cachedRulesetData.hasOmnipotence;
218220

219221
dom.cl.toggle(

platform/mv3/extension/js/background.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ import {
5656
const rulesetConfig = {
5757
version: '',
5858
enabledRulesets: [],
59+
firstRun: false,
5960
};
6061

6162
/******************************************************************************/
@@ -69,6 +70,7 @@ async function loadRulesetConfig() {
6970
const configRule = dynamicRuleMap.get(CURRENT_CONFIG_BASE_RULE_ID);
7071
if ( configRule === undefined ) {
7172
rulesetConfig.enabledRulesets = await defaultRulesetsFromLanguage();
73+
rulesetConfig.firstRun = true;
7274
return;
7375
}
7476

@@ -167,7 +169,9 @@ function onMessage(request, sender, callback) {
167169
enabledRulesets,
168170
rulesetDetails: Array.from(rulesetDetails.values()),
169171
hasOmnipotence,
172+
firstRun: rulesetConfig.firstRun,
170173
});
174+
rulesetConfig.firstRun = false;
171175
});
172176
return true;
173177
}
@@ -243,4 +247,8 @@ async function start() {
243247

244248
browser.permissions.onAdded.addListener(onPermissionsAdded);
245249
browser.permissions.onRemoved.addListener(onPermissionsRemoved);
250+
251+
if ( rulesetConfig.firstRun ) {
252+
runtime.openOptionsPage();
253+
}
246254
})();

platform/mv3/extension/popup.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
<body class="loading" data-section="">
1515
<div id="main">
16+
<!-- -------- -->
1617
<div id="sticky">
1718
<div id="stickyTools">
1819
<div class="rulesetTools">
@@ -40,6 +41,7 @@
4041
</div>
4142
<div id="hostname"><span></span>&shy;<span></span></div>
4243
</div>
44+
<!-- -------- -->
4345
<div class="toolRibbon pageTools">
4446
<span id="toggleGreatPowers">
4547
<span class="fa-icon tool enabled" data-i18n-title="popupGrantGreatPowers">sun-o<span class="caption"></span></span>
@@ -51,9 +53,11 @@
5153
<span></span>
5254
<a href="dashboard.html" class="fa-icon tool enabled" target="uBODashboard" tabindex="0" data-i18n-title="popupTipDashboard">cogs<span class="caption" data-i18n="popupTipDashboard"></span></a>
5355
</div>
56+
<!-- -------- -->
5457
<div id="rulesetStats" data-section="a">
5558
</div>
5659
<hr data-section="a">
60+
<!-- -------- -->
5761
<div id="moreOrLess">
5862
<span id="moreButton">
5963
<span data-i18n="popupMoreButton">_</span>&emsp;<span class="fa-icon">angle-up</span>

platform/mv3/make-rulesets.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,13 @@ const outputDir = commandLineArgs.get('output') || '.';
5555
const cacheDir = `${outputDir}/../mv3-data`;
5656
const rulesetDir = `${outputDir}/rulesets`;
5757
const scriptletDir = `${rulesetDir}/js`;
58-
const env = [ 'chromium', 'ubol', 'native_css_has' ];
58+
const env = [
59+
'chromium',
60+
'native_css_has',
61+
'ublock',
62+
'ubol',
63+
'user_stylesheet',
64+
];
5965

6066
/******************************************************************************/
6167

src/css/themes/default.css

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
https://material.io/
66
77
Color names from:
8-
https://protocol.mozilla.org/fundamentals/color.html
8+
https://protocol.mozilla.org/docs/fundamentals/color.html
99
1010
Tools:
1111
Lightness validator: https://www.hsluv.org/
@@ -237,6 +237,7 @@
237237

238238
--dashboard-tab-active-ink-rgb: var(--primary-40);
239239
--dashboard-tab-focus-surface-rgb: var(--primary-90);
240+
--dashboard-highlight-surface-rgb: var(--primary-90);
240241

241242
/* popup panel */
242243
--popup-cell-cname-ink: #0054d7; /* h260 S:100 Luv:40 */;
@@ -327,6 +328,7 @@
327328

328329
--dashboard-tab-active-ink-rgb: var(--primary-70);
329330
--dashboard-tab-focus-surface-rgb: var(--primary-20);
331+
--dashboard-highlight-surface-rgb: var(--primary-20);
330332

331333
/* popup panel */
332334
--popup-cell-cname-ink: #93a6ff; /* h260 S:100 Luv:70 */;

tools/make-mv3.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ echo "*** uBOLite.mv3: Copying common files"
2525
cp -R src/css/fonts/* $DES/css/fonts/
2626
cp src/css/themes/default.css $DES/css/
2727
cp src/css/common.css $DES/css/
28-
cp src/css/dashboard.css $DES/css/
2928
cp src/css/dashboard-common.css $DES/css/
3029
cp src/css/fa-icons.css $DES/css/
3130

0 commit comments

Comments
 (0)