aspacecodyssey Posted December 22, 2010 Share Posted December 22, 2010 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? Quote Link to comment https://forums.phpfreaks.com/topic/222361-facebook-likeunlike-text-greasemonkey/ Share on other sites More sharing options...
aspacecodyssey Posted December 22, 2010 Author Share Posted December 22, 2010 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; } Quote Link to comment https://forums.phpfreaks.com/topic/222361-facebook-likeunlike-text-greasemonkey/#findComment-1150290 Share on other sites More sharing options...
aspacecodyssey Posted December 22, 2010 Author Share Posted December 22, 2010 Pastebin: http://aspacecodyssey.pastebin.com/iPRJUWcP Quote Link to comment https://forums.phpfreaks.com/topic/222361-facebook-likeunlike-text-greasemonkey/#findComment-1150540 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.