Greasy Fork 支持简体中文。

toggle fullscreen

try to take over the world!

目前為 2024-04-14 提交的版本,檢視 最新版本

  1. // ==UserScript==
  2. // @name toggle fullscreen
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.5
  5. // @description try to take over the world!
  6. // @author You
  7. // @match https://m.youtube.com/watch*
  8. // @icon https://www.google.com/s2/favicons?sz=64&domain=youtube.com
  9. // @grant none
  10. // @require http://code.jquery.com/jquery-latest.js
  11. // ==/UserScript==
  12.  
  13. (function() {
  14. 'use strict';
  15.  
  16. // Your code here...
  17. $(document).ready(
  18. function() {
  19.  
  20. // get window width height
  21. var ht = $(window).height();
  22. var wd = $(window).width();
  23.  
  24. window.setTimeout(function(){
  25. $('.player-placeholder').after(
  26. '<div id="blockingdiv" style="width:100%; height:200px; background-color: pink;" ></div>'
  27. );
  28.  
  29. $('#blockingdiv').on('click', function(){
  30.  
  31.  
  32. // play video
  33. window.setTimeout(function(){
  34. // Get the element
  35. let element = document.querySelector('.ytp-large-play-button');
  36.  
  37. // Create a new 'click' event
  38. let clickEvent = new MouseEvent("click", {
  39. bubbles: true,
  40. cancelable: true,
  41. view: window
  42. });
  43.  
  44. element.dispatchEvent(clickEvent);
  45. }, 1000);
  46.  
  47.  
  48. // show double tap buttons
  49. window.setTimeout(function(){
  50. document.querySelector('.player-controls-content').click();
  51. }, 2000);
  52.  
  53.  
  54. // double tap rewind
  55. window.setTimeout(function(){
  56. // Get the element
  57. let seek = document.querySelector('.player-controls-double-tap-to-seek-static-circle');
  58.  
  59. // Create a new 'click' event
  60. let clickEvent2 = new MouseEvent("click", {
  61. bubbles: true,
  62. cancelable: true,
  63. view: window
  64. });
  65.  
  66. // Function to dispatch the event
  67. function doubleTap() {
  68. seek.dispatchEvent(clickEvent2);
  69. setTimeout(() => {
  70. seek.dispatchEvent(clickEvent2);
  71. }, 200); // 200ms delay between taps
  72. }
  73.  
  74. // Execute the double tap
  75. doubleTap();
  76. }, 2000);
  77.  
  78.  
  79. // window.setTimeout(function(){
  80. // $('.fullscreen-icon').find('path').trigger('click');
  81. // }, 500);
  82.  
  83. });
  84.  
  85. }, 1000);
  86.  
  87.  
  88.  
  89.  
  90.  
  91. }
  92. );
  93.  
  94. })();