Facebook Double

Adds doubles to Facebook

目前为 2016-06-13 提交的版本。查看 最新版本

  1. // ==UserScript==
  2. // @name Facebook Double
  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. // @require http://code.jquery.com/jquery-2.2.1.min.js
  10. // @namespace https://greasyfork.org/users/31125
  11. // ==/UserScript==
  12.  
  13.  
  14. //HEX
  15. var highlightColour = "#ffe";
  16.  
  17.  
  18.  
  19.  
  20.  
  21.  
  22.  
  23.  
  24. $( document ).on( "mouseover", "html body .userContentWrapper:not(.op_final)", function() {
  25. var post = $(this).find('a._5pcq').attr("href");
  26. var post_id = post.match("permalink/" + "(.*)" + "/")[1];
  27. var $op_post_id = $(this).find('.op_post_id');
  28. if($op_post_id.length < 1){
  29. $(this).find('a._5pcq').parent().append('<span> · </span><span class="op_post_id">No. '+post_id+'</span>');
  30. $(this).addClass("op_final");
  31. }
  32. var xD = $(this).find('span.op_post_id').text();
  33. var last2 = xD.slice(-2);
  34. function doubleHighlight (str)
  35. {
  36. var Fletter = str.substr(0, 1);
  37. return (str.replace(new RegExp(Fletter, 'g'), "").length === 0);
  38. }
  39. if(doubleHighlight(last2)){
  40. $(this).find('span.op_post_id').css({ "background-color": highlightColour});
  41. }
  42.  
  43. });
  44.  
  45.  
  46.  
  47.  
  48. /////////COMMENTS/////////
  49.  
  50.  
  51. $( document ).on( "mouseover", "html body .UFICommentContentBlock:not(.final)", function() {
  52. var post = $(this).find('a.uiLinkSubtle').attr("href");
  53. var post_id;
  54. if(post.indexOf("reply_comment_id")>-1){
  55. post_id = post.match("reply_comment_id=" + "(.*)" + "&comment_tracking")[1];
  56. }
  57. else{
  58. post_id = post.match("comment_id=" + "(.*)" + "&comment_tracking")[1];
  59. }
  60.  
  61. var $post_id = $(this).find('.post_id');
  62.  
  63. if($post_id.length < 1){
  64. $(this).find('a.uiLinkSubtle').parent().append('<span> · </span><span class="post_id">No. '+post_id+'</span>');
  65. $(this).addClass("final");
  66. }
  67.  
  68. var xD = $(this).find('span.post_id').text();
  69. var last2 = xD.slice(-2);
  70.  
  71. function doubleHighlight (str)
  72. {
  73. var Fletter = str.substr(0, 1);
  74. return (str.replace(new RegExp(Fletter, 'g'), "").length === 0);
  75. }
  76.  
  77. if(doubleHighlight(last2)){
  78. $(this).find('span.post_id').css({ "background-color": highlightColour});
  79. }
  80. });