您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Greasy Fork is available in English.
Add line numbers to raw files at GitLab
您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
- // ==UserScript==
- // @name GitLab Raw File Fix
- // @namespace http://tampermonkey.net/
- // @version 1.0
- // @description Add line numbers to raw files at GitLab
- // @author Lasse Brustad
- // @match https://gitlab.com/*/raw/*
- // @match https://gitlab.*/*/raw/*
- // @match https://git.coolaj86.com/*/raw/*
- // @grant none
- // @locale en
- // ==/UserScript==
- // jshint esversion: 6
- (() => {
- 'use strict';
- // Get the text block
- let pre = document.getElementsByTagName('pre')[0];
- // Split the lines into an array
- let arr = pre.innerText.trim().split('\n');
- // Create the new text
- for (let i = 0; i < arr.length; i++) {
- arr[i] = (i + 1) + ': ' + arr[i];
- }
- // Replace the text with the fixed text
- pre.innerText = arr.join('\n');
- })();