npm.io
1.0.2 • Published 7 years ago

season-js

Licence
ISC
Version
1.0.2
Deps
0
Size
7.9 MB
Vulns
0
Weekly
0

SeasonJs

A Javascript library that provides logo decorations and images for carousels based on the current holiday season.

Installation

npm i season-js

Dependencies

  • Jimp(JavaScript Image Manipulation Program): This library is used for editing the images. Include the following script tag before including the season-js script tag.

``

Usage

  • Include the season-js script tag in your page:

``
  • Initialize SeasonJs with the package location and set the holiday type(ethiopian, international):

`var seasonJs = new SeasonJs("vendor/"); seasonJs.setHolidayType(); `
  • Initialize SeasonLogo with the id of the img tag that contains the logo, set the decoration position(top, bottom) and call replaceLogo:

`var seasonLogo = seasonJs.seasonLogo(); seasonLogo.setDecorationPosition(); seasonLogo.replaceLogo(); `
  • Initialize SeasonCarousel with the id of the img that contains the image of one of the carousels and call replaceLogo:

`var seasonCarousel = seasonJs.seasonCarousel(); seasonCarousel.replaceCarousel(); `
Example Usage
<script src="https://unpkg.com/jimp@0.5.6/browser/lib/jimp.js"></script>
<script src="vendor/season-js/season-js.js"></script>
<script>
    var seasonJs = new SeasonJs("vendor/");
    seasonJs.setHolidayType("ethiopian");

    var seasonLogo = seasonJs.seasonLogo("logo");
    seasonLogo.setDecorationPosition("bottom");
    seasonLogo.replaceLogo();

    var seasonCarousel = seasonJs.seasonCarousel("carousel-1");
    seasonCarousel.replaceCarousel();
</script>