GitHub Release Filename Wrap

Improve the display of file names in GitHub Releases with the word-wrap feature so that long file names are fully visible on mobile displays.

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         GitHub Release Filename Wrap
// @namespace    http://tampermonkey.net/
// @version      2.2
// @description  Improve the display of file names in GitHub Releases with the word-wrap feature so that long file names are fully visible on mobile displays.
// @author       Partner Coding
// @match        https://github.com/*/*/releases*
// @icon         https://github.githubassets.com/pinned-octocat.svg
// @grant        GM_addStyle
// @license      MIT
// @run-at       document-start
// ==/UserScript==

(function() {
    'use strict';

    const css = `
        .Box-row a.Truncate {
            max-width: none !important;
            height: auto !important;
        }

        .Box-row a.Truncate .Truncate-text {
            white-space: normal !important;
            overflow: visible !important;
            word-break: break-word !important;
            line-height: 1.4 !important;
            padding-bottom: 4px;
        }

        .Box-row span.Truncate {
            max-width: 100% !important;
            display: inline-block !important;
            white-space: nowrap !important;
            overflow: hidden !important;
            text-overflow: ellipsis !important;
            vertical-align: bottom !important;
        }
    `;

    function addGlobalStyle(css) {
        const head = document.getElementsByTagName('head')[0];
        if (!head) { return; }
        const style = document.createElement('style');
        style.type = 'text/css';
        style.innerHTML = css;
        head.appendChild(style);
    }

    addGlobalStyle(css);

})();