Jump to content

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;
}

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.