Code Monkey home page Code Monkey logo

hopscotch's People

Contributors

affka avatar benjamin-dobell avatar chriseppstein avatar eoneill avatar gkoo avatar gnatok avatar joehalliwell avatar joshjordan avatar kate2753 avatar kemaldaggen avatar kkirsche avatar klaviercat avatar leedavidr avatar leom avatar marc-hughes avatar nanek avatar nickjs avatar ryanone avatar sontan avatar stebunovd avatar timlindvall avatar travstone avatar yeah avatar ykka 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  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

hopscotch's Issues

Use compiled templates for rendering internals of bubble

There are a couple of current enhancements for configuration changes that affect the internals of each Hopscotch bubble (#33 and #39). I'm thinking, instead of creating new configuration options that affect the bubble display (which could lead to a bloated configuration object over time), what if we could provide the option to use a JavaScript template (or other method) to render the internals of each bubble?

How it would work

A user could define a render method in their tour configuration options or register a template via hopscotch.registerTemplate(Function render). Hopscotch would be agnostic to how this template is written or compiled... all it cares about is a method that it can hand an object off to for rendering the bubble's internals. The object itself would contain information relevant to the current step (title, content, stepNum, totalSteps, button info, labels) and would be responsible for returning HTML that can be set as the bubble's innerHTML.

Other contemplations

  • How to handle events? One possibility is to include some means when declaring the template to provide the IDs that Hopscotch should attach events to. Or, we could have Hopscotch pass a DOM reference to the render method and require it to handle attaching the events.
  • Should render() be limited in its scope to just the inside of the bubble, or should it have responsibility for the structure of the whole bubble? The latter might require some updates to positioning calculations.
  • If we go this route, we may want to consider modifying how Hopscotch currently does bubble rendering to use this new pattern instead.

Any thoughts?

jQuery selector example

I believe it'd be very nice to have a jQuery selector example for target. After a lot of time testing, the final one I used was just the string "table tr:first-child td", but I didn't find it in the documentation.

Also, since this script's main use if for a tutorial after an event happened, it'd be nice i it was possible to bind it to an event.

Thank you.

onCTA not firing Callback Helpers

I tried registering the callback to an onNext and to an onShow event and it works,
but with onCTA it just wont.

onCTA do work when using a function literal and not a helper.

Scrolling within an iframe does not seem to work

I have a web app that uses iframes. The main content window is an iframe and I am triggering hopscotch from a button within. When it needs to scroll down the page it initially starts to scroll, but the page content does not scroll with it.
You can see in my screenshot that the scroll bar does not span the entire page anymore. It seems to have added in a bunch of white space that is not part of the page anymore. My tour object is also below. Nothing out of the ordinary I don't think. There seems to be something I am missing with iframes. Suggestions?

hopscotch1

var tour = {
        id: "hello-hopscotch",
        showPrevButton: true,
        showNextButton: true,
        steps: [
        {
            title: "Number",
            content: 'This is the number.<br/><b>OOB Number</b>',
            target: "element.u_that_table.number",
            placement: "bottom"
        },
        {
            title: "State:",
            content: "Select a State in here.",
            target: "element.u_that_table.state",
            placement: "bottom",
        },
        {
            title: "Description:",
            content: "Here is where you add a description of the change.",
            target: "element.u_that_table.description",
            placement: "top",
            arrowOffset: 'center'
        },
        {
            title: "Work Notes:",
            content: "Here is where you add some work notes.",
            target: "element.u_that_table.work_notes",
            placement: "top"
        },
        {
            title: "Approval:",
            content: "This is the approval status.",
            target: "element.u_that_table.approval",
            placement: "bottom"
        }
        ]
    };

TypeError: Object [object Object] has no method 'getBoundingClientRect'

browserLink:37
var hometour = {
id: "nptour",
steps: [
{
title: "Compare anything !",
content: " Start comparing two persons, products, movies and what not ?",
target: $('[data-target="#ComparesM"]'),
placement: "right"
},
{
title: "Debate on issues !",
content: "Start a debate on issues, ",
target: $('[data-target="#DebateM"]'),
placement: "right"
},
{
title: "Share your thoughts !",
content: "Have something interesting ? Or feeling like sharing your thoughts ? Share it right here.",
target: $("#Thought"),
placement: "bottom"
},
{
title: "Be social",
content: "Tease your friends as you do in real life :) Apologize if they are angry with you. Send messages to them and check out what's hot and happening in compares and debate !",
target: $("#Interesting"),
placement: "top",
},
{
title: "Share your thoughts !",
content: "Have something interesting ? Or feeling like sharing your thoughts ? Share it right here.",
target: $("#Thought"),
placement: "bottom"
}
]
};
hopscotch.startTour(hometour);

the error TypeError: Object [object Object] has no method 'getBoundingClientRect' comes

Proposal about spriteUrl

Instead of using a sprite for displaying step number in circle use border radius.

.hopscotch-bubble-number {
// background: transparent @spriteUrl 0 0 no-repeat;
border-radius: 50%;
...

}

hopscotch positioned outside of viewport

Trying to place hopscotch on a targeted element that is in the upper right corner of the browser window. Hopscotch is rendering outside of the browser window.

screen shot 2013-08-27 at 10 57 45 am

What about an "auto close after a timeout" property

I mean, it may be already done with callbacks, but I think it may be useful "by config", for example to

  • alert a user about something "somewhere on page" with a hopscotch popup
  • point to the user "here is the way to launch a hopscotch if you want"
  • ...

Add changelog

This project needs a changelog, so end users know what changed wich new versions of hopscotch

Support onBeforeShow callback for content loaded via Ajax

I have a scenario where a form will be loaded via Ajax upon clicking on a button. I want to have a step to target on the first input field of the form. I've tried to load the form in onNext callback of the previous step. But it seems like the position of the next step's element is calculated before onNext is triggered and the next step is being skipped because the form has yet to be loaded at that time.
Is it possible to add onBeforeShow callback to allow loading of content via Ajax?

How to get current target?

Hello.
I try to find in your library how to retrieve current target of tour. But unsuccessful. Please help me

Successive onCTA events will 'queue-up' and fire together

I'm trying to specify optional onCTA buttons/events, but am finding that these will stack up -- so that if I don't click the CTA button on Step One, but click the CTA button on Step Two, both functions from steps one and two will fire... instead of just the function from Step Two.

I've tried clearing the callbacks in between steps, but no dice.

Example of keyboard support to navigate between steps

It is not pretty, but it adds support for left and right keys to go to the previous and next steps respectively. Add this to your tour options:

  onStart: function(){
    document.onkeydown = checkKey;

    function checkKey(e) {

        e = e || window.event;

        if (e.keyCode == '37') {
            hopscotch.prevStep()
        }
        else if (e.keyCode == '39') {
            hopscotch.nextStep()
        }
    }
  },

i18n and pre localized strings

As agreed in the issue #14, we'll be developing ways to make Hopscotch ships with localizated strings for the common things that are already built in (like "Next", "Previous", so on).

This issue was created mainly to keep track of it.

Reorganize repo structure for easier maintenance and use

Current structure of the project has source and distribution files mixed together. It is hard to understand which files should be updated when sending a pull request, and which ones are auto generated.

It is also hard to get hopscotch at certain version. It's a bit misleading to have hopscotch/js/hopscotch-0.1.2/js which actually has changes since 0.1.2 release. End users should be able to easily grab all hopscotch artifacts for a given hopscotch version.

We need to re-structure repo to make it easier to manage, easier to contribute to and very simple and easy to get all the files you need to use it.

As part of this restructure we should also add CI with Travis, so all pull requests are tested.

Allow specifying a button css class

I'd like to override the button style to match my application. However the default style .hopscotch-nav-button and .hopscotch-nav-button .next applies a number of css styles. It would be nice if I could specify a buttonCssClass to be used instead of the default .hopscotch-nav-button. This would allow me to easily change the button style without having to try to undo the styles added by .hopscotch-nav-button. Thanks!

Unit testing hopscotch tours?

My team and I are doing our best to unit test all of our code. We recently implemented Hopscotch and it's pretty awesome. We wondered if there was a way for us to unit test hopscotch to make sure it all runs properly?

Video in a tour "bubble"?

Its unclear if Hopscotch can support showing a video inside a hopscotch tour "bubble"? Seems there should not be a problem in principle but no one is listing it or there are no such examples. Is this a feature that is planned to be supported?

multipage in iframe possible?

Hi I"m writing a tour that opens a same domain iframe modal and continues the tour in the iframe. I'm trying to use multipage: true for this functionality. Seeing an error from the iframe.

Uncaught TypeError: Cannot read property 'length' of undefined hopscotch-0.1.1.js?body=1:1821

the error is stemming from startTour line 1821

        if (stepNum >= currTour.steps.length) {
          throw 'Specified step number out of bounds.';
        }

Heres the tour code, The onNext calls a click handler that opens the modal:

$(function(){
  hopscotch.add_widget_tour = {
    id: "add_widget_tour",
    steps:[
      {
        "target": "add_widget_link",
        "placement": "left",
        "title": "You can add a new Widget",
        "content": "Add a new widget to build a new Table, Chart or Graph.",
        "multipage": true,
        "yOffset": "-20",
        "onNext": function(){
          $('#add_widget_link').click();
        }
      },

      {
        "target": document.querySelector("h3 .page-title"),
        "placement": "right",
        "title": "adding a widget",
        "content": "This is the Add Widget Screen"
      }
    ]
  };
});

I'm trying to continue the tour in the iframe with this code:

  if(hopscotch.getState()){
    var tour = hopscotch.getState().split(':');
    $(function(){
      hopscotch.startTour(tour[0], tour[1]);
    });
  }

Allow next/back to be triggered by right/left arrow keys (and/or tab)

It would be helpful for people who are more keyboard-focused and/or especially in tours that explain form fields.

Here, it would also be great if the tour would follow the current focus. This way, one could "tab" through form fields and the tour would always explain what can be entered in the current field.

Tour step with target selected using document.querySelector() is not working

I am using Hopscotch with a tour that looks like this:

    var tour = {
      id: "quoddy-intro",
      steps: [
        {
          title: "Activity Stream",
          content: "This is the Activity Stream area.  Various kinds of activities appear here, based on the" +
          " users you follow, groups you join, subscriptions you setup, etc.  Activity Stream events include Status Updates" +
          " from other users, Calendar Feed entries, Business Events, RSS Feed entries, BPM User Task entries, and others.",
          target: "activityStream",
          placement: "top",
          width: 350
        },
        {
            title: "Status Update",
            content: "This is a Status Update, shared by one of your Friends or someone you Follow.",
            target: document.querySelector(".basicActivityStreamEntry"),
            placement: "left",
            width: 350          

        }
      ]
    };

The first step works fine, using an id. But the second step never results in a tour bubble being rendered. I've verified with a simple function that alert()'s the output of the document.querySelector call that it does, indeed, find the element I am looking for, but Hopscotch doesn't seem to like it.

This occurs in both Chrome Version 25.0.1364.172 and Firefox 18.0.2, both on Fedora Linux.

bower.json missing

Hopscotch has been registered with bower, but there is no bower.json file detailing version, js files, css files etc

This means that automated bower injection using the grunt task bower-install fails:

grunt bower-install

hopscotch was not injected in your file.

Previous step flashes in Chrome 29

In Chrome 29.0.1547.65, whenever I click 'Next' to go to the next step and as soon as the next bubble slides in, the previous step bubble flashes, and this happens for every single step.

Do not see the same behavior in FF 23 or Safari 5.

Strangely enough, when I tried the demo tour using Chrome, this does not happen. What could possibly cause this annoying behavior?

continue tour at a closed step

Hi,
is it possible to continue the tour at a closed tour step?
Getting the state via hopscotch.getState() is only possible when the tour is running.
If it's closed the state is null.

Setting style.left bombs on ie8

I get an 'invalid argument' error on line 621 when I am using the the arrowOffsetCenter argument.

It happens here (line 621):

arrowEl.style.left = bubbleWidth/2 + bubblePadding - arrowEl.getBoundingClientRect().width/2 + 'px';

and here as well:

el.style.left = left + 'px';

Support for chaining steps to dynamically loaded content

Currently building a .NET application built around the single page model. Users interact with the application by click on a navigation link that opens up a popup modal. Unfortunately the content loaded within the modal is called dynamically with AJAX and is not present when Hopscotch is instantiated.

Is there a way to chain steps to selector within the dynamically loaded content? Or perhaps a way to "refresh" Hopscotch so that it has the most current state of the DOM?

Possible related scenario and solution here: http://stackoverflow.com/questions/18897520/hopscotch-js-dynamically-created-modal-target-not-functioning
Is there an official way to accomplish this functionality?

Make exit animated

Everything's awesome but when the last step comes and when we click "Done", there is no fading in animation or something like that. Its just disappearing. Animate the exit too please !

Cant even get it to work

I have it all set up right. You can see my demo site here

http://dev2.playmakercrm.com/Hopscotch/

I have the

h1 id="hopscotch-title" (with the < > of course)

and I have it set in the js as

steps: [
{
target: "hopscotch-title",
title: "Welcome to Hopscotch!",
content: "Hey there! This is an example Hopscotch tour. There will be plenty of time to read documentation and sample code, but let's just take some time to see how Hopscotch actually works.",
placement: "bottom",
xOffset: 'center',
arrowOffset: 'center'
},

But I cannot get it to load at all. If anyone can take a look I would sure appreciate it.

Support for BeforeShowNextStep?

Hi,

I have the scenario where i need to show a modal window before show the last step because the element for last step is in the modal window. When i try to show the window modal in onNext i got an error because the element was not found.

any solution to handle this?

Hopscotch and Angular views, creating events

Hey guys,

We're having a slight issue trying to get Hopscotch to work with Angular routes and views. Basically what's happening is when we use isNext() to change the route and the next Hopscotch bubble is pointing to an element on the next view, Hopscotch fails and won't continue. This makes complete sense, because there is no element for Hopscotch to use as a target. It just doesn't exist yet.

What would probably solve this problem is the ability to create events just by passing a string in hopscotch.listen() and then be able to call hopscotch.trigger('eventName') later in the application... Thoughts?

Thanks.

i18n example

Could we have an example of i18n working? I made this:

var retour = {
  id: "tutorial-user-creation",
  steps: [
                  {
                    title: "Tutorial is here",
                    content: "At any time you can press this button to restart the tutorial.",
                    target: '#restart_tutorial',
                    placement: "bottom",
                    xOffset: -15,
                    showNextButton: true,
                    showPrevButton: true
                  },
  ],
  i18n.nextBtn: "Próximo"
};
 hopscotch.startTour(retour);

...and it returns me the error "Uncaught SyntaxError: Unexpected identifier". In the documentation it says it accepts string. What is wrong with that?

Thank you.

Implement hotscotch on asp.net pages

I am trying to implement hopscotch on a few asp.net pages. I put the references to the scripts and js in the master file. The problem is that the messagebox keeps flashes for some reason like it is in a loop. Any help would be greatly appreciated.

hopscotch.showStep(idx) doesn't work

I'm using hopscotch to create a tour in an Angular app, in this app depending of some conditions I need to skip the tour to an specific step.

so I have something like this:

hopscotch.registerHelper("skipToStep", function(stepIdx) {
console.log(hopscotch.getCurrStepNum());
console.log(hopscotch.getState());
hopscotch.showStep(stepIdx);
console.log(hopscotch.getCurrStepNum());
console.log(hopscotch.getState());
});

and then I put the callback inside the step in the tour

steps[1].onNext = ["skipToStep", 5]

the output of the console when i click next in the step 1 is:

2
graphTour:1

5
graphTour:5

but the step that appears is the step[2]

How to reinitialize hopscotch

Hi i'm using hopscotch in a rails app that uses Turbolinks. On an initial page load of the app I can trigger hopscotch tours manually with hopscotch.startTour When switching to a new page with Turbolinks I can call the hopscotch api methods, startTour GetCurrStepNo GetCurrTour they look successful but hopscotch doesn't render any DOM elements. I'm thinking some hook or event or something gets wiped in the Turbolinks page load and needs to be reestablished.

Display total number of steps.

Hi,

I am using hopscotch to display the product tour. It is working fine.

While showing the tour, the step number shown as 1,2,3.... . I want to show the step number with the total number of steps (1/5,2/5,3/5...).

Is there any possible way to do this?

UX Enhancement

a) Remove all buttons
b) Add a inuitive keyboard/mouse navigation

