AsusComm.com Video Controls

A button on the bottom right to activate video controls on videos.

  1. // ==UserScript==
  2. // @name AsusComm.com Video Controls
  3. // @namespace http://tampermonkey.net/
  4. // @version 1.0
  5. // @description A button on the bottom right to activate video controls on videos.
  6. // @author CodePer
  7. // @match https://*.asuscomm.com/
  8. // @icon data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
  9. // @grant none
  10. // @license MIT
  11. // ==/UserScript==
  12.  
  13. (function() {
  14. 'use strict';
  15.  
  16. // Create a new button element
  17. var button = document.createElement('button');
  18. button.textContent = 'Activate Video Controls'; // Set button text
  19.  
  20. // Set button styles
  21. button.style.position = 'fixed';
  22. button.style.bottom = '32px';
  23. button.style.right = '350px';
  24. button.style.padding = '10px 20px';
  25. button.style.backgroundColor = '#007bff';
  26. button.style.color = 'white';
  27. button.style.border = 'none';
  28. button.style.borderRadius = '5px';
  29. button.style.cursor = 'pointer';
  30. button.style.zIndex = '4000'; // Set z-index
  31.  
  32. // Add event listener to button
  33. button.addEventListener('click', function() {
  34.  
  35. // Get all iframes on the page
  36. var iframes = document.getElementsByTagName('iframe');
  37.  
  38. // Loop through each iframe
  39. for (var i = 0; i < iframes.length; i++) {
  40. // Access the contentDocument of each iframe
  41. var iframeDocument = iframes[i].contentDocument || iframes[i].contentWindow.document;
  42.  
  43. // Check if the iframeDocument exists and is not empty
  44. if (iframeDocument) {
  45. // Get all video elements inside the iframe
  46. var videos = iframeDocument.getElementsByTagName('video');
  47.  
  48. // Loop through each video element
  49. for (var j = 0; j < videos.length; j++) {
  50. // Add controls to each video element
  51. videos[j].setAttribute('controls', true);
  52. }
  53. }
  54. }
  55.  
  56. });
  57.  
  58. // Append button to the body
  59. document.body.appendChild(button);
  60. })();