[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!
Scam Warning
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: 448
Joined: Sat Aug 27, 2011 11:00 pm
Location: NL
Name: Theriddler❶
Contact:

Re: [BETA] Post Numbers

Post by Theriddler1 » Tue Dec 22, 2015 12:12 am

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 - Moderator @ phpBB.nl | phpBBservice.nl Team-member
ImageSupport Tools | Image My Extensions | buy me a beer Image

User avatar
kasimi
Extension Customisations
Extension Customisations
Posts: 3901
Joined: Sat Sep 10, 2011 7:12 pm
Location: Germany
Contact:

Re: [BETA] Post Numbers

Post by kasimi » Tue Dec 22, 2015 12:27 am

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
Contact:

Re: [BETA] Post Numbers

Post by huddy » Tue Dec 22, 2015 7:22 pm

A very welcome extension when ready :)

User avatar
Theriddler1
Registered User
Posts: 448
Joined: Sat Aug 27, 2011 11:00 pm
Location: NL
Name: Theriddler❶
Contact:

Re: [BETA] Post Numbers

Post by Theriddler1 » Wed Dec 23, 2015 4:20 pm

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 - Moderator @ phpBB.nl | phpBBservice.nl Team-member
ImageSupport Tools | Image My Extensions | buy me a beer Image

User avatar
kasimi
Extension Customisations
Extension Customisations
Posts: 3901
Joined: Sat Sep 10, 2011 7:12 pm
Location: Germany
Contact:

Re: [BETA] Post Numbers

Post by kasimi » Thu Dec 24, 2015 5:13 am

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: 448
Joined: Sat Aug 27, 2011 11:00 pm
Location: NL
Name: Theriddler❶
Contact:

Re: [BETA] Post Numbers

Post by Theriddler1 » Thu Dec 24, 2015 11:35 am

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 - Moderator @ phpBB.nl | phpBBservice.nl Team-member
ImageSupport Tools | Image My Extensions | buy me a beer Image

User avatar
kasimi
Extension Customisations
Extension Customisations
Posts: 3901
Joined: Sat Sep 10, 2011 7:12 pm
Location: Germany
Contact:

Re: [BETA] Post Numbers

Post by kasimi » Fri Dec 25, 2015 7:49 pm

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
Extension Customisations
Extension Customisations
Posts: 3901
Joined: Sat Sep 10, 2011 7:12 pm
Location: Germany
Contact:

Re: [BETA] Post Numbers

Post by kasimi » Sat Dec 26, 2015 1:32 am

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: 448
Joined: Sat Aug 27, 2011 11:00 pm
Location: NL
Name: Theriddler❶
Contact:

Re: [BETA] Post Numbers

Post by Theriddler1 » Mon Dec 28, 2015 12:05 pm

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 - Moderator @ phpBB.nl | phpBBservice.nl Team-member
ImageSupport Tools | Image My Extensions | buy me a beer Image

User avatar
kasimi
Extension Customisations
Extension Customisations
Posts: 3901
Joined: Sat Sep 10, 2011 7:12 pm
Location: Germany
Contact:

Re: [BETA] Post Numbers

Post by kasimi » Mon Dec 28, 2015 12:41 pm

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 » Mon Dec 28, 2015 5:08 pm

Is it possible to add an option to view the post numbers in the subject header?

User avatar
kasimi
Extension Customisations
Extension Customisations
Posts: 3901
Joined: Sat Sep 10, 2011 7:12 pm
Location: Germany
Contact:

Re: [BETA] Post Numbers

Post by kasimi » Mon Dec 28, 2015 5:42 pm

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 » Mon Dec 28, 2015 7:40 pm

Yes, that's exactly what I had in mind.

User avatar
kasimi
Extension Customisations
Extension Customisations
Posts: 3901
Joined: Sat Sep 10, 2011 7:12 pm
Location: Germany
Contact:

Re: [BETA] Post Numbers

Post by kasimi » Mon Dec 28, 2015 11:32 pm

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: 448
Joined: Sat Aug 27, 2011 11:00 pm
Location: NL
Name: Theriddler❶
Contact:

Re: [BETA] Post Numbers

Post by Theriddler1 » Tue Dec 29, 2015 10:16 pm

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 - Moderator @ phpBB.nl | phpBBservice.nl Team-member
ImageSupport Tools | Image My Extensions | buy me a beer Image

Locked

Return to “Extensions in Development”