diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..6d0d7f1 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,60 @@ +TITULKY PLUS Changelog + +v 0.93 +Novinky +- v sekci poždavky po najetí myši na link, zobrazí náhled posteru + +Opravy +- Přepracovaná sekce vlastní požadavky s indikaci časů dokončení +- Přepracované ukládání do Local storage + +Změny +- Odkaz na vyhledávač cizojazyčných titulků na subscene.com v sekci požadavky +- Odkaz na CSFD v detailech titulků + +Zrušené funkce +- Odkaz na vyhledání filmu skrze CSFD.cz v sekci Požadavky +- Zobrazené hodnocení filmu na CSFD v detailech titulků +- Možnost rychlého vložení odkazu na film na ČSFD do poznámky +- Funkce fóra +- V sekci požadavky se nyní dynamicky nahrávají hodnocení filmů na IMDB a ČSFD, případně rok +- V sekci požadavky lze filtrovat filmy dle žánru +- U seriálových titulků možnost vyhledání titulků k celé řadě + +v 0.92 +- Upozornění na nové komentáře pod rozpracovanými titulky + proklik přímo na rozpracované titulky kdekoliv z webu (aktivuje se až při editaci zápisu v rozpracovaných) +- Jestliže je v textu odkaz, vytvoří z něho klasický klikací odkaz (defaultně zapnuto, lze vypnout v nastavení) +- Opraveny některé funkce +- Další drobné úpravy v rozložení +- Volitelná možnost tématických úprav webu na Vánoce, Velikonoce apod. (defaultně zapnuto) +- U seriálových titulků možnost vyhledání titulků k celé řadě +- Vedle počtu nepřečtených komentářů pod vašimi titulky přibylo počítadlo nepřečtených reakcí pod vašimi komentáři +- V sekci požadavky lze filtrovat filmy dle žánru +- V sekci požadavky se nyní dynamicky nahrávají hodnocení filmů na IMDB a ČSFD, případně rok +- Ve vašem profilu jsou graficky zvýrazněny nové komentáře pod vašimi titulky (uvidí pouze aktivní překladatelé) +- U profilu uživatele v bočním menu (vedle počtu bodu) se zobrazuje počet nepřečtených komentářů pod vašimi titulky (uvidí pouze aktivní překladatelé) - aktualizuje se každých 15 minut +- Vzkazy z fóra najedou na daný příspěvek, pokud jste momentálně ve vláknu, kde se příspěvek nachází (není třeba tak načítat celé vlákno znovu) +- Vylepšené odkazování na konkrétní příspěvky na fóru (přesnější, graficky zvýrazněné) +- Vzkazy z fóra nyní odkazují přímo na konkrétní příspěvky na fóru +- U starší verze nahrávání titulků přidáno umazávání nadbytečných znaků při vkládání velikosti filmu +- Možnost rychlého vložení odkazu na film na ČSFD do poznámky +- Předvyplnění formuláře u nového titulku na základě názvu filmu +- Jasně viditelné tlačítko pro editaci stavu rozpracovaného překladu +- Vylepšená sekce vlastní požadavky o indikaci probíhajících překladů a časy dokončení +- Přímé zobrazení verze filmu u výsledků hledání +- Možnost tlačítka premium v menu +- Přidání původní hlavičky webu (lze zapnout v nastavení) +- Vlastní nastavení rozšíření (rozšíření - možnosti) +- Funkce šablony pro automatické předvyplnění poznámek u nových titulek a nového zápisu do rozpracovaných +- Tlačítko Domů pro návrat na hlavní stránku +- Po načtení hlavní stránky je ihned aktivní vyhledávací pole +- U odhadu počtu dní pro dokončení titulek zobrazené odpovídající datum +- Možnost vyhledávat přímou shodu (žádný fulltext) u vyhledávacího boxu nebo jako Další verze u detailu titulku (pouze pro premium uživatele) +- Při vyhledávání titulků jsou zvýrazněny přesné shody názvů +- Přímý odkaz na CSFD v detailech titulků +- Zobrazené hodnocení filmu na CSFD v detailech titulků +- Zobrazené hodnocení filmu na IMDB v detailech titulků +- Odkaz na vyhledání filmu skrze CSFD.cz v sekci Požadavky +- Odkaz na vyhledávač cizojazyčných titulků na subtitleseeker.com v sekci požadavky +- Rychlý odkaz na vytvoření nového zápisu přímo v profilu +- Další drobné úpravy \ No newline at end of file diff --git a/TODO.md b/TODO.md index b11d7e1..fb736bd 100644 --- a/TODO.md +++ b/TODO.md @@ -1,3 +1,22 @@ + + +TODO: + +Zkontrolovat +1,5-Jak se to chova pri vice rozpracovanych +2 - UPDATE KOMENTÁŘŮ PRO ROZPRACOVANÝ PŘEKLAD // JINAK TLAČÍTKO NOVÝ PŘEKLAD - tlačítko nový více prošrudovat +4 - PŘIDEJ HLAVIČKU WEBU +5 - AUTOLIKER ? FUNGUJE TO vUBEC? NENI TO UZ NATIVNE IMPLEMENTOVANE? + +predelat +autocompletebytitle + +Napady: +- pohrat si s CSFD API https://github.com/PatrikValkovic/csfd-api +- vytvorit ajax getJSON imdb+csfd akce ondemand +- ukladani getJSON imdb+csfd do local storage na 24h + +----------------- Zbývá udělat: Hotovo: diff --git a/background.js b/background.js deleted file mode 100644 index 3d94e26..0000000 --- a/background.js +++ /dev/null @@ -1,21 +0,0 @@ - -// Show page action icon in omnibar. -function ShowPageAction(tabId, changeInfo, tab) { - chrome.pageAction.show(tabId); -} - -// Chrome v.33+ -chrome.runtime.onInstalled.addListener(function(details) { - chrome.declarativeContent.onPageChanged.removeRules(undefined, function() { - chrome.declarativeContent.onPageChanged.addRules([{ - conditions: [ - new chrome.declarativeContent.PageStateMatcher({ - pageUrl: { - hostContains: 'titulky.com' - } - }) - ], - actions: [new chrome.declarativeContent.ShowPageAction()] - }]); - }); -}); \ No newline at end of file diff --git a/cstyle.css b/css/cstyle.css similarity index 95% rename from cstyle.css rename to css/cstyle.css index 8809395..e1fa9fd 100644 --- a/cstyle.css +++ b/css/cstyle.css @@ -7,7 +7,7 @@ display: block; border-radius: 4px; background: #DDDDDD; - font-size: 13px; + font-size: 12px; padding: 5px; right: 12px; top: 70px; @@ -62,7 +62,6 @@ padding: 0 !important; text-align: center !important; font-weight: bold !important; - display: } .plus-cell-rating a { @@ -148,7 +147,7 @@ display: block; border-radius: 4px; background: #DDDDDD; - font-size: 13px; + font-size: 12px; padding: 4px; right: 12px; top: 70px; @@ -197,4 +196,13 @@ position: relative; left: 155px; top: -87px; -} \ No newline at end of file +} + +#link_under{ + position:fixed; + border:1px solid #ccc; + background:#333; + padding:5px; + display:none; + color:#fff; + } \ No newline at end of file diff --git a/options.css b/css/options.css similarity index 86% rename from options.css rename to css/options.css index 53bc9d7..b9ec7e8 100644 --- a/options.css +++ b/css/options.css @@ -27,22 +27,22 @@ h2 { font-weight: normal; } -#save { +#save, #reset { padding: 5px 10px; font-weight: bold; background: rgb(221, 221, 221); border: 1px solid silver; - margin: 2px 0px 2px 0px; + margin: 2px 0 2px 0; border-radius: 4px; cursor: pointer; } -#save:hover { +#save:hover, #reset:hover { background: #9DC8EB; } textarea { - width: 700px; + width: 620px; height: 150px; margin-bottom: 10px; } @@ -51,7 +51,8 @@ textarea { color: rgb(0,128,0); padding: 5px; font-weight: bold; - display: inline-block; + display: block; + height:20px; } i { diff --git a/css/popup.css b/css/popup.css new file mode 100644 index 0000000..f2698a1 --- /dev/null +++ b/css/popup.css @@ -0,0 +1,55 @@ +html{font-family: Arial, Helvetica, sans-serif;} +body{ + margin:0; + padding:0; + font-family: arial,sans-serif; + font-size: 13px; + transition: background .4s ease-in-out; +} +body ul{ + min-width: 100px; + list-style-type: none; + padding: 0; + margin: 0; +} +body li{ + list-style-type: none; + padding: 0 10px; + margin: 2px 0; +} +select{ + border-radius: 3px; + border: 1px solid #d0d9ff; + height: 26px; + padding: 0 5px; + min-width: 100px; + width: 120px; + color: rgba(0, 0, 0, 0.9); + font-size: 16px; +} +.menu_line{ + border-top: 1px solid rgba(134, 134, 134, 0.3); +} +.menu_item{ + min-height: 32px; + line-height: 32px; + transition: all .4s ease-in-out; + overflow: hidden; + white-space: nowrap; + text-overflow: ellipsis; + text-align:center; + font-size:12px; + font-weight:bold; +} +.menu_item:hover{ + cursor: pointer; + background: #C6D6E3; +} +.menu_item .action_select{ + border-radius: 0; + width: 100px; + height: 30px; + border: none; + border-bottom: 1px solid rgba(58, 58, 228, 0.48); + margin: 5px auto; +} \ No newline at end of file diff --git a/icon128.png b/icon128.png deleted file mode 100644 index 3984471..0000000 Binary files a/icon128.png and /dev/null differ diff --git a/icon16.png b/icon16.png deleted file mode 100644 index e382252..0000000 Binary files a/icon16.png and /dev/null differ diff --git a/icon48.png b/icon48.png deleted file mode 100644 index f79a3a3..0000000 Binary files a/icon48.png and /dev/null differ diff --git a/csfd.png b/images/_csfd.png similarity index 100% rename from csfd.png rename to images/_csfd.png diff --git a/christmas.jpg b/images/christmas.jpg similarity index 100% rename from christmas.jpg rename to images/christmas.jpg diff --git a/christmas.old.jpg b/images/christmas.old.jpg similarity index 100% rename from christmas.old.jpg rename to images/christmas.old.jpg diff --git a/images/csfd.png b/images/csfd.png new file mode 100644 index 0000000..0d4f902 Binary files /dev/null and b/images/csfd.png differ diff --git a/images/icon128.png b/images/icon128.png new file mode 100644 index 0000000..7af7f06 Binary files /dev/null and b/images/icon128.png differ diff --git a/images/icon16.png b/images/icon16.png new file mode 100644 index 0000000..4f35b40 Binary files /dev/null and b/images/icon16.png differ diff --git a/icon19.png b/images/icon19.png similarity index 100% rename from icon19.png rename to images/icon19.png diff --git a/images/icon48.png b/images/icon48.png new file mode 100644 index 0000000..f83c9fa Binary files /dev/null and b/images/icon48.png differ diff --git a/lock.png b/images/lock.png similarity index 100% rename from lock.png rename to images/lock.png diff --git a/snowman.png b/images/snowman.png similarity index 100% rename from snowman.png rename to images/snowman.png diff --git a/tree.png b/images/tree.png similarity index 100% rename from tree.png rename to images/tree.png diff --git a/autolinker.min.js b/js/autolinker.min.js similarity index 100% rename from autolinker.min.js rename to js/autolinker.min.js diff --git a/content.js b/js/content.js similarity index 61% rename from content.js rename to js/content.js index ac54f10..49cc234 100644 --- a/content.js +++ b/js/content.js @@ -1,359 +1,34 @@ -function searchMovieCsfd (title,year,caller) { - $.get("http://csfdapi.cz/movie?search="+title,function(data) { - var id = false; - for (var resultsCount = data.length,i=0; i < resultsCount; i++) { - if (year == data[i]["year"]) { - id = data[i]["id"]; - break; - } - } - - if (id) { - $.get("https://csfdapi.cz/movie/"+id,function(data) { - window[caller](data); - }); - } - }); -} - -function searchMovieImdb (imdb,title) { - $.get("https://www.omdbapi.com/?i="+imdb+"&apikey=2c7f8b02",function(data) { - // data = JSON.parse(data); - if (data.imdbRating) { - //searchMovieCsfd(title,data.Year.slice(0,4),"displayCsfdRating"); - // searchMovieCsfd(spaceTitle(data.Title),data.Year.slice(0,4),"displayCsfdRating"); - displayImdbRating(data.imdbRating); - } - }); -} - - -function spaceTitle (title) { - return title.replace(new RegExp(" ", 'g'), "+").replace("&",""); -} - -function clearTitle (title) { - return title.split(/s\d{2}e\d{2}.*/i)[0]; -} - -/** - * Removes the episode number from the title (eg. E01) - * - * @param {string} title - * @returns {string} - */ -function clearTitleEpisodeOnly (title) { - return title.split(/e\d{2}.*/i)[0]; -} - -function addCsfdLink(data) { - var url = data["csfd_url"]; - $("textarea[name='SQLsNote']").val(function(index, old) { - return url + "\n" + old; - }); -} - -/** - * If the given title is TV series or just a movie - * - * @param {string} title - * @returns {bool} - */ -function isTvSeries (title) { - var pattern = /(s\d{2}e\d{2}.*)/i, - matches = pattern.exec(title); - console.log(matches && matches.length > 1); - if (matches && matches.length > 1) - { - return matches[0]; - } - else return false; -} - -function autocompleteByTitle (title) { - $(".plus-poster,.plus-poster + img").remove(); - title = clearTitle(title); - var query = "https://www.omdbapi.com/?t="+title; - - if ($("input[name='SQLnRokUvedeni']").val().length > 0) - { - query = "https://www.omdbapi.com/?t=" + title + "&y=" + $("input[name='SQLnRokUvedeni']").val() + "&apikey=2c7f8b02"; - } - - $.get(query,function(data) { - var result = JSON.parse(data); - if (result.Response === "False") return; - // console.log(result); - $("input[name='SQLnRokUvedeni']").val(result.Year.slice(0,4)); - $("input[name='SQLsIMDB']").val(result.imdbID.slice(2)); - $("#side1cont").prepend("
PLAKÁT
"); - - var pattern = /s(\d{2})e(\d{2}).*/i, - matches = pattern.exec($("input[name='SQLsNazev']").val()); - - if (matches && matches.length > 2) - { - $("input[name='Serial']").click(); - $("input[name='SQLnSerialSezona']").val(parseInt(matches[1],10)); - $("input[name='SQLnSerialEpizoda']").val(parseInt(matches[2],10)); - } +$(document).ready(function() { - searchMovieCsfd(spaceTitle(result.Title),result.Year.slice(0,4),"findAlternativeTitle"); + //**************** AKTIVNÍ INPUT PRO VYHLEDÁVÁNÍ HNED PO NAČTENÍ ************************ + if (location.href === "https://www.titulky.com/") $("#searchTitulky").focus(); - }); -} + //**************** VÝSLEDKY VYHLEDÁVÁNÍ ************************************************* + if (location.href.indexOf("Fulltext") !== -1) { -function findAlternativeTitle (data) { - var rawTitle = $("input[name='SQLsNazev']").val(); - title = clearTitle(rawTitle); - if (typeof data.names === "object") - { - for (var prop in data.names) + //highlight exact results + var search = $("#searchTitulky").val().toLowerCase(); + if (search.length) { - if (data.names[prop] !== title) + $.get("https://www.omdbapi.com/?s=" + search + "&apikey=2c7f8b02", function(data) { - if ($("input[name='SQLnSerialSezona']").val() && $("input[name='SQLnSerialEpizoda']").val()) + console.log(data); + if (typeof data.Search !== "undefined") { - var session = ($("input[name='SQLnSerialSezona']").val() <= 9) ? "0"+$("input[name='SQLnSerialSezona']").val():$("input[name='SQLnSerialSezona']").val(); - var episode = ($("input[name='SQLnSerialEpizoda']").val() <= 9) ? "0"+$("input[name='SQLnSerialEpizoda']").val():$("input[name='SQLnSerialEpizoda']").val(); - $("input[name='SQLsPuvodniNazev']").val(data.names[prop] + " S" + session + "E"+episode); + var year = data["Search"][0]["Year"]; } - else + $(".soupis td:nth-child(1)").slice(1).filter(function() { - $("input[name='SQLsPuvodniNazev']").val(data.names[prop]); - } - return; - } - } - } -} - -function displayCsfdRating (data) { - var rating = data["rating"], - url = data["csfd_url"]; - - $("a[target='imdb']").after("\"CSFD.cz\""); - if (typeof rating !== "undefined") { - var ratingBg = "plus-rating-blue"; - if (rating >= 70) ratingBg = "plus-rating-red"; - if (rating <= 30) ratingBg = "plus-rating-black"; - $("#contcont").prepend("
"+rating+"%
"); - } - else { - $("#contcont").prepend("
"); - } -} - -function displayImdbRating (rating) { - - var ratingBg = "plus-rating-blue"; - if (rating >= 7.0) ratingBg = "plus-rating-red"; - if (rating <= 3.0) ratingBg = "plus-rating-black"; - var url = $("a[target='imdb']").attr("href"); - $("#contcont").prepend("
"+rating+"
"); -} - -/*function searchForumForHashOld (lengthValue,hashValue) { - var hash = location.href.split("#")[1]; - if (typeof hashValue === "string") hash = hashValue; - $(".detailv td").each(function(index,value){ - if ($(value).text().trim().slice(0,lengthValue) == hash) - { - $('html, body').animate({ - scrollTop: $(".detailv").eq(index).prev().offset().top - }, 1000,"linear",function(){ - $(".detailv").eq(index).children().addClass("plus-animate-post"); + return $(this).text().trim().toLowerCase().replace(new RegExp(/ s\d{2}e\d{2}.*/), "") == search; + }).closest("tr").addClass("plus-topped"); + $(".plus-topped:first").attr("id","titulek").attr("name","titulek"); + window.location.hash="titulek"; }); } - return; - }); -}*/ - -/*function searchForumForHash () { - var hash = location.hash; - $(hash).parent().next().children().addClass("plus-animate-post"); -}*/ - -function getUserId () { - var pattern = /(\d{1,10})/, - matches = pattern.exec($("#tablelogon a[title='Info']").attr("onclick")); - return matches[0]; -} - -function isActiveTranslator () { - return ($("#tablelogon img").eq(1).attr("src") && $("#tablelogon img").eq(1).attr("src") !== "./img/stars/0.gif") ? true : false; -} - -function addNewPostCounter (counter,answers,mentions,preklad) { - $("#tablelogon").after(""+counter+" / "+answers+""); - - // Odkaz na vytvoreni noveho prekladu nebo na upravu stavajiciho - if (preklad) - { - var workLink = "Rozpracované / " + mentions + ""; - } - else - { - var workLink = "Nový"; - } - $("#tablelogon a[href$='Logoff=true']").closest("table").after(workLink); - - - if (counter > 0 || answers > 0) - { - $(".plus-unread-count").addClass("plus-unread-count-red"); - } - - if (mentions > 0) - { - $(".plus-unread-count-mentions").addClass("plus-unread-count-red"); - } -} - -function updateCommentFeed (lastVisit) { - - // komentare a reakce - $.get("https://www.titulky.com/index.php?UserDetail=me",function(data) { - - var rawHTML = document.createElement('div'); - rawHTML.innerHTML = data; - - var counter = 0, - counterAns = 0, - counterMentions = 0; - $("#side1wrap ul").eq(3).find("li").each(function(index, value) { - // $(rawHTML).find("#side1wrap ul:nth-child(4) li").each(function(index, value) { - var pattern = /([^\[][^\]]*)/, - matches = pattern.exec($(value).text()), - dateSplit = matches[0].split("."), - day = dateSplit[0], - month = dateSplit[1]-1, - lastSeq = dateSplit[2].split(" "), - year = lastSeq[0], - time = lastSeq[1].split(":"), - hours = time[0], - minutes = time[1], - timestamp = new Date(year, month, day, hours, minutes).getTime(); - - // if (1415008800000 < timestamp) - if (lastVisit < timestamp) - { - counter++; - } - else return; - }); - - - $(rawHTML).find("#side1wrap ul").last().children().each(function(index, value) { - var pattern = /([^\[][^\]]*)/, - matches = pattern.exec($(value).text()), - dateSplit = matches[0].split("."), - day = dateSplit[0], - month = dateSplit[1]-1, - lastSeq = dateSplit[2].split(" "), - year = lastSeq[0], - time = lastSeq[1].split(":"), - hours = time[0], - minutes = time[1], - timestamp = new Date(year, month, day, hours, minutes).getTime(); - - // if (1415008800000 < timestamp) - if (lastVisit < timestamp) - { - counterAns++; - } - else return; - }); - - chrome.storage.sync.get({ - preklad: 0 - }, function(items) { - if (items.preklad) - { - - // komentare v rozpracovanych - $.get("https://www.titulky.com/?Stat=5&item="+items.preklad,function(data) { - var rawHTML = document.createElement('div'); - rawHTML.innerHTML = data; - - $(rawHTML).find(".soupis .detail").first().find("tr").each(function(index, value) { - if(index%2) - { - var dateRaw = $(value).children().first().text().trim().split(" "); - if (dateRaw.length == 3) - { - - var dateSplit = dateRaw[0].split("."), - day = dateSplit[0], - month = dateSplit[1]-1, - year = dateSplit[2], - time = dateRaw[1].split(":"), - hours = time[0], - minutes = time[1]; - - timestamp = new Date(year, month, day, hours, minutes).getTime(); - // console.log(lastVisit,timestamp, year, month, day, hours, minutes); - // if (1415008800000 < timestamp) - if (lastVisit < timestamp) - { - counterMentions++; - } - else return; - } - - } - }); - - chrome.storage.sync.set({ - navstevaProfilu: +Date.now(), - novychZprav: counter, - novychOdpovedi: counterAns, - novychZminek: counterMentions, - },function(){ - addNewPostCounter(counter,counterAns,counterMentions,items.preklad); - }); - - }); - } - else - { - chrome.storage.sync.set({ - navstevaProfilu: +Date.now(), - novychZprav: counter, - novychOdpovedi: counterAns, - novychZminek: 0 - },function(){ - addNewPostCounter(counter,counterAns,counterMentions,items.preklad); - }); - } - }); - }); -} - -function highlightNewPosts (counter,counterAns) { - $("#side1wrap ul:nth-child(4) li").each(function(index,value) { - if (index < counter) - { - $("#side1wrap ul:nth-child(4) li").eq(index).prepend("NOVÉ"); - } - }); + } - $("#side1wrap ul").last().children().each(function(index,value) { - if (index < counterAns) - { - $("#side1wrap ul").last().children().eq(index).prepend("NOVÉ"); - } - }); -} - -$(document).ready(function() { - - // aktivni input pro vyhledavani hned po nacteni - if (location.href === "https://www.titulky.com/") $("#searchTitulky").focus(); - - // pouze prihlaseni - if ($("a[href$='Logoff=true']").length) - { + //**************** PŘESNÉ VYHLEDÁVÁNÍ - POUZE PRO PŘIHLÁŠENÉ *************************** + if ($("a[href$='Logoff=true']").length) { $("#search_submit").after("Vyhledat přesně"); $(".plus-search").click(function(event){ window.location.href ="https://www.titulky.com/index.php?Searching=AdvancedResult&AFulltext=&ARelease=&ARok=&ANazev="+$("#searchTitulky").val(); @@ -362,51 +37,56 @@ $(document).ready(function() { $("#tablesearch").css("margin-bottom","20px"); } - // sekce pozadavky -------------------------------------------------- - if (location.href.indexOf("Stat=6") !== -1 || location.href.indexOf("pozadavek-na-titulky-patri-sem") !== -1) - { - // $(".detailh:first").text("Poslední").attr("width",70); + //**************** SEKCE POŽADAVKY ****************************************************** + if (location.href.indexOf("Stat=6") !== -1 || location.href.indexOf("pozadavek-na-titulky-patri-sem") !== -1) { + + imagePreview(); + // $(".detailh:first").text("Poslední").attr("width",70); $(".detailh").eq(0).after('ČSFD'); $(".detailh").eq(6).after('Subs'); + var records = $('.soupis tr td:nth-child(1)').slice(1), - titles = $('.soupis tr td:nth-child(2)').slice(1), - imdbRatings = $('.soupis tr td:nth-child(4)').slice(1); - + titles = $('.soupis tr td:nth-child(2)').slice(1), + imdbRatings = $('.soupis tr td:nth-child(4)').slice(1) + records.each(function(index,value) { - var title = $(titles[index]).text().split(" ("), + var title = $(titles[index]).text().replace("překládá se","").trim().split(" ("), spaceTitle = title[0].replace(new RegExp(" ", 'g'), "+"), - imdb = $(records[index]).text().trim(), - rating = $(imdbRatings[index]).text().trim(); + imdb = $(records[index]).text().trim(), + rating = $(imdbRatings[index]).text().trim() - // add new column with a link to subtitleseeker.com - $(value).nextAll("td:last").after("Subs"); + // add new column with a link to subscene.com + $(value).nextAll("td:last").after("Subs"); //add new column with a link to CSFD.cz search $(value).after("ČSFD"); //edit rating column with a link to IMDB - $(imdbRatings[index]).html("" + rating + ""); + $(imdbRatings[index]).html("" + rating + ""); + + //insert poster on hover + $(titles[index]).find( ".link_under" ).attr('rel',"https://www.titulky.com/img/poster/req_"+imdb+".jpg"); }); - var imdbs = []; + // hide Detail column + $(".soupis tr td:nth-child(1)").hide(); + $(".soupis .detailh a").eq(0).attr("href","/?orderby=3&Stat=6").attr("title","Seřadit filmy podle hodnocení na IMDB"); + + // pozadavky - dopln hodnoceni k filmum + +/* var imdbs = []; // imdbs.push($(".soupis a[target='imdb']").first().text()); $(".soupis a[target='imdb']").each(function(index, value) { imdbs.push($(value).text()); }); - - // pozadavky - dopln hodnoceni k filmum // console.log(imdbs); - - // hide Detail column - $(".soupis tr td:nth-child(1)").hide(); - $(".soupis .detailh a").eq(0).attr("href","/?orderby=3&Stat=6").attr("title","Seřadit filmy podle hodnocení na IMDB"); - - /*var pusher = new Pusher("e3a617372cf7087256f0"); - var stamp = pusher.sessionID;*/ + */ +/* var pusher = new Pusher("e3a617372cf7087256f0"); + var stamp = pusher.sessionID; var today = Date.now(); var genres = []; var rawGenres = ""; @@ -490,130 +170,96 @@ $(document).ready(function() { .parent() .addClass(ratingBg+" plus-cell-rating"); }); - }); + }); +*/ + + } + + //**************** DETAIL TITULKU ******************************************************* + if ($("h1").length && $("a[target='imdb']").length) { + + var titleArray = $("h1").text().split(" ("), + title = titleArray[0], + spaceTitle = title.replace(new RegExp(" ", 'g'), "+").replace("&",""), + year = titleArray[1].substring(0,4), + imdb = $("a[target='imdb']").attr("href").split("title/")[1].slice(0,-1); - /*$.getJSON("http://richja.cz/titulky/",{multi: true, imdb: imdbs.join(),stamp:stamp},function(data) + // pouze prihlaseni + if ($("a[href$='Logoff=true']").length) { - // console.log(data); - pusher.disconnect(); + // odkaz pro prime vyhledani dalsich verzi, pouze prihlase premium, zadny fulltext + $("a[href^='/?Fulltext']").after("Další přesné verze"); + } - $("h2").before("Filtrování dle žánru
"); - $(".plus-filter").chosen({no_results_text: "Hledaný žánr nenalezen."}).change(function() - { - - var selected = $(".plus-filter").chosen().val(), - classes = []; + // searchMovieCsfd(spaceTitle,year,"displayCsfdRating"); + searchMovieImdb(imdb,title); - if (!selected) - { - $(".soupis tr").slice(1).show(); - return; - } + // add csfd search link + $("a[target='imdb']").after("\"CSFD.cz\""); + } - $(selected).each(function(index,value) - { - classes.push(".plus-"+value); - }); - $(".soupis tr").slice(1).show().not(classes.join()).hide(); - /*var closeImage = "chrome-extension://"+chrome.runtime.id+"/chosen-sprite.png"; - $(".search-choice-close").css("background","url("+closeImage+") !important");*/ - /*}); + //**************** SEKCE VLASTNÍ POŽADAVKY ********************************************** + if (location.href.indexOf("PozadavekTitulku=") !== -1) { + - });*/ - } + //----- Vytahneme seznam filmu v pozadavcich --------- + var pozadavkaIMDBnumbers = []; + + $('.soupis tr td:nth-child(2)').each(function(index, value) { + var imdbNum = $($(value).find('a')).text().trim(); + if (imdbNum !== ''){ + pozadavkaIMDBnumbers.push(imdbNum); + } + }); - // sekce vlastní pozadavky ------------------------------------------ - if (location.href.indexOf("PozadavekTitulku=") !== -1) - { - // get list of wanted movies - var movies = $('.soupis tr td:nth-child(3)').slice(1); - if (movies.length) - { - var list = [], - pattern = /\s\((Video)?\s?\d{4}\)/i; - $(movies).each(function(index,value){ - list.push($(value).text().split(pattern)[0].toLowerCase()); - }); + if (pozadavkaIMDBnumbers.length) { + + //----- Z Rozpracovaných vyparsujeme IMDB cisla + datumy --------- + + $.get("https://www.titulky.com/index.php?Stat=5",function(data) { - $.get("https://www.titulky.com/index.php?Stat=5",function(data) - { var rawHTML = document.createElement('div'), links = [], - titles = [], + imdbNumbers = [], startDates = [], endDates = []; + rawHTML.innerHTML = data; - // $(rawHTML).find(".soupis b > a").each(function(index, value) { - // console.log($(rawHTML).find(".soupis a > img").attr("alt")); - // $(rawHTML).find(".soupis a > img").each(function(index, value) - $(rawHTML).find(".soupis").eq(1).find(".row1,.row2").each(function(index, value) - { - var hrefNode = $($(value).find("b > a")), + $(rawHTML).find(".soupis").eq(1).find(".row1,.row2").each(function(index, value) { + var hrefNode = $($($(value).find("a"))[1]), + imdbN = hrefNode.attr('href').split("tt").pop().replace("/","").trim(), startDate = $($($(value).find("td"))[2]).text(), - endDate = $($($(value).find("td"))[3]).text(); - if (titles.indexOf($(hrefNode).text()) === -1) - { - if ($(hrefNode).text().indexOf(", The") !==-1) { - var editedTitle = "The "+$(hrefNode).text().replace(", The", ""); - titles.push(editedTitle.split(pattern)[0].toLowerCase()); - } - else - { - titles.push($(hrefNode).text().split(pattern)[0].toLowerCase()); - } - links.push($(hrefNode).attr("href")); + endDate = $($($(value).find("td"))[3]).text().trim(); + + if (endDate == ''){ endDate = '???' } + + links.push(hrefNode); + imdbNumbers.push(imdbN); startDates.push(startDate); endDates.push(endDate); - } }); - $(list).each(function (index,value) - { - if (titles.indexOf(value.trim().split("   překládá se")[0]) !== -1) - { - var titleIndex = titles.indexOf(value.trim().split("   překládá se")[0]), - itemLink = links[titleIndex], - itemStartDate = startDates[titleIndex]; - itemEndDate = endDates[titleIndex]; - - // $('.soupis tr td:nth-child(3)').slice(1).eq(index).append(" překládá se ("+itemStartDate+" - "+itemEndDate+")"); - $('.soupis tr td:nth-child(3)').slice(1).eq(index).append("("+itemStartDate+" - "+itemEndDate+")"); - } - }); - }); - } - } + $(pozadavkaIMDBnumbers).each(function (index,value) { - // detail titulku - if ($("h1").length && $("a[target='imdb']").length) - { - var titleArray = $("h1").text().split(" ("), - title = titleArray[0], - spaceTitle = title.replace(new RegExp(" ", 'g'), "+").replace("&",""), - year = titleArray[1].substring(0,4), - imdb = $("a[target='imdb']").attr("href").split("title/")[1].slice(0,-1); + var foudIndex = jQuery.inArray(value, imdbNumbers); + itemStartDate = startDates[foudIndex]; + itemEndDate = endDates[foudIndex]; - // pouze prihlaseni - if ($("a[href$='Logoff=true']").length) - { - // odkaz pro prime vyhledani dalsich verzi, pouze prihlase premium, zadny fulltext - $("a[href^='/?Fulltext']").after("Další přesné verze"); - } + if (foudIndex !== -1){ + $('.soupis tr td:nth-child(3)').slice(1).eq(index).append(""+itemStartDate+" - "+itemEndDate+""); + } - // odkaz na vyhledani titulku celeho serialu - if (isTvSeries(title)) - { - $(".plus-version").after("K celé řadě"); - } + }); - // searchMovieCsfd(spaceTitle,year,"displayCsfdRating"); - searchMovieImdb(imdb,title); - } + }); + + } + + } - // ropracovane detail - if (location.href.indexOf("Stat=5&item=") !== -1) - { + //**************** ROZPRACOVANÉ DETAIL ************************************************** + if (location.href.indexOf("Stat=5&item=") !== -1) { var link = $($(".soupis .row2").children()[6]).children().attr("href"); if (link !== "javascript://") { @@ -621,41 +267,17 @@ $(document).ready(function() { } } - // vysledky vyhledavani - if (location.href.indexOf("Fulltext") !== -1) - { - - //highlight exact results - var search = $("#searchTitulky").val().toLowerCase(); - if (search.length) - { - $.get("https://www.omdbapi.com/?s=" + search + "&apikey=2c7f8b02", function(data) - { - console.log(data); - if (typeof data.Search !== "undefined") - { - var year = data["Search"][0]["Year"]; - } - $(".soupis td:nth-child(1)").slice(1).filter(function() - { - return $(this).text().trim().toLowerCase().replace(new RegExp(/ s\d{2}e\d{2}.*/), "") == search; - }).closest("tr").addClass("plus-topped"); - $(".plus-topped:first").attr("id","titulek").attr("name","titulek"); - window.location.hash="titulek"; - }); - } - } - - // sekce novy preklad ci uprava ropracovaneho - if (location.href.indexOf("Preklad=") !== -1) - { + //**************** SEKCE NOVÝ PŘEKLAD ČI ÚPRAVA ROZPRACOVANÉHO ************************** + if (location.href.indexOf("Preklad=") !== -1) { + $("input[name='SQLsAlternativniNazev']").css("width","200px"); $("#nazev1").css("width","300px"); - // sekce novy preklad (pouze) + //------ sekce novy preklad (pouze) -------- if (location.href.indexOf("Preklad=0") !== -1) - { - chrome.storage.sync.get({ + { + // vytahne v nastaveni ulozenou sablonu pro rozpracovane a vlozi ji do textarea. + chrome.storage.local.get({ rozpracovane: '', }, function(items) { $("textarea[name='SQLsPoznamka']").text(items.rozpracovane); @@ -678,12 +300,13 @@ $(document).ready(function() { } }); } - // uprava rozpracovaneho prekladu + + //------- uprava rozpracovaneho prekladu -------- else { // uloz ID prekladu var prekladID = location.href.split("Preklad=")[1]; - chrome.storage.sync.set({ + chrome.storage.local.set({ preklad: prekladID, novychZminek: 0 }, function(items){ @@ -691,7 +314,7 @@ $(document).ready(function() { // pri dokoncen/zruseni prekladu smaz ID $("form .tlacitko").first().click(function() { - chrome.storage.sync.set({ + chrome.storage.local.set({ preklad: 0, novychZminek: 0 }, function(items){ @@ -700,38 +323,18 @@ $(document).ready(function() { }); } } - -// sekce nahrani novych titulku - prvni krok - if (location.href.indexOf("premium.titulky.com/index.php?Nahrat=1") !== -1) - { - // u velikosti titulku umaze + + //**************** SEKCE NAHRÁNÍ NOVÝCH TITULKŮ - PRVNÍ KROK **************************** + if (location.href.indexOf("premium.titulky.com/index.php?Upload=1") !== -1) { + // u velikosti titulku umaze mezery a pismena $("input[name^='VelikostFilmu']").change(function(){ $(this).val($(this).val().replace(/[^\d]/g,"")); }); } -// FORUM - /* Jiz implementovano nativne */ - //var lengthValue = 5; - // prida hash ke vzkazum na foru - /*$("#stat_bok_v span a").each(function(index,value) - { - $("#stat_bok_v span a").eq(index).attr("href",$(value).attr("href")+"#"+$(value).text().trim().slice(0,lengthValue)) ; - });*/ - - // dle shody hashe a obsahu prispevku sroluje na dany prispevek - /*if (location.href.indexOf("film=1&Prispevek") !== -1 && location.hash.length > 0) - { - searchForumForHash(); - $("#stat_bok_v span a").click(function(){ - if ($(this).attr("href").indexOf(location.search) > 0) - { - searchForumForHash(); - } - }); - }*/ - - chrome.storage.sync.get({ + + //**************** PRÁCE S LOCAL STORAGE ************************************************ + var config = { vyhledavani: false, domu: true, premium: false, @@ -742,16 +345,17 @@ $(document).ready(function() { poznamky: '', release: true, navstevaProfilu: false, - // cacheIntervalProfil: 1*60*60*1000, novychZprav: 0, novychOdpovedi: 0, novychZminek: 0, preklad: 0 - }, function(items) { - // console.log(items); + }; - if (isActiveTranslator()) - { + chrome.storage.local.get(config, items => { + + //------------ UPDATE KOMENTÁŘŮ PRO ROZPRACOVANÝ PŘEKLAD // Jinak TLAČÍTKO NOVÝ PŘEKLAD -------------------------- + + if (isActiveTranslator()) { var time = 1*15*60*1000; // 15 minut => cache // console.log(time,new Date (items.navstevaProfilu),new Date (items.navstevaProfilu+time),new Date()); // if (items.navstevaProfilu === false || items.navstevaProfilu <= +Date.now()) @@ -761,22 +365,20 @@ $(document).ready(function() { } else addNewPostCounter(items.novychZprav,items.novychOdpovedi,items.novychZminek,items.preklad); } - else - { + else { $("#tablelogon a[href$='Logoff=true']").closest("table").after("Nový"); } - - // sekce profil uzivatele - if (location.href.indexOf("UserDetail=") !== -1) - { + //------------ SEKCE PROFIL UŽIVATELE ---------------------------------------------------------------------------- + + if (location.href.indexOf("UserDetail=") !== -1) { // jedna se o vlastni profil uzivatele var userId = getUserId(); if (location.href.indexOf(userId) > 0 || location.href.indexOf("UserDetail=me")) { highlightNewPosts(items.novychZprav,items.novychOdpovedi); - chrome.storage.sync.set({ + chrome.storage.local.set({ navstevaProfilu: +Date.now(), novychZprav: 0, novychOdpovedi: 0 @@ -785,40 +387,19 @@ $(document).ready(function() { }); } } - - if (items.preklad && items.novychZminek && location.href.indexOf("Stat=5&item="+items.preklad) !== -1) - { - chrome.storage.sync.set({ + + if (items.preklad && items.novychZminek && location.href.indexOf("Stat=5&item="+items.preklad) !== -1) { + chrome.storage.local.set({ novychZminek: 0 }, function(){ // console.log(items.navstevaProfilu); }); } - /*var date = new Date(), - year = date.getFullYear(); - - if (items.udalost && year == "2014") - { - // hlavni stranka (index) - if ($(".iboxcover").length) //orloj (by fredikoun) :) - { - // console.log("Vánoce!!!"); - $("#slider li").eq(1).find("img").attr("src","chrome-extension://"+chrome.runtime.id+"/christmas.jpg"); - } - - if ($("#head_a1").length) //orloj (by fredikoun) :) - { - $(this).hide(); - $("#head_a1").append(""); - } - }*/ - - // vysledky hledani (fulltext i prime) - if (location.href.indexOf("Fulltext") !== -1 || location.href.indexOf("Searching") !== -1) - { + //------------ ZOBRAZIT VERZE VE VYSLEDCÍCH HLEDÁNí (Fulltext i prime) -------------------------------------------- + if (location.href.indexOf("Fulltext") !== -1 || location.href.indexOf("Searching") !== -1) { $(".soupis").before(""); - + $(".soupis tr td:nth-child(2)").slice(1).each(function(index,value) { var release = $(value,value).find(".fixedTip").attr("title"); @@ -842,25 +423,23 @@ $(document).ready(function() { var switcher = $(this).prop("checked"); - chrome.storage.sync.set({ + chrome.storage.local.set({ release: switcher, }); $(".plus-release").toggle(); }); } - // pridej hlavicku webu - if (items.hlavicka && !$("#head_a").length) - { + //------------ PŘIDEJ HLAVIČKU WEBU // PODLE NASTAVENI V OPTIONS -------------------------------------------------- + if (items.hlavicka && !$("#head_a").length) { $("#head_b") .css("bottom","-3px") .before("
\"České
"); $("#head_a,#head_b").wrapAll("