Skip to content

Commit 7ead6d2

Browse files
committed
trigger, closeButton, some fix
1 parent 7c1846e commit 7ead6d2

10 files changed

+69
-51
lines changed

.bowerrc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"directory":"lib"
2+
"directory":"lib"
33
}

Gruntfile.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ module.exports = function(grunt){
66
separator: ';'
77
},
88
dist:{
9-
src:['src/*.js', 'lib/kinetic/kinetic.min.js', 'lib/jquery.scrollTo/jquery.scrollTo.min.js'],
9+
src:['src/*.js', 'lib/kineticjs/kinetic.min.js', 'lib/jquery.scrollTo/jquery.scrollTo.min.js'],
1010
dest: '<%= pkg.name %>.js'
1111
}
1212
},

bower.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
],
2424
"dependencies": {
2525
"jquery": "~2.1.3",
26-
"kinetic": "~5.2.0",
27-
"jquery.scrollTo": "~1.4.14"
26+
"jquery.scrollTo": "~1.4.14",
27+
"kineticjs": "~5.1.0"
2828
}
2929
}

enjoyhint.css

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

enjoyhint.js

+27-20
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

enjoyhint.min.js

+5-5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+4
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,9 @@
2424
"homepage": "https://github.com/xbsoftware/enjoyhint",
2525
"devDependencies": {
2626
"grunt-contrib-cssmin": "^0.11.0"
27+
},
28+
"dependencies": {
29+
"grunt": "^0.4.5",
30+
"kinetic": "^5.2.0"
2731
}
2832
}

src/enjoyhint.js

+22-9
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,10 @@ var EnjoyHint = function (_options) {
2626

2727
$body.enjoyhint({
2828
onNextClick: function () {
29-
current_step++;
30-
stepAction();
29+
nextStep();
3130
},
3231
onSkipClick: function () {
33-
var step_data = data[current_step];
34-
var $element = $(step_data.selector);
35-
off(step_data.event);
36-
$element.off(makeEventName(step_data.event));
37-
destroyEnjoy();
32+
skipAll();
3833
}
3934
});
4035
};
@@ -208,6 +203,18 @@ var EnjoyHint = function (_options) {
208203

209204
};
210205

206+
var nextStep = function(){
207+
current_step++;
208+
stepAction();
209+
};
210+
var skipAll = function(){
211+
var step_data = data[current_step];
212+
var $element = $(step_data.selector);
213+
off(step_data.event);
214+
$element.off(makeEventName(step_data.event));
215+
destroyEnjoy();
216+
};
217+
211218
var makeEventName = function (name, is_custom) {
212219
return name + (is_custom ? 'custom' : '') + '.enjoy_hint';
213220
};
@@ -234,9 +241,15 @@ var EnjoyHint = function (_options) {
234241
return current_step;
235242
};
236243

237-
238244
that.trigger = function (event_name) {
239-
$body.trigger(makeEventName(event_name, true));
245+
switch (event_name) {
246+
case 'next':
247+
nextStep();
248+
break
249+
case 'skip':
250+
skipAll();
251+
break
252+
}
240253
};
241254

242255
that.setScript = function (_data) {

src/jquery.enjoyhint.css

+6-6
Original file line numberDiff line numberDiff line change
@@ -145,12 +145,12 @@
145145
-webkit-box-sizing: content-box;
146146
-moz-box-sizing: content-box;
147147
box-sizing: content-box;
148-
width: 29px;
148+
width: 73%;
149149
height: 2px;
150150
position: absolute;
151151
content: "";
152-
top: 16px;
153-
left: 3px;
152+
top: 48%;
153+
left: 14%;
154154
border: none;
155155
font: normal 100%/normal Arial,Helvetica,sans-serif;
156156
color: rgba(0,0,0,1);
@@ -167,12 +167,12 @@
167167
-webkit-box-sizing: content-box;
168168
-moz-box-sizing: content-box;
169169
box-sizing: content-box;
170-
width: 29px;
170+
width: 73%;
171171
height: 2px;
172172
position: absolute;
173173
content: "";
174-
top: 16px;
175-
left: 3px;
174+
top: 46%;
175+
left: 15%;
176176
border: none;
177177
font: normal 100%/normal Arial,Helvetica,sans-serif;
178178
color: rgba(0,0,0,1);

src/jquery.enjoyhint.js

-6
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ CanvasRenderingContext2D.prototype.roundRect = function (x, y, w, h, r) {
1414
(function ($) {
1515
var methods = {
1616
init: function (options) {
17-
console.log(options,'-------------');
1817
return this.each(function () {
1918
var defaults = {
2019
onNextClick: function () {
@@ -81,7 +80,6 @@ CanvasRenderingContext2D.prototype.roundRect = function (x, y, w, h, r) {
8180
width: that.canvas_size.w,
8281
height: that.canvas_size.h
8382
});
84-
console.log(that.enjoyhint);
8583

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

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

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

121117
$(BottomElement).click();
@@ -544,7 +540,6 @@ CanvasRenderingContext2D.prototype.roundRect = function (x, y, w, h, r) {
544540
top: label_y + label_height + 20
545541
});
546542
var left_skip = label_x + that.$next_btn.width() + 10;
547-
console.log(that.nextBtn);
548543
if (that.nextBtn == "hide"){
549544
left_skip = label_x;
550545
}
@@ -747,7 +742,6 @@ CanvasRenderingContext2D.prototype.roundRect = function (x, y, w, h, r) {
747742
};
748743

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

0 commit comments

Comments
 (0)