Direct Image Link E621/926 Silent

Рипалка ссылок в результатах поиска, для менеджеров закачки (тихий вариант)

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

You will need to install an extension such as Tampermonkey to install this script.

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

// ==UserScript==
// @name			Direct Image Link E621/926 Silent
// @version			2021.09.24.1
// @description:en	Images direct links ripper for pages with search results (silent version)
// @description		Рипалка ссылок в результатах поиска, для менеджеров закачки (тихий вариант)
// @include			http*://e621.net/posts*
// @include			http*://e926.net/posts*
// @author			Rainbow-Spike
// @namespace		https://greasyfork.org/users/7568
// @homepage		https://greasyfork.org/ru/users/7568-dr-yukon
// @icon			https://www.google.com/s2/favicons?domain=e621.net
// @grant			GM_setClipboard
// @run-at			document-end
// ==/UserScript==

var prevs = document . querySelectorAll ( '.post-preview' ),
	txt = document . createTextNode ( '' ),
	x, src, md5, link, name,
	lever = 0; // 1 - pic source, 0 - file name

if ( prevs != null ) {
	for ( x = 0; x < prevs . length; x++ ) {
		src = prevs [ x ] . getAttribute ( 'data-file-url' );
		md5 = src . split ( '/' );
		name = md5 [ md5 . length - 1 ];
		md5 = name . split ( '.' ) [ 0 ];

		txt . textContent += ( lever ? src : name ) + '\n'; /* select link */

		link = document . createElement ( 'a' ); /* thumb link */
		link . setAttribute ( 'href', src );
		link . innerHTML = md5;
		link . style = 'word-wrap: anywhere;';
		prevs [ x ] . appendChild ( link );

	}
	GM_setClipboard ( txt . textContent, "text" );
}