GitHub Reader New

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

Mint 2023.04.18.. Lásd a legutóbbi verzió

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 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.3
// @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) {
        var link = `mailto:${recipient}?subject=${encodeURIComponent(subject)}&body=${encodeURIComponent(body)}`;
        window.location.href = link;
    }

    // Evento de clique no botão de salvar e enviar e-mails
    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.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);
})();