Skip to content

Commit 8c6e08d

Browse files
authoredFeb 21, 2024··
Merge pull request #166 from Moustachauve/button-bar-top
Implement option to place the button bar at the top of the interface
2 parents e038af2 + 377674e commit 8c6e08d

File tree

9 files changed

+162
-33
lines changed

9 files changed

+162
-33
lines changed
 

‎interface/lib/ads/activeAds.js

+60-27
Original file line numberDiff line numberDiff line change
@@ -30,33 +30,32 @@ export const ActiveAds = Object.freeze([
3030
"Raise money for charity every time you open a new browser tab. It's free and incredibly easy. Transform your tabs into a force for good in 30 seconds.",
3131
url: 'https://tab.gladly.io/cookieeditor/',
3232
supportedBrowsers: [Browsers.Chrome, Browsers.Edge, Browsers.Safari],
33-
refreshDays: 80,
33+
refreshDays: 90,
3434
startDate: new Date('2023/09/01'),
35-
endDate: new Date('2024/09/01'),
35+
endDate: new Date('2024/02/29'),
3636
}),
3737

3838
new Ad({
39-
id: 'moosend',
40-
text: 'Turn email into your ally with Moosend’s email marketing tools!',
39+
id: 'tab-for-cause2',
40+
text: 'Have 47+ tabs open? Try Tab for a Cause to raise money for non-profits',
4141
tooltip:
42-
'Manage your audience, segment it and use the data you collected to deliver messages that will make them click and convert! Start your journey today.',
43-
url: 'https://trymoo.moosend.com/cookie-editor',
44-
supportedBrowsers: Browsers.Any,
45-
refreshDays: 100,
46-
startDate: new Date('2023/11/01'),
47-
endDate: new Date('2024/11/01'),
42+
"Raise money for charity every time you open a new browser tab. It's free and incredibly easy. Transform your tabs into a force for good in 30 seconds.",
43+
url: 'https://tab.gladly.io/cookieeditor/',
44+
supportedBrowsers: [Browsers.Chrome, Browsers.Edge, Browsers.Safari],
45+
refreshDays: 90,
46+
startDate: new Date('2023/04/01'),
47+
endDate: new Date('2025/09/01'),
4848
}),
4949

5050
new Ad({
5151
id: 'skillshare',
52-
text: 'Join Skillshare Today and Get 30% Off Annual Membership.',
53-
tooltip:
54-
'Get unlimited access to classes on illustration, photography, design, film, music, and more.',
52+
text: 'Skillshare | Explore your creativity with thousands of hands‑on classes.',
53+
tooltip: 'Join Skillshare Today and Get 30% Off Annual Membership.',
5554
url: 'https://skillshare.eqcm.net/Mmo4oM',
5655
supportedBrowsers: Browsers.Any,
57-
refreshDays: 90,
56+
refreshDays: 110,
5857
startDate: new Date('2023/10/21'),
59-
endDate: new Date('2024/12/01'),
58+
endDate: new Date('2025/05/01'),
6059
}),
6160

