csdn copy

copy without login!

2019-07-04 يوللانغان نەشرى. ئەڭ يېڭى نەشرىنى كۆرۈش.

  1. // ==UserScript==
  2. // @name csdn copy
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.3
  5. // @description copy without login!
  6. // @author longslee
  7. // @match https://blog.csdn.net/*
  8. // @grant none
  9. // ==/UserScript==
  10.  
  11. +function() {
  12. 'use strict';
  13. // Your code here...
  14. //auto expand
  15. //document.getElementById('btn-readmore').click();
  16. document.getElementsByClassName('btn-readmore')[0].click();
  17. document.getElementById('mainBox').style.width = '900px';
  18.  
  19. if(typeof mdcp != 'undefined'){
  20. mdcp.signin = function(event){
  21. var div = event.target.parentElement;
  22. var txt = div.innerText;
  23. var tx=document.createElement("textarea");
  24. tx.id='bucunzai'
  25. tx.value=txt;
  26. document.body.appendChild(tx);
  27. var bucunzai = document.getElementById('bucunzai');
  28. bucunzai.select();
  29. document.execCommand("copy");
  30. bucunzai.parentNode.removeChild(bucunzai);
  31. }
  32. }
  33.  
  34. if(typeof hljs != 'undefined'){
  35. hljs.signin = function(event){
  36. debugger;
  37. var div = event.target.parentElement;
  38. var txt = div.innerText;
  39. var tx=document.createElement("textarea");
  40. tx.id='bucunzai'
  41. tx.value=txt;
  42. document.body.appendChild(tx);
  43. var bucunzai = document.getElementById('bucunzai');
  44. bucunzai.select();
  45. document.execCommand("copy");
  46. bucunzai.parentNode.removeChild(bucunzai);
  47. }
  48. }
  49. }();