Greasy Fork

来自缓存

Greasy Fork is available in English.

Xunlei Kuaichuan Display Full Filename

迅雷快传上的下载链接显完整文件名

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name        Xunlei Kuaichuan Display Full Filename
// @namespace   qixinglu.com
// @description 迅雷快传上的下载链接显完整文件名
// @grant       none
// @include     http://kuai.xunlei.com/d/*
// @include     http://kuai.xunlei.com/s/*
// @version 0.0.1.20140517140354
// ==/UserScript==

var addStyle = function(cssText) {
    var head = document.querySelector('head');
    var style = document.createElement('style');
    style.setAttribute('type', 'text/css');
    style.textContent = cssText;
    head.appendChild(style);
};

var fullName = function() {
    // 从 title 标签复制完整文件名
    var nodes = document.querySelectorAll('.c_2 a.file_name');
    var i, node;
    for (i = 0; i < nodes.length; i += 1) {
        node = nodes[i];
        node.textContent = node.title;
    }
};

var swapSizePriviewInfo = function() {
    // 交换「文件大小」和「云预览」信息位置
    var nodes = document.querySelectorAll('.c4');
    var i, node;
    for (i = 0; i < nodes.length; i += 1) {
        node = nodes[i];
        if (node.classList.length === 1) {
            node.parentNode.appendChild(node);
        }
    }
};

var filesCSS =
    '.adv_area, .file_right, .advl, .hot_list {' +
    '    display: none !important;' +
    '}' +
    '.file_left, .file_src, .file_src li {' +
    '    width: 100% !important;' +
    '    height: 100% !important;' +
    '}' +
    '.c_2, .c_2 a{' +
    '    width: auto !important;' +
    '}' +
    '.c4.status {' +
    '    width: 100px !important;' +
    '}' +
    '.c4 {' +
    '    float: right !important;' +
    '}';

var folderCSS =
    '.file_left, .downLoad_area {' +
    '    width: 100% !important;' +
    '}' +
    '.file_w, .file_list {' +
    '    height: 100% !important;' +
    '}';

if (location.href.indexOf('http://kuai.xunlei.com/s/') === 0) {
    addStyle(folderCSS);
} else {
    addStyle(filesCSS);
    fullName();
    swapSizePriviewInfo();
}