Greasy Fork

Greasy Fork is available in English.

tumblr optica restyle

for tumblrs with the optica theme, move header to side and automatically display post notes

目前为 2016-04-26 提交的版本,查看 最新版本

// ==UserScript==
// @name         tumblr optica restyle
// @namespace    http://greasyfork.icu/en/users/36620
// @version      0.2
// @description  for tumblrs with the optica theme, move header to side and automatically display post notes
// @author       scriptfairy
// @include      /https?:\/\/(?!www).+\.tumblr\.com.*/
// @grant        none
// @require      http://ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js
// @run-at       document-body
// ==/UserScript==

(function($) {
    if ($('a[href$="optica"]').length > 0) {
        var themeBackground = $('body').css('background-color');
        themeBackground = themeBackground.slice(themeBackground.indexOf('(')+1,themeBackground.indexOf(')'));
        var themeSplit = themeBackground.split(',');
        var r, g, b, searchColor;
        r = themeSplit[0] < 128 ? 255 : 0;
        g = themeSplit[1] < 128 ? 255 : 0;
        b = themeSplit[2] < 128 ? 255 : 0;
        searchColor = 'rgb('+r+','+g+','+b+')';
        console.log(searchColor);
        $('<style>').text(
            '.iframe-controls--desktop {width:500px;} .logo-wrapper {color:'+searchColor+';} #posts .post-wrapper {overflow:visible;width:700px} .l-container {padding:0;} .inline-meta {width:100%;} .date-note-wrapper #notes {display:block;position:relative;min-height:50px;width:100%;margin:0;left:-10px;top:32px;border:none;box-shadow:none;} .date-note-wrapper .post-date {position:absolute;top:4px;right:120px;} .notes-wrapper .notes {overflow:auto;max-height:100%;} .post-footer .post-controls {position:absolute;top:0;right:0;} .header-wrapper {position:absolute;top:50px;} .header-wrapper #header {width:500px;margin:25px;} #posts, #footer {float:right;top:75px;right:50px;} .staff-blogs {position:absolute;left:-150px;}'
       ).appendTo($('head'));
    }
})(window.jQuery);