Jump to content

Facebook "like/unlike" text (Greasemonkey)


aspacecodyssey

Recommended Posts

I've been trying to create a greasemonkey script to change the text of the "like/unlike" (and applicable) text on facebook and I'm stuck. The script below works only on a hard refresh, but since facebook is ajax-heavy, it fails as soon as you start moving around:

var list = new Array();

list[0] = "likes this^enjoys this";

list[1] = "Like this item^Enjoy this item";

list[2] = ">Like<^>Enjoy<";<br />list[3] = ">Unlike<^>Unenjoy<";<br />list[4] = "You like this.^You enjoy this.";<br />list[5] = "> like this.^> enjoy this.";

list[6] = "People who like this^People who enjoy this";

var j, k, find, item, page, repl;

for (var i=0; i<list>

item = list.split("^");

find = item[0];

repl = item[1];

page = document.body.innerHTML;

while (page.indexOf(find) >= 0) {

var j = page.indexOf(find);

var k = find.length;

page = page.substr(0,j) + repl + page.substr(j+k);

document.body.innerHTML = page;

}

}

 

 

Any ideas?

Link to comment
https://forums.phpfreaks.com/topic/222361-facebook-likeunlike-text-greasemonkey/
Share on other sites

Sorry, code block:

 

var list = new Array();
list[0] = "likes this^enjoys this";
list[1] = "Like this item^Enjoy this item";
list[2] = ">Like<^>Enjoy<"; <br />list[3] = ">Unlike<^>Unenjoy<"; <br />list[4] = "You like this.^You enjoy this."; <br />list[5] = "> like this.^> enjoy this.";
list[6] = "People who like this^People who enjoy this";
var j, k, find, item, page, repl;
for (var i=0; i<list>
item = list[i].split("^");
find = item[0];
repl = item[1];
page = document.body.innerHTML;
while (page.indexOf(find) >= 0) {
    var j = page.indexOf(find);
    var k = find.length;
    page = page.substr(0,j) + repl + page.substr(j+k);
    document.body.innerHTML = page;
}

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.