Skip to content

Commit

Permalink
Move deactivation of obfuscation into search and paint and handle rec…
Browse files Browse the repository at this point in the history
…alculating once search has painted
  • Loading branch information
aferditamuriqi committed Jul 11, 2023
1 parent 3219895 commit 164c046
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions src/modules/search/SearchModule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,9 +161,6 @@ export class SearchModule implements ReaderModule {
self.currentChapterSearchResult = [];
self.currentSearchHighlights = [];
var localSearchResultChapter: any = [];
if (this.navigator.rights.enableContentProtection) {
this.navigator.contentProtectionModule?.deactivate();
}
await this.searchAndPaintChapter(searchVal, index, async (result) => {
localSearchResultChapter = result;
goToResultPage(1);
Expand Down Expand Up @@ -292,6 +289,9 @@ export class SearchModule implements ReaderModule {
index: number = 0,
callback: (result: any) => any
) {
if (this.navigator.rights.enableContentProtection) {
this.navigator.contentProtectionModule?.deactivate();
}
const linkHref = this.publication.getAbsoluteHref(
this.publication.readingOrder[this.navigator.currentResource() ?? 0].Href
);
Expand Down Expand Up @@ -398,7 +398,11 @@ export class SearchModule implements ReaderModule {
this.bookSearchResult = [];

reset();
await this.searchAndPaintChapter(term, 0, async () => {});
await this.searchAndPaintChapter(term, 0, async () => {
if (this.navigator.rights.enableContentProtection) {
this.navigator.contentProtectionModule?.recalculate(200);
}
});

if (current) {
await this.searchBook(term);
Expand Down Expand Up @@ -452,7 +456,11 @@ export class SearchModule implements ReaderModule {
this.searchAndPaintChapter(
item.textMatch,
filteredIndex,
async () => {}
async () => {
if (this.navigator.rights.enableContentProtection) {
this.navigator.contentProtectionModule?.recalculate(200);
}
}
);
}, 300);
}
Expand Down Expand Up @@ -498,7 +506,11 @@ export class SearchModule implements ReaderModule {
this.searchAndPaintChapter(
item.textMatch,
filteredIndex,
async () => {}
async () => {
if (this.navigator.rights.enableContentProtection) {
this.navigator.contentProtectionModule?.recalculate(200);
}
}
);
}, 300);
}
Expand Down

0 comments on commit 164c046

Please sign in to comment.