Editable Title

Makes document title element editable

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        Editable Title
// @namespace   myfonj
// @include     *
// @grant       none
// @version     1.0.2
// @run-at      document-start
// @description Makes document title element editable
// @license     CC0
// ==/UserScript==
/*
 https://greasyfork.org/en/scripts/454707/versions/new
 1.0.1 (2022-11-14) workaround for Firefox https://bugzilla.mozilla.org/show_bug.cgi?id=1291467
*/

const conf = {capture: true};
const dd = document.documentElement;

function editablizeTitleWhenClickizored ( event ) {
  const tgt = event.target;
  if( tgt?.constructor?.name !== 'HTMLTitleElement' ) {
    return;
  }
  // workaround for bug 1291467
  document.body.appendChild(tgt);
  tgt.addEventListener('blur',function(){document.head.appendChild(tgt)},{once:true})
  tgt.setAttribute('contenteditable', '');
  // tgt.focus();
  // dd.removeEventListener('click', editablizeTitleWhenClickizored, conf);
}

dd.addEventListener('mousedown', editablizeTitleWhenClickizored, conf);