NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript== // @name imdb no Legendas.tv // @namespace pootz // @description Poe Link do IMdB do lado do Titulo das Legendas do legendas.tv // @include http://*legendas.tv/download/* // @version 1.9 // @history 1.9 - update url updated // @history 1.8 - fix bug, onde sem http na url ocorreria falha // @history 1.7 - quando o link imdb estiver presente na descricao, adiciona a nota e quantidade de votos ao invez do icone // @history 1.6 - procura pelo ano pra aumentar a precisao de busca pra titulos de mesmo nome e ano diferente // @history 1.5 - adiciona um botao de download logo abaixo do titulo // @history 1.4 - arruma bug pra titulos de legendas com barras // @history 1.3 - coloca o link de download pra baixar a legenda no titulo "azul" a esquerda do imdbIcone imdb // @history 1.2 - resulta no link direto do imdb e nao no de busca (impreciso pra filmes "remakes" de mesmo nome e data diferente // @history 1.1 - adiciona imdbIcone imdb a direita do titulo com link de busca para o mesmo // @history 1.0 - clica no titulo "azul" pra abrir busca do titulo no imdb // @require https://code.jquery.com/jquery-2.1.1.min.js // @updateURL https://openuserjs.org/meta/pootz/imdb_no_Legendas.tv.meta.js // @downloadURL https://openuserjs.org/install/pootz/imdb_no_Legendas.tv.user.js // @grant GM_addStyle // @grant GM_xmlhttpRequest // ==/UserScript== //icones imdbIcone = "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEAYABgAAD/2wBDAAIBAQIBAQICAgICAgICAwUDAwMDAwYEBAMFBwYHBwcGBwcICQsJCAgKCAcHCg0KCgsMDAwMBwkODw0MDgsMDAz/2wBDAQICAgMDAwYDAwYMCAcIDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAz/wAARCAAWADADASIAAhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQAAAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3ODk6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qrezUJteAk5O45UyQXpzARcYqoxqJkkZqcCFkJEc+e4GLzgihXKmStCSNE+hvqxBrtqb6qGwxocmMHSzQmRy0x52q4IaREJYjLWiDsimta4FrnYj9q+bfSBeyeNHdHCdLXUvOuM7QIUApfYrskJkc0clvuTTxCTscb//DQc0WhXfAznRvUzaWxX7B3TuLVSCbcx9VS2I9KZ5Vphc7+vBDEZaySEQERB0awgilnsd+WO8DFyU9CloMg5IaRaH+OT77oaAzKZy0pxcD2SICaPCmkhED4i8nv4AAYVo0xtRizPnLLEHak7dnZyqL8syxaFcC8aa7p+7ZEwO0t3Adow+pcRW8QhICsEAqcjj4bO8gC4JMRlRInuHZsQFvQPFcAHwHycv3i8UmMhps/5BDP/cblak45YvQH8Akif3tF8n0IyAAAAAElFTkSuQmCC"; //pega usuario, descricao, download link var usuario = $("span.nume").text(); var t2 = $("div.t2 p").text(); var download = $("button.icon_arrow").attr("onclick"); //regex dos links imdb a procurar var procura = /(http:\/\/www.imdb.com\/title\/tt\d{7})|(http:\/\/imdb.com\/title\/tt\d{7})|(www.imdb.com\/title\/tt\d{7})/i; //acha titulo e corrige possiveis caracteres q podem bugar a busca h3 = $("h3:first"); buscaTitulo = h3.text(); //se tem barra / no titulo if (buscaTitulo.indexOf("/") != -1) { if (buscaTitulo.indexOf("'s") != -1) { var j = buscaTitulo.indexOf("/"); if (buscaTitulo.charAt(j - 1) == " ") { buscaTitulo = buscaTitulo.slice(0, j - 1); } else { buscaTitulo = buscaTitulo.slice(0, j); } } else { var i = buscaTitulo.lastIndexOf('/'); if (buscaTitulo.substring(i + 1).charAt(0) == " ") { buscaTitulo = buscaTitulo.substring(i + 2); } else { buscaTitulo = buscaTitulo.substring(i + 1); } } trataTitulo(); } else { trataTitulo(); } //busca por link do imdb na descricao, e pega o primeiro encontrado e insere a direita do titulo //(nao busca, se uploader for creepysubs, por adicionarem mtos links imdb nao relacionados ao filme if ( procura.test(t2) ) { // && usuario != "creepysubs") var imdb = t2.match(procura)[0]; if (imdb.indexOf("http") == -1) { imdb = "http://" + imdb; } GM_xmlhttpRequest ( { method: "GET", url: imdb, onload: imdbRate }); } //inicia busca do titulo da legenda no imdb else { site = "http://www.imdb.com/find?q=" + buscaTitulo + "&s=tt&exact=true"; GM_xmlhttpRequest ( { method: "GET", url: site, onload: pesquisaIMdB }); } //insere link imdb ao lado do titulo function insere(imdb) { if (imdb != "undefined" || imdb !== null) { var imdbLink = '<h3>' + h3.text() + '</h3><br><a id="download" onclick="' + download + '" target="_blank"><img src="' + downIcone + '"></img></a><a id="imdb" href="' + imdb + '" target="_blank"><img src="' + imdbIcone + '"></img></a>'; h3.replaceWith(imdbLink); } } function insereRate(imdb, rates) { if (rates != "undefined" || rates !== null) { var imdbLink = '<h3>' + h3.text() + '</h3><br><a id="download" onclick="' + download + '" target="_blank"><img src="' + downIcone + '"></img></a><a id="imdb" href="' + imdb + '" target="_blank"><font color="blue" size="3"><b>' + rates + '</b></font></a>'; h3.replaceWith(imdbLink); } else { insere(imdb); } } function imdbRate(object) { var resp = $(object.responseText); var rate = resp.find('span[itemprop="ratingValue"]'); var count = resp.find('span[itemprop="ratingCount"]'); var rates = rate[0].textContent + " (" + count[0].textContent + ")"; insereRate(imdb, rates); } //encapsula xmlhttprequest pra nao perder dados, acha links e titulos da pesquisa, e seta link imdb function pesquisaIMdB(objeto) { var respDoc = $(objeto.responseText); var resultados = respDoc.find('.result_text'); var achou = false; var h1 = $("h1:first").text().trim(); var ano = /20[0-3][0-9]|19[0-9][0-9]/; if (ano.test(h1)){ pegaAno = h1.match(ano)[0]; } else { pegaAno = null; } for (var i = 0; i < resultados.length; i++) { var achaTitulo = resultados[i].textContent.toLowerCase(); var iLink = resultados[i].getElementsByTagName("a")[0].getAttribute("href"); if (pegaAno !== null) { if (achaTitulo.indexOf( pegaAno ) != -1) { achou = true; var achaLink = iLink.slice( iLink, iLink.indexOf("/?") ); imdb = "http://www.imdb.com" + achaLink; insere(imdb); break; } } else { if (achaTitulo.indexOf( oTitulo ) != -1) { achou = true; buscaLink = iLink.slice( iLink, iLink.indexOf("/?") ); imdb = "http://www.imdb.com" + buscaLink; insere(imdb); break; } } } if (!achou) { imdb = site; insere(imdb); } } function trataTitulo () { oTitulo = buscaTitulo.toLowerCase(); buscaTitulo = buscaTitulo.replace(/&/g,"%26"); buscaTitulo = buscaTitulo.replace(/\?/g,"%3F"); buscaTitulo = buscaTitulo.replace(/=/g,"%3D"); buscaTitulo = buscaTitulo.replace(/ /g,"+"); } //Posiciona link imdb a direita do titulo GM_addStyle ( ' \ #download { \ position: absolute; \ } \ #imdb { \ position: absolute; \ right: 0px; \ } \ ' );