十八个Assets令人眼花缭乱,我做了一个智能高亮脚本,再也不需要一个一个看后缀啦

欣欣|林可欣 2026-06-14 04:48 1



该下载哪个一目了然

起初只是设计给我自己的Windows电脑用的,所以展示图是MSI高亮,理论上任何设备都适用,会自动高亮适合你的文件,但是我懒得去测那些环境是否能正常使用~ 就看你们的反馈啦 ^-^


// ==UserScript==
// @name GitHub Intelligent Installer Highlighter
// @namespace http://tampermonkey.net/
// @version 3.5.0
// @description 自动检测系统并高亮最适合当前设备的安装包😇
// @author 哈基米3.5
// @match *://github.com/*
// @run-at document-start
// @grant none
// ==/UserScript==

(function() {
'use strict';

function detectOS() {
if (navigator.userAgentData && navigator.userAgentData.platform) {
const plat = navigator.userAgentData.platform.toLowerCase();
if (plat.includes('win')) return 'windows';
if (plat.includes('mac')) return 'macos';
if (plat.includes('linux')) return 'linux';
}

const ua = navigator.userAgent.toLowerCase();
if (ua.includes('windows') || ua.includes('win32') || ua.includes('win64')) return 'windows';
if (ua.includes('macintosh') || ua.includes('mac os') || ua.includes('intel mac')) return 'macos';
if (ua.includes('linux')) return 'linux';

return 'unknown';
}

const userOS = detectOS();
if (userOS === 'unknown') return;

let targetSelector = '';

if (userOS === 'windows') {
targetSelector = `
a[href*=".msi"]:not([href*=".msi.sig"]):not([href$=".sig"]),
a[href*=".exe"]:not([href*=".exe.sig"]):not([href$=".sig"]):not([href$=".blockmap"])
`;
} else if (userOS === 'macos') {
targetSelector = `
a[href*=".dmg"]:not([href*=".dmg.sig"]):not([href$=".sig"]),
a[href*=".pkg"]:not([href$=".sig"]),
a[href*="-macos.zip"]:not([href$=".sig"]),
a[href*="-mac.zip"]:not([href$=".sig"])
`;
} else if (userOS === 'linux') {
targetSelector = `
a[href*=".appimage"]:not([href$=".sig"]),
a[href*=".deb"]:not([href$=".sig"]),
a[href*=".rpm"]:not([href$=".sig"])
`;
}

const cssRules = `
@keyframes aurora-flow {
0% { background-position: 0% 50% !important; }
50% { background-position: 100% 50% !important; }
100% { background-position: 0% 50% !important; }
}

@keyframes row-pulse {
0% { border-left-color: #ff007f !important; }
33% { border-left-color: #7f00ff !important; }
66% { border-left-color: #00f0ff !important; }
100% { border-left-color: #ff007f !important; }
}

${targetSelector},
${targetSelector.split(',').map(s => `${s.trim()} *`).join(',\n')} {
background: linear-gradient(90deg, #ff007f, #7f00ff, #00f0ff, #ff007f) !important;
background-size: 200% auto !important;
-webkit-background-clip: text !important;
-webkit-text-fill-color: transparent !important;
color: transparent !important;
font-weight: 900 !important;
text-shadow: 0 0 10px rgba(127, 0, 255, 0.15) !important;
display: inline-block !important;
animation: aurora-flow 8s linear infinite !important;
}

${targetSelector.split(',').map(s => `${s.trim()}:hover`).join(',\n')},
${targetSelector.split(',').map(s => `${s.trim()}:hover *`).join(',\n')} {
text-shadow: 0 0 16px rgba(0, 240, 255, 0.5) !important;
animation: aurora-flow 4s linear infinite !important;
}

.Box-row:has(${targetSelector}),
[class*="Box-row"]:has(${targetSelector}) {
background-color: rgba(127, 0, 255, 0.06) !important;
border-left: 5px solid #7f00ff !important;
border-radius: 4px !important;
animation: row-pulse 6s linear infinite !important;
transition: background-color 0.3s ease !important;
}

.Box-row:has(${targetSelector}):hover,
[class*="Box-row"]:has(${targetSelector}):hover {
background-color: rgba(127, 0, 255, 0.1) !important;
}
`;

const style = document.createElement('style');
style.textContent = cssRules;

if (document.documentElement) {
document.documentElement.appendChild(style);
} else {
document.addEventListener('DOMContentLoaded', () => {
document.documentElement.appendChild(style);
});
}
})();
最新回复 (2)
  • ǝɔ∀ǝdʎz∀ɹɔ 👽 06-14 05:07
    1

    可以可以, 这个实用!


    思路挺好的. 不满意的可以自己找AI写一个. 适合自己用就好.

  • Liberta 06-14 05:10
    2

    match 可以改为仅匹配 Github release 页面。

* 帖子来源Linux.do
返回