ngxson HF Staff commited on
Commit
ec1f60e
·
verified ·
1 Parent(s): 8ea9cfe

Create script.js

Browse files
Files changed (1) hide show
  1. script.js +75 -0
script.js ADDED
@@ -0,0 +1,75 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // ==UserScript==
2
+ // @name Nui SFR TV
3
+ // @namespace http://tampermonkey.net/
4
+ // @version 1.0
5
+ // @description Nui SFR TV
6
+ // @author ngxson
7
+ // @match https://*.sfr.fr/*
8
+ // @icon https://www.google.com/s2/favicons?sz=64&domain=sfr.fr
9
+ // @updateURL https://ngxson-sfr-tv-patch.static.hf.space/script.js
10
+ // @downloadURL https://ngxson-sfr-tv-patch.static.hf.space/script.js
11
+ // @grant none
12
+ // ==/UserScript==
13
+
14
+ const customCss = `
15
+ nav[aria-label="Menu transverse"], nav[aria-label="Menu principal"] {
16
+ display: none !important;
17
+ }
18
+ div.scrim, .info.ng-star-inserted {
19
+ display: none !important;
20
+ }
21
+ web-seek-bar {
22
+ opacity: 0.5;
23
+ }
24
+ `;
25
+
26
+ (function() {
27
+ 'use strict';
28
+
29
+ var head = document.head || document.getElementsByTagName('head')[0];
30
+ if (head) {
31
+ var style = document.createElement('style');
32
+ style.id = 'nui_custom_css';
33
+ style.type = 'text/css';
34
+ style.appendChild(document.createTextNode(customCss));
35
+ head.appendChild(style);
36
+ }
37
+
38
+ setInterval(function () {
39
+ return; // disabled
40
+ const fullScreenBtn = document.querySelector('.svg-icon-fullscreen');
41
+ if (fullScreenBtn) {
42
+ fullScreenBtn.parentElement.click();
43
+ }
44
+ }, 500);
45
+
46
+ function changeChannel(deltaIdx) {
47
+ try {
48
+ const channels = document.querySelector('cdk-virtual-scroll-viewport').children[0].children;
49
+ for (let i = 0; i < channels.length; i++) {
50
+ const channel = channels[i];
51
+ const isActive = channel.classList.contains('active');
52
+ const nextChannel = channels[i + deltaIdx];
53
+ if (isActive && nextChannel) {
54
+ nextChannel.querySelector('.thumbnail').click();
55
+ return nextChannel;
56
+ }
57
+ }
58
+ } catch (err) {
59
+ console.error(err);
60
+ }
61
+ }
62
+
63
+ document.addEventListener('keydown', function(event) {
64
+ if (event.key === 'ArrowLeft') {
65
+ // Left arrow key pressed
66
+ console.log('Left arrow key pressed');
67
+ changeChannel(-1);
68
+ } else if (event.key === 'ArrowRight') {
69
+ // Right arrow key pressed
70
+ console.log('Right arrow key pressed');
71
+ changeChannel(1);
72
+ }
73
+ });
74
+
75
+ })();