TrocaHTTPporHTTPS

[PT] Troca o protocolo 'http' por 'https' (seguro) para TODOS os sites (se este nao tiver uma versao segura, causa erro)

Dovrai installare un'estensione come Tampermonkey, Greasemonkey o Violentmonkey per installare questo script.

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

Dovrai installare un'estensione come Tampermonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Userscripts per installare questo script.

Dovrai installare un'estensione come ad esempio Tampermonkey per installare questo script.

Dovrai installare un gestore di script utente per installare questo script.

(Ho già un gestore di script utente, lasciamelo installare!)

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

(Ho già un gestore di stile utente, lasciamelo installare!)

// ==UserScript==
// @name           TrocaHTTPporHTTPS
// @namespace      http://userscripts.org/scripts/show/77703
// @author         RASG
// @description    [PT] Troca o protocolo 'http' por 'https' (seguro) para TODOS os sites (se este nao tiver uma versao segura, causa erro)
// @include        http://*
// @version        2012.01.01
// ==/UserScript==

(function() {
    var url = window.location.href;

    if (url.indexOf("http:")==0) {
        window.location.replace(location.href.replace(location.protocol, "https:"));
    }

    if (url.indexOf("https:")==0) {
        for (var i=0,link; (link=document.links[i]); i++) {
            if (link.href.indexOf("http:")==0) link.href = link.href.replace(location.protocol, "https:");
        }
    }

}
)();