Skip to content

Commit

Permalink
trigger, closeButton, some fix
Browse files Browse the repository at this point in the history
  • Loading branch information
blackazaru committed Mar 9, 2015
1 parent 7c1846e commit 7ead6d2
Show file tree
Hide file tree
Showing 10 changed files with 69 additions and 51 deletions.
2 changes: 1 addition & 1 deletion .bowerrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"directory":"lib"
"directory":"lib"
}
2 changes: 1 addition & 1 deletion Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ module.exports = function(grunt){
separator: ';'
},
dist:{
src:['src/*.js', 'lib/kinetic/kinetic.min.js', 'lib/jquery.scrollTo/jquery.scrollTo.min.js'],
src:['src/*.js', 'lib/kineticjs/kinetic.min.js', 'lib/jquery.scrollTo/jquery.scrollTo.min.js'],
dest: '<%= pkg.name %>.js'
}
},
Expand Down
4 changes: 2 additions & 2 deletions bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
],
"dependencies": {
"jquery": "~2.1.3",
"kinetic": "~5.2.0",
"jquery.scrollTo": "~1.4.14"
"jquery.scrollTo": "~1.4.14",
"kineticjs": "~5.1.0"
}
}
2 changes: 1 addition & 1 deletion enjoyhint.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

47 changes: 27 additions & 20 deletions enjoyhint.js

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions enjoyhint.min.js

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,9 @@
"homepage": "https://github.com/xbsoftware/enjoyhint",
"devDependencies": {
"grunt-contrib-cssmin": "^0.11.0"
},
"dependencies": {
"grunt": "^0.4.5",
"kinetic": "^5.2.0"
}
}
31 changes: 22 additions & 9 deletions src/enjoyhint.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,10 @@ var EnjoyHint = function (_options) {

$body.enjoyhint({
onNextClick: function () {
current_step++;
stepAction();
nextStep();
},
onSkipClick: function () {
var step_data = data[current_step];
var $element = $(step_data.selector);
off(step_data.event);
$element.off(makeEventName(step_data.event));
destroyEnjoy();
skipAll();
}
});
};
Expand Down Expand Up @@ -208,6 +203,18 @@ var EnjoyHint = function (_options) {

};

var nextStep = function(){
current_step++;
stepAction();
};
var skipAll = function(){
var step_data = data[current_step];
var $element = $(step_data.selector);
off(step_data.event);
$element.off(makeEventName(step_data.event));
destroyEnjoy();
};

var makeEventName = function (name, is_custom) {
return name + (is_custom ? 'custom' : '') + '.enjoy_hint';
};
Expand All @@ -234,9 +241,15 @@ var EnjoyHint = function (_options) {
return current_step;
};


that.trigger = function (event_name) {
$body.trigger(makeEventName(event_name, true));
switch (event_name) {
case 'next':
nextStep();
break
case 'skip':
skipAll();
break
}
};

that.setScript = function (_data) {
Expand Down
12 changes: 6 additions & 6 deletions src/jquery.enjoyhint.css
Original file line number Diff line number Diff line change
Expand Up @@ -145,12 +145,12 @@
-webkit-box-sizing: content-box;
-moz-box-sizing: content-box;
box-sizing: content-box;
width: 29px;
width: 73%;
height: 2px;
position: absolute;
content: "";
top: 16px;
left: 3px;
top: 48%;
left: 14%;
border: none;
font: normal 100%/normal Arial,Helvetica,sans-serif;
color: rgba(0,0,0,1);
Expand All @@ -167,12 +167,12 @@
-webkit-box-sizing: content-box;
-moz-box-sizing: content-box;
box-sizing: content-box;
width: 29px;
width: 73%;
height: 2px;
position: absolute;
content: "";
top: 16px;
left: 3px;
top: 46%;
left: 15%;
border: none;
font: normal 100%/normal Arial,Helvetica,sans-serif;
color: rgba(0,0,0,1);
Expand Down
6 changes: 0 additions & 6 deletions src/jquery.enjoyhint.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ CanvasRenderingContext2D.prototype.roundRect = function (x, y, w, h, r) {
(function ($) {
var methods = {
init: function (options) {
console.log(options,'-------------');
return this.each(function () {
var defaults = {
onNextClick: function () {
Expand Down Expand Up @@ -81,7 +80,6 @@ CanvasRenderingContext2D.prototype.roundRect = function (x, y, w, h, r) {
width: that.canvas_size.w,
height: that.canvas_size.h
});
console.log(that.enjoyhint);

that.layer = new Kinetic.Layer();
that.rect = new Kinetic.Rect({
Expand Down Expand Up @@ -111,11 +109,9 @@ CanvasRenderingContext2D.prototype.roundRect = function (x, y, w, h, r) {
});

that.$canvas.mousedown(function (e) {
console.log('cl')
$('canvas').css({left: '4000px'});

var BottomElement = document.elementFromPoint(e.clientX, e.clientY);
console.log(BottomElement.tagName)
$('canvas').css({left: '0px'});

$(BottomElement).click();
Expand Down Expand Up @@ -544,7 +540,6 @@ CanvasRenderingContext2D.prototype.roundRect = function (x, y, w, h, r) {
top: label_y + label_height + 20
});
var left_skip = label_x + that.$next_btn.width() + 10;
console.log(that.nextBtn);
if (that.nextBtn == "hide"){
left_skip = label_x;
}
Expand Down Expand Up @@ -747,7 +742,6 @@ CanvasRenderingContext2D.prototype.roundRect = function (x, y, w, h, r) {
};

$.fn.enjoyhint = function (method) {
console.log(method);
if (methods[method]) {
return methods[method].apply(this, Array.prototype.slice.call(arguments, 1));
} else if (typeof method === 'object' || !method) {
Expand Down

0 comments on commit 7ead6d2

Please sign in to comment.