Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Increase count on button press #1

Open
ibes opened this issue Jan 9, 2015 · 4 comments
Open

Increase count on button press #1

ibes opened this issue Jan 9, 2015 · 4 comments

Comments

@ibes
Copy link

ibes commented Jan 9, 2015

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
Copy link
Owner

yanniks commented Jan 9, 2015

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
Copy link
Author

ibes commented Jan 9, 2015

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.

  • A person is clicking the button.
  • A new window opens and gets the focus (her has to be an "leave window" event)
  • Something is done with the new window -> like, cancel, closed, liked beside window
  • Her has to be an "gets focus" event - the first page is shown again
  • the "gets focus" events sends an request to the backend
  • the backend flashes the count, gets the new count, sends it back
  • the page is displaying the new count

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
Copy link
Author

ibes commented Jan 9, 2015

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

@ibes
Copy link
Author

ibes commented Jan 9, 2015

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants