SmilesIsPasting

TamperMonkey Cytube Script

Jan 23rd, 2021
166
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.18 KB | None | 0 0
  1. // ==UserScript==
  2. // @name Cytube playlist tool
  3. // @namespace playlisttool
  4. // @description Cytube playlist tool
  5. // @grant GM_addStyle
  6. // @include https://cytu.be/r/*
  7. // @include https://www.cytu.be/r/*
  8. // @run-at document-end
  9. // @version 0.0.1
  10. // ==/UserScript==
  11.  
  12. GM_addStyle ( `
  13. #rightpane {
  14. white-space:nowrap;
  15. overflow-x:auto;
  16. }
  17. #rightpane-inner {
  18. display:inline-block;
  19. float:left;
  20. width:100%;
  21. overflow:hidden;
  22. }
  23. #playlist_area {
  24. width:0px;
  25. height:520px;
  26. border-width:2px;
  27. background-color:#2e3338;
  28. color:#fff;
  29. font-weight:400;
  30. padding:5px;
  31. display:inline-block;
  32. margin-left:30px;
  33. }
  34. ` );
  35.  
  36. document.getElementById("rightpane").innerHTML += "<Textarea id='playlist_area'></Textarea>";
  37. document.getElementById("videocontrols").innerHTML += "<button class='btn btn-sm btn-default' id='toggle_button'>Get playlist links</button>";
  38. document.getElementById("toggle_button").onclick = function(){toggle();};
  39.  
  40. var list = [];
  41. var d = document.getElementById("playlist_area");
  42. var r = document.getElementById("rightpane-inner");
  43. var b = document.getElementById("toggle_button");
  44.  
  45. d.style.visibility="hidden";
  46. d.onclick = function(){d.style.borderColor=null;};
  47.  
  48. function check(){
  49. var matches = document.querySelectorAll(".qe_title");
  50. for(var i = 0; i < matches.length; i++){
  51. if(!list.includes(matches[i])){
  52. list.push(matches[i]);
  53. d.value += (matches[i].innerHTML + "\n" + matches[i].getAttribute("href") + "\n\n");
  54. d.style.borderColor="#42b142";
  55. }
  56. }
  57. }
  58.  
  59. function toggle(){
  60. if(d.style.visibility == "hidden"){
  61. if(list == ""){
  62. check();
  63. window.setInterval(check, 30000);
  64. }
  65. d.style.visibility = "visible";
  66. d.style.width="50%";
  67. r.style.width = "50%";
  68. b.innerHTML = "Hide playlist links";
  69. }
  70. else if(d.style.visibility == "visible"){
  71. d.style.visibility = "hidden";
  72. d.style.width = "0px"
  73. r.style.width = "100%";
  74. b.innerHTML = "Show playlist links";
  75. }
  76. }
Advertisement
Add Comment
Please, Sign In to add comment