Breitbart Comment Fix

BB Comment Fix

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

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

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

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

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

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

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         Breitbart Comment Fix
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  BB Comment Fix
// @author       I did this!
// @match        https://www.breitbart.com/*
// @match        https://www.breitbart.com/t/assets/html/disqus/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=breitbart.com
// @grant        none
// @require http://code.jquery.com/jquery-latest.js
// @license GNU GPLv3
// ==/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) {
               $("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";
           }

    };
    
})();