Tab Layout Organizer

Organize suas abas em layouts dentro de um painel lateral

K instalaci tototo skriptu si budete muset nainstalovat rozšíření jako Tampermonkey, Greasemonkey nebo Violentmonkey.

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

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Userscripts.

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

K instalaci tohoto skriptu si budete muset nainstalovat manažer uživatelských skriptů.

(Už mám manažer uživatelských skriptů, nechte mě ho nainstalovat!)

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.

(Už mám manažer uživatelských stylů, nechte mě ho nainstalovat!)

// ==UserScript==
// @name         Tab Layout Organizer
// @namespace    http://tampermonkey.net/
// @version      1.2
// @description  Organize suas abas em layouts dentro de um painel lateral
// @author       Emerson
// @licence MIT
// @match        *://*/*
// @grant        GM_setValue
// @grant        GM_getValue
// ==/UserScript==

(function() {
    'use strict';

    // Cria painel lateral
    const panel = document.createElement('div');
    panel.style.position = 'fixed';
    panel.style.top = '0';
    panel.style.right = '0';
    panel.style.width = '250px';
    panel.style.height = '100%';
    panel.style.background = '#f0f0f0';
    panel.style.borderLeft = '2px solid #ccc';
    panel.style.overflowY = 'auto';
    panel.style.zIndex = '9999';
    panel.style.padding = '10px';
    panel.innerHTML = `
        <h3>Meus Layouts</h3>
        <button id="saveTab">Salvar aba</button>
        <button id="clearTabs">Limpar</button>
        <select id="layoutMode">
            <option value="list">Lista</option>
            <option value="grid">Grade</option>
        </select>
        <div id="tabContainer"></div>
        <hr>
        <small id="doomSignature" style="
            display:block;
            text-align:center;
            margin-top:10px;
            font-weight:bold;
            color:#0ff;
            text-shadow: 
                0 0 5px #0ff,
                0 0 10px #0ff,
                0 0 20px #0ff,
                0 0 40px #0ff;
        ">
            criado por DOOM_
        </small>
    `;
    document.body.appendChild(panel);

    const tabContainer = document.getElementById('tabContainer');
    let tabs = GM_getValue('tabs', []);

    function renderTabs() {
        const mode = document.getElementById('layoutMode').value;
        tabContainer.innerHTML = '';
        tabContainer.style.display = mode === 'grid' ? 'grid' : 'block';
        tabContainer.style.gridTemplateColumns = mode === 'grid' ? '1fr 1fr' : 'none';

        tabs.forEach((tab) => {
            const link = document.createElement('a');
            link.href = tab.url;
            link.textContent = tab.title;
            link.target = '_blank';
            link.style.display = 'block';
            link.style.margin = '5px';
            link.style.padding = '5px';
            link.style.background = '#fff';
            link.style.border = '1px solid #ccc';
            tabContainer.appendChild(link);
        });
    }

    document.getElementById('saveTab').onclick = () => {
        tabs.push({ title: document.title, url: window.location.href });
        GM_setValue('tabs', tabs);
        renderTabs();
    };

    document.getElementById('clearTabs').onclick = () => {
        tabs = [];
        GM_setValue('tabs', tabs);
        renderTabs();
    };

    document.getElementById('layoutMode').onchange = renderTabs;

    renderTabs();
})();