latest fixes and improvements

pull/317/head
ntmmfts 3 years ago
parent 0302b7f801
commit 30c763fed9

@ -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)
guid = "{}/{}".format(watch['uuid'], watch['last_changed'])
fe = fg.add_entry()
# Include a link to the diff page, they will have to login here to see if password protection is enabled.
# 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.title(watch['url'])
fe.link(href=watch['url'])
fe.description(watch['url'])
fe.guid(guid, permalink=False)
dt = datetime.datetime.fromtimestamp(int(watch['newest_history_key']))
dt = dt.replace(tzinfo=pytz.UTC)
@ -468,8 +454,6 @@ def changedetection_app(config=None, datastore_o=None):
'tag': form.tag.data.strip(),
'title': form.title.data.strip(),
'headers': form.headers.data,
'body': form.body.data,
'method': form.method.data,
'fetch_backend': form.fetch_backend.data,
'trigger_text': form.trigger_text.data,
'notification_title': form.notification_title.data,

@ -9,11 +9,10 @@ var CONSTANT_s_KEY = 115;
var loading;
var sort_column; // new window or tab is always last_changed
var sort_order; // new window or tab is always descending
var coordX;
var coordY;
// restore scroll position on submit/reload
document.addEventListener("DOMContentLoaded", function(event) {
load_functions();
var scrollpos = sessionStorage.getItem('scrollpos');
if (scrollpos) window.scrollTo(0, scrollpos);
});
@ -34,6 +33,17 @@ function storeScrollAndSearch() {
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
document.onkeyup = function(e) {
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
document.addEventListener("click", clickPos);
function clickPos(event) {
coordX = event.clientX;
coordY = event.clientY;
}
// page load functions
window.addEventListener('DOMContentLoaded', (event) => {
load_functions();
});
// new window or tab loading
function load_functions() {
// loading
loading = true;
@ -172,6 +171,18 @@ function sortTable(n) {
// check/uncheck all checkboxes
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 checkboxes = document.getElementsByName('check');
var checkboxFunctions = document.getElementById('checkbox-functions');
@ -179,9 +190,9 @@ function checkAll(e) {
for (i = 0; i < checkboxes.length; i++) {
checkboxes[i].checked = true;
}
checkboxFunctions.style.left = coordX + 25 + "px";
checkboxFunctions.style.top = coordY + "px";
checkboxFunctions.style.display = "";
checkboxFunctions.style.left = offsetLeft + 30 + "px";
checkboxFunctions.style.top = offsetTop + "px";
} else {
for (i = 0; i < checkboxes.length; i++) {
checkboxes[i].checked = false;
@ -190,25 +201,32 @@ function checkAll(e) {
}
}
// check/uncheck checkall checkbox if all other checkboxes are checked/unchecked
function checkChange() {
// show/hide checkbox controls grid popup and check/uncheck checkall checkbox if all other checkboxes are checked/unchecked
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 totalCheckbox = document.querySelectorAll('input[name="check"]').length;
var totalChecked = document.querySelectorAll('input[name="check"]:checked').length;
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) {
checkboxFunctions.style.display = "";
checkboxFunctions.style.left = coordX + 25 + "px";
if ( coordY > ( window.innerHeight - checkboxFunctions.offsetHeight) ) {
checkboxFunctions.style.left = offsetLeft + 30 + "px";
if ( offsetTop > ( window.innerHeight - checkboxFunctions.offsetHeight) ) {
checkboxFunctions.style.top = (window.innerHeight - checkboxFunctions.offsetHeight) + "px";
}
else {
checkboxFunctions.style.top = coordY + "px";
checkboxFunctions.style.top = offsetTop + "px";
}
} else {
checkboxFunctions.style.display = "none";

@ -50,7 +50,7 @@
<table class="pure-table pure-table-striped watch-table" id="watch-table">
<thead>
<tr id="header">
<th class="inline chkbox-header"><input type="checkbox" name="showhide" onchange="checkAll(this)" title="Check/Uncheck All">&nbsp;&nbsp;#</th>
<th class="inline chkbox-header"><input id="chk-all" type="checkbox" name="showhide" onchange="checkAll(this)" title="Check/Uncheck All">&nbsp;&nbsp;#</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 &quot;{{active_tag}}&quot; {%endif%}"/></a>&nbsp;<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 &quot;{{active_tag}}&quot; {%endif%}"/></a>&nbsp;&nbsp;<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;">&#9650;</span><span id="sort-1d" style="display:none;">&#9660;</span></span></span></th>
<th onclick="sortTable(3)"><span class="clickable" title="Sort by Title">Title&nbsp;&nbsp;<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;">&#9650;</span><span id="sort-3d" style="display:none;">&#9660;</span></span></span></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.paused is defined and watch.paused != False %}paused{% endif %}
{% if watch.newest_history_key| int > watch.last_viewed| int %}unviewed{% endif %}">
<td class="inline chkbox"><input type="checkbox" name="check" onchange="checkChange();">&nbsp;&nbsp;{{ loop.index }}</td>
<td class="inline chkbox"><input id="chk-{{ loop.index }}"type="checkbox" name="check" onchange="checkChange(this);">&nbsp;&nbsp;{{ loop.index }}</td>
<td class="inline pause-resume">
{% 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>

Loading…
Cancel
Save