7 points
Description
Writing scripts for Facebook isn't as simple as writing scripts for other sites because Facebook uses Ajax to load pages, making @includes and @excludes useless. I've been using a work around in my scripts along time and now I'm going to share what I've learned with other scriptwrights to make Facebook Greasemonkey friendly once again.Instructions
The code needed to run your scripts in Facebook must be included via @require and all your code must be wrapped in a function namedfbPageChanged. You need to make sure to @include http://*.facebook.com/*Below is sample script that will only execute on
http://*.facebook.com/home.php*// ==UserScript==
// @name Facebook Script
// @description Make any script work on Facebook
// @require http://userscripts.org/scripts/source/84596.user.js?
// @include http://*.facebook.com/*
// ==/UserScript==
function fbPageChanged() {
if (GM_testUrl(['http://*.facebook.com/home.php*'])) {
// All your code goes here
}
}Using GM_testUrl
GM_testUrl duplicates the url matching capabilities of Greasemonkey. The first argument is an array of include urls and the second optional argument is an array of exclude urls. So for example:
if (GM_testUrl(["http://*.google.com/*", "http://*.facebook.com/*"], ["http://*.facebook.com/home.php?*"])) {
// This is equal to:
// @include http://*.google.com/*
// @include http://*.facebook.com/*
// @exclude http://*.facebook.com/home.php?*
}
login to vote
Tbh, this isn't working for me on topic.php.
I'm on http://www.facebook.com/topic.php?uid=102452128... and I click next, and it doesn't run, even though the fbPageChangeMarker changes.
login to vote
I'm not experiencing your problem. I sent you an email.
login to vote
I've added an issue item out on googlecode describing my issue here:
http://code.google.com/p/gmconfig/issues/detail...
The short version is that navigation on friends of friends pages do not change the entire page, so, it does not kill your div.
login to vote
can some one help am not getting this at all