yanniks / shariff-wordpress

Shariff for WordPress
http://ct.de/-2467514
MIT License
5 stars 2 forks source link

Increase count on button press #1

Open ibes opened 9 years ago

ibes commented 9 years ago

Hi,

would be great, if the like-count would increase as a reaction of liking a content.

I haven't digged into shariff completely, but it seems to be not that sensefull to reload the count directly after pressing the button.

What about a little fake. Add a jQuery script, that increase the number by one. This would just change the interface to give the user direct feedback.

Sounds nice?

I guess I could write ne necessary script. Something like: If a shariff button is pressed, search for the count box, get it's value, treat it like a integer, increase by one, write the new value.

Hm - maybe it should listen for the closing-event of the sharing box. If canceled, do nothing. If closed properly, increase.

What's your opinion on this idea?

yanniks commented 9 years ago

Sounds good but I don't know a way to detect if the person really shared the item. Increasing it just after the button got pressed doesn't sound like something I would like.

ibes commented 9 years ago

Yeah, I try to search, if there is something for this.

Increase after the button is pressed is a dirty trick, yes. That doesn't have to be in the plugin - i could write this for my customer.

Some thought on this: When I press a like button, a new window is opened with the context of the specific service. Then I can give my like, the window is closed and I will see the page again.

This seems also dirty, but: Would it be possible, to trigger an event, when the page is focussed after the button is pressed and than reload the cache and get the new count. Woooho - this seems to be much work in the background for a small improvement.

Again in smaller steps.

But this seems too heavy for a page with much traffic. This might make the cache obsolete. But would be awesome to have the count updated via a websocket.

...just a crazy guys thoughts ;)

ibes commented 9 years ago

The "gets focus" event is existing: http://jsfiddle.net/q66d3waq/1/

ibes commented 9 years ago

Hm - the "gets focus" event could also start a json call to the specific API.

Like the backend does. Should be similar to the node.js backend:

https://github.com/heiseonline/shariff-backend-node/blob/master/lib/facebook.js