[CDB] Post Numbers

A place for Extension Authors to post and receive feedback on Extensions still in development. No Extensions within this forum should be used within a live environment!
Ideas Centre
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

IMPORTANT: Extensions Development rules

IMPORTANT FOR NEEDED EVENTS!!!
If you need an event for your extension please read this for the steps to follow to request the event(s)
User avatar
Theriddler1
Registered User
Posts: 451
Joined: Sat Aug 27, 2011 11:00 pm
Location: NL
Name: Theriddler❶

Re: [BETA] Post Numbers

Post by Theriddler1 »

kasimi wrote:Thanks for your feedback.

What purpose does the popup serve? If you need the post link, can't you use your browser's context menu to copy it? A popup for that feels inconvenient.
Yes true, but people are lazy these days ;)

something like this

Code: Select all

<a href="post link" onclick="prompt("DIRECT LINK TO POST",this.href); return false;">
Theriddler - Former Moderator @ phpBB.nl | phpBBservice.nl Team-member
Image My Extensions | buy me a beer Image
User avatar
kasimi
Former Team Member
Posts: 4900
Joined: Sat Sep 10, 2011 7:12 pm
Location: Germany

Re: [BETA] Post Numbers

Post by kasimi »

Lazy? Copying the link from a popup takes longer than using the context menu. :)

There is a way to make it actually easier though: execCommand("copy") which I could add so that the post URL is copied with a simple left click on the post number. However, browser support could be an issue, see last row of the table there: https://developer.mozilla.org/en-US/doc ... patibility

I'll do some experiments.
huddy
Registered User
Posts: 163
Joined: Fri Feb 21, 2014 12:21 pm
Location: Chelmsford UK

Re: [BETA] Post Numbers

Post by huddy »

A very welcome extension when ready :)
User avatar
Theriddler1
Registered User
Posts: 451
Joined: Sat Aug 27, 2011 11:00 pm
Location: NL
Name: Theriddler❶

Re: [BETA] Post Numbers

Post by Theriddler1 »

kasimi wrote:There is a way to make it actually easier though: execCommand("copy") which I could add so that the post URL is copied with a simple left click on the post number. However, browser support could be an issue, see last row of the table there: https://developer.mozilla.org/en-US/doc ... patibility

I'll do some experiments.
Awesome! this sounds great and much easier indeed :)
Theriddler - Former Moderator @ phpBB.nl | phpBBservice.nl Team-member
Image My Extensions | buy me a beer Image
User avatar
kasimi
Former Team Member
Posts: 4900
Joined: Sat Sep 10, 2011 7:12 pm
Location: Germany

Re: [BETA] Post Numbers

Post by kasimi »

New version 1.0.3 in first post. I added copy to clipboard but it is an experimental feature. At the moment it falls back to showing a prompt if an older browser is used, still subject to change though. I haven't tested it across all browsers. Feedback on how this is working for you is always welcome. :)
User avatar
Theriddler1
Registered User
Posts: 451
Joined: Sat Aug 27, 2011 11:00 pm
Location: NL
Name: Theriddler❶

Re: [BETA] Post Numbers

Post by Theriddler1 »

thanks kasimi will test it out :)

Edit:

Tested within firefox: not work
Within: Chrome: works
Within: Edge: not work

I'm too reading and searching for possible solution: http://stackoverflow.com/questions/2258 ... ing-jquery

notice: When you click on the number the page reloads. Maybe much nicer if possible to show some message (ajax) that is has been copied with success ,such as you get when you click 'mark all forums read'

But really nice feature and much easier for members to copy their own post link.
Great work.
Theriddler - Former Moderator @ phpBB.nl | phpBBservice.nl Team-member
Image My Extensions | buy me a beer Image
User avatar
kasimi
Former Team Member
Posts: 4900
Joined: Sat Sep 10, 2011 7:12 pm
Location: Germany

Re: [BETA] Post Numbers

Post by kasimi »

Thanks for testing. I implemented it just like the second answer in your SO link suggests.

