mirror of
https://github.com/dgtlmoon/changedetection.io.git
synced 2025-12-16 13:06:37 +00:00
latest fixes and improvements
This commit is contained in:
@@ -268,23 +268,9 @@ def changedetection_app(config=None, datastore_o=None):
|
|||||||
# @todo In the future make this a configurable link back (see work on BASE_URL https://github.com/dgtlmoon/changedetection.io/pull/228)
|
# @todo In the future make this a configurable link back (see work on BASE_URL https://github.com/dgtlmoon/changedetection.io/pull/228)
|
||||||
guid = "{}/{}".format(watch['uuid'], watch['last_changed'])
|
guid = "{}/{}".format(watch['uuid'], watch['last_changed'])
|
||||||
fe = fg.add_entry()
|
fe = fg.add_entry()
|
||||||
|
fe.title(watch['url'])
|
||||||
|
fe.link(href=watch['url'])
|
||||||
# Include a link to the diff page, they will have to login here to see if password protection is enabled.
|
fe.description(watch['url'])
|
||||||
# Description is the page you watch, link takes you to the diff JS UI page
|
|
||||||
base_url = datastore.data['settings']['application']['base_url']
|
|
||||||
if base_url == '':
|
|
||||||
base_url = "<base-url-env-var-not-set>"
|
|
||||||
|
|
||||||
diff_link = {'href': "{}{}".format(base_url, url_for('diff_history_page', uuid=watch['uuid']))}
|
|
||||||
|
|
||||||
# @todo use title if it exists
|
|
||||||
fe.link(link=diff_link)
|
|
||||||
fe.title(title=watch['url'])
|
|
||||||
|
|
||||||
# @todo in the future <description><![CDATA[<html><body>Any code html is valid.</body></html>]]></description>
|
|
||||||
fe.description(description=watch['url'])
|
|
||||||
|
|
||||||
fe.guid(guid, permalink=False)
|
fe.guid(guid, permalink=False)
|
||||||
dt = datetime.datetime.fromtimestamp(int(watch['newest_history_key']))
|
dt = datetime.datetime.fromtimestamp(int(watch['newest_history_key']))
|
||||||
dt = dt.replace(tzinfo=pytz.UTC)
|
dt = dt.replace(tzinfo=pytz.UTC)
|
||||||
@@ -468,8 +454,6 @@ def changedetection_app(config=None, datastore_o=None):
|
|||||||
'tag': form.tag.data.strip(),
|
'tag': form.tag.data.strip(),
|
||||||
'title': form.title.data.strip(),
|
'title': form.title.data.strip(),
|
||||||
'headers': form.headers.data,
|
'headers': form.headers.data,
|
||||||
'body': form.body.data,
|
|
||||||
'method': form.method.data,
|
|
||||||
'fetch_backend': form.fetch_backend.data,
|
'fetch_backend': form.fetch_backend.data,
|
||||||
'trigger_text': form.trigger_text.data,
|
'trigger_text': form.trigger_text.data,
|
||||||
'notification_title': form.notification_title.data,
|
'notification_title': form.notification_title.data,
|
||||||
|
|||||||
@@ -9,11 +9,10 @@ var CONSTANT_s_KEY = 115;
|
|||||||
var loading;
|
var loading;
|
||||||
var sort_column; // new window or tab is always last_changed
|
var sort_column; // new window or tab is always last_changed
|
||||||
var sort_order; // new window or tab is always descending
|
var sort_order; // new window or tab is always descending
|
||||||
var coordX;
|
|
||||||
var coordY;
|
|
||||||
|
|
||||||
// restore scroll position on submit/reload
|
// restore scroll position on submit/reload
|
||||||
document.addEventListener("DOMContentLoaded", function(event) {
|
document.addEventListener("DOMContentLoaded", function(event) {
|
||||||
|
load_functions();
|
||||||
var scrollpos = sessionStorage.getItem('scrollpos');
|
var scrollpos = sessionStorage.getItem('scrollpos');
|
||||||
if (scrollpos) window.scrollTo(0, scrollpos);
|
if (scrollpos) window.scrollTo(0, scrollpos);
|
||||||
});
|
});
|
||||||
@@ -34,6 +33,17 @@ function storeScrollAndSearch() {
|
|||||||
sessionStorage.setItem('searchtxt', document.getElementById("txtInput").value);
|
sessionStorage.setItem('searchtxt', document.getElementById("txtInput").value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// mobile positioning of checkbox-controls grid popup
|
||||||
|
document.addEventListener("touchstart", touchStartHandler, false);
|
||||||
|
var touchXY = {};
|
||||||
|
function touchStartHandler(event) {
|
||||||
|
var touches = event.changedTouches;
|
||||||
|
touchXY = {
|
||||||
|
clientX : touches[0].clientX,
|
||||||
|
clientY : touches[0].clientY
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
// (ctl)-alt-s search hotkey
|
// (ctl)-alt-s search hotkey
|
||||||
document.onkeyup = function(e) {
|
document.onkeyup = function(e) {
|
||||||
var e = e || window.event; // for IE to cover IEs window event-object
|
var e = e || window.event; // for IE to cover IEs window event-object
|
||||||
@@ -43,18 +53,7 @@ document.onkeyup = function(e) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// keep track of click position for placement of checkbox-functions grid display
|
// new window or tab loading
|
||||||
document.addEventListener("click", clickPos);
|
|
||||||
function clickPos(event) {
|
|
||||||
coordX = event.clientX;
|
|
||||||
coordY = event.clientY;
|
|
||||||
}
|
|
||||||
|
|
||||||
// page load functions
|
|
||||||
window.addEventListener('DOMContentLoaded', (event) => {
|
|
||||||
load_functions();
|
|
||||||
});
|
|
||||||
|
|
||||||
function load_functions() {
|
function load_functions() {
|
||||||
// loading
|
// loading
|
||||||
loading = true;
|
loading = true;
|
||||||
@@ -172,6 +171,18 @@ function sortTable(n) {
|
|||||||
|
|
||||||
// check/uncheck all checkboxes
|
// check/uncheck all checkboxes
|
||||||
function checkAll(e) {
|
function checkAll(e) {
|
||||||
|
var elemID = event.srcElement.id;
|
||||||
|
if (!elemID) return;
|
||||||
|
var elem = document.getElementById(elemID);
|
||||||
|
var rect = elem.getBoundingClientRect();
|
||||||
|
var offsetLeft = document.documentElement.scrollLeft + rect.left;
|
||||||
|
var offsetTop;
|
||||||
|
if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) {
|
||||||
|
offsetTop = touchXY.clientY; // + rect.top;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
offsetTop = document.documentElement.scrollTop + rect.top;
|
||||||
|
}
|
||||||
var i;
|
var i;
|
||||||
var checkboxes = document.getElementsByName('check');
|
var checkboxes = document.getElementsByName('check');
|
||||||
var checkboxFunctions = document.getElementById('checkbox-functions');
|
var checkboxFunctions = document.getElementById('checkbox-functions');
|
||||||
@@ -179,9 +190,9 @@ function checkAll(e) {
|
|||||||
for (i = 0; i < checkboxes.length; i++) {
|
for (i = 0; i < checkboxes.length; i++) {
|
||||||
checkboxes[i].checked = true;
|
checkboxes[i].checked = true;
|
||||||
}
|
}
|
||||||
checkboxFunctions.style.left = coordX + 25 + "px";
|
|
||||||
checkboxFunctions.style.top = coordY + "px";
|
|
||||||
checkboxFunctions.style.display = "";
|
checkboxFunctions.style.display = "";
|
||||||
|
checkboxFunctions.style.left = offsetLeft + 30 + "px";
|
||||||
|
checkboxFunctions.style.top = offsetTop + "px";
|
||||||
} else {
|
} else {
|
||||||
for (i = 0; i < checkboxes.length; i++) {
|
for (i = 0; i < checkboxes.length; i++) {
|
||||||
checkboxes[i].checked = false;
|
checkboxes[i].checked = false;
|
||||||
@@ -190,25 +201,32 @@ function checkAll(e) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// check/uncheck checkall checkbox if all other checkboxes are checked/unchecked
|
// show/hide checkbox controls grid popup and check/uncheck checkall checkbox if all other checkboxes are checked/unchecked
|
||||||
function checkChange() {
|
function checkChange(e) {
|
||||||
|
var elemID = event.srcElement.id;
|
||||||
|
if (!elemID) return;
|
||||||
|
var elem = document.getElementById(elemID);
|
||||||
|
var rect = elem.getBoundingClientRect();
|
||||||
|
var offsetLeft = document.documentElement.scrollLeft + rect.left;
|
||||||
|
var offsetTop;
|
||||||
|
if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) {
|
||||||
|
offsetTop = touchXY.clientY; // + rect.top;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
offsetTop = document.documentElement.scrollTop + rect.top;
|
||||||
|
}
|
||||||
var i;
|
var i;
|
||||||
var totalCheckbox = document.querySelectorAll('input[name="check"]').length;
|
var totalCheckbox = document.querySelectorAll('input[name="check"]').length;
|
||||||
var totalChecked = document.querySelectorAll('input[name="check"]:checked').length;
|
var totalChecked = document.querySelectorAll('input[name="check"]:checked').length;
|
||||||
var checkboxFunctions = document.getElementById('checkbox-functions'); //document.querySelectorAll('[id=checkbox-functions]');
|
var checkboxFunctions = document.getElementById('checkbox-functions'); //document.querySelectorAll('[id=checkbox-functions]');
|
||||||
if (totalCheckbox == totalChecked) {
|
|
||||||
document.getElementsByName("showhide")[0].checked = true;
|
|
||||||
} else {
|
|
||||||
document.getElementsByName("showhide")[0].checked = false;
|
|
||||||
}
|
|
||||||
if (totalChecked > 0) {
|
if (totalChecked > 0) {
|
||||||
checkboxFunctions.style.display = "";
|
checkboxFunctions.style.display = "";
|
||||||
checkboxFunctions.style.left = coordX + 25 + "px";
|
checkboxFunctions.style.left = offsetLeft + 30 + "px";
|
||||||
if ( coordY > ( window.innerHeight - checkboxFunctions.offsetHeight) ) {
|
if ( offsetTop > ( window.innerHeight - checkboxFunctions.offsetHeight) ) {
|
||||||
checkboxFunctions.style.top = (window.innerHeight - checkboxFunctions.offsetHeight) + "px";
|
checkboxFunctions.style.top = (window.innerHeight - checkboxFunctions.offsetHeight) + "px";
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
checkboxFunctions.style.top = coordY + "px";
|
checkboxFunctions.style.top = offsetTop + "px";
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
checkboxFunctions.style.display = "none";
|
checkboxFunctions.style.display = "none";
|
||||||
|
|||||||
@@ -50,7 +50,7 @@
|
|||||||
<table class="pure-table pure-table-striped watch-table" id="watch-table">
|
<table class="pure-table pure-table-striped watch-table" id="watch-table">
|
||||||
<thead>
|
<thead>
|
||||||
<tr id="header">
|
<tr id="header">
|
||||||
<th class="inline chkbox-header"><input type="checkbox" name="showhide" onchange="checkAll(this)" title="Check/Uncheck All"> #</th>
|
<th class="inline chkbox-header"><input id="chk-all" type="checkbox" name="showhide" onchange="checkAll(this)" title="Check/Uncheck All"> #</th>
|
||||||
<th class="pause-resume-header" onclick="sortTable(1)"><span class="clickable" title="Sort by Pause/Resume"><a href="{{url_for('index', pause='pause-all', tag=active_tag)}}"><img src="{{url_for('static_content', group='images', filename='pause.svg')}}" alt="Pause" title="Pause All {%if active_tag%}in "{{active_tag}}" {%endif%}"/></a> <a href="{{url_for('index', pause='resume-all', tag=active_tag)}}"><img src="{{url_for('static_content', group='images', filename='play.svg')}}" alt="Resume" title="Resume All {%if active_tag%}in "{{active_tag}}" {%endif%}"/></a> <span id="sortable-1"><img src="{{url_for('static_content', group='images', filename='sortable.svg')}}" alt="sort" /></span><span class="sortarrow"><span id="sort-1a" style="display:none;">▲</span><span id="sort-1d" style="display:none;">▼</span></span></span></th>
|
<th class="pause-resume-header" onclick="sortTable(1)"><span class="clickable" title="Sort by Pause/Resume"><a href="{{url_for('index', pause='pause-all', tag=active_tag)}}"><img src="{{url_for('static_content', group='images', filename='pause.svg')}}" alt="Pause" title="Pause All {%if active_tag%}in "{{active_tag}}" {%endif%}"/></a> <a href="{{url_for('index', pause='resume-all', tag=active_tag)}}"><img src="{{url_for('static_content', group='images', filename='play.svg')}}" alt="Resume" title="Resume All {%if active_tag%}in "{{active_tag}}" {%endif%}"/></a> <span id="sortable-1"><img src="{{url_for('static_content', group='images', filename='sortable.svg')}}" alt="sort" /></span><span class="sortarrow"><span id="sort-1a" style="display:none;">▲</span><span id="sort-1d" style="display:none;">▼</span></span></span></th>
|
||||||
<th onclick="sortTable(3)"><span class="clickable" title="Sort by Title">Title <span id="sortable-3"><img src="{{url_for('static_content', group='images', filename='sortable.svg')}}" alt="sort" /></span><span class="sortarrow"><span id="sort-3a" style="display:none;">▲</span><span id="sort-3d" style="display:none;">▼</span></span></span></th>
|
<th onclick="sortTable(3)"><span class="clickable" title="Sort by Title">Title <span id="sortable-3"><img src="{{url_for('static_content', group='images', filename='sortable.svg')}}" alt="sort" /></span><span class="sortarrow"><span id="sort-3a" style="display:none;">▲</span><span id="sort-3d" style="display:none;">▼</span></span></span></th>
|
||||||
<th class="hidden-col"></th>
|
<th class="hidden-col"></th>
|
||||||
@@ -68,7 +68,7 @@
|
|||||||
{% if watch.last_error is defined and watch.last_error != False %}error{% endif %}
|
{% if watch.last_error is defined and watch.last_error != False %}error{% endif %}
|
||||||
{% if watch.paused is defined and watch.paused != False %}paused{% endif %}
|
{% if watch.paused is defined and watch.paused != False %}paused{% endif %}
|
||||||
{% if watch.newest_history_key| int > watch.last_viewed| int %}unviewed{% endif %}">
|
{% if watch.newest_history_key| int > watch.last_viewed| int %}unviewed{% endif %}">
|
||||||
<td class="inline chkbox"><input type="checkbox" name="check" onchange="checkChange();"> {{ loop.index }}</td>
|
<td class="inline chkbox"><input id="chk-{{ loop.index }}"type="checkbox" name="check" onchange="checkChange(this);"> {{ loop.index }}</td>
|
||||||
<td class="inline pause-resume">
|
<td class="inline pause-resume">
|
||||||
{% if watch.paused %}
|
{% if watch.paused %}
|
||||||
<a href="{{url_for('index', pause=watch.uuid, tag=active_tag)}}"><img src="{{url_for('static_content', group='images', filename='play.svg')}}" alt="Resume" title="Resume"/></a>
|
<a href="{{url_for('index', pause=watch.uuid, tag=active_tag)}}"><img src="{{url_for('static_content', group='images', filename='play.svg')}}" alt="Resume" title="Resume"/></a>
|
||||||
|
|||||||
Reference in New Issue
Block a user