您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Custom GitLab Style!
当前为
- // ==UserScript==
- // @name Custom GitLab Style
- // @namespace http://tampermonkey.net/
- // @version 1.0
- // @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;}"
- // 添加注入样式
- let extraStyleElement = document.createElement("style");
- extraStyleElement.innerHTML = injectStyle;
- document.head.appendChild(extraStyleElement);
- // 改变列表打开链接方式,改为新窗口打开
- let change = false;
- let tryTimes = 3;
- function changeOpenType() {
- if(!change && tryTimes > 0){
- setTimeout(()=> {
- let links = document.querySelectorAll('.description a');
- tryTimes--;
- 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);
- }
- }
- window.onload = ()=> {
- changeOpenType();
- setTimeout(()=> {
- const links = document.querySelectorAll('.description a');
- for(let i = 0, l = links.length; i < l; i++) {
- links[i].addEventListener('click', ()=> {
- event.stopPropagation();
- });
- }
- }, 2000);
- };
- })();