I did some testing myself, for me it works with:
  • Firefox 43
  • Chrome 47
  • IE 9, 10, 11
    In all of those IE versions this confirmation is displayed when clicking on the post number for the first time:
    Image
    After accepting this once, I'm able to copy all day long. What's strange is that there doesn't seem to be a way to detect when the user clicked on No. There's no exception thrown and the execCommand('copy') call returns true regardless. :roll:
I'm wondering, which browser and version are you using?
Theriddler1 wrote:Maybe much nicer if possible to show some message (ajax) that is has been copied with success
This should already be the case:
Image
Theriddler1 wrote:When you click on the number the page reloads.
At the moment this only happens if copying failed. I will try to get that fixed. :)
User avatar
kasimi
Former Team Member
Posts: 4900
Joined: Sat Sep 10, 2011 7:12 pm
Location: Germany

Re: [BETA] Post Numbers

Post by kasimi »

Instead of using jQuery for creating and adding the temporary DOM element I'm now using pure JavaScript, as suggested on StackOverflow.

Also I found a sneaky way to detect if copying worked in IE: instead of simply copying, the post link is actually cut from the <input> element. Afterwards I just check if the <input> is empty. :geek:

Check out the latest version: https://github.com/kasimi/phpbb-ext-pos ... master.zip
User avatar
Theriddler1
Registered User
Posts: 451
Joined: Sat Aug 27, 2011 11:00 pm
Location: NL
Name: Theriddler❶

Re: [BETA] Post Numbers

Post by Theriddler1 »

awesome will test it out and will let you know.

Great work!

Edit: Tested it out but still not working

for example this is the site: http://www.peppersrus-forum.nl/viewtopi ... 384#p39384

as you click, the page just reloads.

Using
Firefox 43.0.2
Google chrome 47.0.2526.106
Theriddler - Former Moderator @ phpBB.nl | phpBBservice.nl Team-member
Image My Extensions | buy me a beer Image
User avatar
kasimi
Former Team Member
Posts: 4900
Joined: Sat Sep 10, 2011 7:12 pm
Location: Germany

Re: [BETA] Post Numbers

Post by kasimi »

You need to enable the copy-on-click feature in the ACP extension config page. ;)
pantherfan
Registered User
Posts: 44
Joined: Thu Nov 12, 2015 12:15 am
Name: Tangela

Re: [BETA] Post Numbers

Post by pantherfan »

Is it possible to add an option to view the post numbers in the subject header?
User avatar
kasimi
Former Team Member
Posts: 4900
Joined: Sat Sep 10, 2011 7:12 pm
Location: Germany

Re: [BETA] Post Numbers

Post by kasimi »

So, for your post it would say this?

#41 Re: [BETA] Post Numbers

If that's what you mean, yes, that would be possible.
pantherfan
Registered User
Posts: 44
Joined: Thu Nov 12, 2015 12:15 am
Name: Tangela

Re: [BETA] Post Numbers

Post by pantherfan »

Yes, that's exactly what I had in mind.
User avatar
kasimi
Former Team Member
Posts: 4900
Joined: Sat Sep 10, 2011 7:12 pm
Location: Germany

Re: [BETA] Post Numbers

Post by kasimi »

This has been added to latest v1.0.4, see first post.

There's a new <select> in the ACP config page where you can set the post numbers' location:
  1. Between post image and post author name (default)
  2. In post subject
Note that if you add the post numbers to the subject, the preferences Copy post link to clipboard when clicking on post number and Make post numbers/IDs bold are ignored.
User avatar
Theriddler1
Registered User
Posts: 451
Joined: Sat Aug 27, 2011 11:00 pm
Location: NL
Name: Theriddler❶

Re: [BETA] Post Numbers

Post by Theriddler1 »

kasimi wrote:You need to enable the copy-on-click feature in the ACP extension config page. ;)
:o aargh indeed that was it, it works now. Thank you really love this feature :)
Great work kasimi
Theriddler - Former Moderator @ phpBB.nl | phpBBservice.nl Team-member
Image My Extensions | buy me a beer Image

Return to “Extensions in Development”