From 50851efcbb30d69080f51af42a136dda121c24c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?s=C3=B8renpeter?= Date: Mon, 29 Jan 2024 20:58:44 +0100 Subject: [PATCH] Gallery + refresh progress bar --- index.php | 3 +- views/gallery.php | 8 ++--- views/refresh.php | 84 +++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 90 insertions(+), 5 deletions(-) create mode 100644 views/refresh.php diff --git a/index.php b/index.php index 5a00668..03d8371 100644 --- a/index.php +++ b/index.php @@ -30,7 +30,8 @@ $routes = [ '/new' => 'new_twt.php', '/add' => 'add_feed.php', '/following' => 'following.php', - '/refresh' => 'load_twt_files.php', + #'/refresh' => 'load_twt_files.php', + '/refresh' => 'refresh.php', '/login' => 'login.php', '/logout' => 'logout.php', '/profile' => 'profile.php', diff --git a/views/gallery.php b/views/gallery.php index cf29c39..b209712 100644 --- a/views/gallery.php +++ b/views/gallery.php @@ -23,9 +23,9 @@ if (!empty($_GET['profile'])) { // Show twts for some user include 'partials/profile.php'; } } else { - // code... - //$filecontent = file('../twtxt.txt'); - $twtsURL = file($profile->mainURL); + // TODO: default to rendering the local users gallery, if no profile specified + //echo $profile->mainURL;; + //$twtsURL = $profile->mainURL; // correct URL for twtxt.txt } ?> @@ -39,7 +39,7 @@ foreach ($twts as $twt) { $img_array = getImagesFromTwt($twt->content); foreach ($img_array as $img) { - echo ''.$img[0].''; + echo ''.$img[0].''; } } ?> diff --git a/views/refresh.php b/views/refresh.php new file mode 100644 index 0000000..5ec5e2e --- /dev/null +++ b/views/refresh.php @@ -0,0 +1,84 @@ + + +
+ + + + document.getElementById("refreshLabel").innerHTML = "Updating: '.$following[1].' ('.$i.' of '.$total.')"; + document.getElementById("refreshProgress").value = "'.$float.'"; + document.getElementById("refreshProgress").innerHTML = "'.$percent.'"; + '; + + updateCachedFile($following[1]); + ob_flush(); // Send output to browser immediately + flush(); + $i++; +} + +// Tell user that the process is completed +echo ''; +