pic.inmac links handler

Allow to get links for all uploaded links in one click

Du musst eine Erweiterung wie Tampermonkey, Greasemonkey oder Violentmonkey installieren, um dieses Skript zu installieren.

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

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

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

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

Sie müssten eine Skript Manager Erweiterung installieren damit sie dieses Skript installieren können

(Ich habe schon ein Skript Manager, Lass mich es installieren!)

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.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name         pic.inmac links handler
// @version      0.2.1
// @description  Allow to get links for all uploaded links in one click
// @author       DevMan, (StarCom - Russian Localise)
// @match        http*://pic.inmac.org/*
// @include      http*://pic.inmac.org/*
// @grant        none
// @namespace	 https://greasyfork.org/users/7303
// @require		 https://code.jquery.com/jquery-2.1.1.min.js
// ==/UserScript==

$('.nav').append('<li><a href="#" id="do-copy">Скопировать Все</a></li>');
$('#do-copy').click(function(){doCopy();});

function getLinks() {
	var links = $('input#show_url');
    var result = {
        direct: [],
        th: [],
        img: []
    }
    for( var i = 0, size = links.length; i < size; i+=3 ) {
        result.direct.push( $(links[i]).val() );
        result.th.push( $(links[i+1]).val() );
        result.img.push( $(links[i+2]).val() );
    }
    return result;
}

function doCopy() {
    var links = getLinks();
    if( links.direct.length == 0 ) {
        return;
    }
    
    $('#links').remove();
    $('.navbar').after('<div class="container" id="links" style="white-space: pre-line;"></div>');
    var el = $('#links');
    el.append('<h5>Основная ссылка:</h5>');
    for( var i in links.direct ) {
        el.append( links.direct[i] + '<br>' );
    }
    el.append('<h5>Уменьшенная ссылка :</h5>');
    for( var i in links.th ) {
        el.append( links.th[i] + ' ' );
    }
    el.append('<h5>Ссылка для форума:</h5>');
    for( var i in links.img ) {
        el.append( links.img[i] + ' ' );
    }
    $( window ).scrollTop( 0 );
}