From ea5a02f8b61da7799297adfc7a480db8a68ae509 Mon Sep 17 00:00:00 2001 From: Ethan Dalool Date: Thu, 7 Jan 2021 20:18:07 -0800 Subject: [PATCH] Use update_dynamic_elements for user name, clipboard count. --- .../etiquette_flask/static/js/photo_clipboard.js | 12 +----------- frontends/etiquette_flask/templates/clipboard.html | 2 +- .../etiquette_flask/templates/clipboard_tray.html | 2 +- frontends/etiquette_flask/templates/header.html | 2 +- frontends/etiquette_flask/templates/user.html | 6 +++--- 5 files changed, 7 insertions(+), 17 deletions(-) diff --git a/frontends/etiquette_flask/static/js/photo_clipboard.js b/frontends/etiquette_flask/static/js/photo_clipboard.js index 256df84..6d0eeba 100644 --- a/frontends/etiquette_flask/static/js/photo_clipboard.js +++ b/frontends/etiquette_flask/static/js/photo_clipboard.js @@ -379,16 +379,6 @@ function open_full_clipboard_tab() window.open("/clipboard"); } -photo_clipboard.update_clipboard_count = -function update_clipboard_count() -{ - const elements = document.getElementsByClassName("clipboard_count"); - for (const element of elements) - { - element.innerText = photo_clipboard.clipboard.size; - } -} - photo_clipboard.on_storage_event = function on_storage_event() { @@ -405,7 +395,7 @@ function update_pagestate() /* Update all relevant DOM elements to match internal state. */ - photo_clipboard.update_clipboard_count(); + common.update_dynamic_elements("dynamic_clipboard_count", photo_clipboard.clipboard.size); photo_clipboard.update_clipboard_tray(); photo_clipboard.apply_check_all(); } diff --git a/frontends/etiquette_flask/templates/clipboard.html b/frontends/etiquette_flask/templates/clipboard.html index c49887f..5fd7fd5 100644 --- a/frontends/etiquette_flask/templates/clipboard.html +++ b/frontends/etiquette_flask/templates/clipboard.html @@ -95,7 +95,7 @@ {{header.make_header(session=session)}}
-
The clipboard contains 0 items. +
The clipboard contains 0 items.
diff --git a/frontends/etiquette_flask/templates/clipboard_tray.html b/frontends/etiquette_flask/templates/clipboard_tray.html index 6fe941b..1aeeb02 100644 --- a/frontends/etiquette_flask/templates/clipboard_tray.html +++ b/frontends/etiquette_flask/templates/clipboard_tray.html @@ -4,7 +4,7 @@ id="clipboard_tray_expandbutton" class="yellow_button" onclick="return photo_clipboard.clipboard_tray_collapse_toggle();" - >Clipboard: 0 items + >Clipboard: 0 items