Active Tab Arrow Display

Display an arrow on the title of the currently active tab

Version au 04/04/2018. Voir la dernière version.

// ==UserScript==
// @name         Active Tab Arrow Display
// @namespace    ActiveTabArrowDisplay
// @description  Display an arrow on the title of the currently active tab
// @version      1.0
// @author       Kai Krause <[email protected]>
// @include      *
// @run-at       document-end
// ==/UserScript==

var title = document.title;
var modifier = "➜ ";

function flashTitle() {
	setTimeout(() => {
		if (document.hasFocus() || !document.hidden) {
			document.title = modifier + title;
		} else if (!document.hasFocus() && document.hidden) {
			document.title = title;
		}
	}, 500);
}

flashTitle(title);

window.addEventListener("focus", flashTitle, true);
window.addEventListener("blur", flashTitle, true);