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.
<script src="https://unpkg.com/jimp@0.5.6/browser/lib/jimp.js"></script>
Usage
-
Include the season-js script tag in your page:
<script src="vendor/season-js/season-js.js"></script>
-
Initialize SeasonJs with the package location and set the holiday type(ethiopian, international):
var seasonJs = new SeasonJs("vendor/"); seasonJs.setHolidayType(<HOLIDAY TYPE>);
-
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(<ID>); seasonLogo.setDecorationPosition(<DECORATION POSITION>); 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(<ID>); 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>