From fefaf40514cbaaaf2d156a0be700e8a4e4d0cfc0 Mon Sep 17 00:00:00 2001 From: dgtlmoon Date: Mon, 29 Dec 2025 14:52:03 +0100 Subject: [PATCH] UI - Add https:// to URL on quickwatch form if not present --- changedetectionio/static/js/watch-overview.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/changedetectionio/static/js/watch-overview.js b/changedetectionio/static/js/watch-overview.js index 59fae0bf..62822d83 100644 --- a/changedetectionio/static/js/watch-overview.js +++ b/changedetectionio/static/js/watch-overview.js @@ -1,4 +1,21 @@ $(function () { + function normalizeUrl(el) { + const val = el.value.trim(); + if (val && !/^[a-zA-Z][a-zA-Z\d+\-.]*:/.test(val)) { + el.value = 'https://' + val; + } + } + + $('#url').on('blur keydown', function (e) { + if (e.type === 'blur' || e.key === 'Enter') { + normalizeUrl(this); + } + }); + + $('form').on('submit', function () { + normalizeUrl($('#url')[0]); + }); + // Remove unviewed status when normally clicked $('.diff-link').click(function () { $(this).closest('.unviewed').removeClass('unviewed');