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

capitains-sparrow.selector

v0.0.1

Published

jQuery selector plugin for CTS repositories

Downloads

12

Readme

jQuery CTS Selector

Build Status

Description

This plugins aims to provide a solid selector for passage or text in your front-end. Giving it a simple CTS API endpoint and one inventory to call, this plugin will generate for you, next to a given input, the whole DOM necessary for browsing your inventories !

This ain't pretty but you can give it some css love yourself

To use it, you will need to use compressed (or uncompressed) cts.js,

<!DOCTYPE html>
<html>
<head>
  <title>An example</title>
  <script type="text/javascript" src="../build/cts.min.js"></script>
  <script type="text/javascript" src="../build/i18n/en.min.js"></script>
  <script type="text/javascript" src="/path/to/jQuery.js"></script>
  <script type="text/javascript" src="../build/jquery.cts.selector.min.js"></script>
</head>
<body>

<script type="text/javascript">
  $(document).ready(function() {
    $(".target").ctsSelector({
      "endpoint" : "URL/exist/rest/db/xq/CTS.xq?",
      "version" : 3,
      "inventories" : {
        "annotsrc" : "Nice label for annotsrc",
        "pilots" : "Pilots"
      }
    });
  });

</script>
</body>
</html>

Events

| Name   | Description |------------------------------|--------------------------------- | cts-passage:retrieving | Before retrieving the passage, this event is triggered on the retrieve_scope, aka. settings["retrieve_scope"] or on the element targeted at the init phase ($(".target") in the example) | cts-passage:retrieved | After retrieving the passage, this event is triggered on the retrieve_scope, aka. settings["retrieve_scope"] or on the element targeted at the init phase ($(".target") in the example) | cts-passage:urn-updated | When urn value has been updated | cts-passage:urn-work | When a work urn has been chosen | cts-passage:urn-passage | When a work & passage urn has been chosen | cts-passage:passage-error | Retrieved passage is empty | cts-passage:retrieving-error | An HTTP error occured during retrieval

Basic parameters

| Key | Type | Default | Required | Description |----------------|-------------------|---------|----------|------------------ | endpoint | string | "" | Yes | CTS API endpoint (URI) finishing with "?" | css | object | {} | | See below CSS custom classes | version | int | 3 | | Version of the CTS implementation (3 or 5) | inventories | object | {} | Yes | Object where keys are inventory's name and value are label to show | retrieve | boolean or string | false | | If set to true, replace the content of plugin target by the plugins data on clicking retrieve. If it's a string, will use string as a jQuery selector to fill with retrieved passage | retrieve_scope | null or string | null | | Element to retrieve from retrieved passage | passage | boolean | true | | Show a passage selector

CSS custom classes

Because so many plugins force you to dig the code or extend your already existing CSS classes, we thought it might be cool to give you the availability to add your own classes to all the generated DOM elements !. To do so, when passing your option object to the constructor, add the css dictionary, where keys are identifier described below and value a list of classes (WITHOUT THE DOT).

| Identifier | Automatic class | Description |--------------------------|------------------------------------|-------------- | container | ["cts-selector"] | Container for all the generated DOM | retrieve-button | [] | <button /> used to retrieve passage | | | | hidden-inventory | ["cts-hidden-inventory"] | <input[type="hidden"] /> containing inventory information | select-inventory | ["cts-selector-inventory"] | <select /> containing inventory choices (None when there is only one inventory) | select-textgroup | ["cts-selector-textgroup"] | <select /> containing textgroup choices | select-work | ["cts-selector-work"] | <select /> containing work choices | select-text | ["cts-selector-text"] | <select /> containing text choices (Edition, Translation, etc.) | trigger-button | ["cts-selector-trigger"] | <button /> triggering change on select-text when needed. | | | | citation-fieldset | ["cts-selector-citation"] | <Fieldset /> containing beginning or end passage selection's inputs | citation-fieldset-legend | [] | <Legend /> for the given fieldset | citation-label | [] | <Label /> for one passage selection's input | citation-input | ["cts-selector-passage"] | <Input /> for passage selection | citation-input-container | ["cts-selector-input-container"] | <Div /> containing one input for passage selection