Skip to content
This repository was archived by the owner on Feb 22, 2024. It is now read-only.

Commit 3cf0b54

Browse files
Mahdiyeh/ Fix: guide on 4th step (#6753)
* fix guide on 4th step * change const naming
1 parent df41377 commit 3cf0b54

File tree

1 file changed

+23
-18
lines changed

1 file changed

+23
-18
lines changed

src/javascript/app/common/guide.js

Lines changed: 23 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -19,28 +19,30 @@ const Guide = (() => {
1919

2020
const init = (options) => {
2121
opt = {
22-
script : '', // the script name in scripts
23-
autoStart : false, // false: start by button click
24-
guideBtnID : '#guideBtn',
25-
btnText : localize('Guide'), // guide start button's text
26-
blink_class : 'highlight',
27-
blink_inDelay : 1000,
28-
blink_outDelay: 1000,
29-
blink_interval: 3000, // 0: continous blinking (blink_inDelay + blink_outDelay)
30-
blink_count : 0, // 0: infinite
22+
script : '', // the script name in scripts
23+
autoStart : false, // false: start by button click
24+
guide_btn_id : '#guideBtn',
25+
btnText : localize('Guide'), // guide start button's text
26+
blink_class : 'highlight',
27+
blink_inDelay : 1000,
28+
blink_outDelay : 1000,
29+
blink_interval : 3000, // 0: continous blinking (blink_inDelay + blink_outDelay)
30+
blink_count : 0, // 0: infinite
31+
contract_list_id : '#contracts_list',
32+
close_confirmation_id: '#close_confirmation_container',
3133
};
3234
$.extend(true, opt, options);
3335

3436
cookie_name = 'hide_guide';
3537
btn_next = { className: 'button', html: $('<span/>', { text: localize('Next') }) };
3638
btn_finish = { className: 'button btnFinish', html: $('<span/>', { text: localize('Finish') }) };
3739

38-
if ($(opt.guideBtnID).length === 0 || opt.script.length === 0) {
40+
if ($(opt.guide_btn_id).length === 0 || opt.script.length === 0) {
3941
return;
4042
}
4143

4244
if (isDisabled()) {
43-
$(opt.guideBtnID).remove();
45+
$(opt.guide_btn_id).remove();
4446
return;
4547
}
4648

@@ -68,15 +70,15 @@ const Guide = (() => {
6870
* generate the button's html
6971
*/
7072
const makeButton = () => {
71-
if ($(opt.guideBtnID).children().length > 0) {
73+
if ($(opt.guide_btn_id).children().length > 0) {
7274
return;
7375
}
7476

75-
$(opt.guideBtnID)
77+
$(opt.guide_btn_id)
7678
.addClass('gr-hide-m pulser')
7779
.append($('<span/>', { class: 'close', text: 'X' }))
7880
.append($('<strong/>'));
79-
$(`${opt.guideBtnID} strong`).html(`<span></span>${opt.btnText}`);
81+
$(`${opt.guide_btn_id} strong`).html(`<span></span>${opt.btnText}`);
8082

8183
setEvents();
8284
};
@@ -85,20 +87,23 @@ const Guide = (() => {
8587
* both buttons' click event
8688
*/
8789
const setEvents = () => {
88-
$(`${opt.guideBtnID} strong`).click(() => {
90+
$(`${opt.guide_btn_id} strong`).click(() => {
8991
const enjoyhint_instance = new EnjoyHint({});
9092
enjoyhint_instance.setScript(getScript(opt.script));
9193
enjoyhint_instance.runScript();
94+
if ($(opt.contract_list_id).css('display') === 'none') {
95+
$(opt.close_confirmation_id).click();
96+
}
9297
});
9398

9499
if (opt.autoStart) {
95-
$(opt.guideBtnID).click();
100+
$(opt.guide_btn_id).click();
96101
}
97102

98103
// Hide button
99-
$(`${opt.guideBtnID} span.close`).click(() => {
104+
$(`${opt.guide_btn_id} span.close`).click(() => {
100105
setDisabled();
101-
$(opt.guideBtnID).remove();
106+
$(opt.guide_btn_id).remove();
102107
});
103108
};
104109

0 commit comments

Comments
 (0)