6261
new Ad({
@@ -66,33 +65,33 @@ export const ActiveAds = Object.freeze([
6665
'Get NordVPN now to protect yourself online every day, wherever you are. Securely access apps, websites, and entertainment.',
6766
url: 'https://go.nordvpn.net/aff_c?offer_id=15&aff_id=93111&url_id=902',
6867
supportedBrowsers: Browsers.Any,
69-
refreshDays: 105,
68+
refreshDays: 120,
7069
startDate: new Date('2023/11/15'),
71-
endDate: new Date('2024/12/01'),
70+
endDate: new Date('2024/03/15'),
7271
}),
7372

7473
new Ad({
7574
id: 'nordvpn-deal',
76-
text: 'Get 65% off the 2-year NordVPN plan + 3 months extra.',
75+
text: "Don't miss a chance and grab a limited NordVPN deal!",
7776
tooltip:
78-
'Stay safer online with the leading VPN service. Detect malware during download. Block trackers and intrusive ads.',
77+
'Get NordVPN now to protect yourself online every day, wherever you are. Securely access apps, websites, and entertainment.',
7978
url: 'https://go.nordvpn.net/aff_c?offer_id=15&aff_id=93111&url_id=902',
8079
supportedBrowsers: Browsers.Any,
81-
refreshDays: 105,
82-
startDate: new Date('2023/10/01'),
83-
endDate: new Date('2023/11/14'),
80+
refreshDays: 120,
81+
startDate: new Date('2024/03/16'),
82+
endDate: new Date('2024/12/31'),
8483
}),
8584

8685
new Ad({
8786
id: 'aura',
88-
text: 'Aura | Intelligent Digital Safety for the Whole Family',
87+
text: 'Aura | #1 Rated Identity Theft Protection - Try Aura 14-days free.',
8988
tooltip:
90-
'Aura protects your identity, finances and sensitive data. All plans include a $1M insurance policy that covers eligible losses. Try Aura 14-days free.',
89+
'Aura protects your identity, finances and sensitive data. All plans include a $1M insurance policy that covers eligible losses.',
9190
url: 'https://aurainc.sjv.io/c/4869326/1835216/12398',
9291
supportedBrowsers: Browsers.Any,
93-
refreshDays: 125,
92+
refreshDays: 130,
9493
startDate: new Date('2023/10/07'),
95-
endDate: new Date('2024/12/01'),
94+
endDate: new Date('2025/02/01'),
9695
}),
9796

9897
new Ad({
@@ -102,8 +101,42 @@ export const ActiveAds = Object.freeze([
102101
'Thousands of companies are collecting, aggregating, and trading your personal data without you knowing anything about it. Incogni makes them remove it so your data stays secure and private.',
103102
url: 'https://get.incogni.io/aff_c?offer_id=1150&aff_id=25909',
104103
supportedBrowsers: Browsers.Any,
105-
refreshDays: 125,
104+
refreshDays: 140,
106105
startDate: new Date('2023/10/07'),
107106
endDate: new Date('2024/12/01'),
108107
}),
108+
109+
new Ad({
110+
id: 'incogni-code',
111+
text: 'Incogni | Want to stop robocalls and spam emails today?',
112+
tooltip:
113+
'Thousands of companies are collecting, aggregating, and trading your personal data without you knowing anything about it. Incogni makes them remove it so your data stays secure and private.',
114+
url: 'https://get.incogni.io/aff_c?offer_id=1150&aff_id=25909',
115+
supportedBrowsers: Browsers.Any,
116+
refreshDays: 140,
117+
startDate: new Date('2024/03/07'),
118+
endDate: new Date('2024/12/01'),
119+
}),
120+
121+
new Ad({
122+
id: 'namecheap',
123+
text: 'Namecheap | Get a .COM for just $5.98!',
124+
tooltip: 'All domains for great prices. Prices are succeptible to change.',
125+
url: 'https://namecheap.pxf.io/zNkAPe',
126+
supportedBrowsers: Browsers.Any,
127+
refreshDays: 130,
128+
startDate: new Date('2024/03/14'),
129+
endDate: new Date('2025/03/14'),
130+
}),
131+
132+
new Ad({
133+
id: 'curiosity-box',
134+
text: 'Try the Curiosity Box by VSauce and get a FREE Lightyear Bottle!',
135+
tooltip: "The world's best science toys by science legend, VSauce.",
136+
url: 'https://the-curiosity-box.pxf.io/DKrYOo',
137+
supportedBrowsers: Browsers.Any,
138+
refreshDays: 100,
139+
startDate: new Date('2024/03/14'),
140+
endDate: new Date('2025/03/14'),
141+
}),
109142
]);

‎interface/lib/options/options.js

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ export class Options {
1616
this.exportFormat = ExportFormats.Ask;
1717
this.extraInfo = ExtraInfos.Nothing;
1818
this.theme = Themes.Auto;
19+
this.buttonBarTop = false;
1920
this.adsEnabled = true;
2021
}
2122
}

‎interface/lib/optionsHandler.js

+16
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,22 @@ export class OptionsHandler extends EventEmitter {
221221
return false;
222222
}
223223

224+
/**
225+
* Gets whether the button bar is displayed at the top of the page or not.
226+
* @return {boolean} True if the button bar is on the top, otherwise false.
227+
*/
228+
getButtonBarTop() {
229+
return this.options.buttonBarTop;
230+
}
231+
/**
232+
* Sets whether the button bar is displayed at the top of the page or not.
233+
* @param {boolean} buttonBarTop True if the button bar is on the top, otherwise false.
234+
*/
235+
setButtonBarTop(buttonBarTop) {
236+
this.options.buttonBarTop = buttonBarTop;
237+
this.saveOptions();
238+
}
239+
224240
/**
225241
* Gets whether ads are enabled or not.
226242
* @return {boolean} True if ads are enabled, otherwise false.

‎interface/options/options.html

+12
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,18 @@
102102
automatically.
103103
</div>
104104
</div>
105+
106+
<div class="input-container">
107+
<label for="button-bar-top">Place Button Bar on Top</label>
108+
<label class="switch">
109+
<input type="checkbox" id="button-bar-top" aria-describedby="button-bar-top-hint" />
110+
<span class="slider"></span>
111+
</label>
112+
<div class="hint" id="button-bar-top-hint">
113+
When enabled, the main button bar will be placed at the top of the
114+
interface instead of the bottom.
115+
</div>
116+
</div>
105117

106118
<div class="input-container">
107119
<label for="ads-enabled">Show Ads</label>

‎interface/options/options.js

+8
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ document.addEventListener('DOMContentLoaded', async (event) => {
2121
const exportFormatInput = document.getElementById('export-format');
2222
const extraInfoInput = document.getElementById('extra-info');
2323
const themeInput = document.getElementById('theme');
24+
const buttonBarTopInput = document.getElementById('button-bar-top');
2425
const adsEnabledInput = document.getElementById('ads-enabled');
2526

2627
await optionHandler.loadOptions();
@@ -41,6 +42,7 @@ document.addEventListener('DOMContentLoaded', async (event) => {
4142
exportFormatInput.value = optionHandler.getExportFormat();
4243
extraInfoInput.value = optionHandler.getExtraInfo();
4344
themeInput.value = optionHandler.getTheme();
45+
buttonBarTopInput.checked = optionHandler.getButtonBarTop();
4446
adsEnabledInput.checked = optionHandler.getAdsEnabled();
4547

4648
if (!browserDetector.isSafari()) {
@@ -92,6 +94,12 @@ document.addEventListener('DOMContentLoaded', async (event) => {
9294
optionHandler.setTheme(themeInput.value);
9395
themeHandler.updateTheme();
9496
});
97+
buttonBarTopInput.addEventListener('change', (event) => {
98+
if (!event.isTrusted) {
99+
return;
100+
}
101+
optionHandler.setButtonBarTop(buttonBarTopInput.checked);
102+
});
95103
adsEnabledInput.addEventListener('change', (event) => {
96104
if (!event.isTrusted) {
97105
return;

‎interface/options/style.css

+2-1
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ a:hover {
5454

5555
.input-container {
5656
min-height: 2em;
57+
margin-top: 5px;
5758
}
5859

5960
.input-container input,
@@ -101,7 +102,7 @@ a:hover {
101102
color: var(--secondary-text-color);
102103
font-size: 0.8em;
103104
padding: 1em;
104-
padding-top: 2px;
105+
padding-top: 4px;
105106
}
106107

107108
.notice {

‎interface/popup-mobile/style.css

+21
Original file line numberDiff line numberDiff line change
@@ -521,6 +521,12 @@ label {
521521
user-select: none;
522522
overflow: hidden;
523523
}
524+
525+
.button-bar-top .panel-section-footer {
526+
border-top: none;
527+
border-bottom: 1px solid rgba(0, 0, 0, 0.15);
528+
}
529+
524530
.panel-section-footer-button {
525531
flex: 1 1;
526532
font-size: 18px;
@@ -564,6 +570,10 @@ label {
564570
padding: 0 25px;
565571
}
566572

573+
.button-bar-top #notification-container {
574+
bottom: 30px;
575+
}
576+
567577
#notification {
568578
position: relative;
569579
display: inline-block;
@@ -760,6 +770,17 @@ label {
760770
border-right: solid 15px transparent;
761771
}
762772

773+
.button-bar-top #export-menu {
774+
top: 142px;
775+
bottom: auto;
776+
}
777+
.button-bar-top #export-menu:after {
778+
top: auto;
779+
bottom: 100%;
780+
border-top: none;
781+
border-bottom: solid 10px var(--menu-surface-color);
782+
}
783+
763784
#export-menu button {
764785
background-color: var(--menu-surface-color);
765786
color: var(--primary-text-color);

‎interface/popup/cookie-list.js

+19
Original file line numberDiff line numberDiff line change
@@ -1064,6 +1064,7 @@ import { CookieHandlerPopup } from './cookieHandlerPopup.js';
10641064
async function initWindow(_tab) {
10651065
await optionHandler.loadOptions();
10661066
themeHandler.updateTheme();
1067+
moveButtonBar();
10671068
handleAd();
10681069
handleAnimationsEnabled();
10691070
optionHandler.on('optionsChanged', onOptionsChanged);
@@ -1331,6 +1332,7 @@ import { CookieHandlerPopup } from './cookieHandlerPopup.js';
13311332
*/
13321333
function onOptionsChanged(oldOptions) {
13331334
handleAnimationsEnabled();
1335+
moveButtonBar();
13341336
if (oldOptions.advancedCookies != optionHandler.getCookieAdvanced()) {
13351337
document.querySelector('#advanced-toggle-all').checked =
13361338
optionHandler.getCookieAdvanced();
@@ -1341,4 +1343,21 @@ import { CookieHandlerPopup } from './cookieHandlerPopup.js';
13411343
showCookiesForTab();
13421344
}
13431345
}
1346+
1347+
/**
1348+
* Moves the button bar to the top or bottom depending on the user preference
1349+
*/
1350+
function moveButtonBar() {
1351+
const siblingElement = optionHandler.getButtonBarTop()
1352+
? document.getElementById('pageTitle').nextSibling
1353+
: document.body.lastChild;
1354+
document.querySelectorAll('.button-bar').forEach((bar) => {
1355+
siblingElement.parentNode.insertBefore(bar, siblingElement);
1356+
if (optionHandler.getButtonBarTop()) {
1357+
document.body.classList.add('button-bar-top');
1358+
} else {
1359+
document.body.classList.remove('button-bar-top');
1360+
}
1361+
});
1362+
}
13441363
})();

