├── README.md ├── enjoyhint ├── .bowerrc ├── .gitignore ├── Gruntfile.js ├── README.md ├── bower.json ├── enjoyhint.css ├── enjoyhint.js ├── enjoyhint.min.js ├── package.json └── src │ ├── Casino_Hand │ ├── casino_hand-webfont.eot │ ├── casino_hand-webfont.svg │ ├── casino_hand-webfont.ttf │ └── casino_hand-webfont.woff │ ├── enjoyhint.js │ ├── jquery.enjoyhint.css │ └── jquery.enjoyhint.js ├── hint-sequence.js ├── index.html └── style.css /README.md: -------------------------------------------------------------------------------- 1 | ### Demo of EnjoyHint library 2 | 3 | Check https://github.com/xbsoftware/enjoyhint 4 | -------------------------------------------------------------------------------- /enjoyhint/.bowerrc: -------------------------------------------------------------------------------- 1 | { 2 | "directory":"lib" 3 | } -------------------------------------------------------------------------------- /enjoyhint/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/* 2 | lib/* -------------------------------------------------------------------------------- /enjoyhint/Gruntfile.js: -------------------------------------------------------------------------------- 1 | module.exports = function(grunt){ 2 | grunt.initConfig({ 3 | pkg: grunt.file.readJSON('bower.json'), 4 | concat:{ 5 | options: { 6 | separator: ';' 7 | }, 8 | dist:{ 9 | src:['src/*.js', 'lib/kineticjs/kinetic.min.js', 'lib/jquery.scrollTo/jquery.scrollTo.min.js'], 10 | dest: '<%= pkg.name %>.js' 11 | } 12 | }, 13 | uglify: { 14 | main: { 15 | files: { 16 | '<%= pkg.name %>.min.js': ['<%= concat.dist.dest %>'] 17 | } 18 | } 19 | }, 20 | jshint: { 21 | files: ['Gruntfile.js', 'src/*.js'], 22 | options: { 23 | "eqnull": true, 24 | "globals": { 25 | jQuery: true, 26 | console: true, 27 | module: true 28 | } 29 | } 30 | }, 31 | cssmin: { 32 | combine: { 33 | files: { 34 | 'enjoyhint.css': ['src/jquery.enjoyhint.css'] 35 | } 36 | } 37 | } 38 | }); 39 | 40 | grunt.loadNpmTasks('grunt-contrib-uglify'); 41 | grunt.loadNpmTasks('grunt-contrib-jshint'); 42 | grunt.loadNpmTasks('grunt-contrib-concat'); 43 | grunt.loadNpmTasks('grunt-contrib-cssmin'); 44 | 45 | grunt.registerTask("default", ["concat", "uglify", "cssmin"]) 46 | 47 | }; 48 | -------------------------------------------------------------------------------- /enjoyhint/README.md: -------------------------------------------------------------------------------- 1 | EnjoyHint 2 | ========= 3 | **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. 4 | 5 | EnjoyHint is free software distributed under the terms of MIT license. 6 | 7 | #### Demo 8 | * [TODO app demo](http://xbsoftware.github.io/enjoyhint/) ([downloadable package](http://xbsoftware.github.io/enjoyhint/enjoyhint_todo_demo.zip)) 9 | * [A small guide on EnjoyHint](http://xbsoftware.github.io/enjoyhint/example1.html) 10 | 11 | #### Dependencies 12 | EnjoyHint require the following plugins and libs: 13 | 14 | * jQuery > 1.7 15 | * KineticJS v5.1.0 (included into js file) 16 | 17 | #### Installation 18 | You can install it through `bower` package manager: 19 | ``` 20 | bower install enjoyhint 21 | ``` 22 | Alternative way: 23 | - Download the latest version of EnjoyHint 24 | - Extract the archive with EnjoyHint. 25 | - Move the EnjoyHint directory to somewhere on your webserver 26 | - Insert next lines into your page's \
tag: 27 | ```html 28 | 29 | 30 | ``` 31 | 32 | #### Initialization and configuration: 33 | ```javascript 34 | //initialize instance 35 | var enjoyhint_instance = new EnjoyHint({}); 36 | 37 | //simple config. 38 | //Only one step - highlighting(with description) "New" button 39 | //hide EnjoyHint after a click on the button. 40 | var enjoyhint_script_steps = [ 41 | { 42 | 'click .new_btn' : 'Click the "New" button to start creating your project' 43 | } 44 | ]; 45 | 46 | //set script config 47 | enjoyhint_instance.set(enjoyhint_script_steps); 48 | 49 | //run Enjoyhint script 50 | enjoyhint_instance.run(); 51 | ``` 52 | 53 | #### Script Configuration 54 | 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. 55 | 56 | #### Example of script configuration 57 | Highlight some button and after you click on it, highlight some panel: 58 | ```javascript 59 | var enjoyhint_script_steps = [ 60 | { 61 | 'click .some_btn' : 'Click on this btn' 62 | }, 63 | { 64 | 'click .some_panel' : 'Click on this panel' 65 | } 66 | ]; 67 | ``` 68 | 69 | #### Properties of the step configuration 70 | * `"event selector" : "description"` - to describe a step you should set an event type, selecte element and add description for this element (hint) 71 | * `keyCode` - the code of a button, which triggers the next EnjoyHint step upon a click. Defined by the “key” event. (“key #block” : “hello”). 72 | * `event_selector` - if you need to attach an event (that was set in "event" property) to other selector, you can use this one 73 | * `timeout` - delay before the moment, when an element is highlighted 74 | * `shape` - shape for highlighting (circle|rect) 75 | * `radius` - if the shape of "circle" is specified, we can set the radius. 76 | * `margin` - margin for the highlight shape (for Ex.:10) 77 | * `top` - top margin for the shape of "rect" type 78 | * `right` - right margin for the shape of "rect" type 79 | * `bottom` - bottom margin for the shape of "rect" type 80 | * `left` - left margin for the shape of "rect" type 81 | * `scrollAnimationSpeed` - sets the auto scroll speed (ms). 82 | * `nextButton` - allows applying its classes and names for the button Nеxt. 83 | * `skipButton` - allows applying its classes and names for the button Skip. For the example : 84 | ```javascript 85 | var options = { 86 | "next #block": 'Hello.', 87 | "nextButton" : {className: "myNext", text: "NEXT"}, 88 | "skipButton" : {className: "mySkip", text: "SKIP"}, 89 | 90 | } 91 | ``` 92 | * `showSkip` - shows or hides the Skip button (true|false) 93 | * `showNext` - shows or hides the Next button (true|false) 94 | 95 | 96 | 97 | 98 | #### Non-standard events: 99 | **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. 100 | * `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. 101 | ```javascript 102 | //Example of using custom event_type 103 | $.get('/load/some_data', function(data){ 104 | //trigger method has only one argument: event_name.(equal to the value of event property in step config) 105 | enjoyhint_instance.trigger('custom_event_name'); 106 | }); 107 | ``` 108 | * `next` - when you set value of event_type to "next", you will see the "Next" btn on this step. 109 | * `key` - tells EnjoyHint to go to the next step when you click on the button defined by the keyCode 110 | 111 | 112 | #### Methods 113 | * `set` - set current steps configuration. Arguments: config 114 | * `run` - run the current script. Has no arguments 115 | * `resume` - resume the script from the step where it was stopped. Has no arguments 116 | * `getCurrentStep` - returns the current step index 117 | * `trigger` - After writing this code you can either move to the next step or finish with EnjoyHint (next|skip) 118 | 119 | #### Events 120 | **Script Events**: 121 | * `onStart` - fires on the first step. 122 | * `onEnd` - fires after the last step in script. 123 | ```javascript 124 | var enjoyhint_instance = new EnjoyHint({ 125 | onStart:function(){ 126 | //do something 127 | } 128 | }); 129 | ``` 130 | **Step Events**: 131 | * `onBeforeStart` - fires before the step is started. 132 | ```javascript 133 | var enjoyhint_script_steps = [ 134 | { 135 | selector:'.some_btn',//jquery selector 136 | event:'click', 137 | description:'Click on this btn', 138 | onBeforeStart:function(){ 139 | //do something 140 | } 141 | } 142 | ]; 143 | ``` 144 | 145 | #### Release notes 146 | 147 | ##### v.3 148 | 149 | * New and simplified description of EnjoyHint steps 150 | * Auto scroll to the element 151 | * Possibility to hide or display the buttons showNext, showSkip. 152 | * HTML usage allowed in description 153 | * Destructor 154 | * Simplified property names 155 | * Grunt to compress and merge files 156 | * New examples 157 | * You can learn the step you are on by the class enjoyhint-step-* ( where * stands for the step number). 158 | 159 | 160 | 161 | 162 | -------------------------------------------------------------------------------- /enjoyhint/bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "enjoyhint", 3 | "main": [ 4 | "enjoyhint.js", 5 | "enjoyhint.css" 6 | ], 7 | "version": "3.1.0", 8 | "homepage": "https://github.com/xbsoftware/enjoyhint", 9 | "authors": [ 10 | "XB Software" 11 | ], 12 | "description": "Web-tool that provides the simplest way to create interactive tutorials and hints.", 13 | "keywords": [ 14 | "enjoyhint", 15 | "hint", 16 | "xbs", 17 | "tutorials" 18 | ], 19 | "license": "MIT", 20 | "ignore": [ 21 | "**/.*", 22 | "node_modules", 23 | "bower_components", 24 | "test", 25 | "tests" 26 | ], 27 | "dependencies": { 28 | "jquery": "~2.1.3", 29 | "jquery.scrollTo": "~1.4.14", 30 | "kineticjs": "~5.1.0" 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /enjoyhint/enjoyhint.css: -------------------------------------------------------------------------------- 1 | .enjoyhint_close_btn,.enjoyhint_close_btn::after,.enjoyhint_close_btn::before,.enjoyhint_next_btn,.enjoyhint_skip_btn{-o-text-overflow:clip;text-overflow:clip}.enjoyhint_next_btn,.enjoyhint_skip_btn{font:normal normal normal 17px/40px "Advent Pro",Helvetica,sans-serif;-webkit-border-radius:40px;border-radius:40px}.enjoyhint_btn,.enjoyhint_close_btn,.enjoyhint_close_btn::after,.enjoyhint_close_btn::before,.enjoyhint_next_btn,.enjoyhint_skip_btn{-webkit-box-sizing:content-box}.enjoyhint_btn,.enjoyhint_close_btn,.enjoyhint_close_btn::after,.enjoyhint_next_btn,.enjoyhint_skip_btn{-moz-box-sizing:content-box}@font-face{font-family:casino_handregular;src:url(Casino_Hand/casino_hand-webfont.eot);src:url(Casino_Hand/casino_hand-webfont.eot?#iefix)format('embedded-opentype'),url(Casino_Hand/casino_hand-webfont.woff)format('woff'),url(Casino_Hand/casino_hand-webfont.ttf)format('truetype'),url(Casino_Hand/casino_hand-webfont.svg#casino_handregular)format('svg');font-weight:400;font-style:normal}.enjoyhint{position:fixed;width:100%;height:100%;top:0;left:0;z-index:1010;pointer-events:none;overflow:hidden}.enjoyhint_close_btn,.enjoyhint_next_btn,.enjoyhint_skip_btn{z-index:1012;pointer-events:all}.enjoyhint_hide{display:none}.enjoyhint_close_btn::after,.enjoyhint_close_btn::before{background:#fff;border:none;color:rgba(0,0,0,1);display:inline-block}.enjoyhint_disable_events{position:absolute;width:2000px;height:1500px;z-index:1011;pointer-events:all}.enjoyhint_next_btn{position:absolute;box-sizing:content-box;width:100px;height:40px;cursor:pointer;margin:0 auto;border:2px solid #1ecd97;color:#1ecd97;text-align:center;letter-spacing:1px;background:0 0;-webkit-transition:background-color .3s cubic-bezier(0,0,0,0),color .3s cubic-bezier(0,0,0,0),width .3s cubic-bezier(0,0,0,0),border-width .3s cubic-bezier(0,0,0,0),border-color .3s cubic-bezier(0,0,0,0);-moz-transition:background-color .3s cubic-bezier(0,0,0,0),color .3s cubic-bezier(0,0,0,0),width .3s cubic-bezier(0,0,0,0),border-width .3s cubic-bezier(0,0,0,0),border-color .3s cubic-bezier(0,0,0,0);-o-transition:background-color .3s cubic-bezier(0,0,0,0),color .3s cubic-bezier(0,0,0,0),width .3s cubic-bezier(0,0,0,0),border-width .3s cubic-bezier(0,0,0,0),border-color .3s cubic-bezier(0,0,0,0);transition:background-color .3s cubic-bezier(0,0,0,0),color .3s cubic-bezier(0,0,0,0),width .3s cubic-bezier(0,0,0,0),border-width .3s cubic-bezier(0,0,0,0),border-color .3s cubic-bezier(0,0,0,0)}.enjoyhint_next_btn:hover{color:rgba(255,255,255,1);background:#1ecd97}.enjoyhint_next_btn:active{border:2px solid rgba(33,224,163,1);background:rgba(33,224,163,1);-webkit-transition:none;-moz-transition:none;-o-transition:none;transition:none}.enjoyhint_btn,.enjoyhint_skip_btn{-o-transition:background-color .3s cubic-bezier(0,0,0,0),color .3s cubic-bezier(0,0,0,0),width .3s cubic-bezier(0,0,0,0),border-width .3s cubic-bezier(0,0,0,0),border-color .3s cubic-bezier(0,0,0,0)}.enjoyhint_skip_btn{position:absolute;box-sizing:content-box;width:100px;height:40px;cursor:pointer;margin:0 auto;border:2px solid #1ecd97;color:#1ecd97;text-align:center;letter-spacing:1px;background:0 0;-webkit-transition:background-color .3s cubic-bezier(0,0,0,0),color .3s cubic-bezier(0,0,0,0),width .3s cubic-bezier(0,0,0,0),border-width .3s cubic-bezier(0,0,0,0),border-color .3s cubic-bezier(0,0,0,0);-moz-transition:background-color .3s cubic-bezier(0,0,0,0),color .3s cubic-bezier(0,0,0,0),width .3s cubic-bezier(0,0,0,0),border-width .3s cubic-bezier(0,0,0,0),border-color .3s cubic-bezier(0,0,0,0);transition:background-color .3s cubic-bezier(0,0,0,0),color .3s cubic-bezier(0,0,0,0),width .3s cubic-bezier(0,0,0,0),border-width .3s cubic-bezier(0,0,0,0),border-color .3s cubic-bezier(0,0,0,0)}.enjoyhint_close_btn:active,.enjoyhint_skip_btn:active{transition:none;-webkit-transition:none;-moz-transition:none}.enjoyhint_skip_btn:hover{color:rgba(255,255,255,1);background:#1ecd97}.enjoyhint_skip_btn:active{border:2px solid rgba(33,224,163,1);background:rgba(33,224,163,1);-o-transition:none}.enjoyhint_close_btn{display:inline-block;position:absolute;box-sizing:content-box;width:.3em;height:.3em;border:none;-webkit-border-radius:1em;border-radius:1em;font:400 8em/normal Arial,Helvetica,sans-serif;color:rgba(0,0,0,1);background:0 0;border:2px solid rgba(33,224,163,1)}.enjoyhint_close_btn::after,.enjoyhint_close_btn::before{width:73%;height:2px;font:normal 100%/normal Arial,Helvetica,sans-serif}.enjoyhint_close_btn::before{-moz-box-sizing:content-box;box-sizing:content-box;position:absolute;content:"";top:48%;left:14%;text-shadow:none;-webkit-transform:rotateZ(45deg);transform:rotateZ(45deg)}.enjoyhint_close_btn::after{box-sizing:content-box;position:absolute;content:"";top:46%;left:15%;text-shadow:none;-webkit-transform:rotateZ(-45deg);transform:rotateZ(-45deg)}#kinetic_container,.enjoyhint_svg_wrapper,.enjoyhint_svg_wrapper svg{width:100%;height:100%;top:0;left:0}.enjoyhint_close_btn:hover{color:rgba(255,255,255,1);background:#1ecd97;cursor:pointer}.enjoyhint_close_btn:active{border:2px solid rgba(33,224,163,1);background:rgba(33,224,163,1);-o-transition:none}.enjoyhint_btn{box-sizing:content-box;width:150px;height:40px;cursor:pointer;margin:0 auto;border:2px solid #1ecd97;-webkit-border-radius:40px;border-radius:40px;font:normal normal normal 17px/40px "Advent Pro",Helvetica,sans-serif;color:#1ecd97;text-align:center;-o-text-overflow:clip;text-overflow:clip;letter-spacing:1px;background:0 0;-webkit-transition:background-color .3s cubic-bezier(0,0,0,0),color .3s cubic-bezier(0,0,0,0),width .3s cubic-bezier(0,0,0,0),border-width .3s cubic-bezier(0,0,0,0),border-color .3s cubic-bezier(0,0,0,0);-moz-transition:background-color .3s cubic-bezier(0,0,0,0),color .3s cubic-bezier(0,0,0,0),width .3s cubic-bezier(0,0,0,0),border-width .3s cubic-bezier(0,0,0,0),border-color .3s cubic-bezier(0,0,0,0);transition:background-color .3s cubic-bezier(0,0,0,0),color .3s cubic-bezier(0,0,0,0),width .3s cubic-bezier(0,0,0,0),border-width .3s cubic-bezier(0,0,0,0),border-color .3s cubic-bezier(0,0,0,0)}.enjoyhint_btn:hover{color:rgba(255,255,255,1);background:#1ecd97}.enjoyhint_btn:active{border:2px solid rgba(33,224,163,1);background:rgba(33,224,163,1);-webkit-transition:none;-moz-transition:none;-o-transition:none;transition:none}.enjoy_hint_label,.enjoyhint_svg_wrapper{-moz-transition:opacity 400ms cubic-bezier(.42,0,.58,1);transition:opacity 400ms cubic-bezier(.42,0,.58,1);-webkit-transition:opacity 400ms cubic-bezier(.42,0,.58,1)}.enjoyhint div.canvas-container{position:absolute}.enjoyhint_canvas{position:absolute;z-index:100;width:100%;height:100%;pointer-events:none}#kinetic_container{pointer-events:none;position:absolute}.enjoyhint_svg_wrapper{position:absolute;z-index:100}.enjoyhint_svg_wrapper svg{position:absolute}.enjoyhint_svg_transparent .enjoy_hint_label,.enjoyhint_svg_transparent .enjoyhint_svg_wrapper{opacity:0}.enjoy_hint_label{position:absolute;color:#fff;z-index:107;font-size:22px;font-family:casino_handregular,Arial}div.kineticjs-content{position:absolute!important} -------------------------------------------------------------------------------- /enjoyhint/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "enjoyhint", 3 | "version": "1.0.0", 4 | "description": "Web-tool that provides the simplest way to create interactive tutorials and hints.", 5 | "main": "enjoyhint.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "repository": { 10 | "type": "git", 11 | "url": "https://github.com/xbsoftware/enjoyhint.git" 12 | }, 13 | "keywords": [ 14 | "enjoyhint", 15 | "hint", 16 | "xbs", 17 | "tutorials" 18 | ], 19 | "author": "XB Software", 20 | "license": "MIT", 21 | "bugs": { 22 | "url": "https://github.com/xbsoftware/enjoyhint/issues" 23 | }, 24 | "homepage": "https://github.com/xbsoftware/enjoyhint", 25 | "devDependencies": { 26 | "grunt-contrib-concat": "^0.5.1", 27 | "grunt-contrib-cssmin": "^0.11.0", 28 | "grunt-contrib-jshint": "^0.11.2", 29 | "grunt-contrib-uglify": "^0.9.1" 30 | }, 31 | "dependencies": { 32 | "grunt": "^0.4.5", 33 | "kinetic": "^5.2.0" 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /enjoyhint/src/Casino_Hand/casino_hand-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sitepoint-editors/enjoyhint-demo/41754c52a73df8e826ab4c817bb839575298e055/enjoyhint/src/Casino_Hand/casino_hand-webfont.eot -------------------------------------------------------------------------------- /enjoyhint/src/Casino_Hand/casino_hand-webfont.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /enjoyhint/src/Casino_Hand/casino_hand-webfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sitepoint-editors/enjoyhint-demo/41754c52a73df8e826ab4c817bb839575298e055/enjoyhint/src/Casino_Hand/casino_hand-webfont.ttf -------------------------------------------------------------------------------- /enjoyhint/src/Casino_Hand/casino_hand-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sitepoint-editors/enjoyhint-demo/41754c52a73df8e826ab4c817bb839575298e055/enjoyhint/src/Casino_Hand/casino_hand-webfont.woff -------------------------------------------------------------------------------- /enjoyhint/src/enjoyhint.js: -------------------------------------------------------------------------------- 1 | var EnjoyHint = function (_options) { 2 | var that = this; 3 | // Some options 4 | var defaults = { 5 | onStart: function () { 6 | 7 | }, 8 | onEnd: function () { 9 | 10 | } 11 | }; 12 | var options = $.extend(defaults, _options); 13 | 14 | 15 | var data = []; 16 | var current_step = 0; 17 | 18 | $body = $('body'); 19 | 20 | /********************* PRIVAT METHODS ***************************************/ 21 | var init = function () { 22 | if ($('.enjoyhint')) 23 | $('.enjoyhint').remove(); 24 | $('body').css({'overflow':'hidden'}); 25 | $(document).on("touchmove",lockTouch); 26 | 27 | $body.enjoyhint({ 28 | onNextClick: function () { 29 | nextStep(); 30 | }, 31 | onSkipClick: function () { 32 | skipAll(); 33 | } 34 | }); 35 | }; 36 | 37 | var lockTouch = function(e) { 38 | e.preventDefault(); 39 | }; 40 | 41 | var destroyEnjoy = function () { 42 | $body = $('body'); 43 | $('.enjoyhint').remove(); 44 | $("body").css({'overflow':'auto'}); 45 | $(document).off("touchmove", lockTouch); 46 | 47 | }; 48 | 49 | that.clear = function(){ 50 | //(Remove userClass and set default text) 51 | $(".enjoyhint_next_btn").removeClass(that.nextUserClass); 52 | $(".enjoyhint_next_btn").text("Next"); 53 | $(".enjoyhint_skip_btn").removeClass(that.skipUserClass); 54 | $(".enjoyhint_skip_btn").text("Skip"); 55 | } 56 | 57 | var $body = $('body'); 58 | 59 | var stepAction = function () { 60 | if (data && data[current_step]) { 61 | $(".enjoyhint").removeClass("enjoyhint-step-"+current_step); 62 | $(".enjoyhint").addClass("enjoyhint-step-"+(current_step+1)); 63 | var step_data = data[current_step]; 64 | if (step_data.onBeforeStart && typeof step_data.onBeforeStart === 'function') { 65 | step_data.onBeforeStart(); 66 | } 67 | var timeout = step_data.timeout || 0; 68 | setTimeout(function () { 69 | if (!step_data.selector) { 70 | for (var prop in step_data) { 71 | if (step_data.hasOwnProperty(prop) && prop.split(" ")[1]) { 72 | var space_index = prop.indexOf(" "); 73 | step_data.event = prop.slice(0, space_index); 74 | step_data.selector = prop.slice(space_index + 1); 75 | if (step_data.event == 'next' || step_data.event == 'auto' || step_data.event == 'custom') { 76 | step_data.event_type = step_data.event; 77 | } 78 | step_data.description = step_data[prop]; 79 | } 80 | } 81 | } 82 | setTimeout(function(){ 83 | that.clear(); 84 | }, 250); 85 | $(document.body).scrollTo(step_data.selector, step_data.scrollAnimationSpeed || 250, {offset: -100}); 86 | setTimeout(function () { 87 | var $element = $(step_data.selector); 88 | var event = makeEventName(step_data.event); 89 | 90 | $body.enjoyhint('show'); 91 | $body.enjoyhint('hide_next'); 92 | var $event_element = $element; 93 | if (step_data.event_selector) { 94 | $event_element = $(step_data.event_selector); 95 | } 96 | if (!step_data.event_type && step_data.event == "key"){ 97 | $element.keydown(function( event ) { 98 | if ( event.which == step_data.keyCode ) { 99 | current_step++; 100 | stepAction(); 101 | } 102 | }); 103 | } 104 | if (step_data.showNext == true){ 105 | $body.enjoyhint('show_next'); 106 | } 107 | if (step_data.showSkip == false){ 108 | $body.enjoyhint('hide_skip'); 109 | }else{ 110 | $body.enjoyhint('show_skip'); 111 | } 112 | if (step_data.showSkip == true){ 113 | 114 | } 115 | 116 | 117 | if (step_data.nextButton){ 118 | $(".enjoyhint_next_btn").addClass(step_data.nextButton.className || ""); 119 | $(".enjoyhint_next_btn").text(step_data.nextButton.text || "Next"); 120 | that.nextUserClass = step_data.nextButton.className 121 | } 122 | 123 | if (step_data.skipButton){ 124 | $(".enjoyhint_skip_btn").addClass(step_data.skipButton.className || ""); 125 | $(".enjoyhint_skip_btn").text(step_data.skipButton.text || "Skip"); 126 | that.skipUserClass = step_data.skipButton.className 127 | } 128 | 129 | if (step_data.event_type) { 130 | switch (step_data.event_type) { 131 | case 'auto': 132 | $element[step_data.event](); 133 | switch (step_data.event) { 134 | case 'click': 135 | break; 136 | } 137 | current_step++; 138 | stepAction(); 139 | return; 140 | break; 141 | case 'custom': 142 | on(step_data.event, function () { 143 | current_step++; 144 | off(step_data.event); 145 | stepAction(); 146 | }); 147 | break; 148 | case 'next': 149 | $body.enjoyhint('show_next'); 150 | break; 151 | 152 | } 153 | 154 | } else { 155 | $event_element.on(event, function (e) { 156 | if (step_data.keyCode && e.keyCode != step_data.keyCode) { 157 | return; 158 | } 159 | current_step++; 160 | $(this).off(event); 161 | 162 | stepAction(); 163 | }); 164 | 165 | } 166 | var max_habarites = Math.max($element.outerWidth(), $element.outerHeight()); 167 | var radius = step_data.radius || Math.round(max_habarites / 2) + 5; 168 | var offset = $element.offset(); 169 | var w = $element.outerWidth(); 170 | var h = $element.outerHeight(); 171 | var shape_margin = (step_data.margin !== undefined) ? step_data.margin : 10; 172 | var coords = { 173 | x: offset.left + Math.round(w / 2) , 174 | y: offset.top + Math.round(h / 2) - $(document).scrollTop() 175 | }; 176 | var shape_data = { 177 | center_x: coords.x, 178 | center_y: coords.y, 179 | text: step_data.description, 180 | top: step_data.top, 181 | bottom: step_data.bottom, 182 | left: step_data.left, 183 | right: step_data.right, 184 | margin: step_data.margin, 185 | scroll: step_data.scroll 186 | }; 187 | 188 | if (step_data.shape && step_data.shape == 'circle') { 189 | shape_data.shape = 'circle'; 190 | shape_data.radius = radius; 191 | } else { 192 | shape_data.radius = 0; 193 | shape_data.width = w + shape_margin; 194 | shape_data.height = h + shape_margin; 195 | } 196 | $body.enjoyhint('render_label_with_shape', shape_data); 197 | }, step_data.scrollAnimationSpeed + 20 || 270); 198 | }, timeout); 199 | } else { 200 | $body.enjoyhint('hide'); 201 | options.onEnd(); 202 | destroyEnjoy(); 203 | } 204 | 205 | }; 206 | 207 | var nextStep = function(){ 208 | current_step++; 209 | stepAction(); 210 | }; 211 | var skipAll = function(){ 212 | var step_data = data[current_step]; 213 | var $element = $(step_data.selector); 214 | off(step_data.event); 215 | $element.off(makeEventName(step_data.event)); 216 | destroyEnjoy(); 217 | }; 218 | 219 | var makeEventName = function (name, is_custom) { 220 | return name + (is_custom ? 'custom' : '') + '.enjoy_hint'; 221 | }; 222 | 223 | var on = function (event_name, callback) { 224 | $body.on(makeEventName(event_name, true), callback); 225 | }; 226 | var off = function (event_name) { 227 | $body.off(makeEventName(event_name, true)); 228 | }; 229 | 230 | /********************* PUBLIC METHODS ***************************************/ 231 | that.runScript = function () { 232 | current_step = 0; 233 | options.onStart(); 234 | stepAction(); 235 | }; 236 | 237 | that.resumeScript = function () { 238 | stepAction(); 239 | }; 240 | 241 | that.getCurrentStep = function () { 242 | return current_step; 243 | }; 244 | 245 | that.trigger = function (event_name) { 246 | switch (event_name) { 247 | case 'next': 248 | nextStep(); 249 | break 250 | case 'skip': 251 | skipAll(); 252 | break 253 | } 254 | }; 255 | 256 | that.setScript = function (_data) { 257 | if (_data) { 258 | data = _data; 259 | } 260 | }; 261 | 262 | //support deprecated API methods 263 | that.set = function (_data) { 264 | that.setScript(_data); 265 | }; 266 | 267 | that.setSteps = function (_data) { 268 | that.setScript(_data); 269 | }; 270 | 271 | that.run = function () { 272 | that.runScript(); 273 | }; 274 | 275 | that.resume = function () { 276 | that.resumeScript(); 277 | }; 278 | 279 | 280 | init(); 281 | }; 282 | -------------------------------------------------------------------------------- /enjoyhint/src/jquery.enjoyhint.css: -------------------------------------------------------------------------------- 1 | @font-face { 2 | font-family: 'casino_handregular'; 3 | src: url('Casino_Hand/casino_hand-webfont.eot'); 4 | src: url('Casino_Hand/casino_hand-webfont.eot?#iefix') format('embedded-opentype'), 5 | url('Casino_Hand/casino_hand-webfont.woff') format('woff'), 6 | url('Casino_Hand/casino_hand-webfont.ttf') format('truetype'), 7 | url('Casino_Hand/casino_hand-webfont.svg#casino_handregular') format('svg'); 8 | font-weight: normal; 9 | font-style: normal; 10 | 11 | } 12 | .enjoyhint{ 13 | position: fixed; 14 | width: 100%; 15 | height: 100%; 16 | top:0; 17 | left: 0; 18 | z-index: 1010; 19 | pointer-events: none; 20 | overflow: hidden; 21 | } 22 | 23 | 24 | .enjoyhint_hide{ 25 | display: none; 26 | } 27 | 28 | .enjoyhint_disable_events{ 29 | position:absolute; 30 | width: 2000px; 31 | height: 1500px; 32 | z-index: 1011; 33 | /*display: none;*/ 34 | pointer-events: all; 35 | } 36 | 37 | .enjoyhint_next_btn{ 38 | position:absolute; 39 | z-index: 1012; 40 | /*display: none;*/ 41 | pointer-events: all; 42 | -webkit-box-sizing: content-box; 43 | -moz-box-sizing: content-box; 44 | box-sizing: content-box; 45 | width: 100px; 46 | height: 40px; 47 | cursor: pointer; 48 | margin: 0 auto; 49 | border: 2px solid rgb(30,205,151); 50 | -webkit-border-radius: 40px; 51 | border-radius: 40px; 52 | font: normal normal normal 17px/40px "Advent Pro", Helvetica, sans-serif; 53 | color: rgb(30, 205, 151); 54 | text-align: center; 55 | -o-text-overflow: clip; 56 | text-overflow: clip; 57 | letter-spacing: 1px; 58 | background: rgba(0,0,0,0); 59 | -webkit-transition: background-color 0.3s cubic-bezier(0, 0, 0, 0), color 0.3s cubic-bezier(0, 0, 0, 0), width 0.3s cubic-bezier(0, 0, 0, 0), border-width 0.3s cubic-bezier(0, 0, 0, 0), border-color 0.3s cubic-bezier(0, 0, 0, 0); 60 | -moz-transition: background-color 0.3s cubic-bezier(0, 0, 0, 0), color 0.3s cubic-bezier(0, 0, 0, 0), width 0.3s cubic-bezier(0, 0, 0, 0), border-width 0.3s cubic-bezier(0, 0, 0, 0), border-color 0.3s cubic-bezier(0, 0, 0, 0); 61 | -o-transition: background-color 0.3s cubic-bezier(0, 0, 0, 0), color 0.3s cubic-bezier(0, 0, 0, 0), width 0.3s cubic-bezier(0, 0, 0, 0), border-width 0.3s cubic-bezier(0, 0, 0, 0), border-color 0.3s cubic-bezier(0, 0, 0, 0); 62 | transition: background-color 0.3s cubic-bezier(0, 0, 0, 0), color 0.3s cubic-bezier(0, 0, 0, 0), width 0.3s cubic-bezier(0, 0, 0, 0), border-width 0.3s cubic-bezier(0, 0, 0, 0), border-color 0.3s cubic-bezier(0, 0, 0, 0); 63 | } 64 | 65 | .enjoyhint_next_btn:hover{ 66 | color: rgba(255,255,255,1); 67 | background: rgb(30, 205, 151); 68 | } 69 | 70 | .enjoyhint_next_btn:active{ 71 | border: 2px solid rgba(33,224,163,1); 72 | background: rgba(33,224,163,1); 73 | -webkit-transition: none; 74 | -moz-transition: none; 75 | -o-transition: none; 76 | transition: none; 77 | } 78 | 79 | .enjoyhint_skip_btn{ 80 | position:absolute; 81 | position: absolute; 82 | z-index: 1012; 83 | /*display: none;*/ 84 | pointer-events: all; 85 | -webkit-box-sizing: content-box; 86 | -moz-box-sizing: content-box; 87 | box-sizing: content-box; 88 | width: 100px; 89 | height: 40px; 90 | cursor: pointer; 91 | margin: 0 auto; 92 | border: 2px solid rgb(30,205,151); 93 | -webkit-border-radius: 40px; 94 | border-radius: 40px; 95 | font: normal normal normal 17px/40px "Advent Pro", Helvetica, sans-serif; 96 | color: rgb(30, 205, 151); 97 | text-align: center; 98 | -o-text-overflow: clip; 99 | text-overflow: clip; 100 | letter-spacing: 1px; 101 | background: rgba(0,0,0,0); 102 | -webkit-transition: background-color 0.3s cubic-bezier(0, 0, 0, 0), color 0.3s cubic-bezier(0, 0, 0, 0), width 0.3s cubic-bezier(0, 0, 0, 0), border-width 0.3s cubic-bezier(0, 0, 0, 0), border-color 0.3s cubic-bezier(0, 0, 0, 0); 103 | -moz-transition: background-color 0.3s cubic-bezier(0, 0, 0, 0), color 0.3s cubic-bezier(0, 0, 0, 0), width 0.3s cubic-bezier(0, 0, 0, 0), border-width 0.3s cubic-bezier(0, 0, 0, 0), border-color 0.3s cubic-bezier(0, 0, 0, 0); 104 | -o-transition: background-color 0.3s cubic-bezier(0, 0, 0, 0), color 0.3s cubic-bezier(0, 0, 0, 0), width 0.3s cubic-bezier(0, 0, 0, 0), border-width 0.3s cubic-bezier(0, 0, 0, 0), border-color 0.3s cubic-bezier(0, 0, 0, 0); 105 | transition: background-color 0.3s cubic-bezier(0, 0, 0, 0), color 0.3s cubic-bezier(0, 0, 0, 0), width 0.3s cubic-bezier(0, 0, 0, 0), border-width 0.3s cubic-bezier(0, 0, 0, 0), border-color 0.3s cubic-bezier(0, 0, 0, 0); 106 | } 107 | 108 | .enjoyhint_skip_btn:hover{ 109 | color: rgba(255,255,255,1); 110 | background: rgb(30, 205, 151); 111 | } 112 | 113 | .enjoyhint_skip_btn:active{ 114 | border: 2px solid rgba(33,224,163,1); 115 | background: rgba(33,224,163,1); 116 | -webkit-transition: none; 117 | -moz-transition: none; 118 | -o-transition: none; 119 | transition: none; 120 | } 121 | 122 | .enjoyhint_close_btn { 123 | display: inline-block; 124 | position: absolute; 125 | z-index: 1012; 126 | pointer-events: all; 127 | -webkit-box-sizing: content-box; 128 | -moz-box-sizing: content-box; 129 | box-sizing: content-box; 130 | width: .3em; 131 | height: .3em; 132 | border: none; 133 | -webkit-border-radius: 1em; 134 | border-radius: 1em; 135 | font: 400 8em/normal Arial,Helvetica,sans-serif; 136 | color: rgba(0,0,0,1); 137 | -o-text-overflow: clip; 138 | text-overflow: clip; 139 | background: rgba(0,0,0,0); 140 | border: 2px solid rgba(33,224,163,1); 141 | } 142 | 143 | .enjoyhint_close_btn::before { 144 | display: inline-block; 145 | -webkit-box-sizing: content-box; 146 | -moz-box-sizing: content-box; 147 | box-sizing: content-box; 148 | width: 73%; 149 | height: 2px; 150 | position: absolute; 151 | content: ""; 152 | top: 48%; 153 | left: 14%; 154 | border: none; 155 | font: normal 100%/normal Arial,Helvetica,sans-serif; 156 | color: rgba(0,0,0,1); 157 | -o-text-overflow: clip; 158 | text-overflow: clip; 159 | background: #fff; 160 | text-shadow: none; 161 | -webkit-transform: rotateZ(45deg); 162 | transform: rotateZ(45deg); 163 | } 164 | 165 | .enjoyhint_close_btn::after { 166 | display: inline-block; 167 | -webkit-box-sizing: content-box; 168 | -moz-box-sizing: content-box; 169 | box-sizing: content-box; 170 | width: 73%; 171 | height: 2px; 172 | position: absolute; 173 | content: ""; 174 | top: 46%; 175 | left: 15%; 176 | border: none; 177 | font: normal 100%/normal Arial,Helvetica,sans-serif; 178 | color: rgba(0,0,0,1); 179 | -o-text-overflow: clip; 180 | text-overflow: clip; 181 | background: #fff; 182 | text-shadow: none; 183 | -webkit-transform: rotateZ(-45deg); 184 | transform: rotateZ(-45deg); 185 | } 186 | 187 | 188 | .enjoyhint_close_btn:hover{ 189 | color: rgba(255,255,255,1); 190 | background: rgb(30, 205, 151); 191 | cursor: pointer; 192 | } 193 | 194 | .enjoyhint_close_btn:active{ 195 | border: 2px solid rgba(33,224,163,1); 196 | background: rgba(33,224,163,1); 197 | -webkit-transition: none; 198 | -moz-transition: none; 199 | -o-transition: none; 200 | transition: none; 201 | } 202 | 203 | .enjoyhint_btn{ 204 | -webkit-box-sizing: content-box; 205 | -moz-box-sizing: content-box; 206 | box-sizing: content-box; 207 | width: 150px; 208 | height: 40px; 209 | cursor: pointer; 210 | margin: 0 auto; 211 | border: 2px solid rgb(30,205,151); 212 | -webkit-border-radius: 40px; 213 | border-radius: 40px; 214 | font: normal normal normal 17px/40px "Advent Pro", Helvetica, sans-serif; 215 | color: rgb(30, 205, 151); 216 | text-align: center; 217 | -o-text-overflow: clip; 218 | text-overflow: clip; 219 | letter-spacing: 1px; 220 | background: rgba(0,0,0,0); 221 | -webkit-transition: background-color 0.3s cubic-bezier(0, 0, 0, 0), color 0.3s cubic-bezier(0, 0, 0, 0), width 0.3s cubic-bezier(0, 0, 0, 0), border-width 0.3s cubic-bezier(0, 0, 0, 0), border-color 0.3s cubic-bezier(0, 0, 0, 0); 222 | -moz-transition: background-color 0.3s cubic-bezier(0, 0, 0, 0), color 0.3s cubic-bezier(0, 0, 0, 0), width 0.3s cubic-bezier(0, 0, 0, 0), border-width 0.3s cubic-bezier(0, 0, 0, 0), border-color 0.3s cubic-bezier(0, 0, 0, 0); 223 | -o-transition: background-color 0.3s cubic-bezier(0, 0, 0, 0), color 0.3s cubic-bezier(0, 0, 0, 0), width 0.3s cubic-bezier(0, 0, 0, 0), border-width 0.3s cubic-bezier(0, 0, 0, 0), border-color 0.3s cubic-bezier(0, 0, 0, 0); 224 | transition: background-color 0.3s cubic-bezier(0, 0, 0, 0), color 0.3s cubic-bezier(0, 0, 0, 0), width 0.3s cubic-bezier(0, 0, 0, 0), border-width 0.3s cubic-bezier(0, 0, 0, 0), border-color 0.3s cubic-bezier(0, 0, 0, 0); 225 | } 226 | 227 | .enjoyhint_btn:hover{ 228 | color: rgba(255,255,255,1); 229 | background: rgb(30, 205, 151); 230 | } 231 | 232 | .enjoyhint_btn:active { 233 | border: 2px solid rgba(33,224,163,1); 234 | background: rgba(33,224,163,1); 235 | -webkit-transition: none; 236 | -moz-transition: none; 237 | -o-transition: none; 238 | transition: none; 239 | } 240 | 241 | 242 | .enjoyhint div.canvas-container{ 243 | position: absolute; 244 | } 245 | 246 | .enjoyhint_canvas{ 247 | position: absolute; 248 | z-index: 100; 249 | width: 100%; 250 | height: 100%; 251 | pointer-events: none; 252 | } 253 | 254 | #kinetic_container{ 255 | pointer-events: none; 256 | position: absolute; 257 | width: 100%; 258 | height: 100%; 259 | top:0; 260 | left: 0; 261 | } 262 | 263 | .enjoyhint_svg{ 264 | } 265 | .enjoyhint_svg_wrapper{ 266 | position: absolute; 267 | width: 100%; 268 | height: 100%; 269 | top:0; 270 | left: 0; 271 | z-index: 100; 272 | -webkit-transition: opacity 400ms cubic-bezier(0.42, 0, 0.58, 1); 273 | -moz-transition: opacity 400ms cubic-bezier(0.42, 0, 0.58, 1); 274 | transition: opacity 400ms cubic-bezier(0.42, 0, 0.58, 1); 275 | } 276 | .enjoyhint_svg_wrapper svg{ 277 | position: absolute; 278 | width: 100%; 279 | height: 100%; 280 | top:0; 281 | left: 0; 282 | } 283 | 284 | .enjoyhint_svg_transparent .enjoyhint_svg_wrapper,.enjoyhint_svg_transparent .enjoy_hint_label{ 285 | opacity:0; 286 | } 287 | 288 | 289 | .enjoy_hint_label{ 290 | position: absolute; 291 | color: white; 292 | z-index: 107; 293 | font-size: 22px; 294 | font-family: 'casino_handregular', 'Arial'; 295 | -webkit-transition: opacity 400ms cubic-bezier(0.42, 0, 0.58, 1); 296 | -moz-transition: opacity 400ms cubic-bezier(0.42, 0, 0.58, 1); 297 | transition: opacity 400ms cubic-bezier(0.42, 0, 0.58, 1); 298 | } 299 | 300 | 301 | 302 | div.kineticjs-content{ 303 | position: absolute !important; 304 | } -------------------------------------------------------------------------------- /enjoyhint/src/jquery.enjoyhint.js: -------------------------------------------------------------------------------- 1 | CanvasRenderingContext2D.prototype.roundRect = function (x, y, w, h, r) { 2 | if (w < 2 * r) r = w / 2; 3 | if (h < 2 * r) r = h / 2; 4 | this.beginPath(); 5 | this.moveTo(x + r, y); 6 | this.arcTo(x + w, y, x + w, y + h, r); 7 | this.arcTo(x + w, y + h, x, y + h, r); 8 | this.arcTo(x, y + h, x, y, r); 9 | this.arcTo(x, y, x + w, y, r); 10 | this.closePath(); 11 | return this; 12 | }; 13 | 14 | (function ($) { 15 | var methods = { 16 | init: function (options) { 17 | return this.each(function () { 18 | var defaults = { 19 | onNextClick: function () { 20 | }, 21 | onSkipClick: function () { 22 | }, 23 | animation_time: 800 24 | }; 25 | 26 | 27 | this.enjoyhint_obj = {}; 28 | var that = this.enjoyhint_obj; 29 | var $that = $(this); 30 | var $body = $('body'); 31 | that.options = jQuery.extend(defaults, options); 32 | 33 | //general classes 34 | that.gcl = { 35 | chooser: 'enjoyhint' 36 | }; 37 | 38 | // classes 39 | that.cl = { 40 | enjoy_hint: 'enjoyhint', 41 | hide: 'enjoyhint_hide', 42 | disable_events_element: 'enjoyhint_disable_events', 43 | btn: 'enjoyhint_btn', 44 | skip_btn: 'enjoyhint_skip_btn', 45 | close_btn: 'enjoyhint_close_btn', 46 | next_btn: 'enjoyhint_next_btn', 47 | main_canvas: 'enjoyhint_canvas', 48 | main_svg: 'enjoyhint_svg', 49 | svg_wrapper: 'enjoyhint_svg_wrapper', 50 | svg_transparent: 'enjoyhint_svg_transparent', 51 | kinetic_container: 'kinetic_container' 52 | }; 53 | function makeSVG(tag, attrs) { 54 | var el = document.createElementNS('http://www.w3.org/2000/svg', tag); 55 | for (var k in attrs) 56 | el.setAttribute(k, attrs[k]); 57 | return el; 58 | } 59 | 60 | // ======================================================================= 61 | // ========================---- enjoyhint ----============================== 62 | // ======================================================================= 63 | that.canvas_size = { 64 | w: $(window).width()*1.4, 65 | h: $(window).height()*1.4 66 | }; 67 | var canvas_id = "enj_canvas"; 68 | 69 | that.enjoyhint = $('