Tab Title Editor

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

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey, Greasemonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

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

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्क्रिप्ट व्यवस्थापक एक्स्टेंशन इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्क्रिप्ट व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्टाईल व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

// ==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;
        }
    });
})();