您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Makes to Youtube comments click to view rather than always showing them or hiding them
当前为
- // ==UserScript==
- // @name Youtube toggle comments
- // @description Makes to Youtube comments click to view rather than always showing them or hiding them
- // @author Lewis Aron Milne
- // @include http://www.youtube.com/watch*
- // @include https://www.youtube.com/watch*
- // @include http://youtube.com/watch*
- // @include https://youtube.com/watch*
- // @run-at document-end
- // @grant none
- // @version 0.0.1.20141207213652
- // @namespace https://greasyfork.org/users/7439
- // ==/UserScript==
- var observer = new MutationObserver(function(mutations) {
- var triggerNum = 0;
- mutations.forEach(function(mutation) {
- triggerNum++;
- if (triggerNum <= 1)
- {
- var comments = document.getElementById("watch-discussion");
- var toggleDiv = document.createElement("div");
- toggleDiv.style.textAlign = "center";
- toggleDiv.innerHTML = "<input id='toggleBtn' value='Show Comments' type='submit'>";
- comments.parentNode.insertBefore(toggleDiv, comments);
- comments.style.display = "none";
- var toggleBtn = document.getElementById("toggleBtn")
- toggleBtn.onclick = function()
- {
- if (comments.style.display !== "none")
- {
- comments.style.display = "none";
- toggleBtn.value = "Show Comments";
- }
- else
- {
- comments.style.display = "";
- toggleBtn.value = "Hide Comments";
- }
- }
- }
- });
- });
- observer.observe(document.getElementById("distiller-spinner"), { attributes: true });