0.8.0 • Published 10 months ago

@puzzlelabs/puzzle-glossary v0.8.0

Weekly downloads
-
License
MIT
Repository
github
Last release
10 months ago

Getting Started

Installation with NPM:

npm install @puzzlelabs/puzzle-glossary

Installation with CDN:

<script
  type="module"
  src="https://unpkg.com/@puzzlelabs/puzzle-glossary/dist/puzzle-glossary/puzzle-glossary.esm.js"
></script>

Highlight Widget Configuration

document.addEventListener('highlightWidgetReady', function() {
  highlightWidgetManager.config = {
    // It needs to select specific parts of page:
    selectors: ['body'],
    // It needs to mark words one time:
    hasMarkAll: false,
    // It needs to hide Puzzle Labs logo in widget:
    puzzleBranding: false,
    // It needs not to mark hyperlinks:
    hasMarkHyperlink: false,
    // It needs to add CTA (Call to action):
    callToAction: {
      text: 'CTA',
      link: 'https://puzzlelabs.ai',
    },
  };

  highlightWidgetManager.handlers = {
    onCopyClick: (event) => {
      console.log(event.type); // event.type === "onCopyClick"
      console.log(event.details.concept); // Concept
      console.log(event.details.marker); // Marker element
    },
    onMarkerHover: (event) => {
      console.log(event.type); // event.type === "onMarkerHover"
      console.log(event.details); // details === Concept
    },
    onCtaClick: (event) => {
      console.log(event.type); // event.type === "onCtaClick"
      console.log(event.details); // details === Concept
    },
    onResourceClick: (event) => {
      console.log(event.type); // event.type === "onResourceClick"
      console.log(event.details.concept); // Concept
      console.log(event.details.marker); // Marker element
      console.log(event.details.resource); // Resource
    },
    onEvent: (event) => {
      console.log(event.type); // One of the available events types
      console.log(event.details) // One of the available events
    },
  };

  highlightWidgetManager.theme = {
    // It needs to change mode (dark/light):
    mode: 'light',
    // It needs to change font (make sure this is added to website):
    fontFamily: 'Times New Roman',
    // It needs to change style and type (highlight/underline) of marker:
    marker: {
      color: '#E7FF57',
      type: 'highlight',
    },
    // It needs to change style of resources: 
    resource: {
      color: args['theme.resource.color'],
    },
    // It needs to change style of CTA (Call to action):
    callToAction: {
      color: '#fff',
      backgroundColor: '#000',
    },
    // It needs to change style of widget modal:
    modal: {
      primaryColor: '#000',
      secondaryColor: '#74747F',
      backgroundColor: '#E7E8FE',
    },
  };

  // first argument is glosary id, { mark: true } say manager after initialization highlight concept automaticaly
  highlightWidgetManager.init('6437d691b3c98451b429460f', { mark: true });
  // Or you can mark separetly
  // highlightWidgetManager.init('6437d691b3c98451b429460f').then(() => {
  //    highlightWidgetManager.mark();
  // });
})

Page Widget Configuration

<page-widget api-key="6437d691b3c98451b429460f"/>
0.7.2

10 months ago

0.7.1

10 months ago

0.7.0

11 months ago

0.6.3-rc.35

11 months ago

0.6.3-rc.36

11 months ago

0.6.3-rc.37

11 months ago

0.8.0

10 months ago

0.6.3-rc.30

11 months ago

0.6.3-rc.31

11 months ago

0.6.3-rc.34

11 months ago

0.6.3-rc.32

11 months ago

0.6.3-rc.33

11 months ago

0.6.3-rc.27

11 months ago

0.6.3-rc.28

11 months ago

0.6.3-rc.26

11 months ago

0.6.3-rc.29

11 months ago

0.6.3-rc.12

11 months ago

0.6.3-rc.13

11 months ago

0.6.3-rc.10

11 months ago

0.6.3-rc.11

11 months ago

0.6.3-rc.7

12 months ago

0.6.3-rc.8

12 months ago

0.6.3-rc.5

12 months ago

0.6.3-rc.6

12 months ago

0.6.3-rc.9

12 months ago

0.6.3-rc.16

11 months ago

0.6.3-rc.17

11 months ago

0.6.3-rc.0

1 year ago

0.6.3-rc.14

11 months ago

0.6.3-rc.15

11 months ago

0.6.3-rc.3

1 year ago

0.6.3-rc.4

12 months ago

0.6.3-rc.18

11 months ago

0.6.3-rc.1

1 year ago

0.6.3-rc.19

11 months ago

0.6.3-rc.2

1 year ago

0.5.4

1 year ago

0.5.5

1 year ago

0.5.8

1 year ago

0.5.7

1 year ago

0.5.9

1 year ago

0.6.3-rc.20

11 months ago

0.6.3-rc.23

11 months ago

0.6.3-rc.24

11 months ago

0.6.3-rc.21

11 months ago

0.6.3-rc.22

11 months ago

0.6.3-rc.25

11 months ago

0.6.4

12 months ago

0.6.1

1 year ago

0.6.0

1 year ago

0.3.0

1 year ago

0.5.3

1 year ago

0.5.0

1 year ago

0.1.4

1 year ago

0.4.0

1 year ago

0.1.3

1 year ago

0.5.2

1 year ago

0.1.6

1 year ago

0.5.1

1 year ago

0.1.5

1 year ago

0.1.0

1 year ago

0.1.2

1 year ago

0.1.1

1 year ago

0.0.9

1 year ago

0.0.8

1 year ago