Facebook Double Beta

Adds doubles to Facebook

  1. // ==UserScript==
  2. // @name Facebook Double Beta
  3. // @author Niqueish
  4. // @description Adds doubles to Facebook
  5. // @homepage https://www.facebook.com/Niqueish
  6. // @version 1.0
  7. // @include *://*.facebook.com/*
  8. // @grant none
  9. // @run-at document-start
  10. // @require http://code.jquery.com/jquery-2.2.1.min.js
  11. // @namespace https://greasyfork.org/users/31125
  12. // ==/UserScript==
  13.  
  14.  
  15. /* KOLOR PODŚWIETLENIA W HEX*/
  16.  
  17. var highlightColour = "#ffe";
  18.  
  19. /* KOLOR PODŚWIETLENIA W HEX*/
  20.  
  21.  
  22.  
  23.  
  24.  
  25.  
  26.  
  27. function waitForKeyElements(e,t,n,a){var r,o;r="undefined"==typeof a?$(e):$(a).contents().find(e),r&&r.length>0?(o=!0,r.each(function(){var e=$(this),n=e.data("alreadyFound")||!1;if(!n){var a=t(e);a?o=!1:e.data("alreadyFound",!0)}})):o=!1;var l=waitForKeyElements.controlObj||{},i=e.replace(/[^\w]/g,"_"),d=l[i];o&&n&&d?(clearInterval(d),delete l[i]):d||(d=setInterval(function(){waitForKeyElements(e,t,n,a)},300),l[i]=d),waitForKeyElements.controlObj=l}
  28.  
  29. waitForKeyElements ("._4-u2.mbm._5v3q._4-u8", op);
  30.  
  31. function op (jNode) {
  32.  
  33. $timestamp = $(jNode).find('a._5pcq');
  34. var post;
  35. if($($timestamp).is("[href]")){
  36. post = $timestamp.attr("href");
  37. }
  38.  
  39. if (typeof post !== 'undefined') {
  40. var post_id;
  41. if (post.indexOf("permalink") > -1){
  42. post_id = post.replace(/\//g, "");
  43. post_id = post_id.split("permalink", 2)[1];
  44.  
  45. $(jNode).find('a._5pcq').parent().append('<span> · </span><span class="op_post_id">No. '+post_id+'</span>');
  46. }
  47.  
  48.  
  49. var xD = $(jNode).find('span.op_post_id').text();
  50. var last2 = xD.slice(-2);
  51. doubleHighlight = function (str){
  52. var Fletter = str.substr(0, 1);
  53. return (str.replace(new RegExp(Fletter, 'g'), "").length === 0);
  54. };
  55.  
  56. if(doubleHighlight(last2)){
  57. $(jNode).find('span.op_post_id').css({ "background-color": highlightColour});
  58.  
  59. }
  60.  
  61. }
  62.  
  63. }
  64.  
  65.  
  66. /////////COMMENTS/////////
  67.  
  68.  
  69.  
  70. waitForKeyElements (".UFICommentContentBlock", comment);
  71.  
  72. function comment (jNode) {
  73.  
  74.  
  75. var post = $(jNode).find('a.uiLinkSubtle').attr("href");
  76.  
  77. if (typeof post !== 'undefined') {
  78. var post_id;
  79.  
  80. if(post.indexOf("reply_comment_id") > -1){
  81. post_id = post.match("reply_comment_id=" + "(.*)" + "&comment_tracking")[1];
  82. }
  83. else if (post.indexOf("reply_comment_id") == -1 && post.indexOf("comment_id") > -1){
  84. post_id = post.match("comment_id=" + "(.*)" + "&comment_tracking")[1];
  85. }
  86.  
  87.  
  88. $(jNode).find('a.uiLinkSubtle').parent().append('<span> · </span><span class="post_id">No. '+post_id+'</span>');
  89.  
  90.  
  91. var xD = $(jNode).find('span.post_id').text();
  92. var last2 = xD.slice(-2);
  93.  
  94. doubleHighlight = function (str){
  95. var Fletter = str.substr(0, 1);
  96. return (str.replace(new RegExp(Fletter, 'g'), "").length === 0);
  97. };
  98.  
  99. if(doubleHighlight(last2)){
  100. $(jNode).find('span.post_id').css({ "background-color": highlightColour});
  101. }
  102. }
  103.  
  104. }