To make AutoPlay Next Duration longer
< Commentaires sur YouTube: Make AutoPlay Next More Than 3 seconds
This needs to be worked in page context.
If GM_setValue
, GM_getValue
, GM_registerMenuCommand
are applied, the script would not be in the page context. Thus it does not work.
This is why most of my scripts for youtube do not use any GM methods. There are several ways to do but for me I just want the 8s which is the traditional youtube setting.
I just updated the script. You can use localStorage.second_to_play_next
to set your favourite value.
I don't thing people need to edit the value everyday. Just set it once and finish.
(And seems no one use this script)
Open DevTools. Type in console
localStorage.second_to_play_next = 15
and press Enter
Yup, I know, its not a big thing, but 3 sec. sucks, and yeah its kinda one time thing, 10-12 sec. works for me, I was just wondering if there is some way we can use through tempermonkey script icon only, and change the variable. But maybe as you said, its not possible yet! :/
Anyways, thanks for the reply :D
One more thing, the updated code doesn't work for console (atleast in my Brave Browser it isn't working if I type this). It still picks the one which is written in code only.
Update the script again. I tested it. It should work.
You might need to refresh the page.
I was trying to implement "Change the timer through click below the Tempermonkey settings icon), but failed due to some reason (unable to understand), seems like when directive "// @unwrap" is present then we can't see the menu in tempermonkey.. If possible then please check the below code and try to implement it, so that it'll be easy for users to directly change timer through 1 click:
// @grant GM_setValue
// @grant GM_getValue
// @grant GM_registerMenuCommand
// Attempt to retrieve the stored value, or use the default if not found
second_to_play_next = GM_getValue('second_to_play_next');
// Register menu command
GM_registerMenuCommand("Set AutoPlay Delay", function() {
var newDelay = prompt("Enter new delay in seconds:", second_to_play_next);
if (newDelay !== null) {
newDelay = parseInt(newDelay, 10);
if (!isNaN(newDelay)) {
GM_setValue('second_to_play_next', newDelay);
setTimer(second_to_play_next); // Set the timer with the new delay
alert('AutoPlay delay set to ' + newDelay + ' seconds.');
} else {
alert('Invalid input! Please enter a number.');
}
}
});