Better Comments for Drive PDF Viewer

Hides every comment in 'comments column' which has no text inside. Makes comments with text inside simpler by hiding author and other data.

スクリプトをインストールするには、Tampermonkey, GreasemonkeyViolentmonkey のような拡張機能のインストールが必要です。

スクリプトをインストールするには、TampermonkeyViolentmonkey のような拡張機能のインストールが必要です。

スクリプトをインストールするには、TampermonkeyViolentmonkey のような拡張機能のインストールが必要です。

スクリプトをインストールするには、TampermonkeyUserscripts のような拡張機能のインストールが必要です。

このスクリプトをインストールするには、Tampermonkeyなどの拡張機能をインストールする必要があります。

このスクリプトをインストールするには、ユーザースクリプト管理ツールの拡張機能をインストールする必要があります。

(ユーザースクリプト管理ツールは設定済みなのでインストール!)

このスタイルをインストールするには、Stylusなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus などの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus tなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

(ユーザースタイル管理ツールは設定済みなのでインストール!)

このスクリプトの質問や評価の投稿はこちら通報はこちらへお寄せください
// ==UserScript==
// @name         Better Comments for Drive PDF Viewer
// @namespace    http://tampermonkey.net/
// @version      0.14
// @description  Hides every comment in 'comments column' which has no text inside. Makes comments with text inside simpler by hiding author and other data.
// @author       Balint Sotanyi
// @match        https://drive.google.com/file/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';
    document.body.onload = function() {
        var style = document.createElement('style'), parent_found = false, comments;
        style.innerText = 'div { transition: opacity .8s; }';
        document.head.appendChild(style);
        var check_interval = setInterval(function() {
            var comment_collection = document.getElementsByClassName('dcs-a-dcs-bd dcs-a dcs-a-dcs-u-dcs-v dcs-a-dcs-u-dcs-v-dcs-pf dcs-a-dcs-u-dcs-v-dcs-w-dcs-pf dcs-a-dcs-lg-dcs-ah dcs-a-dcs-lg-dcs-mg');
            if (comment_collection !== undefined && comment_collection[0] !== undefined) {
                comments = [].slice.call(comment_collection[0].children);
                if (comments !== undefined && comments.length > 0) {
                    clearInterval(check_interval);
                    comments.forEach(function(c){
                        try {
                            var b1 = c.firstElementChild.innerText == "",
                                b2 = c.firstElementChild.firstElementChild.firstElementChild.firstElementChild.children[1].innerText == "";
                        } catch (e) { /* omegalul */ }
                        if (b1 || b2) {
                            c.style.opacity = '0';
                            c.style.cursor = 'default';
                        } else {
                            var parent = c.firstElementChild.firstElementChild.firstElementChild.firstElementChild;
                            parent.innerHTML = parent.children[1].innerText;
                            c.click();
                        }
                    });
                }
            }
        }, 1000);
    }
})();