‎interface/popup/style.css

+23-5
Original file line numberDiff line numberDiff line change
@@ -468,11 +468,6 @@ label {
468468
margin: 0;
469469
}
470470

471-
.panel-section-footer-button {
472-
font-size: 14px;
473-
line-height: 14px;
474-
}
475-
476471
.button-bar {
477472
display: none;
478473
z-index: 5;
@@ -567,7 +562,15 @@ body,
567562
user-select: none;
568563
overflow: hidden;
569564
}
565+
566+
.button-bar-top .panel-section-footer {
567+
border-top: none;
568+
border-bottom: 1px solid rgba(0, 0, 0, 0.15);
569+
}
570+
570571
.panel-section-footer-button {
572+
font-size: 14px;
573+
line-height: 14px;
571574
flex: 1 1;
572575
padding: 12px;
573576
text-align: center;
@@ -643,6 +646,10 @@ body,
643646
padding: 0 25px;
644647
}
645648

649+
.button-bar-top #notification-container {
650+
bottom: 15px;
651+
}
652+
646653
#notification {
647654
position: relative;
648655
display: inline-block;
@@ -853,6 +860,17 @@ body,
853860
border-right: solid 10px transparent;
854861
}
855862

863+
.button-bar-top #export-menu {
864+
top: 92px;
865+
bottom: auto;
866+
}
867+
.button-bar-top #export-menu:after {
868+
top: auto;
869+
bottom: 100%;
870+
border-top: none;
871+
border-bottom: solid 10px var(--menu-surface-color);
872+
}
873+
856874
#export-menu h3 {
857875
margin-top: 0;
858876
margin-left: 2px;

0 commit comments

Comments
 (0)
Please sign in to comment.