0

It's about new Facebook reactions. The bar with emoticons shows up when user has mouse over the "Like" button. So before user does it for first time (I mean from DOMready to next refresh/page change) it is nowhere in the code but when user moves his mouse over then div with reactions appears and I can manage it via jQuery. But I want to make bar appear instantly, I can do that for every post but user has to do that first mouseover move, I want to do it instantly, without needing to move the mouse over first.

I was thinking about copying whole html and css but there are also other events binded to the bars that are responsible for giving a like, showing reaction name etc.

So is this possible to get the code before facebook inserts it after user interaction?

  • You can call events from javascript. http://stackoverflow.com/questions/2228376/trigger-onmouseover-event-programatically-in-javascript – Seano666 Mar 01 '16 at 19:22
  • Ye but they are using some ajax calls and every html for like bar looks like this: http://pastebin.com/NGgfd5yz how the facebook will now in which post it was clicked? – stevenhawkingsbiggestfan Mar 01 '16 at 19:50
  • And I'm doing `clone(true,true);` on an like button, then paste it somewhere else and button doesn't work. – stevenhawkingsbiggestfan Mar 01 '16 at 20:28
  • So there are multiple like buttons for different posts? Which one do you want to show immediately on page load? Your specs are confusing. If it's just one of these many buttons, use a pseudo-selector in jquery (n-th child or something) to select only one. – Seano666 Mar 01 '16 at 21:08
  • Button is under every post but it is hidden until you move your mouse over. I want to move it from "hidden" to shown. – stevenhawkingsbiggestfan Mar 01 '16 at 21:18
  • Find what is different in the CSS from when it's shown vs/hidden with the browser inspector. It's usually as simple as a CSS class being added or removed, or a :hover CSS selector. When you discover that, you can override it when the page loads. – Seano666 Mar 01 '16 at 21:24
  • The CSS is not a problem, the problem is that when I `jQuery.clone(true)` the like button for example, and I paste it somewhere else, in the same post div, it stops working, clicking on it doesn't do anything. – stevenhawkingsbiggestfan Mar 01 '16 at 21:33
  • Are you using clone like this? (first answer) http://stackoverflow.com/questions/9549643/jquery-clone-not-cloning-event-bindings-even-with-on – Seano666 Mar 01 '16 at 22:03
  • Yes, I checked documentation and I was using `(true, true)`. You can easly check it by yourself if you have an facebook account (if not then please create one, only for testing, with fake data). The like buttons are in `div.UFILikeLink._48-k` so `var like = $('div.UFILikeLink._48-k').eq(0).clone(true,true);` will give me first button, then I append it into div in the same post `$('div._42nr').eq(0).append(like);` and only first button will work, the second will not even have the mouseover event on. I tried to remove first button and leaving only appended one but it doesn't work either. – stevenhawkingsbiggestfan Mar 02 '16 at 13:13
  • 1
    I checked in the developer tools that it has binded event listener for mouseover, it just wont work. – stevenhawkingsbiggestfan Mar 02 '16 at 13:14

0 Answers0