GitHub Reader New

Ajusta automaticamente a largura do GitHub para melhorar a visualização.

נכון ליום 13-04-2024. ראה הגרסה האחרונה.

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

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

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

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

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

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

(I already have a user script manager, let me install it!)

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.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name        GitHub Reader New
// @namespace   Violentmonkey Scripts
// @match       https://*.github.com/*
// @grant       none
// @version     1.4
// @author      EmersonxD
// @description Ajusta automaticamente a largura do GitHub para melhorar a visualização.
// @license     MIT
// ==/UserScript==

(function() {

    'use strict';


    // Verifica se o estilo já existe antes de criar um novo

    if (!document.querySelector('#github-reader-enhancer-style')) {

        var style = document.createElement('style');

        style.id = 'github-reader-enhancer-style';

        document.head.appendChild(style);

    }


    // Define variáveis para valores repetidos

    var maxWidth = '100%';

    var containerMaxWidth = '90%';


    // Aplica o CSS personalizado

    document.querySelector('#github-reader-enhancer-style').innerHTML = `

        .timeline-new-comment,

        .markdown-body {

            max-width: ${maxWidth};

        }

        .markdown-body {

            font-size: 1.4em;

        }

        .discussion-timeline,

        .container-lg,

        .container-xl {

            max-width: ${containerMaxWidth};

        }

    `;


    // Função para enviar e-mails

    function sendEmail(subject, body, recipient) {

        // Verifica se o destinatário é um endereço de e-mail válido

        if (!validateEmail(recipient)) {

            alert('O destinatário deve ser um endereço de e-mail válido.');

            return;

        }


        // Verifica se o corpo do e-mail não está vazio

        if (body.trim() === '') {

            alert('O corpo do e-mail não pode estar vazio.');

            return;

        }


        // Cria um link de e-mail com o assunto, corpo e destinatário especificados

        var link = `mailto:${recipient}?subject=${encodeURIComponent(subject)}&body=${encodeURIComponent(body)}`;


        // Exibe uma mensagem de confirmação antes de enviar o e-mail

        if (confirm('Tem certeza de que deseja enviar o e-mail?')) {

            window.location.href = link;

        }

    }


    // Função para validar endereços de e-mail

    function validateEmail(email) {

        var re = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;

        return re.test(String(email).toLowerCase());

    }


    // Cria o botão de "Salvar e Enviar E-mail"

    var saveAndSendBtn = document.createElement('button');

    saveAndSendBtn.textContent = 'Salvar e Enviar E-mail';

    saveAndSendBtn.style.position = 'fixed';

    saveAndSendBtn.style.bottom = '20px';

    saveAndSendBtn.style.right = '20px';

    saveAndSendBtn.style.zIndex = '9999';

    saveAndSendBtn.style.backgroundColor = '#4CAF50';

    saveAndSendBtn.style.color = '#fff';

    saveAndSendBtn.style.padding = '10px 20px';

    saveAndSendBtn.style.borderRadius = '5px';

    saveAndSendBtn.style.border = 'none';

    saveAndSendBtn.addEventListener('click', function() {

        var subject = 'Texto salvo do GitHub Reader New';

        var body = document.body.innerText;

        var recipient = '[email protected]';

        sendEmail(subject, body, recipient);

    });

    document.body.appendChild(saveAndSendBtn);

})();
// Função para enviar e-mails
function sendEmail(subject, body, recipient) {
    // Verifica se o destinatário é um endereço de e-mail válido
    if (!validateEmail(recipient)) {
        alert('O destinatário deve ser um endereço de e-mail válido.');
        return;
    }

    // Verifica se o corpo do e-mail não está vazio
    if (body.trim() === '') {
        alert('O corpo do e-mail não pode estar vazio.');
        return;
    }

    // Cria um link de e-mail com o assunto, corpo e destinatário especificados
    var link = `mailto:${recipient}?subject=${encodeURIComponent(subject)}&body=${encodeURIComponent(body)}`;

    // Exibe uma mensagem de confirmação antes de enviar o e-mail
    if (confirm('Tem certeza de que deseja enviar o e-mail?')) {
        window.location.href = link;
    }
}

// Função para validar endereços de e-mail
function validateEmail(email) {
    var re = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
    return re.test(String(email).toLowerCase());
}