A: Why? Because the position of the buttons is changing, which is annoying.
B: A Consisten UI requires a consistent navigation. That means changing the location of buttons is inacceptable. The best solution is to offer a way to skip to the next introduction by pressing the left mouse button or spacebar for example. Esc or holding the mouse button/touch or spacebar could be used to skip the entire tutorial. You could also center all dialogues and point with an arrow to the place it describes. Fading the intro in is a good idea, but the size of the text/dialog should be larger in order to look like "easy intructions". It might be useful to not display all text at once, but fade/swipe/typewriter style display the next paragraph after a calculated amount of time (avg words per minute).

onEnd not firing

I have a hopscothc tour. Im doing this:

onEnd:function(){
window.location="findfriends";
}

but even after pressing the last button of the the tour "Done", I am not being redirected to findfriends page.

So does it mean that onEnd isn't firing ?

NextOnTarget Click event not always removed

Situation

If I set the nextOnTarget: true property on a step, everything works as expected if I'm using the Next button or clicking on the target (basically if I'm moving forward). However, if, while I'm at a step with that property enabled, on an element A, I click Back or I use a CTA with showStep() in the callback, the event is not removed from the element. Thus, in the future, even if I'm on another step, if I click on element A, I'm getting forwarded to the next step.

Reason

The issue happens because the targetClickNextFn event is added to the element, but is only removed on nextStep (as defined here ) and not in the other cases.

