this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Shift+j/k shortcut to skip posts in Boosts Carousel

+20 -4
+20 -4
src/pages/home.jsx
··· 139 139 140 140 const scrollableRef = useRef(); 141 141 142 - useHotkeys('j', () => { 142 + useHotkeys('j, shift+j', (_, handler) => { 143 143 // focus on next status after active status 144 144 // Traverses .timeline li .status-link, focus on .status-link 145 145 const activeStatus = document.activeElement.closest( ··· 157 157 activeStatusRect.bottom > 0 158 158 ) { 159 159 const activeStatusIndex = allStatusLinks.indexOf(activeStatus); 160 - const nextStatus = allStatusLinks[activeStatusIndex + 1]; 160 + let nextStatus = allStatusLinks[activeStatusIndex + 1]; 161 + if (handler.shift) { 162 + // get next status that's not .status-boost-link 163 + nextStatus = allStatusLinks.find( 164 + (statusLink, index) => 165 + index > activeStatusIndex && 166 + !statusLink.classList.contains('status-boost-link'), 167 + ); 168 + } 161 169 if (nextStatus) { 162 170 nextStatus.focus(); 163 171 nextStatus.scrollIntoViewIfNeeded?.(); ··· 175 183 } 176 184 }); 177 185 178 - useHotkeys('k', () => { 186 + useHotkeys('k. shift+k', () => { 179 187 // focus on previous status after active status 180 188 // Traverses .timeline li .status-link, focus on .status-link 181 189 const activeStatus = document.activeElement.closest( ··· 193 201 activeStatusRect.bottom > 0 194 202 ) { 195 203 const activeStatusIndex = allStatusLinks.indexOf(activeStatus); 196 - const prevStatus = allStatusLinks[activeStatusIndex - 1]; 204 + let prevStatus = allStatusLinks[activeStatusIndex - 1]; 205 + if (handler.shift) { 206 + // get prev status that's not .status-boost-link 207 + prevStatus = allStatusLinks.find( 208 + (statusLink, index) => 209 + index < activeStatusIndex && 210 + !statusLink.classList.contains('status-boost-link'), 211 + ); 212 + } 197 213 if (prevStatus) { 198 214 prevStatus.focus(); 199 215 prevStatus.scrollIntoViewIfNeeded?.();