Skip to content

Instantly share code, notes, and snippets.

View RafalJDev's full-sized avatar
💭
Love technology

RafalJDev

💭
Love technology
View GitHub Profile
@RafalJDev
RafalJDev / Asteroid_mining.txt
Last active August 28, 2024 09:56
My thoughts about space mining and how to finallly colonize space
// ==UserScript==
// @name Youtube script - without sleep
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match https://www.youtube.com/*
// @run-at document-end
// @grant none
// ==/UserScript==
@RafalJDev
RafalJDev / Youtube Watch Later Scroller.js
Last active June 24, 2019 20:21
Scroll to index video on youtube playlist page
function scrollTillIndexNumber (indexToScroll) {
window.scrollTo(0,document.querySelector("div.style-scope ytd-section-list-renderer").scrollHeight);
var lastElementIndex = document.getElementsByTagName("yt-formatted-string").length;
var currentLastIndex = (lastElementIndex - 8)/2;
if (currentLastIndex < indexToScroll) {
// ==UserScript==
// @name Youtube quality
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match https://www.youtube.com/*
// @run-at document-end
// @grant none
// ==/UserScript==
@RafalJDev
RafalJDev / Youtube Tampermonkey.js
Last active May 17, 2019 16:34
Expand titles and show playlist popup if video is on some playlist
// ==UserScript==
// @name Youtube script
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match https://www.youtube.com/*
// @run-at document-end
// @grant none
// ==/UserScript==
var elements = document.getElementsByClassName('lines-added');
var sumForAdded = 0;
for (var i=0; i<elements.length; i++) {
var innerText = elements[i].innerText;
// console.log("Sth2"+innerText)
var clearInnerText = innerText.replace('+', '').replace('-', '');
sumForAdded += +clearInnerText;
}
@RafalJDev
RafalJDev / YoutubeTitleExpander.js
Last active January 31, 2019 21:18
Expand title on youtube video titles (before: 2 lines, after running script in chrome console: 4 lines)
var elements = document.querySelectorAll('#video-title.yt-simple-endpoint.style-scope.ytd-grid-video-renderer');
elements.forEach(element => {
element.style.maxHeight = '7em';
element.style.webkitLineClamp = '7'
})
//thanks to @tylde
@RafalJDev
RafalJDev / CountYoutubeVideosTime.js
Last active April 7, 2025 16:36
Count all videos time duration on youtube channel
//You need to run this in javascript console inside chrome (althought should work the same in other browsers)
//Assumptions:
//1. Will count only "expanded" videos on page, you may first need to run script to scroll to last video or do it manually
//2. Tested on chrome, ubuntu, 2019
//3. Time format: hh:mm:ss
var array = document.getElementsByClassName("style-scope ytd-thumbnail-overlay-time-status-renderer");
var arrLength = array.length;