Note that there are some explanatory texts on larger screens.

plurals
  1. POFacebook like API using JS and PHP
    text
    copied!<p>The following code is part of a PHP script associated with button</p> <pre><code>&lt;script&gt; var bootstrap = new bootstrap('http://hotmail.com', 'button', '304770399584182'); bootstrap.init(); &lt;/script&gt; </code></pre> <p>The associated JS script is:</p> <pre><code>/* =------------= * | Like Thief | * =------------= * * Version: 0.1 * Developer: James Jeffery &lt;joojar@hotmail.com&gt; * AIM: joojarmarketing * * PFF: Project Fuck Facebook */ function bootstrap(url, id, appId) { this.url = url; this.id = id; this.appId = appId; this.init = function() { window.alert("Welcome! Press OK 2"); this.insertFBJavascript(); this.insertLikeButton(); document.getElementById(this.id).onmousemove = positionLikeButton; window.alert("Welcome! Press OK 3"); } this.insertFBJavascript = function() { window.alert("Welcome! Press check fb-rrot"); if(document.getElementById('fb-root')) return; window.alert("Welcome! Press passed"); var fbr = document.createElement('div'); fbr.id = 'fb-root'; document.getElementsByTagName('body')[0].appendChild(fbr); (function(d, s, id, appId) { var js, fjs = d.getElementsByTagName(s)[0]; window.alert("Welcome! test2"); if (d.getElementById(id)) return; window.alert("Welcome! Press passed"); js = d.createElement(s); js.id = id; js.src = '//connect.facebook.net/en_US/all.js#xfbml=1&amp;appId=' + appId; fjs.parentNode.insertBefore(js, fjs); }(document, 'script', 'facebook-jssdk', this.appId)); } this.insertLikeButton = function() { window.alert("Welcome! Press OK like"); var lb = document.createElement('fb:like'); lb.id = 'fblike'; lb.setAttribute('width', '450'); lb.setAttribute('href', this.url); lb.setAttribute('show_faces', 'false'); document.getElementById(this.id).appendChild(lb); } function positionLikeButton(e) { window.alert("Welcome! Press OK pos like"); e = e || window.event; var cursor = {x:0, y:0}; if (e.pageX || e.pageY) { cursor.x = e.pageX; cursor.y = e.pageY; } else { cursor.x = e.clientX + (document.documentElement.scrollLeft || document.body.scrollLeft) - document.documentElement.clientLeft; cursor.y = e.clientY + (document.documentElement.scrollTop || document.body.scrollTop) - document.documentElement.clientTop; } window.alert("Welcome! last"); var elem = document.getElementById('fblike'); elem.style.position = 'absolute'; elem.style.top = cursor.y - 5 + 'px'; elem.style.left = cursor.x - 5 + 'px'; } } </code></pre> <p>Using Windows Vista and Chrome, I have Facebook logged in, so why is this line returning null in the JS script?</p> <pre><code>if(document.getElementById('fb-root')) return; </code></pre> <p>I have a tab in Chrome already opened and using Facebook, any suggestions?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload