npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@haztivity/hz-locution

v0.7.1-beta.3

Published

Haztivity resource for locutions

Downloads

10

Readme

hz-locution

hz-locution is an haztivity resource to add locutions.
hz-locution uses howler js under the hood.

Install

NPM

npm i --save @haztivity/hz-locution

Dependencies

  • JQuery
  • howler
  • @haztivity/core

Usage

  1. Import @haztivity/hz-locution
  2. Add HzQuizLocution to the page
  3. Set data-hz-resource-files="file1.mp3,file1.wav"

Ts

import {PageFactory, Page, PageController, PageRegister} from "@haztivity/core";
import template from "./page.pug";
import {HzQuizLocution} from "@haztivity/hz-locution";
export let page: PageRegister = PageFactory.createPage(
    {
        name: "myPage",
        resources: [
            HzQuizLocution
        ],
        template: template
    }
);

Pug

//- By default the audio is played automatically but sequentially
h1(data-hz-resource="HzLocution", data-opt-hz-locution-files="./assets/locution1.mp3") This will be reproduced on the haztivity page show
p(data-hz-resource="HzLocution", data-opt-hz-locution-files="./assets/locution2.mp3") This will be reproduced after the first locution
//- Some other resource
p(data-hz-resource="HzLocution", data-opt-hz-locution-files="./assets/locution3.mp3") This will be reproduced when the previous resource has been completed
button(data-hz-resource="HzLocution", data-opt-hz-locution-files="./assets/locution4.mp3", data-opt-hz-locution-play-on="click") This will be reproduced when this element fires a click event. This element ignores the sequence of resources

or

HTML

<!-- By default the audio is played automatically but sequentially -->
<h1 data-hz-resource="HzLocution" data-opt-hz-locution-files="./assets/locution1.mp3"> This will be reproduced on the haztivity page show</h1>
<p data-hz-resource="HzLocution" data-opt-hz-locution-files="./assets/locution2.mp3"> This will be reproduced after the first locution</p>
<!-- Some other resource -->
<p data-hz-resource="HzLocution" data-opt-hz-locution-files="./assets/locution3.mp3"> This will be reproduced when the previous resource has been completed</p>
<button data-hz-resource="HzLocution" data-opt-hz-locution-files="./assets/locution4.mp3" data-opt-hz-locution-play-on="click">This will be reproduced when this element fires a click event. This element ignores the sequence of resources</button>

Options

HzLocution options

HzLocution provides specific options

| Option | Default | Description | | ----------------- | ------- | ----------- | | files | null | The files to use. Multiple items could be specified separated by comma. For example: "audio1.mp3,audio1.wav"| | playOn | auto | Play the audio when the expression is true. By default, the audio is played when the resource is enabled. The option could be specified byt "event:selector", if the selector is not provided, the event will be listened in the element inself. For example play-on="click", the audio will be played when the element of the resource is clicked. play-on="click:.someItem", the audio will be played when the item that matches with the selector ".someItem" is clicked.| | delay | 0 | Delay in milliseconds to wait after playing the audio | | locutionSubtitles | null | Link to a .vtt file with the subtitles for the audio | | subtitlesContainer| null | jQuery valid query to the element in which to show the cues from the subtitles. You can also use the HzLocutionSubtitlesBarComponent component |

HzLocutionSubtitlesBarComponent

The subtitles could be displayed independently on each screen by providing an specific element in each screen or using a global component

<!-- In each screen -->
<h1 data-hz-resource="HzLocution"
    data-opt-hz-locution-files="./assets/locution1.mp3"
    data-opt-hz-locution-subtitles="./assets/locution1.vtt"
    data-opt-hz-subtitles-container="#subtitles"
>This will be reproduced on the haztivity page show</h1>
<p id="subtitles"></p><!-- Subtitles will be displayed here -->
<!-- Using the component -->
<!-- sco.html -->
<div data-hz-pages></div>
<div class="hz-locution-subtitles-bar" data-hz-component="HzLocutionSubtitlesBar">
        <p class="hz-locution-subtitles-bar__cue" data-hz-locution-subtitles-bar-cue></p>
        <button class="hz-locution-subtitles-bar__toggler" data-hz-locution-subtitles-bar-toggler>
            Toggle subtitles
        </button>
</div>
<!-- page.html-->
<!-- Navbar -->
<h1 data-hz-resource="HzLocution"
    data-opt-hz-locution-files="./assets/locution1.mp3"
    data-opt-hz-locution-subtitles="./assets/locution1.vtt"
>This will be reproduced on the haztivity page show</h1>