Greasy Fork is available in English.

게시판 » 제작 요청

Disable tab title changing/flickering

§
작성: 2022-02-07

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.

§
작성: 2022-02-07
수정: 2022-02-07

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

§
작성: 2022-02-08

That just makes it blink faster.

§
작성: 2022-02-08

Share an example website.

hoothin관리자
§
작성: 2022-02-08
수정: 2022-02-08
// ==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() {}
  });
})();
§
작성: 2022-02-08
수정: 2022-02-08

@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?

hoothin관리자
§
작성: 2022-02-08

Try document-start then

§
작성: 2022-02-09

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

댓글 남기기

댓글을 남기려면 로그인하세요.