Eres un flojo? esto es perfecto para ti
Versión del día
// ==UserScript==
// @name ttu logs for Iniesta
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Eres un flojo? esto es perfecto para ti
// @author You
// @match https://reader.ttsu.app/b?id=*
// @icon https://www.google.com/s2/favicons?sz=64&domain=ttsu.app
// @grant none
// @license GPL-3.0-or-later
// ==/UserScript==
function copyLog(textLog) {
navigator.clipboard.writeText(textLog);
};
function runScript() {
const flexChild = this.querySelector(".flex-1");
const regex = /\|.*/gm;
const subst = ``;
if (flexChild) {
let divChildren = flexChild.childNodes;
for (var i=0; i<divChildren.length; i++) {
//console.log(divChildren[i]);
let logText = `.log lectura ${divChildren[i+1].childNodes[2].innerText - divChildren[i].childNodes[2].innerText} ${document.title.replace(regex, subst)} ${divChildren[i].childNodes[0].innerText}`;
divChildren[i].addEventListener("click", function(){
copyLog(logText);
}, false);
}
} else {
console.log("No child with class 'flex-1'");
// Your additional code here
}
};
// Get a reference to the container element
const container = document.querySelector('.writing-horizontal-tb');
// Add an event listener to run the script when the container is visible
// You might want to use a specific event, like 'scroll', 'click', or 'visibilitychange'
container.addEventListener('click', runScript);