various bookmarklets

by Laurens Maneschijn

HTML

Drag any bookmarklet link to bookmark bar.

<hr>

<a href="javascript:(function(){ let title = document.querySelector('head title'); let str = title ? title.innerText : ''; str = prompt(`Set new window title:\n\nCurrent:\n${str}`, str); if(str === null) { return; } if (!title) { title = document.createElement('title'); (document.head || document.body).appendChild(title); } title.innerText = str; })(); ">&#127363; get/set title</a>
<br>

<hr>

<h2>YouTube playbackRate variations:</h2>

<a href="javascript:(function(){ document.getElementsByTagName('video')[0].playbackRate = 1; })(); // YouTube 1x">&#9654;&#65039; YouTube 1x</a>
<small>(reset playback rate 1x)</small>
<br>

<a href="javascript:(function(){ document.getElementsByTagName('video')[0].playbackRate = 10; document.querySelector('.ytp-skip-ad-button')?.click(); })(); // YouTube 10x and skip ad">&#9193; YouTube 10x and skip ad</a>
<small>(set playback rate 10x, and click skip ad button if possible. click twice or a few times.)</small>
<br>

<a href="javascript:(function(){ const video = document.getElementsByTagName('video')[0]; if (!video){return;} let rate = video.playbackRate || 1; rate = prompt(`Set the new playback rate (current: ${rate})`, rate); if (rate === null){return;} if (rate === ''){rate = 1;} rate = parseFloat(rate); if (isNaN(rate)){return;} video.playbackRate = rate; })(); ">&#9199;&#65039; YouTube get/set playbackrate</a>
<small>(get or set custom playback rate)</small>
<br>

<a href="javascript:(function(){ document.getElementsByTagName('video')[0].playbackRate = 0.25; })();">&#188; x</a>
<a href="javascript:(function(){ document.getElementsByTagName('video')[0].playbackRate = 0.5; })();">&#189; x</a>
<a href="javascript:(function(){ document.getElementsByTagName('video')[0].playbackRate = 1.0; })();">1x</a>
<a href="javascript:(function(){ document.getElementsByTagName('video')[0].playbackRate = 1.5; })();">1.5x</a>
<a href="javascript:(function(){...

CSS

h1, h2, h3, h4, h5, h6 {
	font-size: 100%;
	margin-top: 0;
	margin-bottom: 0;
}

JavaScript

/*
javascript:
(function(){
	let title = document.querySelector('head title');
	let str = title ? title.innerText : '';
	str = prompt(`Set new window title:\n\nCurrent:\n${str}`, str);
	if(str === null) { return; }
	if (!title) {
		title = document.createElement('title');
		(document.head || document.body).appendChild(title);
	}
	title.innerText = str;
})(); // get/set window title
*/


// YouTube quick skip ad, just play at 10x speed:
/*
javascript:
(function(){
	document.getElementsByTagName('video')[0].playbackRate = 10;
})(); // $ YouTube quickskip
*/


// YouTube get/set custom playback rate:
/*
javascript:
(function(){
	const video = document.getElementsByTagName('video')[0];
	if (!video){return;}
	let rate = video.playbackRate || 1;
	rate = prompt(`Set the new playback rate (current: ${rate})`, rate);
	if (rate === null){return;}
	if (rate === ''){rate = 1;}
	rate = parseFloat(rate);
	if (isNaN(rate)){return;}
	video.playbackRate = rate;
})(); // YouTube get/set playbackRate
*/