Visited Lite

Mark all visited links as custom color.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey, το Greasemonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

You will need to install an extension such as Tampermonkey to install this script.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Userscripts για να εγκαταστήσετε αυτόν τον κώδικα.

You will need to install an extension such as Tampermonkey to install this script.

Θα χρειαστεί να εγκαταστήσετε μια επέκταση διαχείρισης κώδικα χρήστη για να εγκαταστήσετε αυτόν τον κώδικα.

(Έχω ήδη έναν διαχειριστή κώδικα χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Έχω ήδη έναν διαχειριστή στυλ χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

// ==UserScript==
// @name        Visited Lite
// @namespace   iFantz7E.VisitedLite
// @description Mark all visited links as custom color.
// @version     0.23
// @include     http*
// @icon        https://addons.cdn.mozilla.net/user-media/addon_icons/359/359581-64.png
// @run-at      document-start
// @grant       none
// @copyright	2015, 7-elephant
// ==/UserScript==

(function ()
{

//// Config

// View your old config from Visited 
// about:config?filter=extensions.visited

// Copy from extensions.visited.color.visited
var p_color_visited = "LightCoral";

// Copy from extensions.visited.except
var p_except = "mail.live.com,";

//// End Config

//// Variable

const style_id = "visited-lite-7e-style";
const css_a_visited = " a:visited, a:visited * { color: %COLOR% !important; } ";

var colorArr = ["Aqua","Blue","BlueViolet","Brown","CadetBlue","Chocolate","Coral"
    ,"CornflowerBlue","Crimson","DarkGoldenRod","DarkGreen","DarkKhaki","DarkMagenta"
    ,"Darkorange","DarkOrchid","DarkRed","DarkSalmon","DarkSeaGreen","DarkTurquoise"
    ,"DarkViolet","DeepPink","DeepSkyBlue","DodgerBlue","FireBrick","ForestGreen"
    ,"Fuchsia","Gold","GoldenRod","Green","GreenYellow","HotPink","IndianRed"
    ,"Indigo","Khaki","Lavender","LawnGreen","LightCoral","LightSalmon","LightSeaGreen"
    ,"LightSteelBlue","Lime","LimeGreen","Magenta","Maroon"
	,"MediumAquaMarine","MediumOrchid","MediumSlateBlue","MediumTurquoise","NavajoWhite","Navy"
	,"Orange","OrangeRed","Orchid","PaleVioletRed","Peru","Purple","Red","RosyBrown"
	,"RoyalBlue","SaddleBrown","Salmon","SandyBrown","SeaGreen","Sienna","SlateBlue"
	,"SpringGreen","SteelBlue","Tomato","Turquoise","Violet","YellowGreen"];
	
//// End Variable

//// Function

function attachOnLoad(callback)
{
	window.addEventListener("load", function (e) 
	{
		callback();
	});
}

function attachOnReady(callback) 
{
	document.addEventListener("DOMContentLoaded", function (e) 
	{
		callback();
	});
}

function isExceptSite(except, site)
{
    var exceptList = except.split(",");
    for (var i = 0; i < exceptList.length; i++)
    {
        var str = exceptList[i].replace(/\s/ig,"");
        
        var str1 = str;
        if (str1.indexOf(".") != 0 && str1.indexOf("/") != 0)
            str1 = "." + str1;
        
        var str2 = str;
        if (str2.indexOf("://") != 0)
            str2 = "://" + str2;
        
        if(str != "" 
            && (site.indexOf(str1) > -1 || site.indexOf(str2) > -1))
        {
            return true;
        }
    }
    return false;
}

function addStyle(css)
{
    var style = document.getElementById(style_id);
    if(style == null)
    {
        var heads = document.getElementsByTagName("head");
        
        if(heads != null && heads.length > 0)
        {
            var head = heads[0];
            var style = document.createElement("style");
            if(style != null)
            {
                style.setAttribute("id",style_id);
                style.setAttribute("type","text/css");
                head.appendChild(style);
            }
        }
    }

    if(style != null)
    {
        style.textContent = String(css);
    }
}

function assignColor(css, color)
{
    return css.replace(/%COLOR%/ig, color);
}

function main()
{
	var url = document.documentURI;
	var css = "";
	
	css += assignColor(css_a_visited, p_color_visited);
	
	if(!isExceptSite(p_except, url))
	{
		addStyle(css);
	}
}

//// End Function

attachOnReady(main);

})();

// End