Skip to content

Instantly share code, notes, and snippets.

View acropup's full-sized avatar

Shane Burgess acropup

View GitHub Profile
@acropup
acropup / youtube new homepage.css
Last active December 31, 2020 20:14
Show 4 lines of title text for videos on youtube homepage. See the following repo where this and other YouTube UI improvements is made into a UserStyle CSS script: https://github.com/acropup/acropup-UserStyle-CSS-Scripts#YouTube-UI-Refinements
/* Set height of video's text info */
div#details {
height: 11rem;
}
ytd-rich-item-renderer.ytd-rich-grid-renderer {
margin-bottom: 24px;
}
/* Move ellipsis menu to bottom left corner */
@acropup
acropup / atic.ca product filter.js
Last active May 3, 2020 00:51
ATIC.ca website custom filtering of products in category view
/* Category view on ATIC.ca doesn't have any means of filtering items.
This script can be run in the browser console and filters based on a product's link text.
Used on the Power Supply category: http://www.atic.ca/index.php?page=Products&cat=119
Excellent site for PSU efficiency and noise level testing:
https://www.cybenetics.com/index.php?option=database&params=1,2,0
*/
document.querySelectorAll("table table table tr td:nth-child(3) a").forEach((item) => {
let remove = false;
@acropup
acropup / google messages chat backup.js
Last active September 23, 2020 06:32
Google Messages for Web (https://messages.google.com/web) script to save an entire conversation history in simple text form. MMS messages such as images are not saved.
// Chat conversation backup for https://messages.google.com/web
// To use, start by choosing a conversation, and scroll to the top until all previous chats have been loaded.
// Then copy and paste this script into the Chrome Developer Console (Ctrl+Shift+J), hit Enter, and copy the
// value of 'result' and paste it wherever you would like to save the chat history.
var result = Array.from(document.querySelectorAll("mws-relative-timestamp, mws-text-message-part")).map((item) => {
switch (item.nodeName) {
case "MWS-TEXT-MESSAGE-PART":
// Extract the sender's name from aria-label, which starts as '[Person] said:'
var aria = item.getAttribute("aria-label");
@acropup
acropup / youtube caption extractor.js
Last active December 31, 2020 22:15
Capture the caption text of a youtube video as the video plays. The entire transcript can also be obtained through a single HTTP request, so read the notes at the bottom for details.
// Capture caption text into the allCaptions array as the video plays. See bottom of script for notes.
let oldCaptionText = "";
let allCaptions = [];
let videoPlayer = document.querySelector(".html5-video-player");
let config = { childList: true };
let captureCaption = function(mutationsList, observer) {
let captionNode = videoPlayer.querySelector(".caption-window");
let newCaptionText = captionNode?.textContent?.trim() || "";
if (newCaptionText != oldCaptionText) {
@acropup
acropup / show href on hover.css
Created February 23, 2021 07:48
CSS to show link URLs in the window corner immediately on hover
/* This shows URLs in the bottom left corner of the window immediately on hover, similar to
how most web browsers do it, but faster.
In Google Chrome, hovering over a link will show the target URL at the bottom of the window.
But Chrome takes its sweet time with this, especially if the URL is long, where it starts by
showing a subset of the URL, with a '...' replacing the part of the URL that was hidden.
Some people (myself included) would much prefer if Chrome showed the complete URL immediately:
https://superuser.com/questions/778533/getting-url-in-status-bar-immediately-on-hovering-over-a-link
@acropup
acropup / webcam_manual_focus.js
Created July 7, 2022 21:50
webcam manual focus
// This uses the html5 MediaStream Image Capture API to manually control focus of the
// active webcam or phone camera.
// https://w3c.github.io/mediacapture-main/#dom-mediastreamtrack
// https://w3c.github.io/mediacapture-image/#mediatracksupportedconstraints-section
let videoElem = document.querySelector('video');
let track = videoElem.srcObject.getVideoTracks()[0];
let cap = track.getCapabilities();
console.info('focusMode: ', cap.focusMode);