From 23d0679d13e09e5f63fdc3129c70b6a77cec887f Mon Sep 17 00:00:00 2001 From: dgtlmoon Date: Sat, 26 Nov 2022 20:13:14 +0100 Subject: [PATCH] WIP --- .../blueprint/extract/__init__.py | 24 +++++++++++ changedetectionio/static/js/extract.js | 40 +++++++++++++++++++ changedetectionio/templates/edit.html | 26 ++++++++++++ 3 files changed, 90 insertions(+) create mode 100644 changedetectionio/blueprint/extract/__init__.py create mode 100644 changedetectionio/static/js/extract.js diff --git a/changedetectionio/blueprint/extract/__init__.py b/changedetectionio/blueprint/extract/__init__.py new file mode 100644 index 00000000..b721b2e2 --- /dev/null +++ b/changedetectionio/blueprint/extract/__init__.py @@ -0,0 +1,24 @@ + +from distutils.util import strtobool +from flask import Blueprint, request, make_response +from flask_login import login_required +import os +import logging +from changedetectionio.store import ChangeDetectionStore + + + +def construct_blueprint(datastore: ChangeDetectionStore): + + browser_steps_blueprint = Blueprint('browser_steps', __name__, template_folder="templates") + + @login_required + @browser_steps_blueprint.route("/extract-regex", methods=['POST']) + def browsersteps_ui_update(): + import time + + return {123123123: 'yup'} + + return browser_steps_blueprint + + diff --git a/changedetectionio/static/js/extract.js b/changedetectionio/static/js/extract.js new file mode 100644 index 00000000..81a984b0 --- /dev/null +++ b/changedetectionio/static/js/extract.js @@ -0,0 +1,40 @@ +$(document).ready(function () { + + $('#extract').click(function (e) { + download_csv_file(); + }); + +//create CSV file data in an array + var csvFileData = [ + ['Alan Walker', 'Singer'], + ['Cristiano Ronaldo', 'Footballer'], + ['Saina Nehwal', 'Badminton Player'], + ['Arijit Singh', 'Singer'], + ['Terence Lewis', 'Dancer'] + ]; + +//create a user-defined function to download CSV file + function download_csv_file() { + + //define the heading for each row of the data + var csv = 'Name,Profession\n'; + + //merge the data with CSV + csvFileData.forEach(function (row) { + csv += row.join(','); + csv += "\n"; + }); + + //display the created CSV data on the web browser + document.write(csv); + + + var hiddenElement = document.createElement('a'); + hiddenElement.href = 'data:text/csv;charset=utf-8,' + encodeURI(csv); + hiddenElement.target = '_blank'; + //provide the name for the CSV file to be downloaded + hiddenElement.download = 'Famous Personalities.csv'; + hiddenElement.click(); + } + +}); \ No newline at end of file diff --git a/changedetectionio/templates/edit.html b/changedetectionio/templates/edit.html index 0805c35a..a32994e3 100644 --- a/changedetectionio/templates/edit.html +++ b/changedetectionio/templates/edit.html @@ -23,6 +23,7 @@ {% if playwright_enabled %} + {% endif %}
@@ -37,6 +38,7 @@
  • Visual Filter Selector
  • Filters & Triggers
  • Notifications
  • +
  • Export
  • @@ -374,6 +376,30 @@ Unavailable") }} +
    +
    +
    + +
    +
    +
    + Enter a regular-expression, all history snapshots will be scanned and where the regex + matches, it will exported along with the times-stamp.
    + For a complete backup, use the Backup button
    +
    +

    + + +

    + + The regex you enter will be stored for next time + +
    + +
    +
    +
    +
    {{ render_button(form.save_button) }}