aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKyle D <kdumontnu@gmail.com>2021-04-05 10:45:01 -0600
committerGitHub <noreply@github.com>2021-04-05 18:45:01 +0200
commite10d028b039af5d63ef29f4c33fb04029da3d5a8 (patch)
tree9d2aa1f5b5436cc65538637f376caef64dd5617a
parent16dea6cebd375fc274fc7a9c216dbcc9e22bd5c7 (diff)
downloadgitea-e10d028b039af5d63ef29f4c33fb04029da3d5a8.tar.gz
gitea-e10d028b039af5d63ef29f4c33fb04029da3d5a8.zip
Check if stopwatch element empty (#15278)
-rw-r--r--web_src/js/features/stopwatch.js9
1 files changed, 5 insertions, 4 deletions
diff --git a/web_src/js/features/stopwatch.js b/web_src/js/features/stopwatch.js
index 9352ef292d..ed20ca3227 100644
--- a/web_src/js/features/stopwatch.js
+++ b/web_src/js/features/stopwatch.js
@@ -9,6 +9,11 @@ export async function initStopwatch() {
}
const stopwatchEl = $('.active-stopwatch-trigger');
+
+ if (!stopwatchEl.length) {
+ return;
+ }
+
stopwatchEl.removeAttr('href'); // intended for noscript mode only
stopwatchEl.popup({
position: 'bottom right',
@@ -20,10 +25,6 @@ export async function initStopwatch() {
$(this).parent().trigger('submit');
});
- if (!stopwatchEl) {
- return;
- }
-
if (NotificationSettings.EventSourceUpdateTime > 0 && !!window.EventSource && window.SharedWorker) {
// Try to connect to the event source via the shared worker first
const worker = new SharedWorker(`${__webpack_public_path__}js/eventsource.sharedworker.js`, 'notification-worker');