Greasy Fork

Greasy Fork is available in English.

toutiao better

make toutiao better

目前为 2019-06-12 提交的版本。查看 最新版本

// ==UserScript==
// @name         toutiao better
// @namespace    http://www.netroby.com/
// @version      0.4
// @description  make toutiao better
// @author       www.netroby.com
// @match        https://www.toutiao.com/*
// @require       http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js
// @grant        none
// ==/UserScript==

(function() {
    console.log(window.location.pathname);
    'use strict';
    jQuery.noConflict();
    if (window.location.pathname == "/") {
        jQuery("div.container").css("width", "auto").css("margin-top", "0");
        jQuery("div.ugcBox").hide();
        jQuery("div.bui-right").css("float", "left").css("margin-top", "-34px");
        jQuery("div.index-channel").css("display", "none");
        jQuery("div.index-channel").css("width", "10px").css("margin-right", 0);
        jQuery("div.index-right-bar").css("width", window.innerWidth-660);
        jQuery("div#rightModule").html("<iframe name=\"vctx\" id=\"vctx\" style=\"width:100%;height:750px;border:0\"></iframe>");
        function linkOiframe() {
            jQuery("a.link").each(function( index ) {
                jQuery(this).attr("target", "vctx");
            });
            jQuery("div.refresh-mode").click(function () {
                jQuery(document).scrollTop(-1);
                jQuery("div.index-content").scrollTop(-1);
            });
            var cilink = jQuery("div.title-box>a.link:eq(3)").attr("href");
            var cisrc = jQuery("#vctx").attr("src");
            if (cisrc == undefined) {
                console.log(cisrc);
                jQuery("#vctx").attr("src", cilink);
            }
        }
        jQuery("body").on("DOMSubtreeModified", "div.feed-infinite-wrapper", function() {
            console.log("Dom changed");
            linkOiframe();
        });

        jQuery("div.index-content").height(window.innerHeight-50);
        jQuery("div.index-content").css("overflow", "scroll");
        jQuery("#vctx").height(window.innerHeight+12);
        jQuery(".toolbar").hide();

        jQuery("body").css("overflow", "hidden");
    }else {
        jQuery("div.index-left").css("display", "none");
        jQuery("div.index-right").css("display", "none");
    }

    // Your code here...
})();