Who the Fuck uses GOOGLE+?

A script which removes the google plus +1 sign

当前为 2016-05-11 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Who the Fuck uses GOOGLE+?
  3. // @namespace MegaByteWTFUG
  4. // @description A script which removes the google plus +1 sign
  5. // @require http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js
  6. // @run-at document-idle
  7. // @include *
  8. // @version 0.2
  9. // @grant none
  10. // ==/UserScript==
  11.  
  12.  
  13. if(!('contains' in String.prototype)) {
  14. String.prototype.contains = function(str, startIndex) {
  15. return -1 !== String.prototype.indexOf.call(this, str, startIndex);
  16. };
  17. }
  18. if (!Array.prototype.forEach) {
  19. Array.prototype.forEach = function(callback, thisArg) {
  20. var T, k;
  21. if (this == null) throw new TypeError(' this is null or not defined');
  22. var O = Object(this);
  23. var len = O.length >>> 0;
  24. if (typeof callback !== "function") throw new TypeError(callback + ' is not a function');
  25. if (arguments.length > 1) T = thisArg;
  26. k = 0;
  27. while (k < len) {
  28. var kValue;
  29. if (k in O) {
  30. kValue = O[k];
  31. callback.call(T, kValue, k, O);
  32. }
  33. k++;
  34. }
  35. };
  36. }
  37.  
  38. this.$ = this.jQuery = jQuery.noConflict(true);
  39. var attr = ["class", "id", "title", "tooltip"];
  40. var filter = ["googleplus", "google_plus", "gplus", "g_plus", "google+"];
  41. attr.forEach(function(i) {
  42. filter.forEach(function(j) {
  43. $("["+attr[i]+"*="+filter[j]+"]").remove();
  44. });
  45. });
  46. var site = window.location.href || document.URL;
  47. if(site.contains("plus.google.com")) {
  48. var content = $("body > *");
  49. content.remove();
  50. $("body").append(" \
  51. <center style='margin-top: 25px;'> \
  52. <h1 style='margin-bottom: 10px;'>Are you sure you want to be here?</h1> \
  53. <input type='button' value='Take me Away!' class='_away' /> \
  54. <input type='button' value='Show site!' class='_show' /> \
  55. </center> \
  56. ");
  57. $("._show").click(function() {
  58. $("body > *").remove();
  59. $("body").append(content);
  60. });
  61. $("._away").click(function() {
  62. window.location.href = document.referrer;
  63. });
  64. }