Discussões » Solicitações de Criação

Disable tab title changing/flickering

§
Publicado em: 07/02/2022

Many websites have a title that changes.
Think social media that adds a (1) to the title when you get a message, or any website with ads that make the title blink to catch your attention.
That's insufferable.
I've tried using foxreplace to cancel any changes to the title (deleting any <<([_a-z][a-z0-9_\s]*\.\s*)*document\s*.\s*title\s*=>> within page source) but it works too 'late' wrt to the page loading.

Would that be doable through a user script?
Foxreplace's dev recommended I use one through greasemonkey using the run-at property to execute it at the earliest, but I don't know how to code in js.

§
Publicado em: 07/02/2022
Editado em: 07/02/2022

// ==UserScript==
// @name Tab Title Keeper
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Prevents the tab title from changing.
// @author hacker09
// @match *
// @grant none
// @run-at document-body
// ==/UserScript==

(function() {
'use strict';
const title = document.title;
setInterval(function () { document.title = title; }, 1000);
})();

§
Publicado em: 08/02/2022

That just makes it blink faster.

§
Publicado em: 08/02/2022

Share an example website.

hoothinMod
§
Publicado em: 08/02/2022
Editado em: 08/02/2022
// ==UserScript==
// @name Tab Title Keeper
// @namespace hoothin
// @version 0.1
// @description Prevents the tab title from changing.
// @author hoothin
// @match *
// @grant none
// @run-at document-body
// ==/UserScript==

(function() {
  'use strict';
  const title = document.title;
  Object.defineProperty(document, 'title', {
      get: function() {return title},
      set: function() {}
  });
})();
§
Publicado em: 08/02/2022
Editado em: 08/02/2022

@hacker09 Any social media/blogging site, literally every streaming service, most news website, and lots of others.


@hoothin I use greasemonkey and the <<@match *>> line was causing problems, so I used <<@include *>> instead.
That at least doesn't make the title change more, but it still changes.
Maybe this is executed too late ?(like some interval is already going on)
Or too early ?(like if the set property is redefined later)

Is there no way to just force every script to go through a regex replace before they get executed?

hoothinMod
§
Publicado em: 08/02/2022

Try document-start then

§
Publicado em: 09/02/2022

Yeah, I tried all the run-at options. Does it work for you?

Enviar resposta

Entre para publicar uma resposta.

长期地址
遇到问题?请前往 GitHub 提 Issues。