@aristotle-metadata-enterprises/aristotle_tooltip

中文文档
1.2.4发布于 2022/11/25BSD-3 ClauseCommonJS近 30 天下载 1695

Aristotle Tooltip: add Aristotle functionality to any website!

原始使用文档
文档目录11 节
  1. Features
  2. Example
  3. Quick Start
  4. Package Manager
  5. CDN
  6. Usage
  7. Setup
  8. Options
  9. Setting up a Development Environment
  10. IE11 Compatibility
  11. ES6 Promise with a CDN

Javascript Tests Publish to NPM

Aristotle Cloud Services Australia

Aristotle Tooltip

A highly customisable and easy to use way to insert Aristotle powered definitions to your website!

Features

  • :heavy_check_mark: Adaptable: use any Aristotle Metadata Registry!
  • :globe_with_meridians: IE11+ Support * : compatible with 99% of desktop and 98% of mobile users.
  • :mouse: Light: weighs just 60kb, including image assets.
  • :dog: Dogfooded: This library is used in our production Aristotle Registries. Updates guaranteed!

Example

Image

Quick Start

Package Manager

Install the aristotle-tooltip package:

frankie@aristotle:~$ npm i @aristotle-metadata-enterprises/aristotle_tooltip

In your application, import the aristotle_tooltip module, and the core css:

import aristotleTooltip from '@aristotle-metadata-enterprises/aristotle_tooltip'
import 'aristotle_tooltip/dist/tooltip.css'

This assumes you're using a module bundler like Webpack, Rollup or Parcel.

CDN

<script src="https://cdn.jsdelivr.net/npm/@aristotle-metadata-enterprises/aristotle_tooltip@latest/dist/aristotletooltip.min.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@aristotle-metadata-enterprises/aristotle_tooltip@latest/dist/tooltip.css">

Place the script at the very bottom of the <body>. It must be placed before your own scripts, because of how the underlying Tippy.js library adds the tooltips.

Usage

To add a tooltip for a piece of content on your webpage:

A <a href="#" data-aristotle-concept-id="498427">person</a> is known by the company they keep

Custom styling for Aristotle links can set by applying CSS rules that target attribute decorators:

a[data-aristotle-concept-id] {
  border-bottom: 1px dotted #155799;
}
a[data-aristotle-concept-id]:hover {
  text-decoration: none;
  border-bottom: 1px solid #155799;
}

Setup

let options = {
  'url': 'https://registry.aristotlemetadata.com',
  'definitionWords': 50,
  'longDefinitionWords': 75,
};
aristotleTooltip(options);

Options

OptionDefaultExplanation
urlregistry.aristotlemetadata.comThe URL of an Aristotle Metadata Registry
definitionWords50The number of words to display in the initial popup
longDefinitionWords75The number of words to display when 'see more..' is pressed
placementbottomThe positioning of the tooltip
triggermouseenter focusEvents used to trigger the tooltip
externalLinkVisibletrueWhether to display an external link icon next to the name of the metadata item
selectordocument.bodyElement or css selector for creating tooltips under, tooltips not under this element will be ignored
interactivetrueWhether interactive content such as links should be displayed

Setting up a Development Environment

We're an open source project that welcomes any new contributions. To setup a development environment, simply fork the repo, clone it locally, and from within the aristotle-tooltip project, run:

oscar@aristotle:~$ npm install
oscar@aristotle:~$ npm run build:dev

IE11 Compatibility

A Promise polyfill is required for IE11 compatibility.aristotle-tooltip has been tested to work with ES6 Promise

ES6 Promise with a CDN

<script src="https://cdn.jsdelivr.net/npm/es6-promise@4/dist/es6-promise.auto.js"></script> 

版本与发布记录

@aristotle-metadata-enterprises/aristotle_tooltip 共发布 11 个版本,首次发布于 2020/02/19;过去 12 个月发布了 0 个版本。

版本发布日期距今
1.2.4latest2022/11/253 年前
1.2.32021/01/135 年前
1.2.22020/11/105 年前
1.2.12020/05/046 年前
1.2.02020/04/296 年前
1.1.02020/04/216 年前

关于 @aristotle-metadata-enterprises/aristotle_tooltip 的常见问题

@aristotle-metadata-enterprises/aristotle_tooltip 是什么?

Aristotle Tooltip: add Aristotle functionality to any website!

如何安装 @aristotle-metadata-enterprises/aristotle_tooltip?

在项目目录运行 npm install @aristotle-metadata-enterprises/aristotle_tooltip,或使用 pnpm add / yarn add / bun add。

@aristotle-metadata-enterprises/aristotle_tooltip 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/aristotle-metadata-enterprises__aristotle_tooltip 是否存在。

@aristotle-metadata-enterprises/aristotle_tooltip 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

@aristotle-metadata-enterprises/aristotle_tooltip 可以商用吗?

@aristotle-metadata-enterprises/aristotle_tooltip 使用 BSD-3 Clause 许可。声明的许可为 BSD-3 Clause,请阅读许可原文确认使用条件。以上为概括,不构成法律意见,请以许可原文为准。

@aristotle-metadata-enterprises/aristotle_tooltip 的下载量有多少?

根据 npm 官方下载统计,@aristotle-metadata-enterprises/aristotle_tooltip 在 2026/10/07 – 2026/11/05 这 30 天内被下载 1,695 次,日均约 57 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@aristotle-metadata-enterprises/aristotle_tooltip 还在维护吗?

最新版本 1.2.4 发布于 2022/11/25(3 年前);至今共发布 11 个版本,其中过去 12 个月发布了 0 个;首次发布于 2020/02/19。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。