您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
A user script that unfolds GitHub news.
// ==UserScript== // @name Github News Unfold // @namespace http://tampermonkey.net/ // @version 0.3 // @description A user script that unfolds GitHub news. // @author LovelyWei // @match https://github.com/ // @grant none // ==/UserScript== const unfold = () =>{ const detailsContainerSelector = 'div.Details.js-details-container.js-news-feed-event-group'; const detailsContainer = Array.from(document.querySelectorAll(detailsContainerSelector)); if (detailsContainer.length !== 0) { for (let i = 0; i < detailsContainer.length; i += 1) { const element = detailsContainer[i]; element.classList.add('Details--on'); } } } const init = () => { const target = document.getElementsByClassName('news')[0]; const observer = new MutationObserver(() => { unfold(); }); observer.observe(target, { childList: true, subtree: true }); }; (function() { 'use strict'; init(); })();