MIT License

项目介绍

Drarig29/brackets-viewer.js 是一个托管在 GitHub 上的开源项目,主要使用 TypeScript 编写,采用 MIT License 许可证,目前获得 228 个 Star、62 次 Fork。

仓库全名
Drarig29/brackets-viewer.js
开源许可证
MIT License
Star 数
228
Fork 数
62
未关闭 Issue
5

README 摘要

brackets-viewer.js A simple library to display tournament brackets (round-robin, single elimination, double elimination). It contains all the logic needed to display tournaments. Features Supports translation (i18next), which also allows you to change the vocabulary It was developed in vanilla JS, so you can use it in any framework A full working example of creating and displaying brackets (see ./demo/with-ui.html)…

完整内容见 GitHub 原始 README 或本页 。

常见问题

brackets-viewer.js 用什么语言开发?

主要使用 TypeScript 编写,采用 MIT License 许可证,目前有 228 个 Star。

brackets-viewer.js 可以免费商用吗?

仓库采用 MIT License 许可证,可免费使用与修改,商业使用请遵守许可证条款(例如保留版权声明与许可声明)。

如何获取 brackets-viewer.js 的源码?

可以直接克隆仓库:git clone https://github.com/Drarig29/brackets-viewer.js.git;安装与运行步骤见仓库 README。

brackets-viewer.js 最近还在维护吗?

仓库最近一次更新为 5月18日,当前有 5 个未关闭 Issue;Star 数为 228,可作为社区活跃度的参考。

关于

A simple library to display tournament brackets (round-robin, single elimination, double elimination).

描述取自 GitHub 官方 API,中文内容由 GitRead 中文社区 编辑团队整理。

README

brackets-viewer.js

npm Downloads jsDelivr Package Quality

A simple library to display tournament brackets (round-robin, single elimination, double elimination).

It contains all the logic needed to display tournaments.

Features

Screenshot

How to use?

Import the library from npm using jsDelivr (you can replace @latest to lock a specific version):

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/brackets-viewer@latest/dist/brackets-viewer.min.css" />
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/brackets-viewer@latest/dist/brackets-viewer.min.js"></script>

Or from GitHub with (you can replace @master by any branch name, tag name or commit id):

<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/Drarig29/brackets-viewer.js@master/dist/brackets-viewer.min.css" />
<script type="text/javascript" src="https://cdn.jsdelivr.net/gh/Drarig29/brackets-viewer.js@master/dist/brackets-viewer.min.js"></script>

Now, you can use it with data generated using brackets-manager or with crafted data following the brackets-model.

Usage:

This will find a unique element with a .brackets-viewer class, and append to it:

window.bracketsViewer.render({
  stages: data.stage,
  matches: data.match,
  matchGames: data.match_game,
  participants: data.participant,
});

If you want to clear the container’s content before rendering again, use this:

window.bracketsViewer.render({
  stages: data.stage,
  matches: data.match,
  matchGames: data.match_game,
  participants: data.participant,
}, {
  clear: true,
});

If you have multiple elements with a .brackets-viewer class, you must provide a selector:

window.bracketsViewer.render({
  stages: data.stage,
  matches: data.match,
  matchGames: data.match_game,
  participants: data.participant,
}, {
  selector: '#example',
});

See the full documentation for the render() configuration.

Demos

To quickly test, you can also try the demos by visiting ./demo/index.html.

To use json-server, you can:

  • Run the npm script named db to serve the static database file ./demo/db.json

    npm run db
    
  • Or use directly the db.json file generated by unit tests in the brackets-manager project

    npx json-server --watch path/to/brackets-manager/db.json
    

Credits

This library has been created to be used by the Nantarena.

It has been inspired by:

评论

暂无评论