Skip to content

Commit e6ba5b7

Browse files
committed
Fix invalid REGEX
1 parent 065b86b commit e6ba5b7

File tree

2 files changed

+8
-11
lines changed

2 files changed

+8
-11
lines changed

js/background.js

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -115,17 +115,14 @@ function LoadFavoritePage(pageNumber, callback) {
115115
/// Get all doujinshis that are in a page, return an array of Doujinshi
116116
function GetDoujinshisFromHtml(html) {
117117
let currDoujinshis = [];
118-
let matchs = /<a href="\/g\/([0-9]+)\/".+img src="([^"]+)".+<div class="caption">([^<]+)<\/div>/g; // Get all doujinshis
119-
do {
120-
match = matchs.exec(html);
121-
if (match !== null) {
122-
let image = match[2];
123-
if (image.startsWith("//")) {
124-
image = "https:" + image;
125-
}
126-
currDoujinshis.push(new Doujinshi(match[1], image, match[3]));
118+
html.split('<div class="gallery"').slice(1).forEach(e => {
119+
let match = e.match(/<a href="\/g\/([0-9]+)\/".+img src="([^"]+)".+<div class="caption">([^<]+)<\/div>/)
120+
let image = match[2];
121+
if (image.startsWith("//")) {
122+
image = "https:" + image;
127123
}
128-
} while (match);
124+
currDoujinshis.push(new Doujinshi(match[1], image, match[3]));
125+
});
129126
return currDoujinshis;
130127
}
131128

manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "NHentai Analytics",
3-
"version": "1.2.1",
3+
"version": "1.2.2",
44
"description": "A chrome extension to help you find the best doujinshi based on your favorites",
55
"applications": {
66
"gecko": {

0 commit comments

Comments
 (0)