imgur output formatter

Adds fully formatted output containers

Από την 16/09/2015. Δείτε την τελευταία έκδοση.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey, το Greasemonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Userscripts για να εγκαταστήσετε αυτόν τον κώδικα.

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

Θα χρειαστεί να εγκαταστήσετε μια επέκταση διαχείρισης κώδικα χρήστη για να εγκαταστήσετε αυτόν τον κώδικα.

(Έχω ήδη έναν διαχειριστή κώδικα χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

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.

(Έχω ήδη έναν διαχειριστή στυλ χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

// ==UserScript==
// @name           imgur output formatter
// @namespace      surrealmoviez.info
// @description    Adds fully formatted output containers
// @include        http://imgur.com/*
// @include        http://www.imgur.com/*
// @include        https://imgur.com/*
// @include        https://www.imgur.com/*
// @version        1.0.1
// @grant          none
// ==/UserScript==

function extractUrls() {
    var imgUrls = [];
    $('head > meta[property="og:image"]').each(function (i, v) {
        link = $(v).attr('content');
        if (!link.endsWith('?fb')) {
            imgUrls.push(link);
        }
    });
    return imgUrls;
}

$(document).ready(function () {
    var imgUrls = extractUrls();
    var decoratedLinks = '<center><img src="' + imgUrls.join('">\n\n<img src="') + '"></center>';
    var plainLinks = imgUrls.join("\n");

    var preformattedLinksPanel = '<div class="new-panel post-options-panel">'
            + '<h2 class="new-panel-header">Preformatted Links</h2>'
            + '<div class="post-options">'
            + '<textarea id="preformatted-links-decorated" style="height: 100px; width: 100%;" onclick="this.select();" title="Click to select">' + decoratedLinks + '</textarea>'
            + '<textarea id="preformatted-links-plain" style="height: 100px; width: 100%;" onclick="this.select();" title="Click to select">' + plainLinks + '</textarea>'
            + '</div></div>';

    $('#right-content').prepend(preformattedLinksPanel);
});