I have some digital content I have purchased, and to back it up I’d like to use the Archive.web browser extension.
The content has articles that popup on a hover over certain elements, currently Autopilot does not pick them up itself (unless it’s scroll gets lucky).
I have managed to put together some shoddy javascript I can punch into chrome’s console, It iterates through unique hover elements to trigger the mouseover event.
Is this something that could be built into AutoPilot ?
//sleep routine to allow download of objects
const sleep = (delay) => new Promise((resolve) => setTimeout(resolve, delay))
//create mouseover event to trigger hover element
async function RunMouseOver(ToolTip) {
ToolTip.dispatchEvent(new MouseEvent('mouseover'))
}
//create mouseleave event to clear hover element
async function RunMouseleave(ToolTip) {
ToolTip.dispatchEvent(new MouseEvent('mouseout'))
}
//Identify all nodes with a tooltip hover class
//const classList = [ ".tooltip", ".hover", ".tooltip-hover" ]
const classList = [ ".tooltip-hover" ]
const nodeList = document.querySelectorAll(classList)
//create a sorted and unique list of nodes
nodeListSorted = [...new Set(nodeList)].sort()
uniqueAndSorted = new Array()
uniqueAndSorted.push( nodeListSorted[0] )
//iterate all nodes and select unique links
for ( let i = 1; i < nodeListSorted.length ; i++ ) {
if ( uniqueAndSorted.findIndex( node => node.href === nodeListSorted[i].href ) < 0 )
{
uniqueAndSorted.push( nodeListSorted[i] )
}
}
//load each tooltip with a delay to allow the objects to download
( async function () {
i = 0 ;
for await ( Node of uniqueAndSorted ) {
RunMouseOver(Node);
//console.log(i) ; i++
await sleep( 4000 );
RunMouseleave(Node);
}
})();