Tumblr. blog icon to bottom

Tumblr. blog icon to bottom in reblog form

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

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

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

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

你需要先安裝一款使用者腳本管理器擴展,比如 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);
})();