Added option to show time of last display-update

This commit is contained in:
Ace 2019-06-11 02:39:44 +02:00 committed by GitHub
parent d27b1855f5
commit 6842f2a893
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -284,6 +284,20 @@ body{
</div>
</div>
<div class="field">
<label>Show time when the display was last updated?</label>
<div class="ts checkboxes">
<div class="ts radio checkbox">
<input id="last_update_false" type="radio" name="lu" checked>
<label for="last_update_false">No</label>
</div>
<div class="ts radio checkbox">
<input id="last_update_true" type="radio" name="lu">
<label for="last_update_true">Yes</label>
</div>
</div>
</div>
</form>
<br>
<button class="ts primary button" onClick="generate();">Generate</button>
@ -308,7 +322,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
<br>
<script>
var template = 'ical_urls = ["{ical_urls}"]\nrss_feeds = ["{rss_urls}"]\nupdate_interval = "{update_interval}"\napi_key = "{api_key}"\nlocation = "{location}"\nweek_starts_on = "{week_starts_on}"\nevents_max_range = "{events_max_range}"\ncalibration_hours = [{calibration_hours}]\ndisplay_colours = "{display_colours}"\nlanguage = "{language}"\nunits = "{units}"\nhours = "{hours}"\ntop_section = "{top_section}"\nmiddle_section = "{middle_section}"\nbottom_section = "{bottom_section}"';
var template = 'ical_urls = ["{ical_urls}"]\nrss_feeds = ["{rss_urls}"]\nupdate_interval = "{update_interval}"\napi_key = "{api_key}"\nlocation = "{location}"\nweek_starts_on = "{week_starts_on}"\nevents_max_range = "{events_max_range}"\ncalibration_hours = [{calibration_hours}]\ndisplay_colours = "{display_colours}"\nlanguage = "{language}"\nunits = "{units}"\nhours = "{hours}"\ntop_section = "{top_section}"\nmiddle_section = "{middle_section}"\nbottom_section = "{bottom_section}"\nshow_last_update_time = "{last_update}"';
function generate(){
var ical_urls = $("#ical_urls").val().trim();
@ -444,9 +458,13 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
bottom_section = "";
}
var last_update = "False";
if ($('#last_update_true').is(':checked')){
last_update = "True";
}
//console.log(ical_urls, rss_urls, update_interval, api_key, location, week_starts_on, events_max_range, calibration_hours, display_colours, language, units, hours, top_section, middle_section, bottom_section);
createPythonSetting(ical_urls, rss_urls, update_interval, api_key, location, week_starts_on, events_max_range, calibration_hours, display_colours, language, units, hours, top_section, middle_section, bottom_section);
//console.log(ical_urls, rss_urls, update_interval, api_key, location, week_starts_on, events_max_range, calibration_hours, display_colours, language, units, hours, top_section, middle_section, bottom_section, last_update);
createPythonSetting(ical_urls, rss_urls, update_interval, api_key, location, week_starts_on, events_max_range, calibration_hours, display_colours, language, units, hours, top_section, middle_section, bottom_section, last_update);
}
function rk(content,key,value){
@ -454,7 +472,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
return content.split("{" + key + "}").join(value);
}
function createPythonSetting(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o){
function createPythonSetting(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p){
var box = template;
box = rk(box,"ical_urls",a);
box = rk(box,"rss_urls",b);
@ -471,6 +489,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
box = rk(box,"top_section",m);
box = rk(box,"middle_section",n);
box = rk(box,"bottom_section",o);
box = rk(box,"last_update",p);
var config = new Blob([box], {type : "text/plain"});