From 1bd7ffd0c0512dd82c12c87944948b1bf35faae0 Mon Sep 17 00:00:00 2001 From: Rob Green Date: Wed, 24 May 2023 20:44:46 +0100 Subject: [PATCH] 20230524 issues (#138) * fixes #131. caused by regex selecting minum of 4 digits for id, which has been changed to 2 digits. * fixes #134. imdb videos now show both radarr and servarr icons * update readme --- README.md | 8 ++- src/content/js/content_script.js | 88 ++++++++++++++++++++++---------- src/manifest.json | 2 +- src/options.html | 5 -- 4 files changed, 67 insertions(+), 36 deletions(-) diff --git a/README.md b/README.md index 77df002..208ed57 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ [![Chrome Web Store](https://img.shields.io/chrome-web-store/v/jmmjjcddjldjdjgckdiokhfokccdnekc?label=Chrome%20web%20store&logo=data%3Aimage%2Fpng%3Bbase64%2CiVBORw0KGgoAAAANSUhEUgAAAA4AAAAOCAYAAAAfSC3RAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADdYAAA3WAZBveZwAAAIISURBVDhPdVLPaxNBFP52tyVpTGPbIImlLVEDtvVWwRZPooJUiLd6WBQFETTtRelV%2FAc8it6s6V0r%2BOsaBD14UwtCwEp%2FYNAejLvZNLuzM9M3s5tgC%2F3g7Xvvm%2Fn2vTczBv7D%2BrydI3eXrEQ2LqS0uJTf%2FZC%2Faof8yemll9tqn0JXSCKb3FOyjCb2gYR%2FPRbemnr2YkXlWkii6%2BQqnfwg%2BJxz12dzVHnFWHx9Lnd%2BdaB2aiu1p5KZOkS%2FkQDbiZkITcYaPCUneiie%2F3TSyZz4nUSSmbAOD6Ln6m186B2GCYlLuS2kt5cB7mmhlH0D3g67Z1J8pd0r8Lno6gXDLsP%2BYuJhdQMPqpuYe2%2BheeSGXlMwaBjLNEpKOK6Ib2MenGNZvPOHUG8GitJYd0K8%2FZWn3emYUWKjqIT6QAR9P056CATNtQ%2BME2eorV1Ila1FMfCD%2F8T0sItMwooZIJs0MTvSAEInZtScsmadtQtFimciCvjjfsXCzEXk00P0kzTuTDGMNpZhiuh0JRX3A76kruM45atkfXqFYFBb%2Bf4ChBSYtP7h8mA2XgECJloknDAflaqq1TJZdzhJgrqzhlZrExfoejrg9P4CxsuZ6cqGnpjEz8ndJGupvINZqpQwo0MJuXDbAb%2FWf6aiXtjeJ0Ztj5G7T1YaTSQKC0dHApqpFobiDbX4mCrV9UYAu%2FF1yscRLQLJAAAAAElFTkSuQmCC&style=plastic&color=brightgreen)](https://chrome.google.com/webstore/detail/sonarrradarrlidarr-autose/jmmjjcddjldjdjgckdiokhfokccdnekc) [![Chrome Web Store](https://img.shields.io/chrome-web-store/users/jmmjjcddjldjdjgckdiokhfokccdnekc?label=users&style=plastic&color=brightgreen)](https://chrome.google.com/webstore/detail/sonarrradarrlidarr-autose/jmmjjcddjldjdjgckdiokhfokccdnekc) [![Chrome Web Store](https://img.shields.io/chrome-web-store/stars/jmmjjcddjldjdjgckdiokhfokccdnekc?label=rating&style=plastic&color=brightgreen)](https://chrome.google.com/webstore/detail/sonarrradarrlidarr-autose/jmmjjcddjldjdjgckdiokhfokccdnekc)
[![Mozilla Add-on](https://img.shields.io/amo/v/sonarr-radarr-lidarr-search?label=Firefox%20add-ons&logo=data%3Aimage%2Fpng%3Bbase64%2CiVBORw0KGgoAAAANSUhEUgAAAA4AAAANCAYAAACZ3F9%2FAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAI6SURBVChTfVJNSFRRGD33vjdv3nvOmx9%2FygQRs5yoHAiMyGUGgdlGym2LNjW0SGhjtNB9hJvauAmiMGjTSmhTRBpWi1AzwkZTR0mdmeffzJt5z3e%2F7gyTtIgOXD74OOfcw%2BHD%2F0DZHo3syy%2FkvFBdHYBX579R8obg%2Bf3Y959Q%2BuLh6rYCVp2g0YYkQuoUlNYa1j%2F5jj6e0RE2NxAMWFAVQOAzhNbLWsfXy3y5kaJ7LZdA%2FnN46mm4wevx9Pjb9Iee%2B%2B5mpEvleRiRbJnaBJ8lhu7G2fDI%2FHTlR7od%2F4So04loEaglzKeu0tzUINPcIMzGBZzsG0XDsSVA04hMf4H5XjsXfefqsKN3ggWAozpwKIzjXa%2FZ%2BRuD2LJM5Ow2MIOAXQFkOIPH2mTkE6q3EWuW1QHSEORgtrYD418GUGQJWGEdoV1g%2Fv1Z1Hd%2Fg9i2wMIylTAaee5rW1bYIWDbABZrMDGZwFyGY5k2kVZtZCgPUcxBrMhEfBf0SwGtqzb3PXMlv1aXwo4Ubpm4wiZhFBaxl1mGbf%2BEcGaQCLwB3y6BF6RJyshShs1WyklHksna5rVHRmQP0D0UNAXTogUKJ3SYP6CXS4txeCIGErGh4MjYcEW4GhrgQnVeWQ25XiuaBw%2B4QMAHVPkUWYo8E6cYhqD6CfWI6NbHnpYODmA1dCfoM%2Fch052besjhWtAF5wL%2BvorSjkXMNZ9pFt2KLj2Wsf66nD%2BQBu2Sfg2MToEY56R8Z6S%2BbCo8mKlSJIDf81Pn%2Bw9CHy8AAAAASUVORK5CYII%3D&style=plastic&color=orange)](https://addons.mozilla.org/en-GB/firefox/addon/sonarr-radarr-lidarr-search/) [![Mozilla Add-on](https://img.shields.io/amo/users/sonarr-radarr-lidarr-search?label=users&style=plastic&color=orange)](https://addons.mozilla.org/en-GB/firefox/addon/sonarr-radarr-lidarr-search/) [![Mozilla Add-on](https://img.shields.io/amo/stars/sonarr-radarr-lidarr-search?label=rating&style=plastic&color=orange)](https://addons.mozilla.org/en-GB/firefox/addon/sonarr-radarr-lidarr-search/)
-[![](https://img.shields.io/static/v1?label=Edge%20add-ons&message=v2.7.0.0&color=blue&style=plastic&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAOCAYAAAAfSC3RAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAJdSURBVDhPVVLPaxNBFP7eZJPNNomCqGj1aBGkB8WKF4/iyR4sQqGm4M1TKyoI1T+gf0BBqHhRoQW9CO1BEcUKIhSlh4rx18FKm1q7aZJustmdnZ3xTSj+ePDNDPPeN9+bb4bwT5x4vdqrocYN5HlNsg/oEFF7haj1Ku/UpxdPj77bKcUf4sBCbcQgnTZQRU0KGgk0xTDoIOf4KLjrxsvV77rZcHz+6G3ZJZ5aaFwCzEMDQ0xkApMsEZJ3IuRz6yjl11DIb8LNth45IhmmgQX/EGc/BVW/GPoNmFTB8TLwDvTA2eN2iT3uKnZ5qyh5m7wO4GSSYRF1grHvbz4Wq5VNBIGDUBbQambgL9fQrFS5n5ARMxQjhRAM0lfF2lJ10BajsA/G3c0owThF7mtvOdowZelvVY0OkWoJlWrECSGSOOmEbe8IuT3gC3GbGqZZg1x+e7P95PoMS2D/8wc61cGMUiFkItlNxaoqFqnIa50adKHY18oSiNy2JdnIFVbYwF+QqsFqATqyxYrtx8JofNV6h7i9BUpSUNYb2uFBYGNEoAqtfyKWPmP7hUyiG0w08wxO8GNEEZDJcs8Y3XXx3oglEtUvCKqfIbSH+J4DcaLOvjw+2ySa+HCQs5+FQEnELbjf3oOcPMieZtL7pPUdGL1EacIG6D4k0bnGs1tTwkz2rxtjrmi7nStCW6NY0orxdJnXizAm5sPtm1R4rtmksAMm+2dZoMwagTx8DNqkXM82/w1b12GUG08num7/98m57V4+cUyoaDDn/+jLhA0ScecLpWqOTDrVmLtmfwQH8BseJ1GMK7TIYwAAAABJRU5ErkJggg==)](https://microsoftedge.microsoft.com/addons/detail/sonarrradarrlidarr-auto/aclgfcjonnhgdkinhmmafdbkpegfcnal) ![Edge](https://img.shields.io/static/v1?label=users&message=388&color=blue&style=plastic) +[![](https://img.shields.io/static/v1?label=Edge%20add-ons&message=v2.7.1.0&color=blue&style=plastic&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAOCAYAAAAfSC3RAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAJdSURBVDhPVVLPaxNBFP7eZJPNNomCqGj1aBGkB8WKF4/iyR4sQqGm4M1TKyoI1T+gf0BBqHhRoQW9CO1BEcUKIhSlh4rx18FKm1q7aZJustmdnZ3xTSj+ePDNDPPeN9+bb4bwT5x4vdqrocYN5HlNsg/oEFF7haj1Ku/UpxdPj77bKcUf4sBCbcQgnTZQRU0KGgk0xTDoIOf4KLjrxsvV77rZcHz+6G3ZJZ5aaFwCzEMDQ0xkApMsEZJ3IuRz6yjl11DIb8LNth45IhmmgQX/EGc/BVW/GPoNmFTB8TLwDvTA2eN2iT3uKnZ5qyh5m7wO4GSSYRF1grHvbz4Wq5VNBIGDUBbQambgL9fQrFS5n5ARMxQjhRAM0lfF2lJ10BajsA/G3c0owThF7mtvOdowZelvVY0OkWoJlWrECSGSOOmEbe8IuT3gC3GbGqZZg1x+e7P95PoMS2D/8wc61cGMUiFkItlNxaoqFqnIa50adKHY18oSiNy2JdnIFVbYwF+QqsFqATqyxYrtx8JofNV6h7i9BUpSUNYb2uFBYGNEoAqtfyKWPmP7hUyiG0w08wxO8GNEEZDJcs8Y3XXx3oglEtUvCKqfIbSH+J4DcaLOvjw+2ySa+HCQs5+FQEnELbjf3oOcPMieZtL7pPUdGL1EacIG6D4k0bnGs1tTwkz2rxtjrmi7nStCW6NY0orxdJnXizAm5sPtm1R4rtmksAMm+2dZoMwagTx8DNqkXM82/w1b12GUG08num7/98m57V4+cUyoaDDn/+jLhA0ScecLpWqOTDrVmLtmfwQH8BseJ1GMK7TIYwAAAABJRU5ErkJggg==)](https://microsoftedge.microsoft.com/addons/detail/sonarrradarrlidarr-auto/aclgfcjonnhgdkinhmmafdbkpegfcnal) ![Edge](https://img.shields.io/static/v1?label=users&message=441&color=blue&style=plastic) ## Overview @@ -26,7 +26,7 @@ Leave a review: [![Chrome Web Store](https://img.shields.io/chrome-web-store/v/jmmjjcddjldjdjgckdiokhfokccdnekc?label=Chrome%20web%20store&logo=data%3Aimage%2Fpng%3Bbase64%2CiVBORw0KGgoAAAANSUhEUgAAAA4AAAAOCAYAAAAfSC3RAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADdYAAA3WAZBveZwAAAIISURBVDhPdVLPaxNBFP52tyVpTGPbIImlLVEDtvVWwRZPooJUiLd6WBQFETTtRelV%2FAc8it6s6V0r%2BOsaBD14UwtCwEp%2FYNAejLvZNLuzM9M3s5tgC%2F3g7Xvvm%2Fn2vTczBv7D%2BrydI3eXrEQ2LqS0uJTf%2FZC%2Faof8yemll9tqn0JXSCKb3FOyjCb2gYR%2FPRbemnr2YkXlWkii6%2BQqnfwg%2BJxz12dzVHnFWHx9Lnd%2BdaB2aiu1p5KZOkS%2FkQDbiZkITcYaPCUneiie%2F3TSyZz4nUSSmbAOD6Ln6m186B2GCYlLuS2kt5cB7mmhlH0D3g67Z1J8pd0r8Lno6gXDLsP%2BYuJhdQMPqpuYe2%2BheeSGXlMwaBjLNEpKOK6Ib2MenGNZvPOHUG8GitJYd0K8%2FZWn3emYUWKjqIT6QAR9P056CATNtQ%2BME2eorV1Ila1FMfCD%2F8T0sItMwooZIJs0MTvSAEInZtScsmadtQtFimciCvjjfsXCzEXk00P0kzTuTDGMNpZhiuh0JRX3A76kruM45atkfXqFYFBb%2Bf4ChBSYtP7h8mA2XgECJloknDAflaqq1TJZdzhJgrqzhlZrExfoejrg9P4CxsuZ6cqGnpjEz8ndJGupvINZqpQwo0MJuXDbAb%2FWf6aiXtjeJ0Ztj5G7T1YaTSQKC0dHApqpFobiDbX4mCrV9UYAu%2FF1yscRLQLJAAAAAElFTkSuQmCC&style=plastic&color=brightgreen)](https://chrome.google.com/webstore/detail/sonarrradarrlidarr-autose/jmmjjcddjldjdjgckdiokhfokccdnekc)
[![Mozilla Add-on](https://img.shields.io/amo/v/sonarr-radarr-lidarr-search?label=Firefox%20add-ons&logo=data%3Aimage%2Fpng%3Bbase64%2CiVBORw0KGgoAAAANSUhEUgAAAA4AAAANCAYAAACZ3F9%2FAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAI6SURBVChTfVJNSFRRGD33vjdv3nvOmx9%2FygQRs5yoHAiMyGUGgdlGym2LNjW0SGhjtNB9hJvauAmiMGjTSmhTRBpWi1AzwkZTR0mdmeffzJt5z3e%2F7gyTtIgOXD74OOfcw%2BHD%2F0DZHo3syy%2FkvFBdHYBX579R8obg%2Bf3Y959Q%2BuLh6rYCVp2g0YYkQuoUlNYa1j%2F5jj6e0RE2NxAMWFAVQOAzhNbLWsfXy3y5kaJ7LZdA%2FnN46mm4wevx9Pjb9Iee%2B%2B5mpEvleRiRbJnaBJ8lhu7G2fDI%2FHTlR7od%2F4So04loEaglzKeu0tzUINPcIMzGBZzsG0XDsSVA04hMf4H5XjsXfefqsKN3ggWAozpwKIzjXa%2FZ%2BRuD2LJM5Ow2MIOAXQFkOIPH2mTkE6q3EWuW1QHSEORgtrYD418GUGQJWGEdoV1g%2Fv1Z1Hd%2Fg9i2wMIylTAaee5rW1bYIWDbABZrMDGZwFyGY5k2kVZtZCgPUcxBrMhEfBf0SwGtqzb3PXMlv1aXwo4Ubpm4wiZhFBaxl1mGbf%2BEcGaQCLwB3y6BF6RJyshShs1WyklHksna5rVHRmQP0D0UNAXTogUKJ3SYP6CXS4txeCIGErGh4MjYcEW4GhrgQnVeWQ25XiuaBw%2B4QMAHVPkUWYo8E6cYhqD6CfWI6NbHnpYODmA1dCfoM%2Fch052besjhWtAF5wL%2BvorSjkXMNZ9pFt2KLj2Wsf66nD%2BQBu2Sfg2MToEY56R8Z6S%2BbCo8mKlSJIDf81Pn%2Bw9CHy8AAAAASUVORK5CYII%3D&style=plastic&color=orange)](https://addons.mozilla.org/en-GB/firefox/addon/sonarr-radarr-lidarr-search/)
-[![](https://img.shields.io/static/v1?label=Edge%20add-ons&message=v2.7.0.0&color=blue&style=plastic&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAOCAYAAAAfSC3RAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAJdSURBVDhPVVLPaxNBFP7eZJPNNomCqGj1aBGkB8WKF4/iyR4sQqGm4M1TKyoI1T+gf0BBqHhRoQW9CO1BEcUKIhSlh4rx18FKm1q7aZJustmdnZ3xTSj+ePDNDPPeN9+bb4bwT5x4vdqrocYN5HlNsg/oEFF7haj1Ku/UpxdPj77bKcUf4sBCbcQgnTZQRU0KGgk0xTDoIOf4KLjrxsvV77rZcHz+6G3ZJZ5aaFwCzEMDQ0xkApMsEZJ3IuRz6yjl11DIb8LNth45IhmmgQX/EGc/BVW/GPoNmFTB8TLwDvTA2eN2iT3uKnZ5qyh5m7wO4GSSYRF1grHvbz4Wq5VNBIGDUBbQambgL9fQrFS5n5ARMxQjhRAM0lfF2lJ10BajsA/G3c0owThF7mtvOdowZelvVY0OkWoJlWrECSGSOOmEbe8IuT3gC3GbGqZZg1x+e7P95PoMS2D/8wc61cGMUiFkItlNxaoqFqnIa50adKHY18oSiNy2JdnIFVbYwF+QqsFqATqyxYrtx8JofNV6h7i9BUpSUNYb2uFBYGNEoAqtfyKWPmP7hUyiG0w08wxO8GNEEZDJcs8Y3XXx3oglEtUvCKqfIbSH+J4DcaLOvjw+2ySa+HCQs5+FQEnELbjf3oOcPMieZtL7pPUdGL1EacIG6D4k0bnGs1tTwkz2rxtjrmi7nStCW6NY0orxdJnXizAm5sPtm1R4rtmksAMm+2dZoMwagTx8DNqkXM82/w1b12GUG08num7/98m57V4+cUyoaDDn/+jLhA0ScecLpWqOTDrVmLtmfwQH8BseJ1GMK7TIYwAAAABJRU5ErkJggg==)](https://microsoftedge.microsoft.com/addons/detail/sonarrradarrlidarr-auto/aclgfcjonnhgdkinhmmafdbkpegfcnal) +[![](https://img.shields.io/static/v1?label=Edge%20add-ons&message=v2.7.1.0&color=blue&style=plastic&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAOCAYAAAAfSC3RAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAJdSURBVDhPVVLPaxNBFP7eZJPNNomCqGj1aBGkB8WKF4/iyR4sQqGm4M1TKyoI1T+gf0BBqHhRoQW9CO1BEcUKIhSlh4rx18FKm1q7aZJustmdnZ3xTSj+ePDNDPPeN9+bb4bwT5x4vdqrocYN5HlNsg/oEFF7haj1Ku/UpxdPj77bKcUf4sBCbcQgnTZQRU0KGgk0xTDoIOf4KLjrxsvV77rZcHz+6G3ZJZ5aaFwCzEMDQ0xkApMsEZJ3IuRz6yjl11DIb8LNth45IhmmgQX/EGc/BVW/GPoNmFTB8TLwDvTA2eN2iT3uKnZ5qyh5m7wO4GSSYRF1grHvbz4Wq5VNBIGDUBbQambgL9fQrFS5n5ARMxQjhRAM0lfF2lJ10BajsA/G3c0owThF7mtvOdowZelvVY0OkWoJlWrECSGSOOmEbe8IuT3gC3GbGqZZg1x+e7P95PoMS2D/8wc61cGMUiFkItlNxaoqFqnIa50adKHY18oSiNy2JdnIFVbYwF+QqsFqATqyxYrtx8JofNV6h7i9BUpSUNYb2uFBYGNEoAqtfyKWPmP7hUyiG0w08wxO8GNEEZDJcs8Y3XXx3oglEtUvCKqfIbSH+J4DcaLOvjw+2ySa+HCQs5+FQEnELbjf3oOcPMieZtL7pPUdGL1EacIG6D4k0bnGs1tTwkz2rxtjrmi7nStCW6NY0orxdJnXizAm5sPtm1R4rtmksAMm+2dZoMwagTx8DNqkXM82/w1b12GUG08num7/98m57V4+cUyoaDDn/+jLhA0ScecLpWqOTDrVmLtmfwQH8BseJ1GMK7TIYwAAAABJRU5ErkJggg==)](https://microsoftedge.microsoft.com/addons/detail/sonarrradarrlidarr-auto/aclgfcjonnhgdkinhmmafdbkpegfcnal) [![ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/K3K22CEIT) @@ -34,6 +34,10 @@ All support is very gratefully received, thank you :raised_hands: :sunglasses: : ## Change log (just the most recent; see [releases](https://github.com/trossr32/sonarr-radarr-lidarr-autosearch-browser-extension/releases) for full history) +**Bug fixes (V2.7.1)** +- Bug fix: TmdbId not parsed correctly from Trakt to Radarr search for some titles (#131) +- Bug fix: Icon not showing on IMDB (#134) + **New features (V2.7)** - Readarr integration. Added as 2 separate configurations for ebooks and audiobooks. Works similarly to Lidarr, i.e. there are no site integrations so this only exposes new entries in the context menu. diff --git a/src/content/js/content_script.js b/src/content/js/content_script.js index 0bd945f..9c47a2b 100644 --- a/src/content/js/content_script.js +++ b/src/content/js/content_script.js @@ -24,7 +24,7 @@ { siteId: 'sonarr', match: { - pattern: /tv_show/i, + pattern: /(tv_show|other)/i, operator: 'eq' } } @@ -52,7 +52,7 @@ { siteId: 'radarr', match: { - pattern: /movie/i, + pattern: /(movie|other)/i, operator: 'eq' } } @@ -127,7 +127,7 @@ modifiers: [ { type: 'regex-match', - pattern: /\/(?\d{4,10})-/i + pattern: /\/(?\d{2,10})-/i }, { type: 'prepend', var: 'tmdb:' @@ -226,7 +226,7 @@ modifiers: [ { type: 'regex-match', - pattern: /\/(?\d{4,10})/i + pattern: /\/(?\d{2,10})/i }, { type: 'prepend', var: 'tvdb:' @@ -292,7 +292,7 @@ modifiers: [ { type: 'regex-match', - pattern: /\/(?\d{4,10})/i + pattern: /\/(?\d{2,10})/i }, { type: 'prepend', var: 'tmdb:' @@ -731,7 +731,7 @@ imgStyles: 'width: 30px; margin: 7px 0 0 0;' } }, - // myanimelist sonarr + // myanimelist sonarr { id: 'myanimelist', defaultSite: 'sonarr', @@ -792,7 +792,7 @@ // modifiers: [ // { // type: 'regex-match', - // pattern: /\/(?\d{4,10})/i + // pattern: /\/(?\d{2,10})/i // }, { // type: 'prepend', // var: 'tmdb:' @@ -938,21 +938,20 @@ var title = (s, removeUnderscore) => { }; /** - * Get HTML markup for a custom icon to inject into the body. + * Add a custom icon and inject into the body. * @param {InjectedIconConfig} injectedIconConfig - injected icon config * @param {string} iconDataUri - icon data uri * @param {string} siteId - id of the servarr site; sonarr, radarr, lidarr, etc. * @returns {string} - HTML to inject */ - function getCustomIconMarkup(injectedIconConfig, siteId, linkHref) { -return ` -
- -
- -
+`; + + let siteStyles = `.servarr-ext_icon-image-${siteId} { + background: url('${base64Icons_40px.find(i => i.id == siteId).base64}') no-repeat; +} + +.servarr-ext_floating-icon .servarr-ext_icon-image-${siteId} { + margin: ${(siteId == 'radarr' ? '6px 0px 0px 8px' : '6px 0px 0px 6px')}; +} + +.servarr-ext_anchored-left-icon .servarr-ext_icon-image-${siteId} { + margin: ${(siteId == 'radarr' ? '6px -10px 0 0' : '6px -10px 0 0')}; +} + +.servarr-ext_anchored-right-icon .servarr-ext_icon-image-${siteId} { + margin: ${(siteId == 'radarr' ? '6px 0px 0px -5px' : '6px 0px 0px -9px')}; +}`; + + // anchor tag + let anchor = ` +
+ +
`; + + // check if the wrapper already exists + if ($('#servarr-ext_custom-icon-wrapper').length) { + log(['found servarr-ext_custom-icon-wrapper']); + + let positionOffset = injectedIconConfig.type == 'anchored' ? `calc(${injectedIconConfig.positionOffset} ${(injectedIconConfig.position === 'top' ? '+' : '-')} 57px)` : injectedIconConfig.positionOffset; + let sideOffset = injectedIconConfig.type == 'anchored' ? injectedIconConfig.sideOffset : `calc(${injectedIconConfig.sideOffset} ${(injectedIconConfig.position === 'left' ? '+' : '-')} 57px)`; + + siteStyles += `.servarr-ext_anchor-${siteId} { ${injectedIconConfig.position}: ${positionOffset}; } +.servarr-ext_floating-anchor-${siteId} { ${injectedIconConfig.side}: ${sideOffset}; }`; + + $('body').prepend(``); + + $('#servarr-ext_custom-icon-wrapper').append(anchor); + + return; + } + + // anchor doesn't exist, create the wrapper + let wrapper = `
+ ${anchor}
`; + + siteStyles += `.servarr-ext_anchor-${siteId} { ${injectedIconConfig.position}: ${injectedIconConfig.positionOffset}; } +.servarr-ext_floating-anchor-${siteId} { ${injectedIconConfig.side}: ${injectedIconConfig.sideOffset}; }`; + + $('body').prepend(`${styles}${wrapper}`); } async function init() { @@ -1203,9 +1237,7 @@ async function init() { } } else { // show a custom icon based on the icon config - let el = getCustomIconMarkup(settings.injectedIconConfig, site.id, searchUrl); - - $('body').prepend(el); + addCustomIconMarkup(settings.injectedIconConfig, site.id, searchUrl); } containerEl.attr('data-servarr-ext-completed', true); diff --git a/src/manifest.json b/src/manifest.json index 2609805..d81eaf2 100644 --- a/src/manifest.json +++ b/src/manifest.json @@ -2,7 +2,7 @@ "manifest_version": 2, "name": "Sonarr/Radarr/Lidarr autosearch", "description": "Exposes a context menu that enables direct searching for tv shows, movies and other text in Sonarr, Radarr, Lidarr and Readarr.", - "version": "2.7.0.0", + "version": "2.7.1.0", "browser_action": { "default_icon": "content/assets/images/SonarrRadarrLidarr128.png", "default_popup": "popup.html" diff --git a/src/options.html b/src/options.html index e515cc3..c74027f 100644 --- a/src/options.html +++ b/src/options.html @@ -151,11 +151,6 @@

Custom icon settings

In situations where multiple elements are found on the page, the integration's configured icon containers will be used as a fallback. Sometimes this will be obvious with multiple icons being injected on a page, but in other cases a fallback may be caused by a selector being found multiple times even though an icon is only injected once.

- -
Enhancements
-

- If you like this functionality and have any suggestions for improvements on the implementation (enable/disable per integration, perhaps?), then please raise an issue on Github for discussion. -