1.8.0 • Published 4 months ago

godfather v1.8.0

Weekly downloads
15
License
MIT
Repository
github
Last release
4 months ago

Godfather

Build Status npm npm

A man who doesn't spend time with his customers can never be a real man.

Simple vanilla plugin to create good & beautiful onscreen-guides.

Demo

Check out a simple demo

Installation

npm install godfather

Wrappers

API

FunctionDescriptionReturn
register(id, target, options) -> check "Parameters" for more infoRegister a new guide entryInstance
unregister(id)Unregister a guide entry
show(id)Show a guide
hide(id)Hide a guide
setDefault(options)Change the default options

Parameters

id

TypeDescription
StringSet an unique id for identification

target

Guides can be attached to DOM elements

TypeDescription
StringSelector
ObjectDOM-Element

options

This plugin can be customized, the following options are enabled:

KeyTypeDescriptionDefault
titleStringThe displayed titlenull
contentStringThe displayed contentnull
imageStringThe displayed imagenull
hintBooleanAdds a small hint to the targetfalse
attachToStringDefine where the tooltip should attach. Values are: "hint", "element", DOM element"element"
placementStringDefines the placement of the tooltip elementauto
scrollIntoViewBooleanScrolls the guide into viewtrue
clickAwayBooleanCancel guiding if user clicks outside guide elementtrue
prevFunctionFunction to be executet on prevnull
nextString, Functionid of the next guide to show or function to be executetnull
overlayBooleanadd an overlay on the background and highlight the targetfalse
themeObject......
└-- backgroundStringHex or rgb background"#222"
└-- colorStringHex or rgb text color"white"
labelsObject......
└-- prevStringlabel for prev button"<"
└-- nextStringlabel for next button">"
└-- closeStringlabel for close button"✕"

Instance object

The register method return an instance of the Godfather entry with the following functions.

FunctionDescription
unregister()removes the entry
show()shows the entry
hide()hides the entry
addEventListener(event, callback)hook to predefined events: "show", "hide", "close", "prev", "next"

Example

let entry = Godfather.register("don", ".sample-selector", {
  title: "Don Vito Corleone",
  content: "I'm gonna make him an offer he can't refuse",
  image: "don-vito-corleone.png",
  hint: true,
  next: "michael",
});

Godfather.show("don");

entry.unregister();
entry.addEventListener("close", (e) => e.unregister());
entry.removeEventListener("close", (e) => e.unregister());

Development & Testing

npm run dev starts webpack with watch mode.

License

The MIT License Copyright (c) Carsten Jacobsen

1.8.0

4 months ago

1.6.0

4 years ago

1.5.2

5 years ago

1.5.1

5 years ago

1.5.0

5 years ago

1.4.3

5 years ago

1.4.2

5 years ago

1.4.1

5 years ago

1.4.0

6 years ago

1.3.0

6 years ago

1.2.5

6 years ago

1.2.4

7 years ago

1.2.3

7 years ago

1.2.2

7 years ago

1.2.1

7 years ago

1.2.0

7 years ago

1.1.3

7 years ago

1.1.2

7 years ago

1.1.1

7 years ago

1.1.0

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago

0.0.1

10 years ago