Skip to content

Instantly share code, notes, and snippets.

@sviani
sviani / instagramVideoControls.js
Last active April 29, 2026 18:27
Instagram Video Controls
// Instagram video controls
(function () {
const videos = document.getElementsByTagName('video');
for (let i = 0; i < videos.length; ++i) {
const video = videos[i];
video.setAttribute('controls', '');
}
const videoPlayerDivs = document.querySelectorAll('div[aria-label="Video player"]');
for (let i = 0; i < videoPlayerDivs.length; ++i) {
const videoPlayerDiv = videoPlayerDivs[i];
@sviani
sviani / blobDownload.js
Created May 18, 2018 20:52
Blob Download
blobDownload = function(url, fileName) {
var a = document.createElement('a');
a.style = 'display: none';
a.href = url;
a.download = fileName;
document.body.appendChild(a);
a.click();
};
// RAI Play example
@sviani
sviani / wikimedia-sticky-table-header.css
Created March 17, 2018 15:23
Wikimedia Sticky Table Header
table.wikitable thead>tr>th[role~=columnheader] {
position: sticky;
top: 0px;
}
@sviani
sviani / videoRangeLoop.js
Last active March 17, 2018 15:23
Video Range Loop
videoRangeLoop = function(video, fromTime, toTime, playbackRate) {
video.ontimeupdate = function() {
(video.currentTime >= toTime) && (video.currentTime = fromTime);
};
playbackRate && (video.playbackRate = playbackRate);
video.currentTime = fromTime;
video.play();
}
// Youtube example