KomentoScript combines custom websites with automated third-party URL sync, allowing you to put Hayami’s comments embedder wherever your wish.
The current version of KomentoScript is v1.
KomentoScript is in early-phase undergoing testing & can be subject to change. Documentation will be more limited during initial development & testing periods.
KomentoScript combines the logic behind custom websites, as well as allow additional more complex logic, pertaining to additional details such as dates, fallbacks, amongst other things. The syntax is inspired by similar syntax used in MAL-Sync’s ChibiScript, except more catered more towards rendering Hayami on sites itself and use of Hayami’s different rendering modes.Before getting started, fork Hayami’s KomentoScript Pages Builder if you want to host your own multi-site endpoint. When ready, read the “Quick start guide” to understand KomentoScript’s details, or find the schema attached. Hayami also accepts manually importing KomentoScript files instead of via a URL to test functionality.Primary schema: komentoscript-pack.schema.json (raw).
Supported pipeline steps: querySelector, text, trim, regex, number .Pipeline mode uses a workflow-like approach. For the example above, this’d undergo the following:
Find an element on the page that matches .episode
Read that element’s text content
Apply regex (\d+) to that text and extract the first number capture
Convert the extracted value to a numeric string (sanitizes to digits/decimal, parses number, then stores as string)
Doing this will, in the above example, set below as default, and allow KomentoScript users to choose how they’d like it mounted on-site, configured by your KomentoScript.
For popup mode, anchorSelector is mostly irrelevant.
If anchorSelector is missing, runtime falls back to mountSelector, then body.
There is also anchorXPath if CSS selectors are unreliable.
To get started, fork the repository from GitHub. You can also one-click the Cloudflare Pages, or Netlify deployment buttons, which’ll do this & auto-deploy for you. For GitHub pages, fork the repository, and enable GitHub Pages through the repository settings, and re-run the deployment workflow through Actions.Under sites/, this contains JSON files for each site. There are sample files for Crunchyroll and HIDIVE (these are sample files unintended for production-use) that demonstrate the use of KomentoScript. Feel free to rename these files, and use the schema plus this documentation to aid scripting. To test functionality through the Hayami extension, you can import files directly via:
Hayami settings > KomentoScript > Import fileYou can also validate that your files fit the schema by npm run build . If there are any errors, such as trying to put custom website configurations into KomentoScript without considering the syntax:
PS C:\Users\User\Documents\komentoscript-pages> npm run build> komentoscript-pages@1.0.0 build> node ./scripts/build.mjsValidation failed:- sites\animeWebsite.json: root must have required property 'komentoVersion'- sites\animeWebsite.json: root must have required property 'id'- sites\animeWebsite.json: root must have required property 'targets'- sites\animeWebsite.json: root unsupported field 'format'.- sites\animeWebsite.json: root unsupported field 'version'.- sites\animeWebsite.json: root unsupported field 'exportedAt'. - sites\animeWebsite.json: root unsupported field 'mapping'.
Hayami’s KomentoScript Pages Builder automatically chains all sites you’ve configured to a /all endpoint when you deploy KomentoScripts Page Builder. You can also individually go to the JSON of each site by going to /id (where id is your pack ID).