Finally Comments NPM Package/Front-End Library

Initial Library Release

Finally NPM

Finally Comments is an embeddable comments system powered by the Steem Blockchain. The aim of this project is to promote the Steem ecosystem by breaking the comments system out of the walls of Steem based applications, replacing popular comments systems like Disqus & Facebook comments plugin. See the latest at https://finallycomments.com#news.

Aim of this project

The NPM module is intended to make working with Finallycomments better for developers. Until this release Finally used an embed code created on the website. Copy/pasting Embed codes is great for a general tech savvy internet users that are used to embedding Youtube/Soundclound/twitter-cards etc. Developers prefer additional control and customisation of 3rd party code through a Javascript API. The NPM module is intended to provide this control and work in a standard build tool environment/workflow.

This library will make it easier to use and hopefully lead to an increase in number of users.

What Is Included

The package has been published on NPM.

To install this library run: npm install finallycomments --save

Methods added

init() : Adds event listeners to the window for the ‘message' event. Messaged are passed between the finally frame and parent site to control the size of the iframe. These events allow the frame to automatically change size based on the contents.

loadFromSteemitUrl(steemitUrl, options) : Returns an iframe html node representing a finally comments thread built from the input Steemit post.

loadThread(slug, username, options) : Returns an iframe html node. Slug/username represents a custom thread created at finallycomments.com

appendTo(selector, embedType, id, username, options) : Creates an iframe from the parameters and uses appendChild to insert the frame into the DOM using the selector specified. This shortcuts needing the create the iframe and add it separately using the functions above. Useful but provides less control.

directThreadLink(embedType, url, options) : Returns a url(String) that links to the Finally thread viewer. In the latest version of finally threads have individual pages on the site on the /viewer/route.

There are other parts to the code that are not exposed to the module but work internally with the provided actions.

Examples

Below are a couple of examples to illustrate how simple adding Finally comment threads now is. The options object is always optional.

loadFromSteemitUrl(steemitUrl, options)

Prepare an iframe for using within your html.

let iframe = loadFromSteemitUrl('https://steemit.com/utopian-io/@sambillingham/finally-comments-api-and-new-dashboard-features')

appendTo(selector, embedType, id, username, options)

append the thread with slug finally-hellomars' to themain` html tag

let options = {
  values: true,
  reputation: false,
  profile: false
}
finallycomments.appendTo('main', 'thread', 'finally-hellomars', 'sambillingham', options)

Roadmap

I will maintain this library to match featured that are created for finallycomments. If you're interested in what's to come in future versions of Finally please look at this previous post.

Contributions

If you have any suggestions, requests or would like to contribute people message or submit issues via Github.



Posted on Utopian.io - Rewarding Open Source Contributors

H2
H3
H4
3 columns
2 columns
1 column
Join the conversation now
Logo
Center