2021-01-31 18:55:35 +00:00
{% extends 'base.html' %}
2022-12-05 13:48:03 +00:00
{% from '_helpers.jinja' import render_field, render_checkbox_field, render_button %}
2021-01-31 18:55:35 +00:00
{% block content %}
2022-06-07 17:22:42 +00:00
< script >
const screenshot_url="{{url_for('static_content', group='screenshot', filename=uuid)}}";
2022-08-15 16:56:53 +00:00
{% if last_error_screenshot %}
const error_screenshot_url="{{url_for('static_content', group='screenshot', filename=uuid, error_screenshot=1) }}";
{% endif %}
2023-08-24 12:29:48 +00:00
const highlight_submit_ignore_url="{{url_for('highlight_submit_ignore_url', uuid=uuid)}}";
2022-06-07 17:22:42 +00:00
< / script >
2023-04-30 08:38:50 +00:00
< script src = "{{url_for('static_content', group='js', filename='diff-overview.js')}}" defer > < / script >
2022-06-07 17:22:42 +00:00
2021-02-01 11:39:15 +00:00
< div id = "settings" >
< h1 > Differences< / h1 >
< form class = "pure-form " action = "" method = "GET" >
< fieldset >
< label for = "diffWords" class = "pure-checkbox" >
2023-04-29 20:29:57 +00:00
< input type = "radio" name = "diff_type" id = "diffWords" value = "diffWords" > Words< / label >
2021-02-01 11:39:15 +00:00
< label for = "diffLines" class = "pure-checkbox" >
2023-04-29 20:29:57 +00:00
< input type = "radio" name = "diff_type" id = "diffLines" value = "diffLines" checked = "" > Lines< / label >
2021-02-01 11:39:15 +00:00
< label for = "diffChars" class = "pure-checkbox" >
2023-04-29 20:29:57 +00:00
< input type = "radio" name = "diff_type" id = "diffChars" value = "diffChars" > Chars< / label >
2022-11-19 14:15:25 +00:00
<!-- @todo - when mimetype is JSON, select this by default? -->
< label for = "diffJson" class = "pure-checkbox" >
2023-04-29 20:29:57 +00:00
< input type = "radio" name = "diff_type" id = "diffJson" value = "diffJson" > JSON< / label >
2021-02-01 11:39:15 +00:00
{% if versions|length >= 1 %}
2021-02-02 15:36:03 +00:00
< label for = "diff-version" > Compare newest (< span id = "current-v-date" > < / span > ) with< / label >
2021-02-01 11:39:15 +00:00
< select id = "diff-version" name = "previous_version" >
2022-06-23 08:16:05 +00:00
{% for version in versions|reverse %}
2021-04-01 10:53:19 +00:00
< option value = "{{version}}" { % if version = = current_previous_version % } selected = "" { % endif % } >
{{version}}
< / option >
2021-02-01 11:39:15 +00:00
{% endfor %}
< / select >
< button type = "submit" class = "pure-button pure-button-primary" > Go< / button >
{% endif %}
< / fieldset >
< / form >
2021-01-31 18:55:35 +00:00
< del > Removed text< / del >
< ins > Inserted Text< / ins >
2022-11-19 14:08:27 +00:00
< span >
<!-- https://github.com/kpdecker/jsdiff/issues/389 ? -->
< label for = "ignoreWhitespace" class = "pure-checkbox" id = "label-diff-ignorewhitespace" >
2023-04-29 20:29:57 +00:00
< input type = "checkbox" id = "ignoreWhitespace" name = "ignoreWhitespace" > Ignore Whitespace< / label >
2022-11-19 14:08:27 +00:00
< / span >
2021-01-31 18:55:35 +00:00
< / div >
2021-02-24 08:53:40 +00:00
< div id = "diff-jump" >
< a onclick = "next_diff();" > Jump< / a >
< / div >
2022-04-02 12:49:32 +00:00
2023-04-30 08:38:50 +00:00
< script src = "{{url_for('static_content', group='js', filename='tabs.js')}}" defer > < / script >
2022-04-02 12:49:32 +00:00
< div class = "tabs" >
< ul >
2022-08-15 16:56:53 +00:00
{% if last_error_text %}< li class = "tab" id = "error-text-tab" > < a href = "#error-text" > Error Text< / a > < / li > {% endif %}
{% if last_error_screenshot %}< li class = "tab" id = "error-screenshot-tab" > < a href = "#error-screenshot" > Error Screenshot< / a > < / li > {% endif %}
< li class = "tab" id = "" > < a href = "#text" > Text< / a > < / li >
2022-06-07 17:22:42 +00:00
< li class = "tab" id = "screenshot-tab" > < a href = "#screenshot" > Screenshot< / a > < / li >
2022-12-05 13:48:03 +00:00
< li class = "tab" id = "extract-tab" > < a href = "#extract" > Extract Data< / a > < / li >
2022-04-02 12:49:32 +00:00
< / ul >
< / div >
2021-02-01 11:39:15 +00:00
< div id = "diff-ui" >
2022-08-15 16:56:53 +00:00
< div class = "tab-pane-inner" id = "error-text" >
< div class = "snapshot-age error" > {{watch_a.error_text_ctime|format_seconds_ago}} seconds ago< / div >
< pre >
{{ last_error_text }}
< / pre >
< / div >
< div class = "tab-pane-inner" id = "error-screenshot" >
< div class = "snapshot-age error" > {{watch_a.snapshot_error_screenshot_ctime|format_seconds_ago}} seconds ago< / div >
2023-04-29 20:29:57 +00:00
< img id = "error-screenshot-img" style = "max-width: 80%" alt = "Current error-ing screenshot from most recent request" >
2022-08-15 16:56:53 +00:00
< / div >
2022-04-02 12:49:32 +00:00
< div class = "tab-pane-inner" id = "text" >
2023-08-24 12:29:48 +00:00
< div class = "tip" > Pro-tip: Use < strong > show current snapshot< / strong > tab to visualise what will be ignored, highlight text to add to ignore filters< / div >
2023-01-29 21:36:55 +00:00
{% if password_enabled_and_share_is_off %}
< div class = "tip" > Pro-tip: You can enable < strong > "share access when password is enabled"< / strong > from settings< / div >
{% endif %}
2022-08-15 16:56:53 +00:00
< div class = "snapshot-age" > {{watch_a.snapshot_text_ctime|format_timestamp_timeago}}< / div >
2022-04-02 12:49:32 +00:00
< table >
< tbody >
< tr >
<!-- just proof of concept copied straight from github.com/kpdecker/jsdiff -->
< td id = "a" style = "display: none;" > {{previous}}< / td >
< td id = "b" style = "display: none;" > {{newest}}< / td >
< td id = "diff-col" >
2023-08-24 12:29:48 +00:00
< span id = "result" class = "highlightable-filter" > < / span >
2022-04-02 12:49:32 +00:00
< / td >
< / tr >
< / tbody >
< / table >
Diff algorithm from the amazing < a href = "https://github.com/kpdecker/jsdiff" > github.com/kpdecker/jsdiff< / a >
< / div >
2022-06-07 17:22:42 +00:00
< div class = "tab-pane-inner" id = "screenshot" >
< div class = "tip" >
For now, Differences are performed on text, not graphically, only the latest screenshot is available.
< / div >
{% if is_html_webdriver %}
2022-06-07 17:51:17 +00:00
{% if screenshot %}
2022-08-15 16:56:53 +00:00
< div class = "snapshot-age" > {{watch_a.snapshot_screenshot_ctime|format_timestamp_timeago}}< / div >
2023-04-29 20:29:57 +00:00
< img style = "max-width: 80%" id = "screenshot-img" alt = "Current screenshot from most recent request" >
2022-06-07 17:22:42 +00:00
{% else %}
No screenshot available just yet! Try rechecking the page.
{% endif %}
{% else %}
< strong > Screenshot requires Playwright/WebDriver enabled< / strong >
{% endif %}
< / div >
2022-12-05 13:48:03 +00:00
< div class = "tab-pane-inner" id = "extract" >
< form id = "extract-data-form" class = "pure-form pure-form-stacked edit-form"
action="{{ url_for('diff_history_page', uuid=uuid) }}#extract"
method="POST">
2023-04-29 20:29:57 +00:00
< input type = "hidden" name = "csrf_token" value = "{{ csrf_token() }}" >
2022-12-05 13:48:03 +00:00
< p > This tool will extract text data from all of the watch history.< / p >
< div class = "pure-control-group" >
{{ render_field(extract_form.extract_regex) }}
< span class = "pure-form-message-inline" >
2023-03-12 16:05:34 +00:00
A < strong > RegEx< / strong > is a pattern that identifies exactly which part inside of the text that you want to extract.< br >
2022-12-05 13:48:03 +00:00
< p >
2023-03-12 16:05:34 +00:00
For example, to extract only the numbers from text ‐ < br >
< strong > Raw text< / strong > : < code > Temperature < span style = "color: red" > 5.5< / span > °C in Sydney< / code > < br >
< strong > RegEx to extract:< / strong > < code > Temperature < span style = "color: red" > ([0-9\.]+)< / span > < / code > < br >
2022-12-05 13:48:03 +00:00
< / p >
< p >
< a href = "https://RegExr.com/" > Be sure to test your RegEx here.< / a >
< / p >
< p >
Each RegEx group bracket < code > ()< / code > will be in its own column, the first column value is always the date.
< / p >
< / span >
< / div >
< div class = "pure-control-group" >
{{ render_button(extract_form.extract_submit_button) }}
< / div >
< / form >
< / div >
2021-01-31 18:55:35 +00:00
< / div >
2022-11-19 14:08:27 +00:00
< script >
const newest_version_timestamp = {{newest_version_timestamp}};
2021-02-01 11:39:15 +00:00
< / script >
2023-04-30 08:38:50 +00:00
< script src = "{{url_for('static_content', group='js', filename='diff.min.js')}}" > < / script >
2022-11-19 14:08:27 +00:00
2023-04-30 08:38:50 +00:00
< script src = "{{url_for('static_content', group='js', filename='diff-render.js')}}" > < / script >
2021-02-01 11:39:15 +00:00
2021-01-31 18:55:35 +00:00
2023-03-12 16:05:34 +00:00
{% endblock %}