360,百度网盘,微盘链接

360,百度网盘,微盘链接自动添加访问密码

  1. // ==UserScript==
  2. // @name 360,百度网盘,微盘链接
  3. // @author 林岑影
  4. // @description 360,百度网盘,微盘链接自动添加访问密码
  5. // @namespace
  6. // @icon http://disk.yun.uc.cn/favicon.ico
  7. // @license GPL version 3
  8. // @encoding utf-8
  9. // @date 18/07/2015
  10. // @modified 11/13/2015
  11. // @include *
  12. // @exclude http://pan.baidu.com/*
  13. // @exclude http://yunpan.360.cn/*
  14. // @exclude http://yunpan.cn/*
  15. // @exclude http://vdisk.weibo.com/*
  16. // @grant unsafeWindow
  17. // @grant GM_setClipboard
  18. // @run-at document-end
  19. // @version 2.1.1
  20. // ==/UserScript==
  21. //QIQI修改,最后更新时间:2015-11-9 15:32
  22. (function(window){
  23. var autoHash = function(){
  24. this.config = {
  25. domain: {
  26. "baidu":"pan.baidu.com/s/",
  27. "yunpan":"yunpan.cn",
  28. "vdisk":"vdisk.weibo.com"
  29. }
  30. }
  31. };
  32. autoHash.prototype = {
  33. init: function(){
  34. hash.nodeInsertedlistener({target:document.body});
  35. document.addEventListener("DOMNodeInserted", hash.nodeInsertedlistener);
  36. },
  37. nodeInsertedlistener: function(e){
  38. var elem = e.target;
  39. if(typeof(elem) === "object"){
  40. if(typeof(elem.querySelectorAll) !== "undefined"){
  41. var alllink = elem.querySelectorAll("a");
  42. for (var index in alllink) {
  43. if(hash.buttonsFilter(alllink[index])) {
  44. hash.replace(alllink[index]);
  45. }
  46. }
  47. }
  48. }
  49. },
  50. buttonsFilter: function(elem) {
  51. var href = typeof(elem) === "object" ? elem.getAttribute("href") : "";
  52. if (!href){
  53. return false;
  54. }
  55. if (href.indexOf("#")>-1){
  56. return false;
  57. }
  58. isDomain = false;
  59. for (var index in hash.config.domain) {
  60. if (href.indexOf(hash.config.domain[index]) > -1) {
  61. isDomain = true;
  62. break;
  63. }
  64. }
  65. return isDomain;
  66. },
  67. replace: function(a){
  68. var link = a.getAttribute("href"),
  69. body = document.body.innerHTML,
  70. arr_body = body.split('"' + link),
  71. text = arr_body[1].split('href=')[0],
  72. re = /(码|问)[\s|:|:]*([a-zA-Z0-9]{4,4})([\W\s]+|$)/g,
  73. r = re.exec(text);
  74. if (r && r[2]) {
  75. a.setAttribute("href", link+"#" + r[2]);
  76. } else {
  77. text = a.parentNode.innerText;
  78. r = re.exec(text);
  79. if (r && r[2]) {
  80. a.setAttribute("href", link + "#" + r[2]);
  81. }
  82. }
  83. }
  84. };
  85. var hash = new autoHash();
  86. hash.init();
  87. }(window));

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址