Advertisement
Guest User

Voat Privacy Enhancer Version 0.11

a guest
Sep 16th, 2019
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.76 KB | None | 0 0
  1. // ==UserScript==
  2. // @name Voat Privacy Enhancer
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.11
  5. // @description Cross Strike Twitter Links and Highlight Them in RED
  6. // @author hopefortoday
  7. // @match *://*.voat.co/*
  8. // @grant none
  9. // @icon https://voat.co/favicon.ico
  10. // @license GPL-3.0-or-later
  11.  
  12. // ==/UserScript==
  13. (function() {
  14. 'use strict';
  15. // Black list links get deactivated, url added after the title
  16. var black_list = [/https?:\/\/[a-zA-Z0-9\.]*twitter.com\//,
  17. /https?:\/\/[a-zA-Z0-9\.]*twimg.com\//,
  18. /https?:\/\/[a-zA-Z0-9\.]*imgur.com\//,
  19. /https?:\/\/[a-zA-Z0-9\.]*redd.it\//,
  20. /https?:\/\/[a-zA-Z0-9\.]*reddit.com\//];
  21.  
  22. // White list is safe to click
  23. var white_list = [/https?:\/\/[a-zA-Z0-9\.]*catbox.moe\//,
  24. /https?:\/\/[a-zA-Z0-9\.]*pic8.co\//,
  25. /https?:\/\/[a-zA-Z0-9\.]*imgtc.ws\//,
  26. /https?:\/\/[a-zA-Z0-9\.]*voat.co\//,
  27. /https?:\/\/[a-zA-Z0-9\.]*bitchute.com\//,
  28. /https?:\/\/[a-zA-Z0-9\.]*magaimg.net\//];
  29.  
  30. var replacements = [[/https?:\/\/[a-zA-Z0-9\.]*youtube.com\/watch\?v=([a-zA-Z0-9]*)/,"https://invidio.us/watch?v=$1"],
  31. [/https?:\/\/[a-zA-Z0-9\.]*youtu.be\/([a-zA-Z0-9]*)/,"https://invidio.us/watch?v=$1"]
  32. ];
  33. var p = null;
  34. var temp = document.getElementsByClassName("sitetable linklisting")[0];
  35. if (!temp) { //Maybe we're looking at a user submission page
  36. temp = document.getElementsByClassName("content full")[0];
  37. }
  38. if (temp) {
  39. var submission_list = temp.children;
  40. for (var i = 0; i < submission_list.length; i++) {
  41. var tita = submission_list[i].getElementsByClassName("title may-blank")[0];
  42. var titm = submission_list[i].getElementsByClassName("title")[0];
  43. var expando = submission_list[i].getElementsByClassName("expando-button collapsed selftext")[0];
  44. // Default color is grey for grey list
  45. if (tita && titm) {
  46. // Safe links in green
  47. for (var j = 0; j < white_list.length; j++) {
  48. if (white_list[j].exec(tita.href.toString())) {
  49. tita.style.color = "#AAFFAA";
  50. }
  51. }
  52. //Unsafe links deactivated. URL is added for cut and paste
  53. for (j = 0; j < black_list.length; j++) {
  54. if (black_list[j].exec(tita.href.toString())) {
  55. tita.style.color = "#FF0000";
  56. //tita.style.textDecoration="line-through";
  57. tita.style.pointerEvents = "none"
  58. titm.innerHTML = titm.innerHTML + tita.href;
  59. }
  60. }
  61. for (j=0; j < replacements.length; j++) {
  62. if (replacements[j][0].exec(tita.href.toString())) {
  63. tita.href=tita.href.replace(replacements[j][0],replacements[j][1]);
  64. tita.style.color="#CCCCCC"
  65. if (expando) { // Disable embedding in case of replacement
  66. alert("disabling expando for:" + tita.innerText);
  67. expando.style.pointerEvents="none";
  68. expando.style.opacity="0";
  69. } //else alert("expando failed for:" + tita.innerText) #submissionid-3426556 > div.entry.unvoted > div.expando-button.selftext.collapsed
  70. }
  71. }
  72. }
  73. }
  74. }
  75. //disable expand lists to avoid going to youtube accidentally
  76.  
  77. })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement