Jump to content

User:999real

From Wikimedia Commons, the free media repository

JavaScript to help edit, you can paste in browser console or save as bookmark

[edit]

toggle scrolling down constantly in VisualFileChange view. It works as a toggle, it will scroll until you run/click the script again

[edit]
javascript:(function() {
    if (window.scrollInterval) {
        clearInterval(window.scrollInterval);
        window.scrollInterval = null;
        return;
    }
		const scrollButton = document.querySelector("body > div.ui-dialog.ui-widget.ui-widget-content.ui-corner-all.ui-draggable.ui-resizable.ui-dialog-buttons > div.md-nav-button-container > div:nth-child(2) > a");
		const moreButton = document.getElementById('mdQueryMoreBtn');
    window.scrollInterval = setInterval(function() {
        scrollButton.click();
        moreButton.click();
    }, 1000);
})();
[edit]
javascript:(function() {navigator.clipboard.writeText("https://www.tineye.com/search?url="+escape(document.getElementById("file").getElementsByTagName("img")[0].src))})();
[edit]
javascript:(function() {window.open("https://www.tineye.com/search?url="+escape(document.getElementById("file").getElementsByTagName("img")[0].src))})();
[edit]
javascript:(function() { navigator.clipboard.writeText(Array.from(document.getElementsByClassName('mw-file-description')).map(link => (link.getElementsByTagName("img")[0].src)).join('\n')) })();
[edit]
javascript:(function() {const imgs = document.getElementsByClassName('mw-file-description'); for(let i=0; i < imgs.length; i++) window.open("https://www.tineye.com/search?url="+escape(imgs[i].getElementsByTagName("img")[0].src))})();
[edit]
javascript:(function() {window.open("https://lens.google.com/uploadbyurl?url=" + encodeURIComponent(document.getElementById("file").getElementsByTagName("img")[0].src) + "&safe=off")})();
[edit]
javascript:(function() {navigator.clipboard.writeText("https://lens.google.com/uploadbyurl?url=" + encodeURIComponent(document.getElementById("file").getElementsByTagName("img")[0].src) + "&safe=off")})();

prompt to enter keyword and then select/deselect all images containing it in Cat a lot or VisualfileChange view

[edit]
javascript:(function() {
    const searchString = prompt("Enter keyword");
    const elements = document.getElementsByClassName('gallerytext');
    for (var i = 0; i < elements.length; i++) {
        const e = elements[i];
        if (e.textContent.includes(searchString)) {
            e.click();
            const checkBoxVFC = e.querySelector('input');
            if(checkBoxVFC) checkBoxVFC.checked ^= 1;
        }
    }
})();
[edit]
javascript:(function() { navigator.clipboard.writeText(Array.from(document.querySelectorAll('.TablePager_col_img_name a:nth-child(1)')).map(link => link.href).join('\n')) })();
[edit]
(function() {
	const toCopy = [];
	const titles = document.getElementsByClassName('jFileTitle');
	const dimensions = document.getElementsByClassName('jFileSize');
	
	const minimumWidth = 1000;
	const minimumHeight = 1000; 
	
	for (let i = 0; i < titles.length; i++) {
		const url = titles[i].href;
		if (url.endsWith('.mpg') || url.endsWith('.mpeg') || url.endsWith('.ogv') || url.endsWith('.webm')) {
			const ds = dimensions[i].textContent.replace(/^.*KiB/, '').replace('px', '');
			const width = ds.replace(/^.* x /, '');
			const height = ds.replace(/^ x .*/, '');
			if((minimumHeight > parseInt(height.replaceAll(' ', ''))) || (minimumWidth > parseInt(width.replaceAll(' ', '')))) toCopy.push(url);
		}
	}
	if (toCopy.length === 0) {
		alert('No videos with width below ' + minimumWidth + ' or height below ' + minimumHeight + ' found on this page');
	} else {
		navigator.clipboard.writeText(toCopy.join('\n')).then(() => {
			alert('Copied ' + toCopy.length + ' items');
		}).catch(err => {
			console.error('Failed to copy: ', err);
		});
	}
})();