Skip to content

Commit c9a3c26

Browse files
committed
Check if stopwatch element empty
1 parent 16dea6c commit c9a3c26

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

web_src/js/features/stopwatch.js

+5-4
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@ export async function initStopwatch() {
99
}
1010

1111
const stopwatchEl = $('.active-stopwatch-trigger');
12+
13+
if (!stopwatchEl.length) {
14+
return;
15+
}
16+
1217
stopwatchEl.removeAttr('href'); // intended for noscript mode only
1318
stopwatchEl.popup({
1419
position: 'bottom right',
@@ -20,10 +25,6 @@ export async function initStopwatch() {
2025
$(this).parent().trigger('submit');
2126
});
2227

23-
if (!stopwatchEl) {
24-
return;
25-
}
26-
2728
if (NotificationSettings.EventSourceUpdateTime > 0 && !!window.EventSource && window.SharedWorker) {
2829
// Try to connect to the event source via the shared worker first
2930
const worker = new SharedWorker(`${__webpack_public_path__}js/eventsource.sharedworker.js`, 'notification-worker');

0 commit comments

Comments
 (0)