Tab Title Editor

Edit tab name easily with text bar & enter button, no refresh required.

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         Tab Title Editor 
// @namespace    http://tampermonkey.net/
// @version      0.2
// @description  Edit tab name easily with text bar & enter button, no refresh required.
// @author       Emree.el on Instagram
// @match        *://*/*
// @grant        none
// @license      MIT
// ==/UserScript==

(function() {
    'use strict';

    // Create the container div
    var container = document.createElement('div');
    container.style.position = 'fixed';
    container.style.top = '10px';
    container.style.right = '10px';
    container.style.zIndex = '9999';
    container.style.backgroundColor = 'black';
    container.style.padding = '10px';
    container.style.border = '1px solid black';
    container.style.borderRadius = '5px';
    container.style.display = 'flex';
    container.style.alignItems = 'center';
    document.body.appendChild(container);

    // Create the checkbox
    var checkbox = document.createElement('input');
    checkbox.type = 'checkbox';
    checkbox.style.marginRight = '10px';
    container.appendChild(checkbox);

    // Create the text input
    var textInput = document.createElement('input');
    textInput.type = 'text';
    textInput.style.marginRight = '10px';
    textInput.style.display = 'none';
    textInput.style.backgroundColor = 'black';
    textInput.style.color = 'white';
    textInput.style.border = '1px solid white';
    container.appendChild(textInput);

    // Create the button
    var button = document.createElement('button');
    button.textContent = 'Enter';
    button.style.display = 'none';
    button.style.backgroundColor = 'black';
    button.style.color = 'white';
    button.style.border = '1px solid black';
    container.appendChild(button);

    // Show/hide text input and button when checkbox is toggled
    checkbox.addEventListener('change', function() {
        if (checkbox.checked) {
            textInput.style.display = 'inline';
            button.style.display = 'inline';
        } else {
            textInput.style.display = 'none';
            button.style.display = 'none';
        }
    });

    // Change tab title when button is clicked
    button.addEventListener('click', function() {
        if (textInput.value.trim() !== '') {
            document.title = textInput.value;
        }
    });
})();