Solution

The

if (step.nextOnTargetClick) {
        // Detach the listener after we've clicked on the target OR the next button.
        utils.removeEvtListener(targetEl, 'click', targetClickNextFn);
      }

code should be also added in the prevStep method and showStep method.

Multipage + previous button = skip ahead, not backward

Great code and I hope this project continues to be worked on.

Having an issue while going between pages on a tour and then going back to previous pages. I'm going to other pages by using the following (not sure if this is the right approach):

...
multipage: true,
onNext: function() {
document.location.href = 'index2.html';
}
...

This works as expected and I can continue to jump between pages going forward without any issue. Going backwards, however with the same logic, but in "onPrev()" sends me to the other page, but advances the steps. Therefore if step 1 = page 1, step 2 = page 2, step 3 = page 1, then when I click previous on step 2 (page 2) I am sent back to page 1, but it is now on step 3. It seems to have to do with the "multipage" variable being set.

Thanks again!
Michael

Tour stays on same step if using multipage and subsequent step doesn't exist

When using a multipage setup, hopscotch works great in case the subsequent step is on the next page. However, it breaks if the subsequent step's target doesn't exist on the next page. I would assume hopscotch would then just "skip" to the next subsequent step, but it doesn't. Instead, it will repeat the last step after the multipage jump.

bower.json or package.json?

It would make it a little easier to use this if it could be consumed as a package with existing developer workflows. Happy to submit a pull request for either bower or package.json if you want.

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.