Read our paper for more details.
JQuery-powered wizard for choosing data and software licenses. Ships as modular CoffeeScript source with webpack builds for both browser globals (UMD) and modern bundlers (ESM).
Use the selector at https://ufal.github.io/public-license-selector for the most recent build.
- Guided questionnaire covering data and software licensing paths, with inline explanations and tooltips.
- Searchable license catalogue with badges sourced from
src/data/labels.coffee. - History navigation that lets users review and replay previous answers.
- Bundled CSS, icon font, and LESS sources to theme the modal.
View the auto-generated state graph of the questionnaire:
- Full diagram: docs/state-graph.md (renders on GitHub with Mermaid code blocks)
To regenerate after editing src/data/questions.coffee:
npm run generate-graphThe plugin contains a common set of so-called public licenses which will make your work publicly available.
npm install @ufal/license-selectorPeer dependencies:
npm install jquery lodashTested command:
npm install @ufal/license-selector [email protected] [email protected] --saveThe latest version is in the releases branch.
The plugin requires Lo-Dash or Underscore utility library.
Continue reading for development setup, or skip to Consuming the Bundles to use the published package.
Clone the repo and install dependencies once:
npm installBuild the distributable bundles:
npm run build # runs clean + build:umd + build:esm
# or individually
npm run build:umd
npm run build:esmDuring development, launch the demo with live rebuilds:
npm startWebpack serves index.html and watches the CoffeeScript/LESS sources.
Automated end-to-end tests verify the GitHub Pages deployment after each release:
npm test # Run tests in headless mode
npm run test:open # Open Cypress interactive test runner
npm run test:headed # Run tests with visible browserTests cover:
- Page load and asset loading (jQuery, lodash, CSS)
- Modal auto-open behavior
- Questionnaire navigation (Data/Software paths)
- License selection and display
- Responsive design and accessibility
- Performance benchmarks
After installing via npm install @ufal/license-selector, the bundles are available in node_modules/@ufal/license-selector/dist/:
| File | Description |
|---|---|
license-selector.umd.js |
Browser-friendly UMD bundle exposing LicenseSelector. Expects global jQuery and _ (lodash). |
license-selector.esm.js |
Tree-shakeable ESM bundle for modern build pipelines. Expects jquery and lodash via imports. |
license-selector.css |
Stylesheet + icon font references for the modal UI. |
If you cloned the repo and ran npm run build, the same files are in dist/.
<link rel="stylesheet" href="node_modules/@ufal/license-selector/dist/license-selector.css">
<script src="https://code.jquery.com/jquery-3.7.1.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.21/lodash.min.js"></script>
<script src="node_modules/@ufal/license-selector/dist/license-selector.umd.js"></script>
<script>
$(function () {
$('button#pick-license').licenseSelector({
showLabels: true,
onLicenseSelected: function (license) {
console.log('Selected license:', license);
}
});
});
</script>import $ from 'jquery';
import _ from 'lodash';
import '@ufal/license-selector/dist/license-selector.css';
import '@ufal/license-selector/dist/license-selector.esm.js';
$('#pick-license').licenseSelector({
start: 'YourSoftware',
onLicenseSelected(license) {
console.log(license);
}
});import type { LicenseDefinition, LicenseSelectorOptions } from '@ufal/license-selector';
const options: LicenseSelectorOptions = {
showLabels: true,
onLicenseSelected: (license: LicenseDefinition) => {
console.log(license.name, license.url);
}
};
// jQuery plugin available globally (if loaded via UMD)
const $ = (window as any).jQuery;
$('#pick-license').licenseSelector(options);dist/ contains everything you need:
| File | Description |
|---|---|
license-selector.umd.js |
Browser-friendly UMD bundle exposing LicenseSelector. Expects global jQuery and _ (lodash). |
license-selector.esm.js |
Tree-shakeable ESM bundle for modern build pipelines. Expects jquery and lodash via imports. |
license-selector.css |
Stylesheet + icon font references for the modal UI. |
<link rel="stylesheet" href="dist/license-selector.css">
<script src="https://code.jquery.com/jquery-3.7.1.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.21/lodash.min.js"></script>
<script src="dist/license-selector.umd.js"></script>
<script>
$(function () {
$('button#pick-license').licenseSelector({
showLabels: true,
onLicenseSelected: function (license) {
console.log('Selected license:' license);
}
});
});
</script>import $ from 'jquery';
import _ from 'lodash';
import 'dist/license-selector.css';
import 'dist/license-selector.esm.js';
$('#pick-license').licenseSelector({
start: 'YourSoftware',
onLicenseSelected(license) {
console.log(license);
}
});| Option | Type | Default | Notes |
|---|---|---|---|
appendTo |
string | HTMLElement | JQuery |
'body' |
Parent element for the modal root. |
start |
string |
'KindOfContent' |
Initial question; see src/data/questions.coffee. |
showLabels |
boolean |
true |
Toggle license badge rendering. |
licenseItemTemplate |
function | JQuery |
null |
Custom renderer for <li> entries. |
licenses |
Record<string, Partial<LicenseDefinition>> |
{} |
Deep-merged with src/data/licenses.coffee. |
questions |
Record<string, Function> |
{} |
Deep-merged with src/data/questions.coffee. |
onLicenseSelected |
function |
_.noop |
Fires when the user confirms a license. |
The TypeScript interface definitions live in index.d.ts and mirror the table above.
A list of licenses that will get merged to the predefined licenses. The merge is done by _.merge so you can use it to add new licenses or to change configuration of the predefined licenses.
$('.selector').licenseSelector({
licenses: {
'abc-license': {
name: 'NEW license',
priority: 1,
available: true,
url: 'http://www.example.com/new-license',
description: 'This is new license inserted as a test',
categories: ['data', 'new'],
template: function($el, license, selectFunction) {
var h = $('<h4 />').text(license.name);
h.append($('<a/>').attr({
href: license.url,
target: '_blank'
}));
$el.append(h);
$el.append('<p>Custom template function</p>');
$el.append(
$('<button/>')
.append('<span>Click here to select license</span>')
.click(selectFunction)
);
}
},
'cc-by': {
description: 'Modified description ...',
cssClass: 'featured-license'
},
'lgpl-3': {
available: false // hide the LGPL 3 license
}
}
});When customizing licenses via the licenses option, each license object can have the following attributes:
stringkey - The hash key (will be automatically added)stringname - Full name of the licenseboolavailable - Flag whether the license is visible in the license listunsigned intpriority - Sort priority (lower means higher in the license list)stringurl - Url pointing to the license full textstringdescription - A short description of the licensestringcssClass - Custom CSS class set on<li>elementfunction|jQuerytemplate - Template used for custom formatarray[string]categories - A list of arbitrary category names used for filtering in the questionsarray[string]labels - A list of labels that will be shown for the license. Each label has a picture or special css style connected.
List of licenses that can be chosen with default settings.
| License name | URL |
|---|---|
| Affero General Public License 3 (AGPL-3.0) | http://opensource.org/licenses/AGPL-3.0 |
| Apache License 2 | http://www.apache.org/licenses/LICENSE-2.0 |
| Artistic License 1.0 | http://opensource.org/licenses/Artistic-Perl-1.0 |
| Artistic License 2.0 | http://opensource.org/licenses/Artistic-2.0 |
| Common Development and Distribution License (CDDL-1.0) | http://opensource.org/licenses/CDDL-1.0 |
| Creative Commons Attribution (CC-BY) | http://creativecommons.org/licenses/by/4.0/ |
| Creative Commons Attribution-NoDerivs (CC-BY-ND) | http://creativecommons.org/licenses/by-nd/4.0/ |
| Creative Commons Attribution-NonCommercial (CC-BY-NC) | http://creativecommons.org/licenses/by-nc/4.0/ |
| Creative Commons Attribution-NonCommercial-NoDerivs (CC-BY-NC-ND) | http://creativecommons.org/licenses/by-nc-nd/4.0/ |
| Creative Commons Attribution-NonCommercial-ShareAlike (CC-BY-NC-SA) | http://creativecommons.org/licenses/by-nc-sa/4.0/ |
| Creative Commons Attribution-ShareAlike (CC-BY-SA) | http://creativecommons.org/licenses/by-sa/4.0/ |
| Eclipse Public License 1.0 (EPL-1.0) | http://opensource.org/licenses/EPL-1.0 |
| GNU General Public License 2 or later (GPL-2.0) | http://opensource.org/licenses/GPL-2.0 |
| GNU General Public License 3 (GPL-3.0) | http://opensource.org/licenses/GPL-3.0 |
| GNU Library or "Lesser" General Public License 2.1 or later (LGPL-2.1) | http://opensource.org/licenses/LGPL-2.1 |
| GNU Library or "Lesser" General Public License 3.0 (LGPL-3.0) | http://opensource.org/licenses/LGPL-3.0 |
| Mozilla Public License 2.0 | http://opensource.org/licenses/MPL-2.0 |
| Public Domain Dedication (CC Zero) | http://creativecommons.org/publicdomain/zero/1.0/ |
| Public Domain Mark (PD) | http://creativecommons.org/publicdomain/mark/1.0/ |
| The BSD 2-Clause "Simplified" or "FreeBSD" License | http://opensource.org/licenses/BSD-2-Clause |
| The BSD 3-Clause "New" or "Revised" License (BSD) | http://opensource.org/licenses/BSD-3-Clause |
| The MIT License (MIT) | http://opensource.org/licenses/mit-license.php |
- License metadata:
src/data/licenses.coffee - Compatibility matrix:
src/data/compatibility.coffee - Questionnaire states:
src/data/questions.coffee - Tooltip text:
src/helpers/explanations.coffee
See docs/extending.md for step-by-step guidance on adding licenses, extending labels, or branching the wizard logic.
| Module | Responsibility |
|---|---|
src/index.coffee |
Entry point exporting the selector plus bundled data helpers. |
src/core/license-selector.coffee |
Orchestrates modal lifecycle, questions, history, and list state. |
src/core/history.coffee |
Manages the navigation stack and tooltips for previous answers. |
src/core/question.coffee |
Renders prompts, answers, checkbox options, and validation errors. |
src/core/license-list.coffee |
Displays filterable licenses and handles selection state. |
src/core/search.coffee |
Header search input wired to the license list filter. |
src/core/modal.coffee |
Builds the modal shell and handles responsive sizing. |
src/core/tooltip.coffee |
Shared tooltip widget used across the UI. |
src/plugins/jquery.coffee |
Registers the $.fn.licenseSelector plugin and merges overrides. |
src/license-selector.less & friends |
Styles for modal layout, typography, and iconography. |
- Work inside the CoffeeScript/LESS sources under
src/. - Run
npm startfor hot rebuilds and manual testing againstindex.html. - Execute
npm run buildbefore publishing to refresh the assets indist/. - Linting is handled via webpack loaders; ensure the dev server logs stay clean.
The orginal Makefile remains functional if you prefer that workflow:
make install # installs dependencies via npm
make run # starts the demo server
make build # rebuilds distributable assetsThe release helpers (make release, make release-minor, make release-major) are still available for version tagging automation.
- CLARIN DSpace Repositories - deployments across Czechia, Italy, Lithuania, Norway, Poland, Slovenia, Spain, Sweden, Brazil.
- EUDAT B2SHARE.
Using the selector elsewhere? Open an issue or discussion so we can add your deployment.
- Review docs/extending.md before large changes.
- Discuss new features via Github issues/discussions to align on scope.
- Run
npm run build(and optionallynpm start) to verify changes locally. - Submit pull request with clear descriptions of the behaviour affected.
- Pawel Kamocki
- Pavel Straňák
- Michal Sedlák
Descriptions for some licenses taken from (or inspired by) descriptions at tldrLegal.
This tool does not replace professional legal advice. Consult your legal counsel for authoritative guidance.
MIT © Institute of Formal and Applied Linguistics, Charles University.