Tumblr. blog icon to bottom

Tumblr. blog icon to bottom in reblog form

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。

您需要先安装用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name        Tumblr. blog icon to bottom
// @namespace   http://www.sharkpp.net/
// @version     0.4
// @description Tumblr. blog icon to bottom in reblog form
// @author      sharkpp
// @copyright   2015, sharkpp
// @license     MIT License
// @include     https://www.tumblr.com/dashboard*
// @include     https://www.tumblr.com/reblog/*
// @include     https://www.tumblr.com/blog/*
// @include     https://www.tumblr.com/tagged/*
// @include     https://www.tumblr.com/search/*
// ==/UserScript==
(function ()
{
    var blogs = [];
    var evaluate = function (xpath, resultOnce) {
        resultOnce = undefined == typeof resultOnce ? false : resultOnce;
        var items = document.evaluate(xpath, document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
        return resultOnce ? (items.snapshotLength ? items.snapshotItem(0) : null)
                          : items;
    };
    var fn = function () {
            var postContainer = evaluate('//*[@class="post-container"]', true);
            if (postContainer &&
                !postContainer.getAttribute('data-sharkpp-icon-bottom'))
            {
                postContainer.setAttribute('data-sharkpp-icon-bottom', true);
                //////////
                var elm;
                elm = evaluate('//*[@class="post-margin"]', true);
                elm.style.cssText = 'bottom:0; top:initial;';
                if (elm = evaluate('//*[contains(concat(" ",normalize-space(@class)," ")," post-content ")]', true)) { // old desigin
                    elm.style.cssText = 'top: 5px;';
                    elm = evaluate('//*[contains(concat(" ",normalize-space(@class)," ")," post-header ")]', true);
                    elm.style.cssText = 'position:absolute; bottom:5px; width:340px;';
                    elm = evaluate('//*[@class="post-form--controls"]/*[@class="controls-container"]', true);
                    elm.style.cssText = 'width:200px; margin-left:340px;';
                } else if (elm = evaluate('//*[contains(concat(" ",normalize-space(@class)," ")," post-form--form ")]', true)) {
                    elm.style.cssText = 'top: 5px;';
                    elm = evaluate('//*[contains(concat(" ",normalize-space(@class)," ")," post-form--header ")]', true);
                    elm.style.cssText = 'position:absolute; bottom:5px; width:340px;';
                    elm = evaluate('//*[@class="post-form--controls"]/*[@class="controls-container"]', true);
                    elm.style.cssText = 'width:200px; margin-left:340px;';
                }
            }
            setTimeout(fn, 1000);
        };
    setTimeout(fn, 1000);
})();