Skip to content

Commit

Permalink
Upd: Improve performance of chain helper in opencomic.js
Browse files Browse the repository at this point in the history
  • Loading branch information
ollm committed Jan 19, 2025
1 parent 80c1b0e commit 20ec882
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
- Save image not saving the correct page in manga mode [`b14a26e`](https://github.com/ollm/OpenComic/commit/b14a26eacdc77d37cdeb578fc203438058c7c5e2)
- Sometimes right click on reading fails [`b14a26e`](https://github.com/ollm/OpenComic/commit/1a8e145a997c67494e1a6c70c5f73acee7720000)
- Avoid generating thumbnails of images that are still being extracted (Extractions with 7-Zip) [`c415b3f`](https://github.com/ollm/OpenComic/commit/c415b3f0f6eb4bd6eb1bdd6cdd8a191b809df91e)
- Error attempting to open the bookmarks menu after navigating to a bookmark
- Error attempting to open the bookmarks menu after navigating to a bookmark [`80c1b0e`](https://github.com/ollm/OpenComic/commit/80c1b0eb7ea441e1f55a86713d04fe835089ef3d)

## [v1.3.1](https://github.com/ollm/OpenComic/releases/tag/v1.3.1) (05-10-2024)

Expand Down
16 changes: 10 additions & 6 deletions scripts/opencomic.js
Original file line number Diff line number Diff line change
Expand Up @@ -1020,9 +1020,11 @@ function callbackString(callback)

hb.registerHelper('chain', function() {

var helpers = [], value;
let helpers = [], value;

$.each(arguments, function (i, arg) {
for(let i = 0, len = arguments.length; i < len; i++)
{
const arg = arguments[i];

if(hb.helpers[arg])
{
Expand All @@ -1032,13 +1034,15 @@ hb.registerHelper('chain', function() {
{
value = arg;

$.each(helpers, function (j, helper) {
for(let j = 0, len = helpers.length; j < len; j++)
{
const helper = helpers[j];
value = helper(value, arguments[i + 1]);
});
}

return false;
break;
}
});
}

return value;
});
Expand Down

0 comments on commit 20ec882

Please sign in to comment.