Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
  config
  src
  package.json
  .npmignore
  README.md
  jest.config.js
  .release
  tsconfig.json
Size: Mime:
  README.md

Personal storage

Is a simple library and it does two things:

  • When the page is loaded, it takes the content category from the meta tag (if it exists) and saves the visit count in the local storage
  • Checks if the page has certain css classes (html blocks to replace) and if there is a most viewed category in the local storage, it fetches data according to the most viewed category and replaces these html blocks with fetched content

Usage

import this library and initialize

    import {PersonalStorage} from "personal-storage";
    const apiUrl = 'https://example.com';
    const teaserCssClass = 'content';
    new PersonalStorage(apiUrl, teaserCssClass);

Meta tag should have structure:

<meta name="content" content="cars" />

name can be configured by changing teaserCssClass.

By default, html block to replace should have this structure and css classes:

...
<div class="lift-teaser__link">
    <div class="lift-teaser__title">
        <a class="node-tec-news-related-topics-view-mode__title-link">
            <div class="lift-teaser__title">Some title</div>
        </a>
    </div>
    <!--Other teasers-->
</div>
...

Classes can be configured:

...
const conentToreplaceClasses = {
	wrapper: 'wrapper-class',
	title: 'title-class',
	image: 'image-class',
	link: 'link-class'
};
new PersonalStorage(apiUrl, teaserCssClass, conentToreplaceClasses);