Tampermonkey / tampermonkey

Tampermonkey is the most popular userscript manager, with over 10 million users. It's available for Chrome, Microsoft Edge, Safari, Opera Next, and Firefox.
GNU General Public License v3.0
4.17k stars 416 forks source link

GM_notification timeout problem #704

Closed FabianoLothor closed 4 years ago

FabianoLothor commented 5 years ago

Using Chrome:

Timeout 30000 hidding with approximately 7 seconds.

Code:

           GM_notification ({
                text: 'Test notification body.',
                title: 'Test notice title',
                //highlight: true,
                timeout: 30000,
                onclick: function () {
                    console.log("Notice clicked.");
                    window.focus();
                }
            });
derjanb commented 5 years ago

What is your OS version?

FabianoLothor commented 5 years ago

Version 74.0.3729.131 (Official Build) (64-bit)

derjanb commented 5 years ago

What is your Windows, MacOS or Linux version?

FabianoLothor commented 5 years ago

windows

image

FabianoLothor commented 5 years ago

Just for test:

// ==UserScript==
// @name         foo
// @namespace    http://fabianolothor.com.br/
// @version      1.0.0
// @description  Global
// @author       Fabiano (Lothor)
// @match        *://*/*
// @grant        GM_notification
// @grant        GM_getValue
// @grant        GM_setValue
// @grant        GM_deleteValue
// ==/UserScript==
(function() {
    GM_notification({text: "this is a test", timeout: 30000});
})();
FabianoLothor commented 5 years ago

Is it some setting on my Chrome or TamperMonkey?

FabianoLothor commented 5 years ago

I make a test in a linux machine and the problem is the same.

FabianoLothor commented 5 years ago

I see the problem!

Timeout works fine if my mouse is it hover the notification.

If the mouse is not focusing the notification, its just hide after approximately 7 ~ 10 seconds.

FabianoLothor commented 5 years ago

You can add this parameter: https://web-push-book.gauntface.com/chapter-05/03-notification-behaviour/#requires-interaction

The timeoutis working fine, and when it is less the 7000 or 10000 miliseconds the problem is not perceptible.

So, with the requires-interaction until the timeout ended the notification will appear on the screen.

FabianoLothor commented 5 years ago

I solve my problem for now: https://pushjs.org/

// @require https://pushjs.org/scripts/push.min.js

derjanb commented 5 years ago

Fixed at TM BETA 4.9.5960. "requireInteraction" is now set where ever possible.