add a bunch of cool new stuff
This commit is contained in:
79
browser-snippets/a.src-grabber.js
Normal file
79
browser-snippets/a.src-grabber.js
Normal file
@@ -0,0 +1,79 @@
|
||||
const id = 'collectedAHref';
|
||||
let collectedImgSrc = JSON.parse(localStorage.getItem(id)) || [];
|
||||
|
||||
function collectInitialSrc(targetNode) {
|
||||
const elems = targetNode.querySelectorAll('a[href]');
|
||||
|
||||
elems.forEach(elem => {
|
||||
if (!collectedImgSrc.includes(elem.href)) {
|
||||
collectedImgSrc.push(elem.href);
|
||||
|
||||
localStorage.setItem(id, JSON.stringify(collectedImgSrc));
|
||||
console.log(`🙄 Snagged an initial a.href: ${elem.href}`);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
const observer = new MutationObserver((mutations) => {
|
||||
mutations.forEach((mutation) => {
|
||||
mutation.addedNodes.forEach((addedNode) => {
|
||||
if (addedNode.nodeType === Node.ELEMENT_NODE) {
|
||||
const elems = addedNode.querySelectorAll('a[href]');
|
||||
|
||||
elems.forEach((elem) => {
|
||||
if (!collectedImgSrc.includes(elem.href)) {
|
||||
collectedImgSrc.push(elem.href);
|
||||
|
||||
localStorage.setItem(id, JSON.stringify(collectedImgSrc));
|
||||
console.log(`🙄 Added a.href: ${elem.href}`);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
function waitForElement(selector, callback) {
|
||||
if (document.querySelector(selector) != null) {
|
||||
console.log("💠🌐 Target acquired. Commencing operation collect-a.srcs.");
|
||||
|
||||
callback(document.querySelector(selector));
|
||||
} else {
|
||||
setTimeout(() => waitForElement(selector, callback), 500);
|
||||
}
|
||||
}
|
||||
|
||||
collectInitialSrc(document.body);
|
||||
|
||||
const config = { childList: true, subtree: true };
|
||||
observer.observe(document.body, config);
|
||||
|
||||
|
||||
|
||||
function downloadData(data, fileName, type = 'text/plain') {
|
||||
const blob = new Blob([data], { type });
|
||||
const url = URL.createObjectURL(blob);
|
||||
|
||||
const link = document.createElement('a');
|
||||
link.href = url;
|
||||
link.download = fileName;
|
||||
link.click();
|
||||
|
||||
URL.revokeObjectURL(url);
|
||||
}
|
||||
|
||||
function stopObservingAHref() {
|
||||
observer.disconnect();
|
||||
console.log("💠🌐 I've ceased surveillance. Here's what I've collected in a.href:");
|
||||
|
||||
const data = JSON.parse(localStorage.getItem(id)).join('\n');
|
||||
|
||||
console.log(data);
|
||||
downloadData(data, 'a-hrefs.txt');
|
||||
}
|
||||
|
||||
function clearCollectedAHrefs() {
|
||||
localStorage.removeItem(id);
|
||||
collectedImgSrc = [];
|
||||
console.log("💠🌐 Local storage cleared. The slate is wiped clean.");
|
||||
}
|
||||
28
browser-snippets/auto-scroller.js
Normal file
28
browser-snippets/auto-scroller.js
Normal file
@@ -0,0 +1,28 @@
|
||||
const scrollSpeed = 3;
|
||||
const scrollDelay = 20;
|
||||
|
||||
let autoScrollInterval = null;
|
||||
|
||||
function startAutoScroll(){
|
||||
if(autoScrollInterval) return;
|
||||
|
||||
autoScrollInterval = setInterval(() => {
|
||||
window.scrollBy(0, scrollSpeed);
|
||||
|
||||
if ((window.innerHeight + window.scrollY) >= document.body.scrollHeight) {
|
||||
/** Uncomment if you want to enable auto-stop on page end */
|
||||
//stopAutoScroll();
|
||||
//console.log("🙄 Reached bottom of page.");
|
||||
}
|
||||
}, scrollDelay);
|
||||
|
||||
console.log("💠🌐 Auto‑scroll engaged.");
|
||||
}
|
||||
|
||||
function stopAutoScroll(){
|
||||
clearInterval(autoScrollInterval);
|
||||
autoScrollInterval = null;
|
||||
console.log("💠🌐 Auto‑scroll disengaged.");
|
||||
}
|
||||
|
||||
startAutoScroll();
|
||||
20
browser-snippets/grab-magnets.js
Normal file
20
browser-snippets/grab-magnets.js
Normal file
@@ -0,0 +1,20 @@
|
||||
let magnets = [...document.querySelectorAll('a')].map(a => a.href).filter(href => href.startsWith('magnet:')).join('\n');
|
||||
|
||||
if (magnets.length > 0) {
|
||||
let tempTextArea = document.createElement('textarea');
|
||||
tempTextArea.value = magnets;
|
||||
document.body.appendChild(tempTextArea);
|
||||
tempTextArea.select();
|
||||
|
||||
try {
|
||||
let successful = document.execCommand('copy');
|
||||
let msg = successful ? 'Successfully copied to clipboard!' : 'Failed to copy to clipboard!';
|
||||
console.log(msg);
|
||||
} catch (err) {
|
||||
console.error('Fallback: Oops, unable to copy', err);
|
||||
}
|
||||
|
||||
document.body.removeChild(tempTextArea);
|
||||
} else {
|
||||
console.log('No magnet links found on this page.');
|
||||
}
|
||||
76
browser-snippets/href-collector__reddit.js
Normal file
76
browser-snippets/href-collector__reddit.js
Normal file
@@ -0,0 +1,76 @@
|
||||
let collectedHrefs = JSON.parse(localStorage.getItem('collectedHrefs')) || [];
|
||||
|
||||
function collectInitialHrefs(targetNode) {
|
||||
const links = targetNode.querySelectorAll('a[href]');
|
||||
links.forEach(link => {
|
||||
if (!collectedHrefs.includes(link.href)) {
|
||||
collectedHrefs.push(link.href);
|
||||
|
||||
localStorage.setItem('collectedHrefs', JSON.stringify(collectedHrefs));
|
||||
console.log(`🙄 Snagged an initial href: ${link.href}`);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
const observer = new MutationObserver((mutations) => {
|
||||
mutations.forEach((mutation) => {
|
||||
mutation.addedNodes.forEach((addedNode) => {
|
||||
if (addedNode.nodeType === Node.ELEMENT_NODE) {
|
||||
const links = addedNode.querySelectorAll('a[href]');
|
||||
links.forEach((link) => {
|
||||
if (!collectedHrefs.includes(link.href)) {
|
||||
collectedHrefs.push(link.href);
|
||||
|
||||
localStorage.setItem('collectedHrefs', JSON.stringify(collectedHrefs));
|
||||
console.log(`🙄 Added href: ${link.href}`);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
function waitForElement(selector, callback) {
|
||||
if (document.querySelector(selector) != null) {
|
||||
console.log("💠🌐 Target acquired. Commencing operation collect-hrefs.");
|
||||
callback(document.querySelector(selector));
|
||||
} else {
|
||||
setTimeout(() => waitForElement(selector, callback), 500);
|
||||
}
|
||||
}
|
||||
|
||||
waitForElement(".main-container", (targetNode) => {
|
||||
collectInitialHrefs(targetNode);
|
||||
const config = { childList: true, subtree: true };
|
||||
observer.observe(targetNode, config);
|
||||
});
|
||||
|
||||
|
||||
|
||||
function downloadData(data, fileName, type = 'text/plain') {
|
||||
const blob = new Blob([data], { type });
|
||||
const url = URL.createObjectURL(blob);
|
||||
|
||||
const link = document.createElement('a');
|
||||
link.href = url;
|
||||
link.download = fileName;
|
||||
link.click();
|
||||
|
||||
URL.revokeObjectURL(url);
|
||||
}
|
||||
|
||||
function stopObserving() {
|
||||
observer.disconnect();
|
||||
console.log("💠🌐 I've ceased surveillance. Here's what I've collected:");
|
||||
|
||||
const data = JSON.parse(localStorage.getItem('collectedHrefs')).join('\n');
|
||||
|
||||
console.log(data);
|
||||
downloadData(data, 'hrefs__reddit.txt');
|
||||
}
|
||||
|
||||
function clearCollectedHrefs() {
|
||||
localStorage.removeItem('collectedHrefs');
|
||||
collectedHrefs = [];
|
||||
console.log("💠🌐 Local storage cleared. The slate is wiped clean.");
|
||||
}
|
||||
31
browser-snippets/img-auto-clicker.js
Normal file
31
browser-snippets/img-auto-clicker.js
Normal file
@@ -0,0 +1,31 @@
|
||||
const delay = 300; // ms between clicks
|
||||
const thumbs = Array.from(document.querySelectorAll("img"));
|
||||
let i = 0;
|
||||
|
||||
console.log("💠🌐 Found " + thumbs.length + " images. Initiating click rampage.");
|
||||
|
||||
const clicker = setInterval(() => {
|
||||
if (i >= thumbs.length) {
|
||||
clearInterval(clicker);
|
||||
console.log("🙄 Finished clicking everything.");
|
||||
return;
|
||||
}
|
||||
|
||||
const img = thumbs[i];
|
||||
|
||||
try {
|
||||
img.scrollIntoView({ block: "center" });
|
||||
|
||||
img.dispatchEvent(new MouseEvent("click", {
|
||||
bubbles: true,
|
||||
cancelable: true,
|
||||
view: window
|
||||
}));
|
||||
|
||||
console.log("💠🌐 Clicked #" + i + " -> " + (img.src || "no-src"));
|
||||
|
||||
} catch (e) {}
|
||||
|
||||
i++;
|
||||
|
||||
}, delay);
|
||||
79
browser-snippets/img.src-grabber.js
Normal file
79
browser-snippets/img.src-grabber.js
Normal file
@@ -0,0 +1,79 @@
|
||||
const id = 'collectedImgSrc';
|
||||
let collectedImgSrc = JSON.parse(localStorage.getItem(id)) || [];
|
||||
|
||||
function collectInitialSrc(targetNode) {
|
||||
const elems = targetNode.querySelectorAll('img[src]');
|
||||
|
||||
elems.forEach(elem => {
|
||||
if (!collectedImgSrc.includes(elem.src)) {
|
||||
collectedImgSrc.push(elem.src);
|
||||
|
||||
localStorage.setItem(id, JSON.stringify(collectedImgSrc));
|
||||
console.log(`🙄 Snagged an initial img.src: ${elem.src}`);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
const observer = new MutationObserver((mutations) => {
|
||||
mutations.forEach((mutation) => {
|
||||
mutation.addedNodes.forEach((addedNode) => {
|
||||
if (addedNode.nodeType === Node.ELEMENT_NODE) {
|
||||
const elems = addedNode.querySelectorAll('img[src]');
|
||||
|
||||
elems.forEach((elem) => {
|
||||
if (!collectedImgSrc.includes(elem.src)) {
|
||||
collectedImgSrc.push(elem.src);
|
||||
|
||||
localStorage.setItem(id, JSON.stringify(collectedImgSrc));
|
||||
console.log(`🙄 Added img.src: ${elem.src}`);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
function waitForElement(selector, callback) {
|
||||
if (document.querySelector(selector) != null) {
|
||||
console.log("💠🌐 Target acquired. Commencing operation collect-hrefs.");
|
||||
|
||||
callback(document.querySelector(selector));
|
||||
} else {
|
||||
setTimeout(() => waitForElement(selector, callback), 500);
|
||||
}
|
||||
}
|
||||
|
||||
collectInitialSrc(document.body);
|
||||
|
||||
const config = { childList: true, subtree: true };
|
||||
observer.observe(document.body, config);
|
||||
|
||||
|
||||
|
||||
function downloadData(data, fileName, type = 'text/plain') {
|
||||
const blob = new Blob([data], { type });
|
||||
const url = URL.createObjectURL(blob);
|
||||
|
||||
const link = document.createElement('a');
|
||||
link.href = url;
|
||||
link.download = fileName;
|
||||
link.click();
|
||||
|
||||
URL.revokeObjectURL(url);
|
||||
}
|
||||
|
||||
function stopObservingImgSrc() {
|
||||
observer.disconnect();
|
||||
console.log("💠🌐 I've ceased surveillance. Here's what I've collected in img.src:");
|
||||
|
||||
const data = JSON.parse(localStorage.getItem(id)).join('\n');
|
||||
|
||||
console.log(data);
|
||||
downloadData(data, 'img-srcs.txt');
|
||||
}
|
||||
|
||||
function clearCollectedImgSrcs() {
|
||||
localStorage.removeItem(id);
|
||||
collectedImgSrc = [];
|
||||
console.log("💠🌐 Local storage cleared. The slate is wiped clean.");
|
||||
}
|
||||
75
browser-snippets/img.src-grabber__yandex.js
Normal file
75
browser-snippets/img.src-grabber__yandex.js
Normal file
@@ -0,0 +1,75 @@
|
||||
let collectedImgURL = JSON.parse(localStorage.getItem('collectedImgURL')) || [];
|
||||
|
||||
function collectInitialHrefs(targetNode) {
|
||||
const links = targetNode.querySelectorAll('a[href*="img_url"]');
|
||||
|
||||
links.forEach(link => {
|
||||
if (!collectedImgURL.includes(link.href)) {
|
||||
collectedImgURL.push(link.href);
|
||||
|
||||
localStorage.setItem('collectedImgURL', JSON.stringify(collectedImgURL));
|
||||
console.log(`🙄 Snagged an initial img url: ${link.href}`);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
const observer = new MutationObserver((mutations) => {
|
||||
mutations.forEach((mutation) => {
|
||||
mutation.addedNodes.forEach((addedNode) => {
|
||||
if (addedNode.nodeType === Node.ELEMENT_NODE) {
|
||||
const links = addedNode.querySelectorAll('a[href*="img_url"]');
|
||||
links.forEach((link) => {
|
||||
if (!collectedImgURL.includes(link.href)) {
|
||||
collectedImgURL.push(link.href);
|
||||
|
||||
localStorage.setItem('collectedImgURL', JSON.stringify(collectedImgURL));
|
||||
console.log(`🙄 Added href: ${link.href}`);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
||||
function downloadData(data, fileName, type = 'text/plain') {
|
||||
const blob = new Blob([data], { type });
|
||||
const url = URL.createObjectURL(blob);
|
||||
|
||||
const link = document.createElement('a');
|
||||
link.href = url;
|
||||
link.download = fileName;
|
||||
link.click();
|
||||
|
||||
URL.revokeObjectURL(url);
|
||||
}
|
||||
|
||||
function waitForElement(selector, callback) {
|
||||
if (document.querySelector(selector) != null) {
|
||||
console.log("💠🌐 Target acquired. Commencing operation collect-hrefs.");
|
||||
callback(document.querySelector(selector));
|
||||
} else {
|
||||
setTimeout(() => waitForElement(selector, callback), 500);
|
||||
}
|
||||
}
|
||||
|
||||
collectInitialHrefs(document.body);
|
||||
const config = { childList: true, subtree: true };
|
||||
observer.observe(document.body, config);
|
||||
|
||||
function stopObserving() {
|
||||
observer.disconnect();
|
||||
console.log("💠🌐 I've ceased surveillance. Here's what I've collected:");
|
||||
|
||||
const data = JSON.parse(localStorage.getItem('collectedImgURL')).join('\n');
|
||||
|
||||
console.log(data);
|
||||
downloadData(data, 'images__yandex.txt');
|
||||
}
|
||||
|
||||
function clearCollectedImgURL() {
|
||||
localStorage.removeItem('collectedImgURL');
|
||||
collectedImgURL = [];
|
||||
console.log("💠🌐 Local storage cleared. The slate is wiped clean.");
|
||||
}
|
||||
79
browser-snippets/store-magnets.js
Normal file
79
browser-snippets/store-magnets.js
Normal file
@@ -0,0 +1,79 @@
|
||||
const MAGNET_STORAGE_KEY = 'nova_magnets';
|
||||
|
||||
function getStoredMagnets() {
|
||||
const raw = localStorage.getItem(MAGNET_STORAGE_KEY);
|
||||
|
||||
if (!raw) return [];
|
||||
|
||||
try {
|
||||
const parsed = JSON.parse(raw);
|
||||
return Array.isArray(parsed) ? parsed : [];
|
||||
} catch {
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
function setStoredMagnets(magnets) {
|
||||
const unique = Array.from(new Set(magnets));
|
||||
localStorage.setItem(MAGNET_STORAGE_KEY, JSON.stringify(unique));
|
||||
}
|
||||
|
||||
(function collectMagnets() {
|
||||
const pageMagnets = [...document.querySelectorAll('a')]
|
||||
.map(a => a.href)
|
||||
.filter(href => href && href.startsWith('magnet:'));
|
||||
|
||||
if (pageMagnets.length === 0) {
|
||||
console.log('No magnet links found on this page.');
|
||||
return;
|
||||
}
|
||||
|
||||
const stored = getStoredMagnets();
|
||||
const combined = stored.concat(pageMagnets);
|
||||
|
||||
setStoredMagnets(combined);
|
||||
|
||||
console.log(`Stored ${pageMagnets.length} new magnet(s). Total in storage: ${getStoredMagnets().length}`);
|
||||
})();
|
||||
|
||||
async function copyStoredMagnetsToClipboard() {
|
||||
const magnets = getStoredMagnets();
|
||||
if (magnets.length === 0) {
|
||||
console.log('No stored magnets to copy.');
|
||||
return;
|
||||
}
|
||||
|
||||
const text = magnets.join('\n');
|
||||
|
||||
if (navigator.clipboard && navigator.clipboard.writeText) {
|
||||
try {
|
||||
await navigator.clipboard.writeText(text);
|
||||
console.log('Successfully copied magnets to clipboard (navigator.clipboard).');
|
||||
return;
|
||||
} catch (err) {
|
||||
console.warn('navigator.clipboard failed, falling back to execCommand:', err);
|
||||
}
|
||||
}
|
||||
|
||||
const tempTextArea = document.createElement('textarea');
|
||||
tempTextArea.value = text;
|
||||
document.body.appendChild(tempTextArea);
|
||||
tempTextArea.select();
|
||||
|
||||
try {
|
||||
const successful = document.execCommand('copy');
|
||||
const msg = successful
|
||||
? 'Successfully copied magnets to clipboard (execCommand fallback).'
|
||||
: 'Failed to copy magnets to clipboard (execCommand fallback).';
|
||||
console.log(msg);
|
||||
} catch (err) {
|
||||
console.error('Fallback: unable to copy magnets', err);
|
||||
} finally {
|
||||
document.body.removeChild(tempTextArea);
|
||||
}
|
||||
}
|
||||
|
||||
function clearStoredMagnets() {
|
||||
localStorage.removeItem(MAGNET_STORAGE_KEY);
|
||||
console.log('Cleared stored magnets.');
|
||||
}
|
||||
Reference in New Issue
Block a user