npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

cc-calculator-widget

v1.1.0

Published

Widget for embedding Cool Climate Calculator UI with custom offset parameters.

Downloads

25

Readme

Cool Climate Calculator Widget

This widget can be used to embed the Cool Climate Calculator UI in your site.

Installation

Make sure the following packages are installed on your machine

  • node.js
  • npm

Install dependencies

$ npm i

Production build

Compile into a minified bundle with external stylesheets.

$ gulp build

Development

Watch for changes:

$ gulp watch

Usage

The compiled bundle needs to be referenced within the HTML file.

<script charset="utf-8" src="dist/bundle.min.js"></script>

A div including the id tag (equivalent to the container_id parameter) needs to be created within the body tag.

The widget can be instantiated within a <script> tag. (for an example, see: dist/index.html )

<script>
new window.Widget({
    container_id: 'widget_goes_here',
    source: 'nature.org',
    campaign: 'carboncalculator',
    user_platform: false,
    banner_url: "https://clipartion.com/wp-content/uploads/2016/03/green-banner-transparent-png-image.png",
    banner_style: {'maxHeight': '60px'},
    cta: {
      title: 'Offset your impact on nature',
      show_equation: true,
      description: 'Your support will fund forest conservation and help reduce or slow the worst consequences of climate change.',
      carbon_price_per_ton: 45,
      offset_url: 'http://www.nature.org/offset',
      button_title: 'Offset now!'
    }
  });
</script>

Parameters

The UI of the CC Calculator is currently set to: http://calculator.coolclimatenetwork.net/

| property | description | | -------- | ----------- | | container_id | The identifier for the container which the iframe is inserted into. | | source | String to set utm_source on iframe URL parameter for Google Analytics. | | campaign | String to set utm_campaign on iframe URL parameter for Google Analytics. | | user_platform | Boolean which can be set to false in order to hide Settings menu item and disable connection to user platform (optional). | | banner_url | Set the URL of the top banner image for the calculator. | | banner_style | Set the style of the banner image within the the calculator (ie so you can position it properly) - expects an object. | | max_width | Sets maximum width of iframe. If not given, defaults to '1200px'. | | height | Sets height of iframe. If not given, updates responsively. | | * cta: {* | The following parameters need to be placed within this 'cta' object property. | | title | The title that shows up above the offset section on the Take Action page. | | show_equation | Boolean which decides whether the monthly gift equation is shown. | | description | Sets the description text displayed above the CTA button. | | carbon_price_per_ton | The carbon price per ton for calculating the offset amount. | | offset_url | The URL that the call to action button is linked to. | | button_title | The text on the call to action button. | | * }* | |