From dfdff11bee9be31b372726e028011e1084455d5e Mon Sep 17 00:00:00 2001 From: Danilo Novakovic Date: Thu, 1 Nov 2018 08:18:57 +0100 Subject: [PATCH] fixed yt playlist regexp popup suggestion --- package.json | 2 +- src/js/popup/index.js | 13 ++++++++----- src/manifest.json | 2 +- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index 8c1d4ab..c4a980c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "chrome-dynamic-bookmarks", - "version": "2.4.0", + "version": "2.4.1", "description": "Chrome extension which dynamically updates bookmarks based on the specified regular expression.", "scripts": { "dev": "webpack --mode development", diff --git a/src/js/popup/index.js b/src/js/popup/index.js index c92f29a..5e0397e 100644 --- a/src/js/popup/index.js +++ b/src/js/popup/index.js @@ -28,14 +28,17 @@ document.addEventListener('DOMContentLoaded', function() { if (urlInput) { urlInput.value = url; } - if (/youtube\.com\/.*list=\w+/.test(url)) { - const regExpString = url.match(/list=\w+/i); - regExpInput.value = `youtube\.com\/.*${regExpString}`; + if (/youtube\.com\/.*list=[a-z0-9-]+/i.test(url)) { + const regExpString = url.match(/list=[a-z0-9-]+/i); + regExpInput.value = `youtube\\.com/.*${regExpString}`; } else { const subUrl = url.match(/^(http[s]?:\/\/)?(.*\/)|(.*$)/); if (subUrl) { - const regExpString = subUrl[0].replace(/http[s]?:\/\/(www\.)?/, ''); - regExpInput.value = `${regExpString.replace(/[.]/g, `\.`)}.*`; + const regExpString = subUrl[0].replace( + /^(http[s]?:\/\/)?(www\.)?/, + '' + ); + regExpInput.value = `${regExpString.replace(/\./g, `\\.`)}.*`; } } M.updateTextFields(); diff --git a/src/manifest.json b/src/manifest.json index e319772..d6625f6 100644 --- a/src/manifest.json +++ b/src/manifest.json @@ -2,7 +2,7 @@ "manifest_version": 2, "name": "Dynamic Bookmarks", "description": "Chrome extension which dynamically updates bookmarks based on the specified regular expression.", - "version": "2.4.0", + "version": "2.4.1", "permissions": ["tabs", "bookmarks", "storage"], "background": { "page": "background.html"