Guest User

Untitled

a guest
Nov 17th, 2026
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 18.99 KB | None | 0 0
  1. // ==UserScript==
  2. // @name Anti-Spoilers GTA VI - Protection Ultime V6
  3. // @namespace local.anti-spoilers-gta-vi
  4. // @version 6.0.0
  5. // @description Protection anti-spoilers GTA VI : YouTube, Shorts, réseaux sociaux et forums.
  6. // @match *://youtube.com/*
  7. // @match *://www.youtube.com/*
  8. // @match *://m.youtube.com/*
  9. // @match *://x.com/*
  10. // @match *://www.x.com/*
  11. // @match *://twitter.com/*
  12. // @match *://www.twitter.com/*
  13. // @match *://instagram.com/*
  14. // @match *://www.instagram.com/*
  15. // @match *://jeuxvideo.com/*
  16. // @match *://www.jeuxvideo.com/*
  17. // @match *://reddit.com/*
  18. // @match *://www.reddit.com/*
  19. // @match *://old.reddit.com/*
  20. // @match *://tiktok.com/*
  21. // @match *://www.tiktok.com/*
  22. // @match *://facebook.com/*
  23. // @match *://www.facebook.com/*
  24. // @match *://threads.net/*
  25. // @match *://www.threads.net/*
  26. // @run-at document-start
  27. // @grant none
  28. // ==/UserScript==
  29.  
  30. (() => {
  31. 'use strict';
  32.  
  33. // ============================================================
  34. // PARAMETRES
  35. // ============================================================
  36.  
  37. const BLOQUER_GTA_SEUL = true;
  38. const BLOQUER_NOMS_SEULS = true;
  39. const BLOQUER_ROCKSTAR = true;
  40. const CACHER_SUGGESTIONS_YT = true;
  41. const MODE_IMAGES_AVEUGLE = false;
  42.  
  43. // true : bloque les titres mentionnant GTA, même GTA V.
  44. // false : bloque uniquement les références spécifiques à GTA VI.
  45.  
  46. const MOTS_SUPPLEMENTAIRES = [
  47. // 'mon mot-cle',
  48. ];
  49.  
  50.  
  51.  
  52. const NOMS = [
  53. 'Lucia',
  54. 'Lucia Caminos',
  55. 'Jason',
  56. 'Jason Duval',
  57. 'Cal',
  58. 'Cal Hampton',
  59. 'Boobie',
  60. 'Boobie Ike',
  61. "Dre'Quan",
  62. "Dre'Quan Priest",
  63. 'Drequan',
  64. 'Raul',
  65. 'Raul Bautista',
  66. 'Brian',
  67. 'Brian Heder',
  68. 'Real Dimez',
  69. 'Bae-Luxe',
  70. 'Roxy',
  71. 'Lori',
  72. 'DWNPLY'
  73. ];
  74.  
  75. // ============================================================
  76. // TERMES DE SPOILERS
  77. // ============================================================
  78.  
  79. const TERMES_SPOIL = [
  80. 'mort', 'morte', 'morts', 'meurt', 'meurent',
  81. 'mourir', 'mourra', 'deces', 'decede', 'decedee',
  82. 'assassine', 'assassinee', 'tue', 'tuer', 'tuee',
  83. 'suicide', 'survit', 'survie', 'trahit',
  84. 'trahison', 'traitre', 'fin', 'final', 'finale',
  85. 'ending', 'endings', 'dies', 'die', 'dead',
  86. 'death', 'killed', 'murder', 'murdered',
  87. 'betrays', 'betrayal', 'traitor', 'survives',
  88. 'secret', 'plot twist', 'twist', 'revelation',
  89. 'reveal', 'spoiler', 'spoilers', 'spoil',
  90. 'leak', 'leaks', 'leaked', 'leaking',
  91. 'cutscene', 'cinematique', 'scene finale',
  92. 'post credits', 'post credit', 'apres generique',
  93. 'true ending', 'bad ending', 'good ending',
  94. 'last mission', 'mission finale',
  95. 'dernier chapitre', 'chapitre final',
  96. 'ending explained', 'ending breakdown',
  97. 'game over', 'hidden ending',
  98. 'secret ending', 'alternate ending',
  99. 'character death', 'death scene',
  100. 'killing scene', 'final boss',
  101. 'final mission', 'last chapter'
  102. ];
  103.  
  104. // ============================================================
  105. // TERMES ET LIEUX GTA VI
  106. // ============================================================
  107.  
  108. const MOTIFS_SPECIFIQUES = [
  109. // GTA VI
  110. /(?:^|[^a-z0-9])g[\s._\-·•]*t[\s._\-·•]*a[\s._\-·•]*(?:6|vi|six)(?=$|[^a-z0-9])/iu,
  111. /(?:^|[^a-z0-9])grand[\s._\-·•]*theft[\s._\-·•]*auto[\s._\-·•]*(?:6|vi|six)(?=$|[^a-z0-9])/iu,
  112. /(?:^|[^a-z0-9])gtavi(?:6)?(?=$|[^a-z0-9])/iu,
  113.  
  114. // Lieux
  115. /(?:^|[^a-z0-9])vice[\s._\-·•]*city(?=$|[^a-z0-9])/iu,
  116. /(?:^|[^a-z0-9])leonida(?=$|[^a-z0-9])/iu,
  117. /(?:^|[^a-z0-9])port[\s._\-·•]*gellhorn(?=$|[^a-z0-9])/iu,
  118. /(?:^|[^a-z0-9])mount[\s._\-·•]*kalaga(?=$|[^a-z0-9])/iu,
  119. /(?:^|[^a-z0-9])grassrivers(?=$|[^a-z0-9])/iu,
  120. /(?:^|[^a-z0-9])ambrosia(?=$|[^a-z0-9])/iu,
  121. /(?:^|[^a-z0-9])hamlet(?=$|[^a-z0-9])/iu,
  122. /(?:^|[^a-z0-9])vice[\s._\-·•]*beach(?=$|[^a-z0-9])/iu
  123. ];
  124.  
  125. // ============================================================
  126. // SELECTEURS
  127. // ============================================================
  128.  
  129. const YOUTUBE_CARTES = [
  130. 'ytd-rich-item-renderer',
  131. 'ytd-rich-grid-media',
  132. 'ytd-rich-grid-slim-media',
  133. 'ytd-video-renderer',
  134. 'ytd-grid-video-renderer',
  135. 'ytd-compact-video-renderer',
  136. 'ytd-reel-item-renderer',
  137. 'ytd-reel-video-renderer',
  138. 'ytd-shorts-lockup-view-model',
  139. 'yt-shorts-lockup-view-model',
  140. 'ytm-shorts-lockup-view-model',
  141. 'ytm-shorts-lockup-view-model-v2',
  142. 'ytm-rich-item-renderer',
  143. 'ytm-video-with-context-renderer',
  144. 'yt-lockup-view-model',
  145. 'ytd-playlist-renderer',
  146. 'ytd-comment-thread-renderer',
  147. 'ytd-notification-renderer',
  148. 'ytd-watch-metadata',
  149. 'ytm-video-renderer'
  150. ].join(',');
  151.  
  152. const SELECTEURS = {
  153.  
  154. 'youtube.com': [
  155. YOUTUBE_CARTES,
  156. 'a[href*="/shorts/"]',
  157. 'a[href*="/watch?v="]',
  158. 'ytd-rich-section-renderer'
  159. ].join(','),
  160.  
  161. 'x.com': [
  162. 'article[data-testid="tweet"]',
  163. '[data-testid="trend"]',
  164. '[data-testid="notification"]',
  165. '[role="article"]'
  166. ].join(','),
  167.  
  168. 'instagram.com': [
  169. 'article',
  170. '[role="article"]',
  171. 'main a[href*="/p/"]',
  172. 'main a[href*="/reel/"]'
  173. ].join(','),
  174.  
  175. 'jeuxvideo.com': [
  176. 'ul.tablesForum--listTopics > li:not(.dfp__atf):not(.message)',
  177. '.topic-list > li:not(.dfp__atf):not(.message)',
  178. '.topic-list-item',
  179. '.topic-list tr',
  180. 'a.tablesForum__cellSubject',
  181. '.tablesForum__subjectText',
  182. '.topic-subject',
  183. 'a.lien-jv.topic-title',
  184. 'a.topic-title',
  185. '.messageUser',
  186. '.bloc-message-forum',
  187. '.message-forum',
  188. '[class*="message-forum"]'
  189. ].join(','),
  190.  
  191. 'reddit.com': [
  192. 'shreddit-post',
  193. '[data-testid="post-container"]',
  194. '.thing.link',
  195. 'article'
  196. ].join(','),
  197.  
  198. 'tiktok.com': [
  199. '[data-e2e="recommend-list-item-container"]',
  200. '[data-e2e="user-post-item"]',
  201. '[data-e2e="comment-item"]'
  202. ].join(','),
  203.  
  204. 'facebook.com': '[role="article"]',
  205.  
  206. 'threads.net': '[role="article"]'
  207. };
  208.  
  209. // ============================================================
  210. // IDENTIFICATION DU SITE
  211. // ============================================================
  212.  
  213. const h = location.hostname.toLowerCase().replace(/^www\./, '');
  214.  
  215. const site =
  216. h === 'm.youtube.com' ? 'youtube.com' :
  217. h === 'old.reddit.com' ? 'reddit.com' :
  218. h;
  219.  
  220. const selector = SELECTEURS[site];
  221.  
  222. if (!selector) return;
  223.  
  224. // ============================================================
  225. // NORMALISATION
  226. // ============================================================
  227.  
  228. function normaliser(v) {
  229. return String(v || '')
  230. .normalize('NFKD')
  231. .replace(/[\u0300-\u036f]/g, '')
  232. .replace(/[\u200B-\u200D\u2060\uFEFF]/g, '')
  233. .toLowerCase()
  234. .replace(/[@4]/g, 'a')
  235. .replace(/[0]/g, 'o')
  236. .replace(/[3]/g, 'e')
  237. .replace(/\b1(?=[a-z])/g, 'i');
  238. }
  239.  
  240. function echapper(s) {
  241. return s.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
  242. }
  243.  
  244. function borne(s) {
  245. return new RegExp(
  246. '(?:^|[^a-z0-9])' +
  247. echapper(s) +
  248. '(?=$|[^a-z0-9])',
  249. 'iu'
  250. );
  251. }
  252.  
  253.  
  254.  
  255.  
  256. function creerRegexNomFragmentable(nom) {
  257.  
  258. const compact = normaliser(nom)
  259. .replace(/[^a-z0-9]/g, '');
  260.  
  261. if (!compact) return null;
  262.  
  263. const lettres = [...compact]
  264. .map(echapper)
  265. .join('[^a-z0-9]*');
  266.  
  267. return new RegExp(
  268. '(?:^|[^a-z0-9])' +
  269. lettres +
  270. '(?=$|[^a-z0-9])',
  271. 'iu'
  272. );
  273. }
  274.  
  275. const nomsRgx = NOMS.flatMap(n => [
  276. borne(normaliser(n)),
  277. creerRegexNomFragmentable(n)
  278. ]).filter(Boolean);
  279.  
  280. const termesRgx = TERMES_SPOIL.map(
  281. n => borne(normaliser(n))
  282. );
  283.  
  284. const motsRgx = MOTS_SUPPLEMENTAIRES
  285. .filter(Boolean)
  286. .map(n => creerRegexNomFragmentable(n))
  287. .filter(Boolean);
  288.  
  289. // ============================================================
  290. // DETECTION GTA
  291. // ============================================================
  292.  
  293. const motifsJeu = [
  294. /(?:^|[^a-z0-9])g[\s._\-·•]*t[\s._\-·•]*a(?:[\s._\-·•]*(?:6|vi|v[\s._\-·•]*i|six))?(?=$|[^a-z0-9])/iu,
  295.  
  296. /(?:^|[^a-z0-9])grand[\s._\-·•]*theft[\s._\-·•]*auto(?:[\s._\-·•]*(?:6|vi|six))?(?=$|[^a-z0-9])/iu,
  297.  
  298. /(?:^|[^a-z0-9])gtavi(?:6)?(?=$|[^a-z0-9])/iu,
  299.  
  300. /(?:^|[^a-z0-9])rockstar[\s._\-·•]*games(?=$|[^a-z0-9])/iu
  301. ];
  302.  
  303. // ============================================================
  304. // FONCTION DE DETECTION PRINCIPALE
  305. // ============================================================
  306.  
  307. function interdit(texte) {
  308.  
  309. const s = normaliser(texte);
  310.  
  311. // Références GTA VI et lieux.
  312. if (MOTIFS_SPECIFIQUES.some(r => r.test(s))) {
  313. return true;
  314. }
  315.  
  316. // Références GTA en général.
  317. if (
  318. BLOQUER_GTA_SEUL &&
  319. motifsJeu.slice(0, 2).some(r => r.test(s))
  320. ) {
  321. return true;
  322. }
  323.  
  324. // Rockstar Games.
  325. if (BLOQUER_ROCKSTAR && motifsJeu[3].test(s)) {
  326. return true;
  327. }
  328.  
  329. // Mots personnalisés.
  330. if (motsRgx.some(r => r.test(s))) {
  331. return true;
  332. }
  333.  
  334. // Personnages, même fragmentés.
  335. if (
  336. BLOQUER_NOMS_SEULS &&
  337. nomsRgx.some(r => r.test(s))
  338. ) {
  339. return true;
  340. }
  341.  
  342. // Personnage + terme de spoiler.
  343. if (
  344. nomsRgx.some(r => r.test(s)) &&
  345. termesRgx.some(r => r.test(s))
  346. ) {
  347. return true;
  348. }
  349.  
  350. return false;
  351. }
  352.  
  353. // ============================================================
  354. // CSS DE PROTECTION
  355. // ============================================================
  356.  
  357. function installerCSS() {
  358.  
  359. if (
  360. !document.documentElement ||
  361. document.getElementById('anti-gta6-v6-style')
  362. ) return;
  363.  
  364. const style = document.createElement('style');
  365.  
  366. style.id = 'anti-gta6-v6-style';
  367.  
  368. const selectorCache = site === 'jeuxvideo.com'
  369. ? [
  370. 'ul.tablesForum--listTopics > li:not(.dfp__atf):not(.message)',
  371. '.topic-list > li:not(.dfp__atf):not(.message)',
  372. '.topic-list-item',
  373. '.topic-list tr',
  374. '.messageUser',
  375. '.bloc-message-forum',
  376. '.message-forum',
  377. '[class*="message-forum"]'
  378. ].join(',')
  379. : selector;
  380.  
  381. const css = [
  382.  
  383. // Masquage préventif.
  384. `:is(${selectorCache}):not([data-anti-gta6="autorise"]) {
  385. visibility: hidden !important;
  386. }`,
  387.  
  388. // Suppression des contenus interdits.
  389. '[data-anti-gta6="masque"] { display: none !important; }',
  390.  
  391. // Protection des lignes JVC.
  392. ...(site === 'jeuxvideo.com' ? [
  393. 'ul.tablesForum--listTopics > li:not([data-anti-gta6="autorise"]) .tablesForum__subjectText { visibility:hidden!important; }',
  394. 'ul.tablesForum--listTopics > li[data-anti-gta6="masque"] { display:none!important; }'
  395. ] : []),
  396.  
  397. // Page individuelle interdite.
  398. 'html[data-anti-gta6-page="masque"] body { visibility:hidden!important; }'
  399. ];
  400.  
  401. if (site === 'youtube.com' && CACHER_SUGGESTIONS_YT) {
  402. css.push(
  403. '.sbdd_b,.gstl_50,yt-searchbox-suggestions-container,ytSearchboxComponentSuggestionsContainer { display:none!important; }'
  404. );
  405. }
  406.  
  407. if (MODE_IMAGES_AVEUGLE) {
  408. css.push(
  409. 'main img,main video,article img,article video,ytd-thumbnail img,yt-image img,[role="article"] img,[role="article"] video { visibility:hidden!important; }'
  410. );
  411. }
  412.  
  413. style.textContent = css.join('\n');
  414.  
  415. document.documentElement.appendChild(style);
  416. }
  417.  
  418. // ============================================================
  419. // IDENTIFICATION DE LA CARTE COMPLETE
  420. // ============================================================
  421.  
  422. function carteCible(element) {
  423.  
  424. if (site === 'youtube.com') {
  425.  
  426. const carte = element.closest(
  427. 'ytd-rich-item-renderer,' +
  428. 'ytd-rich-grid-media,' +
  429. 'ytd-rich-grid-slim-media,' +
  430. 'ytd-video-renderer,' +
  431. 'ytd-grid-video-renderer,' +
  432. 'ytd-reel-item-renderer,' +
  433. 'ytd-reel-video-renderer,' +
  434. 'ytd-shorts-lockup-view-model,' +
  435. 'yt-shorts-lockup-view-model,' +
  436. 'ytm-shorts-lockup-view-model,' +
  437. 'ytm-shorts-lockup-view-model-v2,' +
  438. 'ytm-rich-item-renderer,' +
  439. 'ytm-video-with-context-renderer,' +
  440. 'yt-lockup-view-model'
  441. );
  442.  
  443. if (carte) return carte;
  444.  
  445. // Recherche d'un conteneur parent pour les structures
  446. // YouTube qui changent régulièrement.
  447. let parent = element;
  448.  
  449. for (let i = 0; i < 7 && parent; i++) {
  450.  
  451. if (
  452. parent.matches &&
  453. parent.matches(
  454. 'ytd-item-section-renderer,' +
  455. 'ytd-rich-section-renderer,' +
  456. 'ytm-section-list-renderer'
  457. )
  458. ) break;
  459.  
  460. if (
  461. parent.matches &&
  462. parent.matches('a[href*="/shorts/"]')
  463. ) {
  464. return parent.parentElement || parent;
  465. }
  466.  
  467. parent = parent.parentElement;
  468. }
  469. }
  470.  
  471. if (site === 'jeuxvideo.com') {
  472.  
  473. const ligne = element.closest(
  474. 'ul.tablesForum--listTopics > li:not(.dfp__atf):not(.message),' +
  475. '.topic-list > li:not(.dfp__atf):not(.message),' +
  476. '.topic-list-item,.topic-list tr'
  477. );
  478.  
  479. if (ligne) return ligne;
  480.  
  481. const lien = element.closest(
  482. 'a.tablesForum__cellSubject,' +
  483. 'a.lien-jv.topic-title,' +
  484. 'a.topic-title'
  485. );
  486.  
  487. if (lien) {
  488.  
  489. let parent = lien.parentElement;
  490.  
  491. for (let i = 0; i < 5 && parent; i++, parent = parent.parentElement) {
  492.  
  493. if (parent.matches(
  494. 'li,tr,[role="row"],.topic-list-item,[class*="tablesForum__row"]'
  495. )) {
  496. return parent;
  497. }
  498.  
  499. if (parent.matches('ul,table,main,body')) break;
  500. }
  501.  
  502. return lien;
  503. }
  504. }
  505.  
  506. if (site === 'instagram.com') {
  507.  
  508. const parent = element.closest('article,[role="article"]');
  509.  
  510. if (parent) return parent;
  511. }
  512.  
  513. return element;
  514. }
  515.  
  516. // ============================================================
  517. // EXTRACTION DU TEXTE
  518. // ============================================================
  519.  
  520. function texteElement(el) {
  521.  
  522. let t = el.textContent || '';
  523.  
  524. const attributs = [
  525. 'title',
  526. 'aria-label',
  527. 'alt',
  528. 'data-title',
  529. 'data-tooltip',
  530. 'content'
  531. ];
  532.  
  533. for (const elem of el.querySelectorAll(
  534. '[title],[aria-label],[alt],[data-title],[data-tooltip],[content],a[href]'
  535. )) {
  536.  
  537. for (const a of attributs) {
  538. t += ' ' + (elem.getAttribute(a) || '');
  539. }
  540.  
  541. if (elem.matches('a[href]')) {
  542. t += ' ' + (elem.getAttribute('href') || '').split('?')[0];
  543. }
  544. }
  545.  
  546. return t;
  547. }
  548.  
  549. // ============================================================
  550. // FILE D'ANALYSE
  551. // ============================================================
  552.  
  553. const file = new Set();
  554.  
  555. let enCours = false;
  556.  
  557. function traiter() {
  558.  
  559. enCours = false;
  560.  
  561. for (const el of file) {
  562.  
  563. if (!el.isConnected) continue;
  564.  
  565. const bloque = interdit(texteElement(el));
  566.  
  567. el.setAttribute(
  568. 'data-anti-gta6',
  569. bloque ? 'masque' : 'autorise'
  570. );
  571. }
  572.  
  573. file.clear();
  574.  
  575. verifierPage();
  576. }
  577.  
  578. function ajouter(el) {
  579.  
  580. if (!el || !el.isConnected || el.nodeType !== 1) return;
  581.  
  582. const cible = carteCible(el);
  583.  
  584. el.removeAttribute('data-anti-gta6');
  585.  
  586. cible.removeAttribute('data-anti-gta6');
  587.  
  588. file.add(el);
  589. file.add(cible);
  590.  
  591. if (!enCours) {
  592.  
  593. enCours = true;
  594.  
  595. requestAnimationFrame(traiter);
  596. }
  597. }
  598.  
  599. // ============================================================
  600. // SCANNER
  601. // ============================================================
  602.  
  603. function scanner(node, profondeur = true) {
  604.  
  605. const el = node?.nodeType === 1
  606. ? node
  607. : node?.parentElement;
  608.  
  609. if (!el) return;
  610.  
  611. if (el.matches(selector)) {
  612. ajouter(el);
  613. }
  614.  
  615. const parent = el.closest(selector);
  616.  
  617. if (parent) {
  618. ajouter(parent);
  619. }
  620.  
  621. if (profondeur) {
  622.  
  623. el.querySelectorAll(selector).forEach(ajouter);
  624. }
  625. }
  626.  
  627. // ============================================================
  628. // PROTECTION DES PAGES INDIVIDUELLES
  629. // ============================================================
  630.  
  631. function verifierPage() {
  632.  
  633. if (!document.documentElement) return;
  634.  
  635. let chemin = location.pathname;
  636.  
  637. try {
  638. chemin = decodeURIComponent(chemin);
  639. } catch (_) {}
  640.  
  641. const pageMedia =
  642. /\/(watch|shorts|reel|p|video|videos|forums)\b/i.test(chemin);
  643.  
  644. const titre =
  645. document.title + ' ' +
  646. chemin + ' ' +
  647. (document.querySelector('meta[name="title"]')?.content || '');
  648.  
  649. document.documentElement.setAttribute(
  650. 'data-anti-gta6-page',
  651. pageMedia && interdit(titre)
  652. ? 'masque'
  653. : 'autorise'
  654. );
  655. }
  656.  
  657. // ============================================================
  658. // DEMARRAGE
  659. // ============================================================
  660.  
  661. function lancer() {
  662.  
  663. installerCSS();
  664.  
  665. scanner(document.documentElement);
  666.  
  667. verifierPage();
  668.  
  669. const observer = new MutationObserver(changements => {
  670.  
  671. for (const m of changements) {
  672.  
  673. if (m.type === 'childList') {
  674.  
  675. m.addedNodes.forEach(n => scanner(n));
  676.  
  677. scanner(m.target, false);
  678.  
  679. } else {
  680.  
  681. scanner(m.target, false);
  682. }
  683. }
  684.  
  685. verifierPage();
  686. });
  687.  
  688. observer.observe(document.documentElement, {
  689.  
  690. subtree: true,
  691. childList: true,
  692. characterData: true,
  693. attributes: true,
  694.  
  695. attributeFilter: [
  696. 'title',
  697. 'alt',
  698. 'aria-label',
  699. 'data-title',
  700. 'data-tooltip',
  701. 'href'
  702. ]
  703. });
  704.  
  705. window.addEventListener('popstate', () => {
  706.  
  707. verifierPage();
  708.  
  709. scanner(document.documentElement);
  710. });
  711.  
  712. }
  713.  
  714. // ============================================================
  715. // INITIALISATION
  716. // ============================================================
  717.  
  718. installerCSS();
  719.  
  720. if (document.readyState === 'loading') {
  721.  
  722. document.addEventListener(
  723. 'DOMContentLoaded',
  724. lancer,
  725. { once: true }
  726. );
  727.  
  728. } else {
  729.  
  730. lancer();
  731. }
  732.  
  733. })();
Add Comment
Please, Sign In to add comment