rwt-piqueme

1.0.11 • Public • Published

Aw . . . Let's peak inside guys!
Premium DOM Component

Piqueme

Pique their interest

by Read Write Tools Feb 17, 2021
Abstract

The Piqueme DOM component is a just-in-time continuous feed of articles featuring collapsable/expandable UI cards.

Background

Visitors appreciate the compact beauty of UI cards. They provide so much more than a simple hyperlink.

UI cards typically have some combination of these elements: image, headline and/or lede paragraph. UI cards give visitors the gist of hyperlinked articles without the effort — for visitors, there's no forward navigation to check out a new page; and there's no back navigation to continue where they left off.

UI cards keep visitors on the same page, and keep them reading your content.

The rwt-piqueme goes two steps further than the classic UI card: 1) it allows the visitor to read the entire article without ever leaving the original document, and 2) it saves network bandwidth by fetching articles only when needed.

The rwt-piqueme component has these features:

  • Articles are initially displayed in UI card format with splash image, caption, kicker, headline, subhead, byline, dateline and lede.
  • Visitors can choose to read the full article in situ, that is, without ever leaving the host page.
  • UI cards can be toggled between collapsed and expanded states, to show just the UI card, or the full article.
  • Articles are fetched just-in-time, when the visitor scrolls down to that part of the document.
  • A document that contains a large set of potential UI cards will only fetch what's needed, and only when it's needed.
  • Each component instance handles a single on-demand article.

In the wild

To see examples of this component in use, visit any of these sites, and be sure to look under-the-hood at the source code to see how easy it is to use the component.

javascriptfanboi.com JAVASCRIPT FANBOI
2020stack.com 2020 STACK
grok.readwritetools.com READ WRITE GROK

Installation

Prerequisites

The rwt-piqueme DOM component works in any browser that supports modern W3C standards. It has no other prerequisites. Distribution and installation are done with either NPM or via Github.

Download

Download using NPM

OPTION 1: Familiar with Node.js and the package.json file?
Great. Install the component with this command:

npm install rwt-piqueme	

OPTION 2: No prior experience using NPM?
Just follow these general steps:

  • Install Node.js/NPM on your development computer.
  • Create a package.json file in the root of your web project using the command:
npm init		
Download and install the DOM component using the command:
npm install rwt-piqueme		

Important note: This DOM component uses Node.js and NPM and package.json as a convenient distribution and installation mechanism. The DOM component itself does not need them.

Download using Github

If you prefer using Github directly, simply follow these steps:

  • Create a node_modules directory in the root of your web project.
  • Clone the rwt-piqueme DOM component into it using the command:
git clone https://github.com/readwritetools/rwt-piqueme.git		

Using the component

After installation, you should add two things to your HTML page to make use of it:

  1. Add a script tag to load the component's rwt-piqueme.js file:
<script src='/node_modules/rwt-piqueme/rwt-piqueme.js' type=module></script>             
  1. Add articles to the page one by one, identifying their location with the component's sourceref attribute:
<rwt-piqueme sourceref='/2021/Jan/article01.html'></rwt-piqueme>

<rwt-piqueme sourceref='/2021/Feb/article02.html'></rwt-piqueme>

<rwt-piqueme sourceref='/2021/Mar/article03.html'></rwt-piqueme>

<rwt-piqueme sourceref='/2021/Apr/article04.html'></rwt-piqueme>

Article meta data

The UI card properties that the visitor sees are extracted in real-time from each article. They are pulled from <meta> tags placed in each article's <head>. You should configure your web server to add the following meta tags:

picueme:photo
The URL to a picture to splash across the top of the UI card.
piqueme:caption
A one line description of the splash picture.
piqueme:kicker
A word or short phrase placed above the headline.
piqueme:headline
The article's title.
piqueme:subhead
The article's subtitle.
piqueme:byline
The author of the article.
piqueme:dateline
The date the article was published.
piqueme:lede
The first paragraph of the article.
piqueme:textblock
An HTML DOM selector referencing the <div> that contains the text of the article.

All <meta> tags are optional. Configure only the ones that you want displayed in the UI card.

Note that all URL's are subject to the browser's same-origin security policy. If articles or images are coming from a different server, you must ask that server's administrator to configure CORS permissions for your origin server.

UI card layout and styling

