KodeItDEV / JiffProxy

// ==UserScript==
// @name         JiffProxy
// @namespace    https://openuserjs.org/scripts/KodeItDEV/JiffProxy
// @version      0.2
// @description  Web proxy using Google Translate
// @author       KodeItDEV
// @copyright    2017, KodeItDEV (https://openuserjs.org/users/KodeItDEV)
// @icon         https://www.graphicsprings.com/filestorage/stencils/020f9e41b7a57c69fbbd8d2c74731c1b.svg
// @updateURL    https://openuserjs.org/meta/KodeItDEV/JiffProxy.meta.js
// @licence      MIT
// @include      *
// @exclude      *.googleusercontent.com/*
// @exclude      notifications.*
// @require      https://raw.githubusercontent.com/eight04/GM_config/master/dist/GM_config.js
// @grant        GM_addStyle
// @grant        GM_getValue
// @grant        GM_setValue
// @grant        GM_registerMenuCommand
// @run-at       document-idle
// ==/UserScript==

GM_registerMenuCommand('[Proxy]', settings);

GM_config.init('Proxy Settings', {
    sites: {
        label: "Please type in the site you want to use JiffProxy on:",
        type: "text",
        default: "www.google.com"
    }
});

function get() {
    var url = window.location.host + window.location.pathname;
    var proxurl = 'https://translate.google.com/translate?sl=es&tl=en&js=y&prev=_t&hl=en&ie=UTF-8&u=https%3A%2F%2F' + url + '&sandbox=1';
    if (window.location.host === 'translate.google.com') {
        window.onload = (function () {
            var x = document.getElementsByTagName("iframe")[0];
            x.setAttribute("id", "framecontent");
            proxurl = document.getElementById("framecontent").src;
            window.location.replace(proxurl);
        })();
    } else {
        window.location.replace(proxurl);
    }
}

if (window.location.host === 'translate.google.com') {
    get();
}

GM_config.onclose = (function (saveFlag) {
    if (saveFlag) {
        get();
    }
});

function settings() {
    GM_config.open();
}