Xunlei Kuaichuan Display Full Filename

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

  1. // ==UserScript==
  2. // @name Xunlei Kuaichuan Display Full Filename
  3. // @namespace qixinglu.com
  4. // @description 迅雷快传上的下载链接显完整文件名
  5. // @grant none
  6. // @include http://kuai.xunlei.com/d/*
  7. // @include http://kuai.xunlei.com/s/*
  8. // @version 0.0.1.20140517140354
  9. // ==/UserScript==
  10.  
  11. var addStyle = function(cssText) {
  12. var head = document.querySelector('head');
  13. var style = document.createElement('style');
  14. style.setAttribute('type', 'text/css');
  15. style.textContent = cssText;
  16. head.appendChild(style);
  17. };
  18.  
  19. var fullName = function() {
  20. // 从 title 标签复制完整文件名
  21. var nodes = document.querySelectorAll('.c_2 a.file_name');
  22. var i, node;
  23. for (i = 0; i < nodes.length; i += 1) {
  24. node = nodes[i];
  25. node.textContent = node.title;
  26. }
  27. };
  28.  
  29. var swapSizePriviewInfo = function() {
  30. // 交换「文件大小」和「云预览」信息位置
  31. var nodes = document.querySelectorAll('.c4');
  32. var i, node;
  33. for (i = 0; i < nodes.length; i += 1) {
  34. node = nodes[i];
  35. if (node.classList.length === 1) {
  36. node.parentNode.appendChild(node);
  37. }
  38. }
  39. };
  40.  
  41. var filesCSS =
  42. '.adv_area, .file_right, .advl, .hot_list {' +
  43. ' display: none !important;' +
  44. '}' +
  45. '.file_left, .file_src, .file_src li {' +
  46. ' width: 100% !important;' +
  47. ' height: 100% !important;' +
  48. '}' +
  49. '.c_2, .c_2 a{' +
  50. ' width: auto !important;' +
  51. '}' +
  52. '.c4.status {' +
  53. ' width: 100px !important;' +
  54. '}' +
  55. '.c4 {' +
  56. ' float: right !important;' +
  57. '}';
  58.  
  59. var folderCSS =
  60. '.file_left, .downLoad_area {' +
  61. ' width: 100% !important;' +
  62. '}' +
  63. '.file_w, .file_list {' +
  64. ' height: 100% !important;' +
  65. '}';
  66.  
  67. if (location.href.indexOf('http://kuai.xunlei.com/s/') === 0) {
  68. addStyle(folderCSS);
  69. } else {
  70. addStyle(filesCSS);
  71. fullName();
  72. swapSizePriviewInfo();
  73. }
  74.