Skip to content

Commit

Permalink
fixed yt playlist regexp popup suggestion
Browse files Browse the repository at this point in the history
  • Loading branch information
DaniloNovakovic committed Nov 1, 2018
1 parent 520bec7 commit dfdff11
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
13 changes: 8 additions & 5 deletions src/js/popup/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion src/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit dfdff11

Please sign in to comment.