return "gkeep"
def periodic_render(self, key):
- strikethrough = re.compile('\u2611([^\n]*)\n', re.UNICODE)
+ strikethrough = re.compile('(\u2611[^\n]*)\n', re.UNICODE)
linkify = re.compile(r'.*(https?:\/\/\S+).*')
self.keep.sync()
contents = note.text + "\n"
self.debug_print("Note title '%s'" % title)
if contents != '' and not contents.isspace():
- contents = strikethrough.sub(r'<font color="#999999">` <del>\1</del></font>\n', contents)
- contents = contents.replace('`', '\u2611')
+ contents = strikethrough.sub('', contents)
+ contents = contents.replace(u'\u2610',
+ u'<LI><INPUT TYPE="checkbox"> ')
+
#self.debug_print("Note contents:\n%s" % contents)
contents = linkify.sub(r'<a href="\1">\1</a>', contents)
+
individual_lines = contents.split("\n")
num_lines = len(individual_lines)
max_length = 0
+ indent = 0
+ contents = ""
for x in individual_lines:
length = len(x)
if length > max_length:
max_length = length
- contents = contents.replace("\n", "<BR>\n")
+ spaces = len(x) - len(x.lstrip(' '))
+ spaces /= 2
+ x = x.lstrip(' ')
+ if spaces > indent:
+ x = "<UL>" + x
+ elif spaces < indent:
+ x = "</UL>" + x
+ indent = spaces
+ contents = contents + x + "\n"
+
+ individual_lines = contents.split("\n")
color = note.color.name.lower()
if color in list(self.colors_by_name.keys()):
color = self.colors_by_name[color]
f = file_writer.file_writer(filename)
f.write("""
<STYLE type="text/css">
-a:link { color:#88bfbf; }
+ a:link { color:#88bfbf; }
+ ul { list-style-type:none; }
</STYLE>
<DIV STYLE="border-radius: 25px; border-style: solid; padding: 20px; background-color: %s; color: #eeeeee; font-size: x-large;">
<p style="color: #ffffff; font-size:larger"><B>%s</B></p>
(num_lines, max_length))
f.write("<TABLE BORDER=0 WIDTH=100%%><TR valign=\"top\">")
f.write("<TD WIDTH=50%% style=\"color:#eeeeee; font-size:large\">\n")
- f.write("<FONT>")
+ f.write("<FONT><UL>")
count = 0
for x in individual_lines:
- f.write(x + "<BR>\n")
+ f.write(x + "\n")
count += 1
if count == num_lines / 2:
- f.write("</FONT></TD>\n")
+ f.write("</UL></FONT></TD>\n")
f.write("<TD WIDTH=50%% style=\"color:#eeeeee; font-size:large\">\n")
- f.write("<FONT>")
- f.write("</FONT></TD></TR></TABLE></DIV>\n");
+ f.write("<FONT><UL>")
+ f.write("</UL></FONT></TD></TR></TABLE></DIV>\n");
else:
self.debug_print("%d lines (max=%d chars): one column" %
(num_lines, max_length))
- f.write("<FONT>%s</FONT>" % contents)
+ f.write("<FONT><UL>%s</UL></FONT>" % contents)
f.write("</DIV>")
f.close()
else:
return new Promise(resolve => setTimeout(resolve, milliseconds))
}
- var loaded = false;
var loadedDate = new Date();
addLoadEvent(zoomScreen);
addLoadEvent(runClock);
addLoadEvent(lateLoadImages);
- addLoadEvent(function() {
- loaded = true;
- });
- // Reload the page after a certain amount of time has passed or
- // immediately if told to do so.
- (function poll() {
+ // Runs the countdown line at the bottom and is responsible for
+ // normal page reloads caused by the expiration of a timer.
+ (function countdown() {
setTimeout(
function() {
var now = new Date();
var deltaMs = now.getTime() - loadedDate.getTime();
-
var totalMs = %d;
var remainingMs = (totalMs - deltaMs);
+
if (remainingMs > 0) {
var hr = document.getElementById("countdown");
- var width = (remainingMs / totalMs) * 100.0;
+ var width = (remainingMs / (totalMs - 5000)) * 100.0;
+ if (width > 100) {
+ width = 100;
+ }
hr.style.width = " ".concat(width, "%%");
hr.style.backgroundColor = "maroon";
} else {
window.location.reload();
}
- // Also reload immediately if told to do so.
+ // Brief sleep before doing it all over again.
+ sleep(50).then(() => {
+ countdown();
+ });
+ }, 50)
+ })();
+
+ // Periodically checks for emergency reload events.
+ (function poll() {
+ setTimeout(
+ function() {
var xhr = new XMLHttpRequest();
xhr.open('GET',
'http://wannabe.house/kiosk/pages/reload_immediately.html');