您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Custom GitLab Style!
当前为
// ==UserScript== // @name Custom GitLab Style // @namespace http://tampermonkey.net/ // @version 1.02 // @description Custom GitLab Style! // @author Sean // @match http://192.168.0.200/fe3project* // @icon http://192.168.0.200/assets/favicon-7901bd695fb93edb07975966062049829afb56cf11511236e61bcf425070e36e.png // @grant none // @license MIT // ==/UserScript== (function() { 'use strict'; // 注入样式:改变容器宽度,项目描述多行展示 let injectStyle = ".group-list-tree .group-row-contents .description p { white-space: normal; } .container-limited.limit-container-width { max-width: 1400px } .limit-container-width .info-well {max-width: none;}"; injectStyle += ".container-fluid.container-limited.limit-container-width .file-holder.readme-holder.limited-width-container .file-content {max-width: none;}" injectStyle += 'button:focus {outline-color: transparent !important;}' // 添加注入样式 let extraStyleElement = document.createElement("style"); extraStyleElement.innerHTML = injectStyle; document.head.appendChild(extraStyleElement); // 改变列表打开链接方式,改为新窗口打开 let change = false; let tryTimes = 3; function changeOpenType() { if(!change){ setTimeout(()=> { let links = document.querySelectorAll('.description a'); if(links.length) { for(let i = 0, l = links.length; i < l; i++) { links[i].target = "_blank"; if(i === l - 1) { change = true; } } } else { changeOpenType(); } }, 1000); } } function stopLinkProp() { setTimeout(()=> { const links = document.querySelectorAll('.description a'); for(let i = 0, l = links.length; i < l; i++) { links[i].addEventListener('click', ()=> { event.stopPropagation(); }); } }, 1000); } window.onload = ()=> { var targetDiv = document.querySelector('section'); // 创建一个 Mutation Observer 实例 var observer = new MutationObserver(function(mutations) { // 在这里处理 div 子元素的变化 mutations.forEach(function(mutation) { if(mutation.addedNodes && mutation.addedNodes.length) { change = false; changeOpenType(); stopLinkProp(); } }); }); // 配置 Mutation Observer var config = { childList: true, subtree: true }; // 开始观察目标 div 元素 observer.observe(targetDiv, config); }; })();