Run simple script when click quoted post link

Need some custom code changes to the phpBB core simple enough that you feel doesn't require an extension? Then post your request here so that community members can provide some assistance.

NOTE: NO OFFICIAL SUPPORT IS PROVIDED IN THIS SUB-FORUM
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

NOTE: NO OFFICIAL SUPPORT IS PROVIDED IN THIS SUB-FORUM
gvp9000
Registered User
Posts: 60
Joined: Mon Oct 02, 2023 4:03 pm

Run simple script when click quoted post link

Post by gvp9000 »

I want to run a simple scroll script

window.scrollBy({
top: -80, // could be negative value
left: 0,
behavior: 'smooth'
});

When I click/tap in the quoted post link and the quoted post is in the same page with the link ...
Normal behavior is phpBB to scroll up until the quoted post ... I want to go up a bit further.
Any idea how to achieve this ?

Untitled 1.jpg
You do not have the required permissions to view the files attached to this post.
Last edited by Mick on Sun Apr 14, 2024 8:59 am, edited 1 time in total.
Reason: Solved
User avatar
Mannix_
Registered User
Posts: 1982
Joined: Sun Oct 25, 2015 2:56 pm
Name: Matt

Re: Run simple script when click quoted post link

Post by Mannix_ »

maybe simple css would be enough

Code: Select all

html {
    scroll-padding-top: 80px;
    scroll-behavior: smooth;
}
Did I helped You? Consider a donation.
New version of phpBB has been released? My styles aren't validated for it yet? Check my page for the latest downloads!
User avatar
P_I
Community Team Member
Community Team Member
Posts: 2433
Joined: Tue Mar 01, 2011 8:35 pm
Location: Western Canada 🇨🇦

Re: Run simple script when click quoted post link

Post by P_I »

gvp9000 wrote: Sat Apr 13, 2024 1:09 pm Normal behavior is phpBB to scroll up until the quoted post ... I want to go up a bit further.
I realize that you have your reasons for potentially making this change. As board admin that is your right.

However I'll offer a counterpoint to changing normal or standard phpBB behaviour. Many of us are members of numerous phpBB boards so have become quite understanding how things work and quite adept using these types of features. If I stumble upon a phpBB board that changes normal phpBB behaviour it sometimes confuses me and quite often annoys me to the point that I do not return nor join the discussion there.

My $0.02 and I acknowledge your milage may vary.
Normal people… believe that if it ain’t broke, don’t fix it. Engineers believe that if it ain’t broke, it doesn’t have enough features yet. – Scott Adams
gvp9000
Registered User
Posts: 60
Joined: Mon Oct 02, 2023 4:03 pm

Re: Run simple script when click quoted post link

Post by gvp9000 »

Mannix_ wrote: Sat Apr 13, 2024 2:38 pm maybe simple css would be enough

Code: Select all

html {
    scroll-padding-top: 80px;
    scroll-behavior: smooth;
}
I want the scroll to take place ONLY when I click on the quoted post link and only when the quoted post is in the same page.
I'm not familiar with css ... can you please give me instructions which file should I modify ?

Thank you.
User avatar
Mannix_
Registered User
Posts: 1982
Joined: Sun Oct 25, 2015 2:56 pm
Name: Matt

Re: Run simple script when click quoted post link

Post by Mannix_ »

You can put it in any css file. Just don't forget to purge the browser cache after making changes.
Did I helped You? Consider a donation.
New version of phpBB has been released? My styles aren't validated for it yet? Check my page for the latest downloads!
gvp9000
Registered User
Posts: 60
Joined: Mon Oct 02, 2023 4:03 pm

Re: Run simple script when click quoted post link

Post by gvp9000 »

Mannix_ wrote: Sat Apr 13, 2024 2:57 pm You can put it in any css file. Just don't forget to purge the browser cache after making changes.
Works fine .. thank you ...
gvp9000
Registered User
Posts: 60
Joined: Mon Oct 02, 2023 4:03 pm

Re: Run simple script when click quoted post link

Post by gvp9000 »

P_I wrote: Sat Apr 13, 2024 2:46 pm
gvp9000 wrote: Sat Apr 13, 2024 1:09 pm Normal behavior is phpBB to scroll up until the quoted post ... I want to go up a bit further.
I realize that you have your reasons for potentially making this change. As board admin that is your right.

However I'll offer a counterpoint to changing normal or standard phpBB behaviour. Many of us are members of numerous phpBB boards so have become quite understanding how things work and quite adept using these types of features. If I stumble upon a phpBB board that changes normal phpBB behaviour it sometimes confuses me and quite often annoys me to the point that I do not return nor join the discussion there.

My $0.02 and I acknowledge your milage may vary.
I totally agree with you.
I avoid make changes in the core phpBB files.
I just trying to fix some minor issues with an extension.
All the changes have been made to the extension files ...

Return to “phpBB Custom Coding”