HIDive Fullscreen & Mouse volume control

Fullscreen & Mouse volume control

  1. // ==UserScript==
  2. // @name HIDive Fullscreen & Mouse volume control
  3. // @namespace https://greasyfork.org/en/users/807108-jeremy-r
  4. // @version 2.0
  5. // @description Fullscreen & Mouse volume control
  6. // @author JRem
  7. // @require https://cdn.jsdelivr.net/gh/mlcheng/js-toast@ebd3c889a1abaad615712485ce864d92aab4c7c0/toast.min.js
  8. // @match https://www.hidive.com/stream/*
  9. // @grant GM_addStyle
  10. // @grant GM.xmlHttpRequest
  11. // @license MIT
  12. // ==/UserScript==
  13.  
  14. // Fullscreen Video Code
  15. window.onload = function(){
  16. setTimeout(function () {
  17. var css = '#rmpPlayer {width: calc(100vw) !important;height: calc(95vh) !important;}';
  18. css += '.container-fluid {padding: 0 0 0 0;margin: 0 0 0 0;max-width:calc(100vw) !important;}';
  19. GM_addStyle(css);
  20. }, 5000);
  21. iqwerty.toast.toast('Fullscreen added', options);
  22. };
  23.  
  24.  
  25. // Toast Vars
  26. const options = {
  27. settings: {
  28. duration: 3000,
  29. },
  30. style: {
  31. main: {
  32. background: "black",
  33. color: "white",
  34. width: "auto",
  35. 'max-width': '10%',
  36. }
  37. }
  38. };
  39.  
  40. const volopts = {
  41. settings: {
  42. duration: 500,
  43. },
  44. style: {
  45. main: {
  46. background: "black",
  47. color: "white",
  48. width: "auto",
  49. 'max-width': '10%',
  50. }
  51. }
  52. };
  53.  
  54. // Volume Control via mouse scroll
  55. // 1 Scroll = 5%
  56. var stepAmount = 5;
  57.  
  58. function volChange(e){
  59. e.preventDefault()
  60. var video = document.querySelector('video')
  61. var curVol = video.volume;
  62. var direction = e.deltaY < 0;
  63. var actualChange = stepAmount / 100;
  64. if (direction) curVol += actualChange;
  65. else curVol -= actualChange;
  66. if (curVol > 1) curVol = 1;
  67. else if (curVol < 0) curVol = 0;
  68. video.volume = curVol;
  69.  
  70. iqwerty.toast.toast(Math.floor(100 * video.volume) +"%", volopts);
  71. }
  72.  
  73. document.getElementById("rmpPlayer").addEventListener("wheel", volChange);
  74.  
  75.  
  76.  
  77.  
  78.  
  79.  
  80.