diff --git a/changedetectionio/__init__.py b/changedetectionio/__init__.py index cc79e2e5..78966ad0 100644 --- a/changedetectionio/__init__.py +++ b/changedetectionio/__init__.py @@ -809,7 +809,13 @@ def changedetection_app(config=None, datastore_o=None): screenshot_url = datastore.get_screenshot(uuid) - output = render_template("diff.html", watch_a=watch, + system_uses_webdriver = datastore.data['settings']['application']['fetch_backend'] == 'html_webdriver' + + is_html_webdriver = True if watch.get('fetch_backend') == 'html_webdriver' or ( + watch.get('fetch_backend', None) is None and system_uses_webdriver) else False + + output = render_template("diff.html", + watch_a=watch, newest=newest_version_file_contents, previous=previous_version_file_contents, extra_stylesheets=extra_stylesheets, @@ -820,7 +826,8 @@ def changedetection_app(config=None, datastore_o=None): current_diff_url=watch['url'], extra_title=" - Diff - {}".format(watch['title'] if watch['title'] else watch['url']), left_sticky=True, - screenshot=screenshot_url) + screenshot=screenshot_url, + is_html_webdriver=is_html_webdriver) return output @@ -881,6 +888,11 @@ def changedetection_app(config=None, datastore_o=None): content.append({'line': "No history found", 'classes': ''}) screenshot_url = datastore.get_screenshot(uuid) + system_uses_webdriver = datastore.data['settings']['application']['fetch_backend'] == 'html_webdriver' + + is_html_webdriver = True if watch.get('fetch_backend') == 'html_webdriver' or ( + watch.get('fetch_backend', None) is None and system_uses_webdriver) else False + output = render_template("preview.html", content=content, extra_stylesheets=extra_stylesheets, @@ -889,8 +901,9 @@ def changedetection_app(config=None, datastore_o=None): current_diff_url=watch['url'], screenshot=screenshot_url, watch=watch, - uuid=uuid) - + uuid=uuid, + is_html_webdriver=is_html_webdriver) + return output @app.route("/settings/notification-logs", methods=['GET']) diff --git a/changedetectionio/static/js/diff-overview.js b/changedetectionio/static/js/diff-overview.js new file mode 100644 index 00000000..f3edbfdf --- /dev/null +++ b/changedetectionio/static/js/diff-overview.js @@ -0,0 +1,14 @@ +$(document).ready(function () { + // Load it when the #screenshot tab is in use, so we dont give a slow experience when waiting for the text diff to load + window.addEventListener('hashchange', function (e) { + toggle(location.hash); + }, false); + + toggle(location.hash); + + function toggle(hash_name) { + if (hash_name === '#screenshot') { + $("img#screenshot-img").attr('src', screenshot_url); + } + } +}); diff --git a/changedetectionio/templates/diff.html b/changedetectionio/templates/diff.html index db8b7f73..86927a8f 100644 --- a/changedetectionio/templates/diff.html +++ b/changedetectionio/templates/diff.html @@ -1,6 +1,11 @@ {% extends 'base.html' %} {% block content %} + + +

Differences

@@ -39,6 +44,7 @@ @@ -60,6 +66,21 @@ Diff algorithm from the amazing github.com/kpdecker/jsdiff
+
+
+ For now, Differences are performed on text, not graphically, only the latest screenshot is available. +
+
+ {% if is_html_webdriver %} + {% if screenshot|length >1 %} + Current screenshot from most recent request + {% else %} + No screenshot available just yet! Try rechecking the page. + {% endif %} + {% else %} + Screenshot requires Playwright/WebDriver enabled + {% endif %} +
diff --git a/changedetectionio/templates/preview.html b/changedetectionio/templates/preview.html index 7015d795..fb7a6546 100644 --- a/changedetectionio/templates/preview.html +++ b/changedetectionio/templates/preview.html @@ -1,6 +1,10 @@ {% extends 'base.html' %} {% block content %} + +

Current - {{watch.last_checked|format_timestamp_timeago}}

@@ -10,6 +14,7 @@
@@ -28,5 +33,20 @@
+
+
+ For now, Differences are performed on text, not graphically, only the latest screenshot is available. +
+
+ {% if is_html_webdriver %} + {% if screenshot|length >1 %} + Current screenshot from most recent request + {% else %} + No screenshot available just yet! Try rechecking the page. + {% endif %} + {% else %} + Screenshot requires Playwright/WebDriver enabled + {% endif %} +
{% endblock %} \ No newline at end of file