1.0.10 • Published 3 years ago

rwt-xenotools v1.0.10

Weekly downloads
60
License
MIT
Repository
github
Last release
3 years ago
Open Source DOM Component

Xenotools

Search popular tech websites

Motivation

Sometimes visitors are unsatisfied with the information provided in your document and need to further research the topic. As a convenience to your visitors you can provide quick links to external forums that may have additional information about the your document's main topic.

The rwt-xenotools DOM component facilitates this by keeping a social-media style linkbar hidden at the bottom of the page until the user needs it.

When activated, the linkbar slides over the page content, showing a collection of icons associated with popular tech forums.

Activation may also be initiated through the component's toggleMenu method or through its event interface.

The component has these features:

  • Each third-party link is prefilled with a query value that is determined by the document's <meta content=xenotools:query> value.
  • When appropriate, some links are prefilled with a hashtag values that are determined by the document's <meta content=xenotools:tagged> value.
  • The Reddit link uses any value provided by the document's <meta content=xenotools:subreddit> value.
  • The Github link uses any value provided by the document's <meta content=xenotools:language> value.
  • The linkbar has an event interface for showing and hiding itself.
  • The linkbar emits a custom event to close sibling menus and dialog boxes.
  • A keyboard listener is provided to allow a shortcut key to open/close the linkbar.

In the wild

To see an example of this component in use, visit the BLUEPHRASE website and press F6 "Link to Q&A forums". To understand what's going on under the hood, use the browser's inspector to view the HTML source code and network activity, and follow along as you read this documentation.

Installation

Prerequisites

The rwt-xenotools DOM component works in any browser that supports modern W3C standards. Templates are written using BLUE PHRASE notation, which can be compiled into HTML using the free Read Write View desktop app. It has no other prerequisites. Distribution and installation are done with either NPM or via Github.

Download

Using the DOM component

After installation, you need to add two things to your HTML page to make use of it.

  • Add a script tag to load the component's rwt-xenotools.js file:
<script src='/node_modules/rwt-xenotools/rwt-xenotools.js' type=module></script>             
  • Add the component tag somewhere on the page:
<rwt-xenotools id=xenotools shortcut='F6' role=navigation />

Self identification

The linkbar's inputs are prefilled with values provided in the document's tags. Here's an example:

<meta name=xenotools:query content='h1, h2, h3' />
<meta name=xenotools:tagged content=html />
<meta name=xenotools:language content=HTML />
<meta name=xenotools:subreddit content=HTML5 />

Customization

Dialog size and position

The linkbar is positioned in a fixed location at the bottom of the viewport. Its position and size may be overridden using CSS by defining new values for the bottom, width and height variables.

rwt-xenotools {
    --bottom: 3rem;
    --height: 11rem;
    --width: 30rem;
    --z-index: 1;
}

Dialog color scheme

The default color palette for the dialog uses a dark mode theme. You can use CSS to override the variables' defaults:

rwt-xenotools {
    --color: var(--white);
    --accent-color1: var(--pure-white);
    --background-color: var(--nav-black);
    --accent-background1: var(--pure-black);
    --accent-background2: var(--medium-black);
    --accent-background3: var(--light-black);
    --accent-background4: var(--title-blue);
    --border-color1: var(--gray);    
    --border-color2: var(--pure-white);    
    --border-color3: var(--pure-black);    
}

Life-cycle events

The component issues life-cycle events.


Reference

License

The rwt-xenotools DOM component is licensed under the MIT License.

1.0.10

3 years ago

1.0.9

4 years ago

1.0.8

4 years ago

1.0.7

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago