Code Monkey home page Code Monkey logo

enjoyhint's Introduction

EnjoyHint

EnjoyHint is a web-tool that provides the simplest way to create interactive tutorials and hints for your site or web-application. It can also be used to highlight and sign application elements.

EnjoyHint is free software distributed under the terms of MIT license.

Demo

Dependencies

EnjoyHint require the following plugins and libs:

  • jQuery v3.5.1
  • jQuery.scrollTo v2.1.2
  • KineticJS > v5.1.0

Installation

You can install it through node or bowerpackage managers:

npm install xbs-enjoyhint
bower install xbs-enjoyhint

Alternative way:

  • Download the latest version of EnjoyHint from GitHub.
  • Extract the archive with EnjoyHint.
  • Move the EnjoyHint directory to somewhere on your webserver.
  • Install dependencies npm install or bower install if you want to use internal libraries.
  • Insert next lines into your page's <head> tag:
  <!-- From external libraries -->
  <script src="https://code.jquery.com/jquery-3.5.1.min.js"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/kineticjs/5.2.0/kinetic.js"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-scrollTo/2.1.2/jquery.scrollTo.min.js"></script>

  <!-- Or from internal libraries from node_modules-->
  <script src="<pathontheserver>/jquery/dist/jquery.min.js"></script>
  <script src="<pathontheserver>/kinetic/kinetic.min.js"></script>
  <script src="<pathontheserver>/jquery.scrollto/jquery.scrollTo.min.js"></script>

  <!-- Enjoyhint library -->
  <link href="<pathontheserver>/enjoyhint/enjoyhint.css" rel="stylesheet">
  <script src="<pathontheserver>/enjoyhint/enjoyhint.min.js"></script>

Initialization and configuration:

//initialize instance
var enjoyhint_instance = new EnjoyHint({});

//simple config. 
//Only one step - highlighting(with description) "New" button 
//hide EnjoyHint after a click on the button.
var enjoyhint_script_steps = [
  {
    'click .new_btn' : 'Click the "New" button to start creating your project'
  }  
];

//set script config
enjoyhint_instance.set(enjoyhint_script_steps);

//run Enjoyhint script
enjoyhint_instance.run();

Script Configuration

The sequence of steps can be only linear for now. So, the script config is an array. Every element of this array is the config for some step.

Example of script configuration

Highlight some button and after you click on it, highlight some panel:

var enjoyhint_script_steps = [
  {
    'click .some_btn' : 'Click on this btn'
  },  
  {
    'click .some_panel' : 'Click on this panel'
  }  
];

Properties of the step configuration

  • "event selector" : "description" - to describe a step you should set an event type, selecte element and add description for this element (hint)
  • arrowColor - the color of a marker that accepts all CSS colors.
  • keyCode - the code of a button, which triggers the next EnjoyHint step upon a click. Defined by the “key” event. (“key #block” : “hello”).
  • event_selector - if you need to attach an event (that was set in "event" property) to other selector, you can use this one
  • timeout - delay before the moment, when an element is highlighted
  • shape - shape for highlighting (circle|rect)
  • radius - if the shape of "circle" is specified, we can set the radius.
  • margin - margin for the highlight shape (for Ex.:10)
  • top - top margin for the shape of "rect" type
  • right - right margin for the shape of "rect" type
  • bottom - bottom margin for the shape of "rect" type
  • left - left margin for the shape of "rect" type
  • scrollAnimationSpeed - sets the auto scroll speed (ms).
  • nextButton - allows applying its classes and names for the button Nеxt.
  • skipButton - allows applying its classes and names for the button Skip.
  • prevButton - allows applying its classes and names for the button Previous. For the example :
	var options = {
                    "next #block": 'Hello.',
                    "nextButton" : {className: "myNext", text: "myNEXT"},
                    "skipButton" : {className: "mySkip", text: "mySKIP"},
                    "prevButton" : {className: "myPrev", text: "myPREV"}
                }
  • showSkip - shows or hides the Skip button (true|false)
  • showNext - shows or hides the Next button (true|false)
  • showPrev - shows or hides the Previous button (true|false)

Non-standard events:

  • auto - for example, you need to click on the same button on the second step imediatelly after the first step and go to the next step after it. Then you can use "auto" in the "event_type" property and "click" in "event" property.
  • custom - this value is very usefull if you need to go to the next step by event in your app code. For example, you want to go to the next step only after some data have been loaded in your application. Then you should use the "custom" event_type and the "trigger" method of the EnjoyHint instance.
//Example of using custom event_type
$.get('/load/some_data', function(data){
  //trigger method has only one argument: event_name.(equal to the value of event property in step config)
  enjoyhint_instance.trigger('custom_event_name');
});
  • next - when you set value of event_type to "next", you will see the "Next" btn on this step.
  • key - tells EnjoyHint to go to the next step when you click on the button defined by the keyCode

Methods

  • set - set current steps configuration. Arguments: config
  • run - run the current script. Has no arguments
  • resume - resume the script from the step where it was stopped. Has no arguments
  • getCurrentStep - returns the current step index
  • trigger - After writing this code you can either move to the next step or finish with EnjoyHint (next|skip)

Events

Script Events:

  • onStart - fires on the first step.
  • onEnd - fires after the last step in script.
  • onSkip - fires after user has clicked skip.
var enjoyhint_instance = new EnjoyHint({
  onStart:function(){
    //do something
  }
});

Step Events:

  • onBeforeStart - fires before the step is started.
var enjoyhint_script_steps = [
  {
    selector:'.some_btn',//jquery selector
    event:'click',
    description:'Click on this btn',
    onBeforeStart:function(){
      //do something
    }
  }
];

Release notes

v.4
  • Fixed label position bugs
  • Fixed arrow position bugs
  • Fixed resize bugs
  • Added responsive design
  • Added mobile support
  • Added possibility to go back to previous step
  • Added possibility to select the color of a marker
  • Added possibility to customize previous button

enjoyhint's People

Contributors

andvikvin avatar asaskevich avatar azhurav1ev avatar barrycoleman avatar billiegoose avatar blackazaru avatar braxtondiggs avatar chucklangford avatar davidsonsns avatar dimalchandrasiri avatar feiteng-alfred avatar jamespsterling avatar kattoor avatar lfreneda avatar myszkowski avatar nedudi avatar oyamowiec avatar oyedyharova avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

enjoyhint's Issues

How restart tour after skip action?

At now, we need to full reinitialize:

tour._instance = new EnjoyHint({
onSkip: function(){
setTimeout(function(){
delete tour._instance;
tour.init()._instance.setSteps(tour.steps);
}, 300);
}
});

Option to show all the tips at once

It would be nice if we have an option to show all the steps in one overlay. I have check the documentation I dont think this feature is available.

Please let me know if this is already present.

Suggestion: Ignore the step if the selector is undefined

Thanks for the library. It looks great!

Can the step be ignored without script error if the element selector does not return anything? This is useful when the elements are either hidden or not rendered in dynamic pages and the step is not valid.

If the last selector is invalid, the next button should not be displayed in the last but one step.

Currently when the element does not exits the next button does not work and the following script error occurs:
Uncaught TypeError: Cannot read property 'left' of undefined(anonymous function) @ enjoyhint.js:176

scrollTop issue in stepAction

Hello, i've an issue when in the webpage there is a fixed (position fixed in CSS) menu/toolbar (with z-index).
The highlighting is behind my menu...

Any tricks ?
Or maybe, add a offset adjustement parameter in the step settings like scrollAnimationSpeed to adjuste manually if necessary

Thanks you realy much.

Advanced (Range) Selector Not Working

I am working on implementing enjoyhint on a Table.

#tbData tr:first td:nth-child(n+4):nth-child(-n+9)

jQuery is selecting the range correctly - but the component is not using the whole range. It's only highlighting the first TD in the range.

Suggestions?

Problem with divs animated

Hi! If you have a div in a left position and when you click it if change the position, the hint it's not in the correct position!

Nice works!! Regards!!

Uncaught ReferenceError: require is not defined

After including enjoyhint.js in html, i am getting the error that "Uncaught ReferenceError: require is not defined". My application using NodeJS for backend and Angular and Jade for front end.
script(src="/enjoyHint/enjoyhint.min.js")

A few issues

Hi,

I am trying to put together a slight custom job on this library for a tour. Couple of issues I am facing, I hope you can assist with:

  1. I want to remove the 'x' icon for closing the code. Is there a method/event for doing this?
  2. I have a large area I require to have highlighted at the bottom of the page...this causes the white pointer line to cut over the Next Button. Is there a way to configure the position of the buttons or text or line position point in-built?
  3. The onSkip function does not work from the documentation. How else can I create a Skip event?

Please help with these queries soon.

Thanks.

Demo page

Is it possible to add demo page that available in your website into github repository to take reference?

Enjoyhint in Wordpress

First off, thank you for making Enjoyhint available for free!

I'm just learning javascript, so I'm learning as I go. I'm stuck as to where I would place the codes to make the overlay activate only on the home page?

Would there happen to be a Wordpress tutorial that I could check out? Or would you be able to advise where or how to place the code in my Wordpress site?

Thank you!

P.S. Not sure if this is the proper place to ask for help, GitHub is new to new as well. Apologizes in advance.

Arrow Head disappears

Hi, thanks for the repo,

When I run the demo arrow heads are there,

but when I import css and js into our project arrow heads are gone, everything else works fine,

all help appreciated,

JQuery 1.8.x skip button and next button do not have class

if use JQuery 1.8.x removeClass(undefined) will remove all classes from the button include default class.

that.clear = function(){
// (Remove userClass and set default text)
if(that.nextUserClass!=undefined)
$(".enjoyhint_next_btn").removeClass(that.nextUserClass);
$(".enjoyhint_next_btn").text("Next");
if(that.skipUserClass!=undefined)
$(".enjoyhint_skip_btn").removeClass(that.skipUserClass);
$(".enjoyhint_skip_btn").text("Skip");
}

This will be OK.
Is it a JQuery bug?

Error 404 on Casino Hand

I get this error in console:

GET http://uikit.dev/assets/vendor/enjoyhint/Casino_Hand/casino_hand-webfont.woff
GET http://uikit.dev/assets/vendor/enjoyhint/Casino_Hand/casino_hand-webfont.ttf 

I don't know what those are for but enjoyhint is working fine.

No Arrow Heads in Ember Apps

Due to 'marker-end' using a url reference to put the arrow head on the pointers, I was only seeing the arc, but not the end of the arrow in my Ember App. I soon discovered it was because of the way Ember manages its routing.

Managed to fix it by getting the URL when making the SVG, then adding it to the properties in the renderArrow function:

var currentURL = window.location.href
... 'marker-end': "url(" + currentURL + "#arrowMarker)" ...

Not sure if its worth fixing for the limited cases, but thought I'd leave this here in case any one had a similar issue

take into account a fixed header

Hi,

what an excellent project.

We are having a problem and would like some guidance to try to fix it. We have a fixed header that is "over" the page. when the Autoscroll feature moves the page up and down, sometimes the highlighted area is incorrectly scrolled under the header.

the work arounds we have thought of are either:

  1. tell the system to not count the top xx pixels when calculating the automatic scroll;
  2. disable the automatic scrolling and manage the scroll manually.

Are either of these possible?

Thanks!

Non-standard events:

After debugging, I think the document should be edited as follows:

//Example of using custom event_type
$.get('/load/some_data', function(data){
//trigger method has only one argument: 'next 'or 'skip'
enjoyhint_instance.trigger('next');
});

Wrong class for skip button

Hi there
the skip button is not initialized with the enjoyhint_skip_btn CSS class as it should. It uses the enjoyhint_next_btn class (line 263 of enjoyhint.js).

Thanks!

I want to add new hints dynamically

Hi,

I am using enjoyhint in my webpage.. I want add new hints dynamically according to newly added fields in page.. Please suggest me any solutions

It loads only first time

whenever I am refreshing the page it loads automatically. help me to fix the issue. I just want it to load only one time when the user login for first time.

Define a 'skip' callback

Hey there

It would be nice to be notified when the user hits the skip button. Some specific actions may need to be done when the user skips the process, so it would be great if we could define a callback in the constructor that would be called only when the user ends enjoyhint by clicking the skip button.

What do you think?

Next and Skip not visible

I am using enjoyhint in a .NET environment. I am able to run basic examples with hints showing, however next and skip buttons are missing. Anyone know what the issue could be?

When I press f12 tab, the style for nextbutton and skip button is missing. However, it's there in the css file.

Quick tip, if you wish to avoid false positive on nehoboring elements..

Quick tip, if you wish to avoid false positive on neighboring elements catch the event and shoot'em down to help enjoyhint get only destined bubbling events.

as in

 $('#fooDiv).on('click',function(e){
                if (e.target.tagName != 'rect'){
                    e.preventDefault();
                    e.stopImmediatePropagation()
                    return false;
                }
            });

'overflow-x: scroll', position is wrong

Modify two codes

171:21

var coords = {
          x: offset.left + Math.round(w / 2)  - $(document).scrollLeft() ,
          y: offset.top + Math.round(h / 2)  - $(document).scrollTop()
      };

591:57

var label_left = label.offset().left - $(document).scrollLeft();

Vertical touch scroll issue

It would be nice if you help me!

After instantiate enjoyhint using window.enjoyhint_instance.run(); the vertical swipe (scroll) is not working yet using angular-touch.js (the horizontal swipe still working fine).

I'm using:

  • AngularJS v1.4.7
  • jQuery v2.1.0

Thank you!

If click is not accurate (miss a few pixels on a div), an error occurs, workaround...

If click is not accurate (miss a few pixels on a div), an error occurs, workaround...
did a workaround for me, but it's just a hack, should be cleanly treated.

CanvasRenderingContext2D.prototype.roundRect = function (x, y, w, h, r) {
    var self = this;
    try {
        if (w < 2 * r) r = w / 2;
        if (h < 2 * r) r = h / 2;
        this.beginPath();
        this.moveTo(x + r, y);
        this.arcTo(x + w, y, x + w, y + h, r);
        this.arcTo(x + w, y + h, x, y + h, r);
        this.arcTo(x, y + h, x, y, r);
        this.arcTo(x, y, x + w, y, r);
        this.closePath();
        return this;
    } catch (e) {
        //todo: catching errors if click is not accuarte and just announce to BB frame on exit, per Sean 9-22-2015
        console.log('error::::::::::::::::::::: enjoyhint' + e);
        // announce to my framework to close the wizard cleanly
        BB.comBroker.fire('CLOSE_WIZARD', this, e);
    }

};

problem $body.enjoyhint is not a function

Hello guys, i'm trying to apply interactive tutorials in my web application. I decided to use enjoyHInt. But on my first test i received the error below.
I just make the initial steps. So i do:

1st import (it's ok);
2nd ctrl + c / ctrl + v in the script provided by "https://github.com/xbsoftware/enjoyhint"
3º i created a div and a button with class especified on the code js.

And i started my web application and i received this error on my console:

VM1533 enjoyhint.js: 22 Uncaught TypeError: $ body.enjoyhint is not a function
At init (VM1533 enjoyhint.js: 22)
At new EnjoyHint (VM1686 enjoyhint.js: 173)
At VM1536 Cad119Action! Browser.action: 364

Do you have somthing to help me?

full code:

	<link rel="stylesheet" href="enjoyhint/enjoyhint/jquery.enjoyhint.css" type="text/css">
	<script type="text/javascript" src="enjoyhint/enjoyhint/enjoyhint.js"></script>
	<script src="http://code.jquery.com/jquery-1.11.3.min.js"></script>

	<title>Teste Framework</title>
</head>

<style>
	.new_btn{
		width: 50px;
		height: 50px;
		margin-top: 99px;
	}
</style>

	
<body>
	<div class="pendenciasTeste">
	<button class="new_btn" onclick="teste();"></button>
	</div>
</body>
<script> var teste = function(){ alert("cliquei"); } //initialize instance var enjoyhint_instance = new EnjoyHint({}); //simple config. //Only one step - highlighting(with description) "New" button //hide EnjoyHint after a click on the button. var enjoyhint_script_steps = [ { 'click .new_btn' : 'Click the "New" button to start creating your project' } ]; //set script config enjoyhint_instance.set(enjoyhint_script_steps); //run Enjoyhint script enjoyhint_instance.run(); </script>

//initialize instance
var enjoyhint_instance = new EnjoyHint({});

//simple config.
//Only one step - highlighting(with description) "New" button
//hide EnjoyHint after a click on the button.
var enjoyhint_script_steps = [
{
'click .new_btn' : 'Click the "New" button to start creating your project'
}
];

//set script config
enjoyhint_instance.set(enjoyhint_script_steps);

//run Enjoyhint script
enjoyhint_instance.run();
</script>

Labels missing on smaller screens

Labels are hidden on when the screen is smaller. The elements are drawn in the DOM elements but hidden.

if (is_center) { if (is_top) { setArrowData('bottom', 'top', 'top'); } else if (is_bottom) { setArrowData('top', 'bottom', 'bottom'); } else { return; // When elements are in smaller screens, they end up in this code segment which prevents them from drawing the rest of the labels. } } else if (is_left) { sideStatements( ['right', 'top', 'top'],//top ['bottom', 'left', 'bottom'],//mid_top ['right', 'left', 'top'],//mid ['top', 'left', 'top'],//mid_bot ['right', 'bottom', 'bottom']//bot ); } else {//right sideStatements( ['left', 'top', 'top'],//top ['bottom', 'right', 'bottom'],//mid_top ['left', 'right', 'top'],//mid ['top', 'right', 'top'],//mid_bot ['left', 'bottom', 'bottom']//bot ); }

Uncaught ReferenceError: EnjoyHint is not defined

I am using Enjoyhint with cookies when cookies are stored then no "Uncaught ReferenceError: EnjoyHint is not defined" but when i am deleting cookies is showing above error.
`if (cookie.indexOf('visited=', 0) == -1) {
document.cookie = "visited=1;expires=30 June 2035 23:59:59 GMT ;path=/";
setTimeout(function () {
var enjoyhint_instance = new EnjoyHint({});
var enjoyhint_script_steps = [
{
'next .tour_sidebar' : 'Filter your search by locations, spors, specific dates, price, days and categories'
},
{
"next .collections_wrap": "Check out our curated collections"
}
];
enjoyhint_instance.set(enjoyhint_script_steps);

        //run Enjoyhint script
        enjoyhint_instance.run();
    }, 2000);            
}`

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.