Breitbart Comment Fix

BB Comment Fix

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         Breitbart Comment Fix
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  BB Comment Fix
// @author       You
// @match        https://www.breitbart.com/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=breitbart.com
// @grant        none
// @require http://code.jquery.com/jquery-latest.js
// ==/UserScript==

(function() {
    'use strict';

    $(document).ready(function(){
       start();
    });


    function start(){
        let containerW = $("#ContainerW");
        let container = document.querySelectorAll(".d-c-button-container");
        let linkLoc = $("a.d-comments-button").attr("href");

        let width = $("#MainW").width();
        let height = 500;

        if(container !== null) {
            $("a.d-comments-button").remove();

            let iframe = document.createElement("iframe");
            iframe.src = linkLoc;
            iframe.width = width + "px";
            iframe.height = height + "px";

            $("#comments").append(iframe);

            let containerTop = containerW.offset().top;

            let iframeTop = $(iframe).offset().top;
            let posDiff = iframeTop - containerTop;

            let containerWHeight = containerW.height();
            let diff = containerWHeight - posDiff;

            iframe.height = diff + "px";
        }
    };

    
})();