auto clicks reddit links to move past the comments page
当前为
// ==UserScript==
// @name reddit-auto-click
// @description auto clicks reddit links to move past the comments page
// @namespace ziffusion.com
// @include http*://*.reddit.com/r/*/comments/*
// @version 8.4
// ==/UserScript==
var content = document.querySelector('[data-test-id="post-content"]');
var paths = [
// link below title
"div[2]/div[1]/div[3]/a[1]",
"div[4]/div[1]/div[3]/a[1]",
"div[4]/a[1]",
// link on right
"div[2]/div[2]/div[1]/a[1]",
"div[4]/div[2]/div[1]/a[1]",
// image
"div[4]/div[1]/a[1]",
/*
"div[4]/div[2]/span[1]/a[2]",
"div[4]/div[2]/div[1]/a[2]",
*/
];
var link;
for (var ii = 0; ii < paths.length && content && !link; ++ii) {
link = document.evaluate(paths[ii], content, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;
}
if (link && link.href && link.href != document.URL) {
window.open(link.href);
}