Skip to content

Commit 42f7751

Browse files
committed
add search result count to nap room
1 parent c967d49 commit 42f7751

27 files changed

+31
-18
lines changed

docs/changelog.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ PRs and other ideas are welcome.
1010
## Changes ##
1111

1212
**May 2021**
13+
#### 2.4.1
14+
- show number of search results in the nap room
15+
- misc ui related fixes
16+
1317
#### 2.4.0
1418
- Edit Snoozz times for sleeping tabs 🎉
1519
- Snooze Again for awoken tabs

external_assets/listing-1.jpg

-256 KB
Binary file not shown.

external_assets/listing-1.png

-189 KB
Binary file not shown.

external_assets/listing-2.png

-200 KB
Binary file not shown.

external_assets/listing-3-edge.png

-212 KB
Binary file not shown.

external_assets/listing-3-ff.png

-212 KB
Binary file not shown.

external_assets/listing-3.png

-211 KB
Binary file not shown.

external_assets/listing-4.png

-200 KB
Binary file not shown.

external_assets/logo-hd.png

-169 KB
Binary file not shown.

external_assets/safari-logo.png

-35.3 KB
Binary file not shown.

external_assets/snoozz.png

-1.97 KB
Binary file not shown.

external_assets/thumb-lg.jpg

-386 KB
Binary file not shown.

external_assets/thumb-lg.png

-237 KB
Binary file not shown.

external_assets/thumb-md.jpg

-132 KB
Binary file not shown.

external_assets/thumb-md.png

-338 KB
Binary file not shown.

external_assets/thumb-sm.jpg

-45.3 KB
Binary file not shown.

external_assets/thumb-sm.png

-71.5 KB
Binary file not shown.

html/nap-room.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
</div>
2929
<div id="time-container"></div>
3030
<div id="no-tabs" class="hidden">
31-
<span>No tabs found :(</span>
3231
<div class="contain-clock">
3332
<div class="face-1">
3433
<div class="hour"></div>
@@ -52,6 +51,7 @@
5251
<div class="bell"></div>
5352
<div class="bell bell-2"></div>
5453
</div>
54+
<span>No tabs found :(</span>
5555
</div>
5656
<p id="api-message" class="hidden">Like most people, tabs may take 10 minutes to get out of bed. Mainly due to API restrictions, but also, laziness.</p>
5757
<p id="history-message">Tabs in your Snoozz history are removed <a id="historyHref" href="./settings.html#history">-</a> after they wake up.</p>
File renamed without changes.

html/settings.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,8 @@ <h4>Snoozz tabs using the right-click (context) menu</h4>
108108
</div>
109109
<div tabindex="0" class="btn"><div></div></div>
110110
<div id="contextMenu" class="choice-list">
111-
<div><input type="checkbox" id="startup"><label for="today-morning">On Browser Launch</label></div>
112-
<div><input type="checkbox" id="in-an-hour"><label for="today-morning">In One Hour</label></div>
111+
<div><input type="checkbox" id="startup"><label for="startup">On Browser Launch</label></div>
112+
<div><input type="checkbox" id="in-an-hour"><label for="in-an-hour">In One Hour</label></div>
113113
<div><input type="checkbox" id="today-morning"><label for="today-morning">This Morning</label></div>
114114
<div><input type="checkbox" id="today-evening"><label for="today-evening">This Evening</label></div>
115115
<div><input type="checkbox" id="tom-morning"><label for="tom-morning">Tomorrow Morning</label></div>

manifest.json

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,5 @@
6161
"month": {
6262
"description": "Snooze till one month from now"
6363
}
64-
},
65-
"browser_specific_settings": {
66-
"gecko": {
67-
"id": "snooze@snooze.me"
68-
}
6964
}
7065
}

scripts/common.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ async function createNotification(id, title, imgUrl, message) {
9595
await chrome.notifications.create(id, {type: 'basic', iconUrl: chrome.extension.getURL(imgUrl), title, message});
9696
}
9797
async function createWindow(tabId) {
98-
return new Promise(r => chrome.windows.create({url: `/html/rise_and_shine.html#${tabId}`}, r));
98+
return new Promise(r => chrome.windows.create({url: `/html/rise-and-shine.html#${tabId}`}, r));
9999
}
100100

