GitHub Reader New

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

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

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

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

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.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

// ==UserScript==
// @name        GitHub Reader New
// @namespace   Violentmonkey Scripts
// @match       https://*.github.com/*
// @grant       none
// @version     1.7
// @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')) {
        const style = document.createElement('style');
        style.id = 'github-reader-enhancer-style';
        document.head.appendChild(style);
    }

    // Define variáveis para valores repetidos
    const maxWidth = '100%';
    const containerMaxWidth = '90%';

    // Aplica o CSS personalizado
    document.querySelector('#github-reader-enhancer-style').textContent = `
        .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 validar endereços de e-mail
    function validateEmail(email) {
        const re = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
        return re.test(String(email).toLowerCase());
    }

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

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

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

        if (confirm('Tem certeza de que deseja enviar o e-mail?')) {
            window.location.href = link;
        }
    }

    // Cria o botão de "Salvar e Enviar E-mail"
    const 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() {
        const subject = 'Texto salvo do GitHub Reader New';
        const body = document.body.innerText;
        const recipient = '[email protected]';
        sendEmail(subject, body, recipient);
    });

    document.body.appendChild(saveAndSendBtn);
})();