Created
October 11, 2021 14:03
-
-
Save gabrielqmatos88/8b89076d9c90bd04ebf2ee9db58ce94a to your computer and use it in GitHub Desktop.
Tampermonkey - Skip ads (Vuejs) baixar.net
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // ==UserScript== | |
| // @name Baixar filmes | |
| // @namespace http://tampermonkey.net/ | |
| // @version 0.1 | |
| // @description try to take over the world! | |
| // @author You | |
| // @match https://www.baixarfilmetorrent.net/* | |
| // @match https://www.baixafilme.net/* | |
| // @icon https://www.google.com/s2/favicons?domain=baixarfilmetorrent.net | |
| // @require https://unpkg.com/[email protected]/dist/vue.min.js | |
| // @grant none | |
| // ==/UserScript== | |
| (function () { | |
| 'use strict'; | |
| function addScript(src) { | |
| var s = document.createElement('script'); | |
| s.setAttribute('src', src); | |
| document.body.appendChild(s); | |
| } | |
| if (!window.$) { | |
| addScript('https://unpkg.com/[email protected]/dist/jquery.min.js'); | |
| } | |
| function initApp() { | |
| const parseMovie = (elem, isSerie) => { | |
| const cells = $(elem).parents('tr').find('td'); | |
| const legendado = /legendado/i.test($($(elem).parents('table').find('th > strong')).text()); | |
| return { | |
| href: $(elem).attr('href'), | |
| text: $(elem).text().trim(), | |
| res: $(cells[0]).text().trim(), | |
| format: $(cells[3]).text().trim(), | |
| cinema: /cinema/i.test($(cells[4]).text()), | |
| size: $(cells[2]).text().trim(), | |
| legendado: legendado, | |
| isSerie: isSerie | |
| }; | |
| }; | |
| const parseSerie = (elem, isSerie) => { | |
| const cells = $(elem).parents('tr').find('td'); | |
| const legendado = /legendado/i.test($($(elem).parents('table').find('th > strong')).text()); | |
| return { | |
| href: $(elem).attr('href'), | |
| text: $(elem).text().trim(), | |
| res: $(cells[1]).text().trim(), | |
| format: $(cells[4]).text().trim(), | |
| cinema: false, | |
| size: $(cells[3]).text().trim(), | |
| epName: $(cells[0]).text().trim(), | |
| legendado: legendado, | |
| isSerie: isSerie | |
| }; | |
| }; | |
| const parseLinks = () => { | |
| const tmpLinks = []; | |
| $('a').each((i, elem) => { | |
| if (/magnet:/i.test($(elem).attr('href'))) { | |
| const isSerie = !/baixar filme:/i.test($('.entry-content').text()); | |
| console.log('isSerie', isSerie); | |
| const parseFn = isSerie ? parseSerie : parseMovie; | |
| tmpLinks.push(parseFn(elem, isSerie)); | |
| } | |
| }); | |
| console.log('tmpLinks', tmpLinks); | |
| return tmpLinks.sort((a, b) => { | |
| if (!a.isSerie) { | |
| return a.cinema - b.cinema; | |
| } else { | |
| return a.epName - b.epName; | |
| } | |
| }); | |
| }; | |
| const list = document.querySelector('.tbl-mv-list'); | |
| var wrapper = document.createElement('div'); | |
| wrapper.id = 'baixa-gratis'; | |
| document.body.appendChild(wrapper); | |
| parseLinks(); | |
| var wrapperStyles = { | |
| position: 'fixed', | |
| width: '250px', | |
| height: '400px', | |
| 'zIndex': '999999', | |
| bottom: '20px', | |
| right: '20px', | |
| border: '1px solid red' | |
| }; | |
| const cssStyles = ` | |
| .download-box { | |
| position: fixed; | |
| width: 250px; | |
| z-index: 999999; | |
| top: 75px; | |
| left: 20px; | |
| border: 2px solid #333; | |
| display: flex; | |
| flex-direction: column; | |
| } | |
| .download-header { | |
| background: #333; | |
| color: #fff; | |
| box-sizing: border-box; | |
| padding: 7px; | |
| } | |
| .download-header h3 { | |
| margin: 0; | |
| padding: 0; | |
| } | |
| .download-link { | |
| box-sizing: border-box; | |
| display: flex; | |
| justify-content: space-between; | |
| background: #efeeee; | |
| } | |
| .download-link > a { | |
| padding: 7px; | |
| text-decoration: underline; | |
| } | |
| .download-link + .download-link { | |
| border-top: 1px solid #cfcfcf; | |
| } | |
| .download-link.cinema > * { | |
| color: #878787; | |
| text-decoration: line-through; | |
| } | |
| .download-container { | |
| display: flex; | |
| flex-direction: column; | |
| flex-grow: 1; | |
| } | |
| .download-container h3 { | |
| background-color: #4264c0; | |
| padding: 3px 7px; | |
| margin: 0; | |
| color: #fff; | |
| } | |
| `; | |
| $('head').append(`<style rel="stylesheet" type="text/css">${cssStyles}</style>`); | |
| Vue.component('down-links', { | |
| props: ['links', 'title'], | |
| methods: { | |
| audio: function (link) { | |
| return link.legendado ? 'LEG' : 'DUB'; | |
| } | |
| }, | |
| template: ` | |
| <div class="download-container" v-if="links && links.length"> | |
| <h3>{{ title }}</h3> | |
| <div class="download-link" :class="{ 'cinema' : link.cinema }" v-for="(link,i) in links" :key="i"> | |
| <a target="_blank" :href="link.href">{{ audio(link) }} - {{link.res}} - {{link.format}} - {{link.size}}</a> | |
| <div> | |
| <span v-if="link.cinema">cinema</span> | |
| </div> | |
| </div> | |
| </div> | |
| ` | |
| }); | |
| new Vue({ | |
| el: wrapper, | |
| data: { | |
| links: parseLinks(), | |
| dublados: [], | |
| legendados: [], | |
| }, | |
| created: function() { | |
| this.dublados = this.links.filter(f => !f.legendado); | |
| this.legendados = this.links.filter(f => f.legendado); | |
| }, | |
| template: ` | |
| <div class='download-box' > | |
| <div class="download-header"> | |
| <h3>Downloads</h3> | |
| </div> | |
| <down-links title="Dublados" :links="dublados"></down-links> | |
| <down-links title="Legendados" :links="legendados"></down-links> | |
| </div>` | |
| }); | |
| }; | |
| window.addEventListener('load', function () { | |
| function addScript(src) { | |
| var s = document.createElement('script'); | |
| s.setAttribute('src', src); | |
| document.body.appendChild(s); | |
| } | |
| if (!window.$) { | |
| addScript('https://unpkg.com/[email protected]/dist/jquery.min.js'); | |
| } | |
| initApp(); | |
| }, false); | |
| // Your code here... | |
| })(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment