|
November 15, 2010
posted by Eric on 11.15.10 at 11:48 PM //Copyright 2010 Facebook, Inc. // //Licensed under the Apache License, Version 2.0 (the "License"); you may //not use this file except in compliance with the License. You may obtain //a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // //Unless required by applicable law or agreed to in writing, software //distributed under the License is distributed on an "AS IS" BASIS, WITHOUT //WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the //License for the specific language governing permissions and limitations //under the License. // ==UserScript== // @name Facebook Like // @namespace http://www.facebook.com // @description Like any page on the web! // @include * // ==/UserScript== //don't append the bar if it's an iframe if (window.top != window.self) { exit; } base_url = getBaseURL(); //don't display the bar on facebook.com if (base_url == 'http://www.facebook.com/' || base_url == '/') { exit; } //assigning event handlers need a timeout so they don't die setTimeout(assignClickHandler, 100); var base_url = getBaseURL(window.location); //define the HTML/CSS that needs to be prepended to the current page var output_markup = ''; output_markup = ' ' +
' ' +
' ';
output = document.createElement('div');
output.innerHTML = output_markup;
//prepend the markup to the body
body = document.getElementsByTagName('body')[0];
body.appendChild(output);
//buffer the top of the page so the bar doesn't overlap any content on initial load
body.style.marginTop = '29px';
//toggle Recent Activity/Recommendations sidebar on and off
function showExtraInfo() {
obj = document.getElementById("extra-info");
if (obj.style.display == "none")
{
obj.style.display = "";
}
else {
obj.style.display = "none";
}
return false;
}
//track the click event on the plus ([+]) button in order to toggle showExtraInfo
function assignClickHandler() {
var clickDiv = document.getElementById('socialInfo');
clickDiv.addEventListener("click", showExtraInfo, true);
}
//get the base URL of the site the user is currently on
function getBaseURL () {
var url = location.href;
var baseURL = url.substring(0, url.indexOf('/', 14));
if (baseURL.indexOf('http://localhost') != -1) {
var url = location.href;
var pathname = location.pathname;
var index1 = url.indexOf(pathname);
var index2 = url.indexOf("/", index1 + 1);
var baseLocalUrl = url.substr(0, index2);
return baseLocalUrl + "/";
}
else {
return baseURL + "/";
}
}
' + document.title.substring(0,60) + '... |
|
November 2010
WORLD-WIDE CALENDAR
Search the Site
E-mail
Classics To Go
Archives
November 2010
October 2010 September 2010 August 2010 July 2010 June 2010 May 2010 April 2010 March 2010 February 2010 January 2010 December 2009 November 2009 October 2009 September 2009 August 2009 July 2009 June 2009 May 2009 April 2009 March 2009 February 2009 January 2009 December 2008 November 2008 October 2008 September 2008 August 2008 July 2008 June 2008 May 2008 April 2008 March 2008 February 2008 January 2008 December 2007 November 2007 October 2007 September 2007 August 2007 July 2007 June 2007 May 2007 April 2007 March 2007 February 2007 January 2007 December 2006 November 2006 October 2006 September 2006 August 2006 July 2006 June 2006 May 2006 April 2006 March 2006 February 2006 January 2006 December 2005 November 2005 October 2005 September 2005 August 2005 July 2005 June 2005 May 2005 April 2005 March 2005 February 2005 January 2005 December 2004 November 2004 October 2004 September 2004 August 2004 July 2004 June 2004 May 2004 April 2004 March 2004 February 2004 January 2004 December 2003 November 2003 October 2003 September 2003 August 2003 July 2003 June 2003 May 2003 May 2002 AB 1634 MBAPBSAAGOP Skepticism See more archives here Old (Blogspot) archives
Recent Entries
Letter To A Friend
Sick of whatever I'm sick of, but how sick! This Is An Order A Split You're not special, but WE are -- an open letter to President Obama Abortion Prohibition Enforcement The Drug War Exception Is Sarah Palin Good Or Is She Lucky? The American Sphinx What are those awful bigoted Arizonans smoking?
Links
Site Credits
|
|