images are now expanded when you click on them

This commit is contained in:
Ghostie 2025-01-08 21:04:36 -05:00
parent 2c6d0b4404
commit 3d5b146467
7 changed files with 30 additions and 8 deletions

View File

@ -63,7 +63,7 @@
- [x] Fix that weird json encoding in the object field of an activity - [x] Fix that weird json encoding in the object field of an activity
- [x] The profile attachments are not working, they are not being federalised somehow (the interests thingy) - [x] The profile attachments are not working, they are not being federalised somehow (the interests thingy)
- [x] Endpoints for getting notes (/ap/v1/note/{note}) - [x] Endpoints for getting notes (/ap/v1/note/{note})
- [ ] Fix hashtags on post update - [ ] Fix hashtags and mentions on post update
- [x] Use jobs when posting activities - [x] Use jobs when posting activities
- [ ] Sign the get activities for mastodon when secure mode is enable - [ ] Sign the get activities for mastodon when secure mode is enable
- [x] Set a minimum font size for the tags cloud - [x] Set a minimum font size for the tags cloud

View File

@ -93,8 +93,8 @@ class HomeController extends Controller
} }
} }
$local_users = User::where ("name", "like", "%$query%")->orderBy ("created_at", "desc")->get (); $local_users = User::where ("name", "like", "%$query%")->orWhere ("summary", "like", "%$query%")->orderBy ("created_at", "desc")->get ();
$actors = Actor::where ("name", "like", "%$query%")->orWhere ("preferredUsername", "like", "%$query%")->orderBy ("created_at", "desc")->get (); $actors = Actor::where ("name", "like", "%$query%")->orWhere ("preferredUsername", "like", "%$query%")->orWhere ("summary", "like", "%$query%")->orderBy ("created_at", "desc")->get ();
$users = $local_users->merge ($actors)->take (10); $users = $local_users->merge ($actors)->take (10);
$hashtags = Hashtag::withCount ("get_notes")->where ("name", "like", "%$query%")->orderBy ("get_notes_count", "desc")->take (16)->get ()->shuffle (); $hashtags = Hashtag::withCount ("get_notes")->where ("name", "like", "%$query%")->orderBy ("get_notes_count", "desc")->take (16)->get ()->shuffle ();

View File

@ -84,7 +84,7 @@ class ProfileController extends Controller
$image_data = $image->cover (256, 256)->toJpeg (); $image_data = $image->cover (256, 256)->toJpeg ();
Storage::disk ("public")->put ("avatars/" . $fname . ".jpg", $image_data); Storage::disk ("public")->put ("avatars/" . $fname . ".jpg", $image_data);
$old_avatar = $user->avatar; $old_avatar = "avatars/" . $user->avatar;
$user->avatar = $fname . ".jpg"; $user->avatar = $fname . ".jpg";
$user->actor->icon = env ("APP_URL") . $user->avatar; $user->actor->icon = env ("APP_URL") . $user->avatar;
@ -97,7 +97,7 @@ class ProfileController extends Controller
$file = $request->file ("song"); $file = $request->file ("song");
Storage::disk ("public")->put ("songs/" . $fname . ".mp3", file_get_contents ($file)); Storage::disk ("public")->put ("songs/" . $fname . ".mp3", file_get_contents ($file));
$old_song = $user->profile_song; $old_song = "songs/" . $user->profile_song;
$user->profile_song = $fname . ".mp3"; $user->profile_song = $fname . ".mp3";
$changing_song = true; $changing_song = true;
} }

View File

@ -3787,3 +3787,11 @@ ul.cloud a {
color: #99c3e0; /* Muted blue for disabled links */ color: #99c3e0; /* Muted blue for disabled links */
cursor: not-allowed; cursor: not-allowed;
} }
img.expandable {
cursor: pointer;
}
img.expanded {
width: 100%;
}

View File

@ -1,4 +1,17 @@
import axios from 'axios'; /* import axios from 'axios';
window.axios = axios; window.axios = axios;
window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest'; window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
*/
(function () {
let elements = document.querySelectorAll(".expandable")
for (let i = 0; i < elements.length; i++)
{
let element = elements [i]
element.addEventListener("click", function () {
this.classList.toggle("expanded")
})
}
})()

View File

@ -71,7 +71,7 @@ else
<p> <p>
@foreach ($display_post->attachments as $attachment) @foreach ($display_post->attachments as $attachment)
<img loading="lazy" src="{{ $attachment->url }}" alt="{{ $attachment->name }}" width="100"> <img loading="lazy" src="{{ $attachment->url }}" alt="{{ $attachment->name }}" width="100" class="expandable">
@endforeach @endforeach
</p> </p>
@ -87,7 +87,7 @@ else
<p> <p>
@foreach ($reply->attachments as $attachment) @foreach ($reply->attachments as $attachment)
<img loading="lazy" src="{{ $attachment->url }}" alt="{{ $attachment->name }}" width="100"> <img loading="lazy" src="{{ $attachment->url }}" alt="{{ $attachment->name }}" width="100" class="expandable">
@endforeach @endforeach
</p> </p>

View File

@ -40,5 +40,6 @@
@include ("partials.footer") @include ("partials.footer")
</div> </div>
@vite(["resources/js/app.js"])
</body> </body>
</html> </html>