imgur output formatter

Adds fully formatted output containers

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==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);
});