🏠 Home 

Rede Canais modo simplificado

Simplifica a pagina Rede Canais removendo elementos de contato, comentarios e outros. Além de adicionar alguns botões para ajudar a encontrar mais filmes


Installer dette script?
  1. // ==UserScript==
  2. // @name Rede Canais modo simplificado
  3. // @name:pt Rede Canais modo simplificado
  4. // @name:pt-BR Rede Canais modo simplificado
  5. // @name:pt-PT Rede Canais modo simplificado
  6. // @name:en Rede Canais simplified mode
  7. // @namespace http://tampermonkey.net/
  8. // @version 1.2.2
  9. // @description Simplifica a pagina Rede Canais removendo elementos de contato, comentarios e outros. Além de adicionar alguns botões para ajudar a encontrar mais filmes
  10. // @description:pt Simplifica a pagina Rede Canais removendo elementos de contato, comentarios e outros. Além de adicionar alguns botões para ajudar a encontrar mais filmes
  11. // @description:pt-BR Simplifica a pagina Rede Canais removendo elementos de contato, comentarios e outros. Além de adicionar alguns botões para ajudar a encontrar mais filmes
  12. // @description:pt-PT Simplifica a pagina Rede Canais removendo elementos de contato, comentarios e outros. Além de adicionar alguns botões para ajudar a encontrar mais filmes
  13. // @description:en Simplifies the Rede Canais page by removing contact elements, comments and others. As well as adding some buttons to help you find more movies
  14. // @author Pedro Henrique
  15. // @match *://redecanais.la/*
  16. // @match *://redecanaistv.la/*
  17. // @match *://redecanais.zip/*
  18. // @match *://redecanaistv.zip/*
  19. // @match *://redecanais.dad/*
  20. // @match *://redecanaistv.dad/*
  21. // @match *://redecanais.mov/*
  22. // @match *://redecanaistv.mov/*
  23. // @match *://redecanais.dev/*
  24. // @match *://redecanaistv.dev/*
  25. // @match *://redecanais.ps/*
  26. // @match *://redecanaistv.ps/*
  27. // @match *://redecanais.ms/*
  28. // @match *://redecanaistv.ms/*
  29. // @match *://redecanais.ac/*
  30. // @match *://redecanaistv.ac/*
  31. // @match *://xn--90afacv0ct3a1ct.xn--p1ai/*
  32. // @match *://xn--90afacaz8cml9ac9f.xn--p1ai/*
  33. // @match *://xn--90afacv0cu2a3cr.xn--p1ai/*
  34. // @match *://xn--90afacv0clj6ac0dxa.xn--p1ai/*
  35. // @icon https://redecanais.la/templates/echo/img/favicon.ico
  36. // @grant GM_registerMenuCommand
  37. // @grant GM_setValue
  38. // @grant GM_getValue
  39. // @license MIT
  40. // @run-at document-start
  41. // ==/UserScript==
  42. (function () {
  43. 'use strict';
  44. function getElementByXpath(path, elem = undefined) {
  45. let e = elem;
  46. if (e == undefined)
  47. e = document
  48. return document.evaluate(path, e, null, XPathR###lt.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;
  49. }
  50. function getElementsByXpath(path, elem = undefined) {
  51. let e = elem;
  52. if (e == undefined)
  53. e = document
  54. var nodes = document.evaluate(path, e, null, XPathR###lt.UNORDERED_NODE_SNAPSHOT_TYPE, null);
  55. var r###lt = [];
  56. for (var i = 0; i < nodes.snapshotLength; i++) {
  57. r###lt.push(nodes.snapshotItem(i));
  58. }
  59. return r###lt;
  60. }
  61. var Config = {
  62. UI_barra_comentarios: true,
  63. }
  64. var u = window.document.URL;
  65. function IniciarScript() {
  66. GM_registerMenuCommand("📚Abrir Mapa do Site📚", () => {
  67. window.open("https://redecanais.zip/mapa.html");
  68. });
  69. GM_registerMenuCommand("🎥Abrir Mapa dos filmes🎥", () => {
  70. window.open("https://redecanais.zip/mapafilmes.html");
  71. });
  72. const _bc = Config.UI_barra_comentarios ? "✔️" : "❌"
  73. GM_registerMenuCommand(_bc + "Barra de comentários", () => {
  74. if (Config.UI_barra_comentarios == true) {
  75. Save_Config("UI_barra_comentarios", false);
  76. window.location.reload();
  77. }
  78. else {
  79. Save_Config("UI_barra_comentarios", true);
  80. window.location.reload();
  81. }
  82. });
  83. // CRIA INTERFACES
  84. let link = new URL(u)
  85. if (link.pathname == "/mapafilmes.html" || link.pathname == "/mapa.html") { // ADICIONA UM SISTEMA DE BUSCA MELHOR NO MAPA DE FILMES
  86. Build_UI_Search(link);
  87. } else {
  88. Build_UI_Main();
  89. }
  90. }
  91. function Build_UI_Search(link) {
  92. let search = "";
  93. if (link.search != "") { // APLICA PARAMETROS DE PESQUISA
  94. search = link.searchParams.get('search');
  95. }
  96. document.getElementById("cool_find_div").remove(); // Deleta aquele botão de procurar que fica no inferior direito
  97. let mainspan = getElementByXpath("//span[@style='color: rgb(255, 255, 255);']/span");
  98. let clonemainspan = mainspan.cloneNode(true);
  99. let maindiv = document.createElement("div");
  100. maindiv.style = "margin: 20px;color:white;background-color:rgb(20,20,20)";
  101. maindiv.id = "divprincipal";
  102. maindiv.append(clonemainspan);
  103. document.body.append(maindiv);
  104. mainspan.remove();
  105. let listadefilmes = DM.Construir_Array_Lista_FilmesSeries();
  106. maindiv.childNodes[0].childNodes[1].childNodes[0].remove();
  107. // ADICIONA UMA NOVA BARRA DE PESQUISA
  108. let barra = maindiv.childNodes[0].childNodes[1];
  109. let div = document.createElement("div");
  110. // Avisar ao usuario que o site foi modificado
  111. addlabel(div, "A pagina foi modificado pelo script, removendo o botão de pesquisar e adicionando um sistema de busca melhor. Os r###tado da pesquisa aparecerão abaixo. A pesquisa é com base na lista disponivel abaixo");
  112. div.append(document.createElement("br"));
  113. addbutton(div, "Ver lista completa", "", () => {
  114. maindiv.childNodes[1].style.display = "block";
  115. }, "150;30");
  116. div.append(document.createElement("hr"));
  117. addlabel(div, "Nome do Filme : ");
  118. let _nomefilmeinput = addinput(div, search, "Digite o nome do filme", "text", "inputnome");
  119. _nomefilmeinput.style.width = "100%";
  120. _nomefilmeinput.placeholder = "Ex:. Vingadores, Bob Esponja, One piece..."
  121. _nomefilmeinput.oninput = () => { getR###lts(listadefilmes) };
  122. div.append(document.createElement("hr"));
  123. addlabel(div, "Ano : ");
  124. div.append(document.createElement("br"));
  125. let anoinput = addinput(div, "", "Ano do filme\r\nDeixe vazio para ignorar", "text", "anoinput");
  126. anoinput.placeholder = "Ex:. 2012";
  127. anoinput.oninput = () => { getR###lts(listadefilmes) };
  128. div.append(document.createElement("hr"));
  129. addlabel(div, "Tipo de pesquisa : ");
  130. div.append(document.createElement("br"));
  131. let typesearch = [
  132. "Contém texto",
  133. "Pesquisa Linear",
  134. ]
  135. var dropdowntypesearch = document.createElement("select");
  136. dropdowntypesearch.id = "typesearch";
  137. dropdowntypesearch.style = "font-size:16px";
  138. dropdowntypesearch.oninput = () => { getR###lts(listadefilmes) };
  139. createOptions(dropdowntypesearch, typesearch);
  140. div.append(dropdowntypesearch);
  141. div.append(document.createElement("hr"));
  142. addlabel(div, "Resolução : ");
  143. div.append(document.createElement("br"));
  144. let _resnone = addinput(div, "Nenhum", "", "checkbox", "resnone");
  145. _resnone.onclick = () => {
  146. document.getElementById("resnone").checked = true;
  147. document.getElementById("res1080p").checked = false;
  148. document.getElementById("res720p").checked = false;
  149. document.getElementById("res480p").checked = false;
  150. getR###lts(listadefilmes);
  151. };
  152. addinput(div, "1080p", "", "checkbox", "res1080p").onclick = () => {
  153. document.getElementById("resnone").checked = false;
  154. document.getElementById("res1080p").checked = true;
  155. document.getElementById("res720p").checked = false;
  156. document.getElementById("res480p").checked = false;
  157. getR###lts(listadefilmes);
  158. };
  159. addinput(div, "720p", "", "checkbox", "res720p").onclick = () => {
  160. document.getElementById("resnone").checked = false;
  161. document.getElementById("res1080p").checked = false;
  162. document.getElementById("res720p").checked = true;
  163. document.getElementById("res480p").checked = false;
  164. getR###lts(listadefilmes);
  165. };
  166. addinput(div, "480p", "", "checkbox", "res480p").onclick = () => {
  167. document.getElementById("resnone").checked = false;
  168. document.getElementById("res1080p").checked = false;
  169. document.getElementById("res720p").checked = false;
  170. document.getElementById("res480p").checked = true;
  171. getR###lts(listadefilmes);
  172. };
  173. _resnone.checked = true;
  174. div.append(document.createElement("hr"));
  175. addlabel(div, "Outros : ");
  176. div.append(document.createElement("br"));
  177. addinput(div, "Dublado", "", "checkbox", "dubinput").onclick = () => { getR###lts(listadefilmes) };
  178. div.append(document.createElement("br"));
  179. addinput(div, "Legendado", "", "checkbox", "leginput").onclick = () => { getR###lts(listadefilmes) };;
  180. div.append(document.createElement("br"));
  181. addinput(div, "Nacional", "", "checkbox", "nacinput").onclick = () => { getR###lts(listadefilmes) };;
  182. div.append(document.createElement("hr"));
  183. addlabel(div, "R###ltado : ");
  184. div.append(document.createElement("br"));
  185. let r###ltados = document.createElement("div");
  186. r###ltados.id = "r###lts";
  187. r###ltados.style = "padding:20px;background-color: rgb(10, 10, 10); border: solid rgb(50, 50, 50);";
  188. div.append(r###ltados);
  189. maindiv.append(div)
  190. maindiv.insertBefore(div, maindiv.childNodes[0])
  191. maindiv.childNodes[1].style.display = "none";
  192. if (link.search != "") {
  193. getR###lts(listadefilmes);
  194. }
  195. }
  196. function Build_UI_Main() {
  197. let inputgroup = getElementByXpath("//div[@class='input-group']");
  198. if (inputgroup.parentNode.className != "search-channel") {
  199. // Cria botão de procurar site
  200. let sitesearchspan = document.createElement("span");
  201. sitesearchspan.className = "input-group-btn";
  202. let sitesearchspanbutton = document.createElement("span");
  203. sitesearchspanbutton.innerHTML = "🔎📚";
  204. sitesearchspanbutton.title = "Pesquisar no Mapa do Site";
  205. sitesearchspanbutton.onclick = () => {
  206. let input = document.getElementById("pm-search").value;
  207. window.location.href = `https://redecanais.zip/mapa.html?search=${input}`
  208. }
  209. sitesearchspanbutton.className = "btn btn-default";
  210. sitesearchspan.append(sitesearchspanbutton);
  211. let filmesearchspan = document.createElement("span");
  212. filmesearchspan.className = "input-group-btn";
  213. let filmesearchspanbutton = document.createElement("span");
  214. filmesearchspanbutton.innerHTML = "🔎🎥";
  215. filmesearchspanbutton.title = "Pesquisar no Mapa de Filmes";
  216. filmesearchspanbutton.onclick = () => {
  217. let input = document.getElementById("pm-search").value;
  218. window.location.href = `https://redecanais.zip/mapafilmes.html?search=${input}`
  219. }
  220. filmesearchspanbutton.className = "btn btn-default";
  221. filmesearchspan.append(filmesearchspanbutton);
  222. inputgroup.append(sitesearchspan);
  223. inputgroup.append(filmesearchspan);
  224. }
  225. let barra = document.getElementById("content-main");
  226. let div = document.createElement("div");
  227. div.id = "BARRA";
  228. if (barra != null) {
  229. // ADICIONA BOTÕES
  230. let b2 = document.createElement("button");
  231. b2.setAttribute("class", "btn btn-default");
  232. b2.innerText = "📚Mapa do Site📚";
  233. div.append(b2);
  234. b2.onclick = () => {
  235. window.open("/mapa.html");
  236. };
  237. let b3 = document.createElement("button");
  238. b3.setAttribute("class", "btn btn-default");
  239. b3.innerText = "🎥Mapa de Filmes🎥";
  240. div.append(b3);
  241. b3.onclick = () => {
  242. window.open("/mapafilmes.html");
  243. };
  244. barra.append(div);
  245. barra.insertBefore(div, barra.childNodes[0])
  246. if (document.getElementsByName("Player")[0] != null) { // Se houver um player de video, adicione esse botão
  247. let b = document.createElement("button");
  248. b.setAttribute("class", "btn btn-default");
  249. b.innerText = "💿Redirecionar ao Url do Filme💿";
  250. div.append(b);
  251. b.onclick = () => {
  252. window.location.href = document.getElementsByName("Player")[0].src;
  253. };
  254. CarregarListaDeEpisódios();
  255. }
  256. }
  257. // Apaga aquela barra de comentarios
  258. if (Config.UI_barra_comentarios == false) {
  259. getElementByXpath("//div[contains(@class,'pm-video-watch-sidebar')]")?.remove();
  260. }
  261. // Apaga aquela barra vermelha onde aparece todos contato do Rede Canais
  262. document.getElementsByClassName("alert alert-danger")[0]?.remove();
  263. // Remove a barra vermelha do Rede Canais TV
  264. document.getElementsByClassName("alert")[0]?.remove();
  265. // Remove Anuncio do rede Cansi TV
  266. const ad = document.getElementsByTagName("center");
  267. if (ad.length != 0) {
  268. ad[ad.length - 1].remove();
  269. }
  270. // Apaga anuncio para apps da Rede Canais
  271. getElementByXpath("//div/a[@href='./android/']").parentNode.remove()
  272. // Apaga aquele texto em baixo
  273. document.getElementsByClassName("col-xs-12 col-sm-12 col-md-10")[1]?.remove();
  274. // Remove links abaixos
  275. document.getElementsByClassName("col-xs-4 col-sm-2 col-md-2")[0]?.remove();
  276. }
  277. function CarregarListaDeEpisódios() { // INSERE O BOTÃO DE PULAR PRO PROXIMO EPISÓDIO
  278. /*
  279. Quando você estiver assistindo uma serie, nesta pagina não amazena nenhum link que leva ao proximo episodio, ou seja, o usuário teria que procurar sozinho o proximo episódio saindo da propria pagina e eu terei que usar fetch para solucionar isso
  280. - O que eu fiz: fiz um codigo que pega nome da serie a partir do nome disponivel que tem no site e cria um link, nesse link é onde fica a lista de episodios
  281. Ex : "https://redecanais.dad/loki-1a-temporada-episodio-01-proposito-glorioso_fb7c023db.html" >>> "https://redecanais.dad/browse-loki-videos-1-date.html" (Acredito eu que todas as series seguem esse formato de url)
  282. - Como nos temos a temporada atual e o eposodio atual, apenas pegaremos o proximo episodio e criarmos o botão, esté e o funcionamento dessa função
  283. */
  284. if (DM.Get_Nome_Serie_Completo(2) != null && !DM.Get_Nome_Serie_Completo(2).toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g, "").includes("episodio")) {
  285. return;
  286. }
  287. u = window.document.URL;
  288. let link, nomeepisodio;
  289. if (DM.Get_Nome_Serie_Completo(2) != null)
  290. link = DM.Construir_link(DM.Get_Apenas_Nome(DM.Get_Nome_Serie_Completo(2)));
  291. else if (DM.Get_Nome_Serie_Completo(1) != null)
  292. link = DM.Construir_link(DM.Get_Apenas_Nome(DM.Get_Nome_Serie_Completo(1)));
  293. else
  294. link = DM.Construir_link(DM.Get_Nome_Serie_Completo(0));
  295. nomeepisodio = DM.Get_Eposide_Name(DM.Get_Nome_Serie_Completo(2));
  296. console.log(link);
  297. obter_pagina_lista_episodios(link);
  298. function obter_pagina_lista_episodios(url, tentativa = 0) {
  299. fetch(url)
  300. .then(function (response) {
  301. // When the page is loaded convert it to text
  302. return response.text()
  303. })
  304. .then(function (html) {
  305. // Initialize the DOM parser
  306. var parser = new DOMParser();
  307. // Parse the text
  308. var doc = parser.parseFromString(html, "text/html");
  309. // Obtem o elemento da lista de episodios e insere na pagina atual
  310. let episodiosdiv = doc.querySelector(".pm-category-description");
  311. let div = document.getElementById("BARRA");
  312. if (document.getElementById("episodiodiv") == null) {
  313. episodiosdiv.id = "episodiodiv";
  314. episodiosdiv.style.display = "none";
  315. episodiosdiv.children[0].children[0].remove();
  316. episodiosdiv.children[0].children[0].remove();
  317. div.append(episodiosdiv);
  318. div.insertBefore(episodiosdiv, div.childNodes[div.childNodes.length - 1]);
  319. }
  320. if (document.getElementById("btnlistaepisodios") == null) {
  321. let listepisodios = document.createElement("button");
  322. listepisodios.setAttribute("class", "btn btn-default");
  323. listepisodios.innerText = "🔢Lista de Episódios";
  324. listepisodios.id = "btnlistaepisodios";
  325. listepisodios.title = "Disponibiliza a lista de eposódios na pagina atual";
  326. listepisodios.onclick = () => {
  327. if (episodiosdiv.style.display == "none")
  328. episodiosdiv.style.display = "block";
  329. else
  330. episodiosdiv.style.display = "none";
  331. };
  332. div.append(listepisodios);
  333. div.insertBefore(listepisodios, div.childNodes[0]);
  334. }
  335. let ListaEpisódios = DM.Construir_Array_Episodios(nomeepisodio);
  336. let nextepisode = document.createElement("button");
  337. nextepisode.setAttribute("class", "btn btn-default");
  338. nextepisode.innerText = "▶️Proximo Episódio";
  339. nextepisode.onclick = () => {
  340. let episodioindex = ListaEpisódios.findIndex((e) => e[0] == nomeepisodio)
  341. window.location.href = ListaEpisódios[episodioindex + 1][2];
  342. };
  343. div.append(nextepisode);
  344. div.insertBefore(nextepisode, div.childNodes[0]);
  345. console.log("Serie encontrada");
  346. })
  347. .catch(function (err) {
  348. console.log(url);
  349. if (tentativa == 0) {
  350. console.error('Serie não encontrada, tentando novamente', err);
  351. link = DM.Construir_link(DM.Get_Apenas_Nome(DM.Get_Nome_Serie_Completo(2)), 1);
  352. obter_pagina_lista_episodios(link, 1);
  353. }
  354. else if (tentativa == 1) {
  355. console.error('Serie não encontrada. tentando novamente(2)', err);
  356. link = DM.Construir_link(DM.Get_Apenas_Nome(DM.Get_Nome_Serie_Completo(2), true));
  357. obter_pagina_lista_episodios(link, 2);
  358. } else if (tentativa == 2) {
  359. console.error('Serie não encontrada. tentando novamente(3)', err);
  360. link = DM.Construir_link(DM.Get_Apenas_Nome(DM.Get_Nome_Serie_Completo(2)), 3);
  361. obter_pagina_lista_episodios(link, 3);
  362. } else if (tentativa == 3) {
  363. console.error('Serie não encontrada. tentando novamente(4)', err);
  364. link = DM.Construir_link(DM.Get_Apenas_Nome(DM.Get_Nome_Serie_Completo(2)), 4);
  365. obter_pagina_lista_episodios(link, 4);
  366. }
  367. });
  368. }
  369. }
  370. window.onload = () => {
  371. if (u.includes("contador.php?static=true") || u.startsWith("https://sinalpublico")) // IGNORAR A EXECUÇÃO DO SCRIPT NESSES URL
  372. return;
  373. Load_Config();
  374. }
  375. window.document._DM = function () { return DM };
  376. var DM = { // Funções para decifrar link e construir arrays
  377. Get_Num_Season(e) {
  378. let m = e.toLowerCase().match(/(\d+)a-temporada/);
  379. if (m != null) {
  380. let int = parseInt(m[1]);
  381. if (int == 0)
  382. int++;
  383. return int;
  384. }
  385. else
  386. return undefined
  387. },
  388. Get_Num_Episode(e) {
  389. let a = e.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g, "");
  390. if (a.match(/episodio-(\d+)/) != null)
  391. a = a.match(/episodio-(\d+)/)[1];
  392. else
  393. a = a.match(/episodio:-(\d+)/)[1];
  394. return a;
  395. },
  396. Get_Eposide_Name(name) {
  397. let array = name.split("-");
  398. return array[array.length - 1].trim();
  399. },
  400. Get_Nome_Serie_Completo(e = 0) { // Obtem o nome da serie ou filme
  401. switch (e) {
  402. case 0:
  403. return window.document.URL; // Exemplo : https://redecanais.dad/loki-1a-temporada-episodio-01-proposito-glorioso_fb7c023db.html
  404. case 1:
  405. return pm_video_data.url; // Exemplo : '/loki-1a-temporada-episodio-01-proposito-glorioso_fb7c023db.html'
  406. case 2:
  407. return getElementByXpath("//h1[@itemprop='name']").innerText.toLowerCase(); // Exemplo : Loki - 1ª Temporada - Episódio 01 - Propósito Glorioso
  408. default:
  409. return ""
  410. }
  411. },
  412. Get_Apenas_Nome(nome, semespaços = false) {
  413. if (nome.includes(" - ")) // converte em link cru
  414. nome = DM.Construir_Nome_Serie_Cru(nome);
  415. if (nome.includes("temporada"))
  416. nome = nome.match(/([^\/]+)-\d+a-temporada-/)[1];
  417. else
  418. nome = nome.match(/([^]+)-episodio-/)[1];
  419. nome = nome.replace(/-legendado/g, "");
  420. if (semespaços == true)
  421. nome = nome.replaceAll("-", "");
  422. return nome;
  423. },
  424. Construir_Nome_Serie_Cru(nome) {
  425. // Exemplo : "Os Simpsons - 1ª Temporada - Episodio 01 - O prêmio de Natal"
  426. nome = nome.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g, ""); // deixa minusculo e remove acéntos
  427. nome = nome.replace(/[\/\(\)\#\.\,]+/g, "")
  428. nome = nome.replaceAll("ª", "a");
  429. nome = nome.split(" ").join("-")
  430. nome = nome.replaceAll("---", "-")
  431. return nome; // Deve retornar : 'os-simpsons-1a-temporada-episodio-01-o-prêmio-de-natal'
  432. },
  433. Construir_link(nome, type = 0) {
  434. switch (type) {
  435. case 0:
  436. return new URL(window.document.URL).origin + "/browse-" + nome.replaceAll("&", "and") + "-videos-1-date.html";
  437. case 1:
  438. return new URL(window.document.URL).origin + "/browse-" + nome.replaceAll("&", "e") + "-videos-1-date.html";
  439. case 2:
  440. return new URL(window.document.URL).origin + "/browse-" + nome.replaceAll(" ", "") + "-videos-1-date.html";
  441. case 3:
  442. return new URL(window.document.URL).origin + "/browse-" + nome.replaceAll("&", "to") + "-videos-1-date.html";
  443. case 4:
  444. return new URL(window.document.URL).origin + "/browse-" + nome.replaceAll(" ", "to") + "-videos-1-date.html";
  445. default:
  446. return ""
  447. }
  448. },
  449. Construir_Array_Episodios(episodioatual) { // DECIFRAR OS ELEMENTOS DA LISTA DE ÉPISÓDIO
  450. let _array = [];
  451. try {
  452. let epdiv = document.getElementById("episodiodiv").children[0];
  453. for (let i = 0; i < epdiv.childNodes.length; i++) {
  454. const element = epdiv.childNodes[i];
  455. if (element.nodeName == "#text") {
  456. if (element.textContent == " / " || element.textContent == "" || element.textContent == " ")
  457. continue;
  458. let link, epnumber;
  459. let nomeep = element.textContent.split("-")[0].trim().toLocaleLowerCase();
  460. // ENCONTRA O LINK DO PROXIMO EPISÓDIO
  461. link = element.nextElementSibling.href || element.nextElementSibling.children[0].href;
  462. // PINTA DE AMARELO O EPISÓDIO ATUAL
  463. if (nomeep == episodioatual)
  464. element.previousSibling.style.color = "yellow";
  465. epnumber = element.previousSibling.textContent || element.previousSibling.innerHTML;
  466. epnumber = epnumber.split("-")[0].trim().toLocaleLowerCase()
  467. // FINALIZA
  468. _array.push([nomeep, epnumber, link]);
  469. }
  470. }
  471. console.log(_array);
  472. return _array;
  473. } catch (error) {
  474. alert(`função encontrou um erro ao decifrar elementos da lista de episódios, essa função ainda não é perfeita, veja o console`);
  475. console.error("Erro na função : ", error, _array);
  476. }
  477. },
  478. Construir_Array_Lista_FilmesSeries() {
  479. let _array = []; // Essa lista é no formato array : [[NOME DO FILME, LINK], ...]
  480. let tempelem = []; // variavel temporaria
  481. let listelem = document.getElementById("divprincipal").childNodes[0].childNodes;
  482. for (let i = 11; i < listelem.length; i++) {
  483. const node = listelem[i];
  484. if (node.nodeName.toLowerCase() == "#text") { // elemento de texto
  485. tempelem.push(node.textContent);
  486. }
  487. else if (node.nodeName.toLowerCase() == "a") { // elemento link
  488. let finaltext = "";
  489. for (let v = 0; v < tempelem.length; v++) {
  490. const element = tempelem[v];
  491. finaltext += element;
  492. }
  493. _array.push([finaltext.replaceAll("\n", ""), node]);
  494. tempelem = [];
  495. } else if (node.nodeName.toLowerCase() == "b") { // elemento negrito
  496. if (node.hasChildNodes()) {
  497. if (node.childNodes[0].nodeName.toLowerCase() == "a") { // se dentro houver link do filme dentro do elemento negrito
  498. let finaltext = "";
  499. for (let v = 0; v < tempelem.length; v++) {
  500. const element = tempelem[v];
  501. finaltext += element;
  502. }
  503. _array.push([finaltext.replaceAll("\n", ""), node.childNodes[0]]);
  504. tempelem = [];
  505. }
  506. else { // caso for outra coisa no negrito
  507. if (node.innerHTML == 'Números &amp; Símbolos') // ignorar esse elemento
  508. continue;
  509. tempelem.push(node.innerHTML);
  510. }
  511. } else {
  512. tempelem.push(node.innerHTML);
  513. }
  514. }
  515. }
  516. console.log("Lista de filmes/series : ", _array);
  517. return _array;
  518. }
  519. }
  520. window.document.dm = DM;
  521. function Save_Config(name, value) {
  522. // SALVA O VALOR DE UMA VARIAVEL E MANTEM OS OUTROS
  523. if (name != undefined) {
  524. Config[name] = value;
  525. GM.setValue("Config", Config);
  526. return;
  527. }
  528. // SALVA TUDO
  529. GM.setValue("Config", Config);
  530. };
  531. async function Load_Config() {// OBTEM OS VALORES DA CONFIGURAÇÃO
  532. let _config = await GM.getValue("Config");
  533. if (_config != undefined) {
  534. for (var k in _config) {
  535. Config[k] = _config[k]
  536. }
  537. }
  538. console.log("Script Settings", _config);
  539. // COMEÇA A MODIFICAÇÃO DA PAGINA DO REDE CANAIS
  540. IniciarScript();
  541. };
  542. function getR###lts(_array, index = 0, clear = true) { // Obtem os r###ltado da procura
  543. let divr###lts = document.getElementById("r###lts");
  544. if (clear == true)
  545. divr###lts.innerHTML = "";
  546. const _originalinput = document.getElementById("inputnome").value;
  547. const _input = document.getElementById("inputnome").value.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g, ""); // deixa minusculo e remove acentos;
  548. let anoinput = document.getElementById("anoinput");
  549. var find = 0;
  550. for (index; index < _array.length; index++) {
  551. let filme = _array[index];
  552. function _othersvalues() {
  553. if (anoinput != "")
  554. if (!filme[0].toLowerCase().includes(anoinput.value.toLowerCase()))
  555. return true;
  556. if (document.getElementById("dubinput").checked == true)
  557. if (!filme[0].toLowerCase().includes("dublado"))
  558. return true;
  559. if (document.getElementById("leginput").checked == true)
  560. if (!filme[0].toLowerCase().includes("legendado"))
  561. return true;
  562. if (document.getElementById("nacinput").checked == true)
  563. if (!filme[0].toLowerCase().includes("(nacional)"))
  564. return true;
  565. if (document.getElementById("res1080p").checked == true)
  566. if (!filme[0].toLowerCase().includes("1080p"))
  567. return true;
  568. if (document.getElementById("res720p").checked == true)
  569. if (!filme[0].toLowerCase().includes("720p"))
  570. return true;
  571. if (document.getElementById("res480p").checked == true)
  572. if (!filme[0].toLowerCase().includes("480p"))
  573. return true;
  574. return false;
  575. }
  576. if (document.getElementById("typesearch").selectedIndex == 0) { // PESQUISA USANDO "INCLUDES"
  577. if (!filme[0].toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g, "").includes(_input)) {
  578. continue;
  579. }
  580. if (_othersvalues()) continue;
  581. } else { // PESQUISA LINEAR
  582. if (_input.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g, "") !== filme[0].toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g, "").slice(0, _input.length)) {
  583. continue;
  584. }
  585. if (_othersvalues()) continue;
  586. }
  587. let _label = addlabel(divr###lts, filme[0], 0);
  588. if (document.getElementById("typesearch").selectedIndex == 0) {
  589. const regEx = new RegExp(_originalinput, "ig");
  590. _label.innerHTML = _label.innerHTML.replaceAll(regEx, "<span style='color:yellow'>" + _originalinput + "</span>");
  591. } else {
  592. let strarray = (_label.innerHTML.substring(0, _originalinput.length) + "|" + _label.innerHTML.substring(_originalinput.length)).split("|");
  593. _label.innerHTML = "<span style='color:yellow'>" + strarray[0] + "</span>" + strarray[1];
  594. }
  595. divr###lts.append(filme[1].cloneNode(true)) // URL
  596. divr###lts.append(document.createElement("br"));
  597. find++;
  598. if (find > 20) // Esse é o comprimento da lista, caso chege ao limite, aparecera o botão de "Mostrar mais"
  599. {
  600. addbutton(divr###lts, "Mostrar Mais", "Mostra mais filmes", (e) => {
  601. e.target.remove();
  602. getR###lts(_array, index + 1, false);
  603. }, "150;30");
  604. break;
  605. }
  606. }
  607. }
  608. function addlabel(elem, text, type = 0) {
  609. const _elementotipo = type == 0 ? "span" : "p"
  610. const l = document.createElement(_elementotipo);
  611. l.innerHTML = text;
  612. elem.append(l)
  613. return l;
  614. }
  615. function addinput(elem, text = "", title = "", type = "text", id = "") {
  616. const _input = document.createElement("input");
  617. _input.type = type;
  618. _input.innerHTML = text;
  619. _input.value = text;
  620. _input.title = title;
  621. _input.style = "font-size:16px";
  622. _input.setAttribute("id", id);
  623. elem.append(_input);
  624. if (type == "checkbox") {
  625. addlabel(elem, text, 0);
  626. }
  627. return _input;
  628. }
  629. function addbutton(elem, text, title, func, width = "100;30") {
  630. const b = document.createElement("button");
  631. b.innerHTML = text
  632. b.title = title;
  633. b.onclick = func;
  634. let w = width.split(";")[0];
  635. let h = width.split(";")[1];
  636. b.style = ` display: flex;
  637. justify-content: center;
  638. align-items: center;
  639. position: relative;
  640. width: ${w}px;
  641. height: ${h}px;
  642. margin: 5px;
  643. border: 10px solid var(--base-color);
  644. font-size: 16px;
  645. cursor: pointer;`;
  646. elem.append(b);
  647. }
  648. function createOptions(selectelem, list) { // CRIA OPÇÕES
  649. list.forEach((a, i) => {
  650. let _op = document.createElement("option");
  651. _op.value = i;
  652. if (a.textContent != undefined)
  653. _op.innerHTML = a.textContent;
  654. else
  655. _op.innerHTML = a;
  656. selectelem.append(_op);
  657. });
  658. }
  659. function capitalizeFirstLetter(string) {
  660. return string.charAt(0).toUpperCase() + string.slice(1);
  661. }
  662. var debug = false; // TESTES NO MEU SCRIPT DEIXE "false" PARA NÃO USAR ESSA FUNÇÃO. ISSO FAZ COM QUE O REDE CANAIS NÃO BLOQUEIE A PÁGINA INTEIRA
  663. if (debug == true) {
  664. const window = unsafeWindow;
  665. GM_registerMenuCommand("(DEBUG) Abrir Console", () => { // ABRIR CONSOLE
  666. window.prompt(`Rede Canais automaticamente fecha a página quando usúarios tentam usar o console, para resolver isso :
  667. Com essa caixa de alerta aberta, Aperte F12 para abrir o console, clique em "Network" e bloqueie a solicitação "cdn.jsdelivr.net/npm/console-ban@4.1.0/dist/console-ban.min.js"
  668. - Clique Ctrl+F8 para desativar o loop do debugger infinito caso estiver sendo executado
  669. - Já existe um script no greasyfork que desbloqueia o clique com o botão direito se você quiser usar`);
  670. });
  671. // DESATIVA FUNÇÃO DE FECHAR A PAGINA E DESATIVA O HISTÓRICO DE VOLTAR
  672. void (window.ConsoleBan = undefined);
  673. void (window.closeWindow = undefined);
  674. void (window.close = undefined);
  675. void (history.go = undefined);
  676. void (history.back = undefined);
  677. void (history.forward = undefined);
  678. void (window.history.go = undefined);
  679. void (window.history.back = undefined);
  680. void (window.history.forward = undefined);
  681. void (window.open = undefined);
  682. // EVITAR SAIR DA PAGINA
  683. /*
  684. function internalHandler(e) {
  685. e.preventDefault(); // required in some browsers
  686. e.returnValue = ""; // required in some browsers
  687. return "Custom message to show to the user"; // only works in old browsers
  688. }
  689. if (window.addEventListener) {
  690. window.addEventListener('beforeunload', internalHandler, true);
  691. } else if (window.attachEvent) {
  692. window.attachEvent('onbeforeunload', internalHandler);
  693. }
  694. window.onbeforeunload = internalHandler;
  695. window.close = function () {
  696. alert("rede canais forçou a fechar a pagina");
  697. }*/
  698. }
  699. })();