Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name Voat Privacy Enhancer
- // @namespace http://tampermonkey.net/
- // @version 0.11
- // @description Cross Strike Twitter Links and Highlight Them in RED
- // @author hopefortoday
- // @match *://*.voat.co/*
- // @grant none
- // @icon https://voat.co/favicon.ico
- // @license GPL-3.0-or-later
- // ==/UserScript==
- (function() {
- 'use strict';
- // Black list links get deactivated, url added after the title
- var black_list = [/https?:\/\/[a-zA-Z0-9\.]*twitter.com\//,
- /https?:\/\/[a-zA-Z0-9\.]*twimg.com\//,
- /https?:\/\/[a-zA-Z0-9\.]*imgur.com\//,
- /https?:\/\/[a-zA-Z0-9\.]*redd.it\//,
- /https?:\/\/[a-zA-Z0-9\.]*reddit.com\//];
- // White list is safe to click
- var white_list = [/https?:\/\/[a-zA-Z0-9\.]*catbox.moe\//,
- /https?:\/\/[a-zA-Z0-9\.]*pic8.co\//,
- /https?:\/\/[a-zA-Z0-9\.]*imgtc.ws\//,
- /https?:\/\/[a-zA-Z0-9\.]*voat.co\//,
- /https?:\/\/[a-zA-Z0-9\.]*bitchute.com\//,
- /https?:\/\/[a-zA-Z0-9\.]*magaimg.net\//];
- var replacements = [[/https?:\/\/[a-zA-Z0-9\.]*youtube.com\/watch\?v=([a-zA-Z0-9]*)/,"https://invidio.us/watch?v=$1"],
- [/https?:\/\/[a-zA-Z0-9\.]*youtu.be\/([a-zA-Z0-9]*)/,"https://invidio.us/watch?v=$1"]
- ];
- var p = null;
- var temp = document.getElementsByClassName("sitetable linklisting")[0];
- if (!temp) { //Maybe we're looking at a user submission page
- temp = document.getElementsByClassName("content full")[0];
- }
- if (temp) {
- var submission_list = temp.children;
- for (var i = 0; i < submission_list.length; i++) {
- var tita = submission_list[i].getElementsByClassName("title may-blank")[0];
- var titm = submission_list[i].getElementsByClassName("title")[0];
- var expando = submission_list[i].getElementsByClassName("expando-button collapsed selftext")[0];
- // Default color is grey for grey list
- if (tita && titm) {
- // Safe links in green
- for (var j = 0; j < white_list.length; j++) {
- if (white_list[j].exec(tita.href.toString())) {
- tita.style.color = "#AAFFAA";
- }
- }
- //Unsafe links deactivated. URL is added for cut and paste
- for (j = 0; j < black_list.length; j++) {
- if (black_list[j].exec(tita.href.toString())) {
- tita.style.color = "#FF0000";
- //tita.style.textDecoration="line-through";
- tita.style.pointerEvents = "none"
- titm.innerHTML = titm.innerHTML + tita.href;
- }
- }
- for (j=0; j < replacements.length; j++) {
- if (replacements[j][0].exec(tita.href.toString())) {
- tita.href=tita.href.replace(replacements[j][0],replacements[j][1]);
- tita.style.color="#CCCCCC"
- if (expando) { // Disable embedding in case of replacement
- alert("disabling expando for:" + tita.innerText);
- expando.style.pointerEvents="none";
- expando.style.opacity="0";
- } //else alert("expando failed for:" + tita.innerText) #submissionid-3426556 > div.entry.unvoted > div.expando-button.selftext.collapsed
- }
- }
- }
- }
- }
- //disable expand lists to avoid going to youtube accidentally
- })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement