Finally Comments NPM Package/Front-End Library

in #utopian-io7 years ago (edited)

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

Sort:  

Thank you for the contribution. It has been approved.

You can contact us on Discord.
[utopian-moderator]

Thanks for reviewing the project Vladimir.

I have just come across your work Sam and making great use of your github repo. Finallycomments is a fantastic idea. I have a project in mind where I will definately implement it in the near future.

Thank you. Great to hear you think Finallycomments is a good idea. Glad you are able to make use of some of the code on Github, let me know if I can help with anything.

Hey @sambillingham I am @utopian-io. I have just upvoted you!

Achievements

  • Seems like you contribute quite often. AMAZING!

Community-Driven Witness!

I am the first and only Steem Community-Driven Witness. Participate on Discord. Lets GROW TOGETHER!

mooncryption-utopian-witness-gif

Up-vote this comment to grow my power and help Open Source contributions like this one. Want to chat? Join me on Discord https://discord.gg/Pc8HG9x

Fantastic, having an NPM package will make it much easier to add Finallycomments to one's blog.

The next time I will work on my personal site I will give Finallycomments a test drive. But since I discovered Steemit, I rarely post on my blog.

You are maintaining your personal site and your Steemit blog, right?​

Dude, this project is legit! I strongly believe that the comment widget would be the first adoption to people and this would definitely replace the current comment widget like Disqus in near future. Thanks for sharing it with us :)