101101
/* CONFIGURE */
@@ -151,14 +151,14 @@ async function openTab(tab, windowId, automatic = false) {
151151
async function openWindow(t, automatic = false) {
152152
var targetWindowID, currentWindow = await getTabsInWindow();
153153
if (currentWindow.length && currentWindow.filter(isDefault).length === currentWindow.length) {
154-
await openExtensionTab(`/html/rise_and_shine.html#${t.id}`);
154+
await openExtensionTab(`/html/rise-and-shine.html#${t.id}`);
155155
targetWindowID = currentWindow[0].windowId;
156156
} else {
157157
var window = await createWindow(t.id);
158158
targetWindowID = window.id;
159159
}
160160

161-
// send message to map browser tabs to tab-list in rise_and_shine.html
161+
// send message to map browser tabs to tab-list in rise-and-shine.html
162162
var loadingCount = 0;
163163
chrome.tabs.onUpdated.addListener(async function cleanTabsAfterLoad(id, state, title) {
164164
if (loadingCount > t.tabs.length) {

scripts/nap_room.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,7 @@ function search(t, query) {
180180
// categories
181181
if (matchQuery(query, getTimeGroup(t, 'wakeUpTime', true).map(tg => tg.replace(/_/g, ' ')))) return true;
182182
if (matchQuery(query, getTimeGroup(t, 'timeCreated', true).map(tg => tg.replace(/_/g, ' ')))) return true;
183+
if (matchQuery(query, getTimeGroup(t, 'modifiedTime', true).map(tg => tg.replace(/_/g, ' ')))) return true;
183184
// absolute time
184185
if ( t.opened && matchQuery(query, dayjs(t.opened).format('dddd DD MMMM A'))) return true;
185186
if (!t.opened && t.wakeUpTime && matchQuery(query, dayjs(t.wakeUpTime).format('dddd DD MMMM A'))) return true;
@@ -191,6 +192,13 @@ function performSearch(searchQuery = '') {
191192
var tabs = document.querySelectorAll('.tab');
192193
if (tabs) tabs.forEach(t => t.classList.toggle('hidden', !search((CACHED_TABS).find(ct => ct.id == t.id), searchQuery)));
193194
updateTimeGroups();
195+
countSearchItems();
196+
}
197+
198+
function countSearchItems() {
199+
var all = document.querySelectorAll('.time-group .tab').length;
200+
var visible = document.querySelectorAll('.time-group .tab:not(.hidden)').length;
201+
document.querySelector('.search-container').setAttribute('data-search', `Showing ${visible} out of ${all} items`);
194202
}
195203

196204
function buildTabActions(t, tabDiv) {

scripts/settings.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ async function initialize() {
3737
document.querySelector('code').addEventListener('click', _ => {
3838
clipboard('about:addons')
3939
document.querySelector('body > .copied').classList.add('toast');
40-
setTimeout(_ => document.querySelector('body > .copied').remove('toast'), 4000)
40+
setTimeout(_ => document.querySelector('body > .copied').classList.remove('toast'), 4000)
4141
});
4242

4343
if (getBrowser() === 'safari') await chrome.runtime.getBackgroundPage(async bg => {await bg.wakeUpTask()});

styles/nap-room.css

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ body {
1515
touch-action: none;
1616
transition: opacity .3s ease-in-out;
1717
}
18+
#no-tabs span {
19+
display: inline-block;
20+
margin-top: 5em;
21+
}
1822
#no-tabs.hidden, .search-container.hidden, .instructions.hidden {
1923
opacity: 0;
2024
pointer-events: none;
@@ -369,15 +373,17 @@ body:not(.dark) p {
369373
background-size: 202%;
370374
background-position: right;
371375
}
372-
.search-container:not(.valid-search):focus-within:before {
376+
.search-container.valid-search:after, .search-container:not(.valid-search):focus-within:before {
373377
content: '3 characters minimum';
374378
position: absolute;
375379
left: 0;
376-
top: 120%;
380+
top: 150%;
377381
width: 100%;
378382
text-align: center;
379-
font-size: .9em;
380-
color: #BBB;
383+
color: var(--color);
384+
}
385+
.search-container.valid-search:after {
386+
content: attr(data-search);
381387
}
382388
.input-wrapper:after {
383389
content: '';

styles/popup.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ img {
99
}
1010

1111
a {
12-
color: #000;
12+
color: var(--color);
1313
}
1414

1515
h3 {

styles/settings.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ kbd {
203203
code {
204204
cursor: pointer;
205205
font-size: 1.2em;
206-
background-color: #ddd;
206+
background-color: #999;
207207
border-radius: .25em;
208208
padding: .1em .2em;
209209
user-select: none;

0 commit comments

Comments
 (0)