The HTML layout for the UI card is configured in the component's rwt-piqueme.blue file. Only advanced applications will need to change this.

The default CSS styling uses a dark mode theme. It is configured in the rwt-piqueme.css file. You can replace the contents of this file with CSS that matches your website's typeface and color theme.

Life-cycle events

The component issues life-cycle events. These can be used in advanced applications to trigger other actions.

component-loaded
Sent when the component is fully loaded and ready to be used.
fetch-complete
Sent when an article has been fetched over the network. The event's detail property will contain two values: remoteURL and fetchStatus.

Reference

DOM components logo Documentation READ WRITE HUB
git logo Source code github
DOM components logo Component catalog DOM COMPONENTS
npm logo Package installation npm
Read Write Stack logo Publication venue READ WRITE STACK

License

The rwt-piqueme DOM component is not freeware. After evaluating it and before using it in a public-facing website, eBook, mobile app, or desktop application, you must obtain a license from Read Write Tools .

Piqueme Software License Agreement
  1. This Software License Agreement ("Agreement") is a legal contract between you and Read Write Tools ("RWT"). The "Materials" subject to this Agreement include the "Piqueme" software and associated documentation.
  2. By using these Materials, you agree to abide by the terms and conditions of this Agreement.
  3. The Materials are protected by United States copyright law, and international treaties on intellectual property rights. The Materials are licensed, not sold to you, and can only be used in accordance with the terms of this Agreement. RWT is and remains the owner of all titles, rights and interests in the Materials, and RWT reserves all rights not specifically granted under this Agreement.
  4. Subject to the terms of this Agreement, RWT hereby grants to you a limited, non-exclusive license to use the Materials subject to the following conditions:
  • You may not distribute, publish, sub-license, sell, rent, or lease the Materials.
  • You may not decompile or reverse engineer any source code included in the software.
  • You may not modify or extend any source code included in the software.
  • Your license to use the software is limited to the purpose for which it was originally intended, and does not include permission to extract, link to, or use parts on a separate basis.
Each paid license allows use of the Materials under one "Fair Use Setting". Separate usage requires the purchase of a separate license. Fair Use Settings include, but are not limited to: eBooks, mobile apps, desktop applications and websites. The determination of a Fair Use Setting is made at the sole discretion of RWT. For example, and not by way of limitation, a Fair Use Setting may be one of these:
  • An eBook published under a single title and author.
  • A mobile app for distribution under a single app name.
  • A desktop application published under a single application name.
  • A website published under a single domain name. For this purpose, and by way of example, the domain names "alpha.example.com" and "beta.example.com" are considered to be separate websites.
  • A load-balanced collection of web servers, used to provide access to a single website under a single domain name.
THE MATERIALS ARE PROVIDED BY READ WRITE TOOLS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL READ WRITE TOOLS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. This license is effective for a one year period from the date of purchase or until terminated by you or Read Write Tools. Continued use, publication, or distribution of the Materials after the one year period, under any of this Agreement's Fair Use Settings, is subject to the renewal of this license. Products or services that you sell to third parties, during the valid license period of this Agreement and in compliance with the Fair Use Settings provision, may continue to be used by third parties after the effective period of your license. If you decide not to renew this license, you must remove the software from any eBook, mobile app, desktop application, web page or other product or service where it is being used. Without prejudice to any other rights, RWT may terminate your right to use the Materials if you fail to comply with the terms of this Agreement. In such event, you shall uninstall and delete all copies of the Materials. This Agreement is governed by and interpreted in accordance with the laws of the State of California. If for any reason a court of competent jurisdiction finds any provision of the Agreement to be unenforceable, that provision will be enforced to the maximum extent possible to effectuate the intent of the parties and the remainder of the Agreement shall continue in full force and effect.

Activation

To activate your license, copy the rwt-registration-keys.js file to the root directory of your website, providing the customer-number and access-key sent to your email address, and replacing example.com with your website's hostname. Follow this example:

export default [{
    "product-key": "rwt-piqueme",
    "registration": "example.com",
    "customer-number": "CN-xxx-yyyyy",
    "access-key": "AK-xxx-yyyyy"
}]

Package Sidebar

Install

npm i rwt-piqueme

Weekly Downloads

0

Version

1.0.11

License

see license.html

Unpacked Size

296 kB

Total Files

17

Last publish

Collaborators

  • joehonton