From 8af445bf93e64de19b43b40432b20bfe0953f2da Mon Sep 17 00:00:00 2001 From: mahdiyeh-fs Date: Tue, 24 Aug 2021 10:47:48 +0430 Subject: [PATCH 1/2] fix guide on 4th step --- src/javascript/app/common/guide.js | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/src/javascript/app/common/guide.js b/src/javascript/app/common/guide.js index 846cd234e22c4..68caeca6358ca 100644 --- a/src/javascript/app/common/guide.js +++ b/src/javascript/app/common/guide.js @@ -19,15 +19,17 @@ const Guide = (() => { const init = (options) => { opt = { - script : '', // the script name in scripts - autoStart : false, // false: start by button click - guideBtnID : '#guideBtn', - btnText : localize('Guide'), // guide start button's text - blink_class : 'highlight', - blink_inDelay : 1000, - blink_outDelay: 1000, - blink_interval: 3000, // 0: continous blinking (blink_inDelay + blink_outDelay) - blink_count : 0, // 0: infinite + script : '', // the script name in scripts + autoStart : false, // false: start by button click + guideBtnID : '#guideBtn', + btnText : localize('Guide'), // guide start button's text + blink_class : 'highlight', + blink_inDelay : 1000, + blink_outDelay : 1000, + blink_interval : 3000, // 0: continous blinking (blink_inDelay + blink_outDelay) + blink_count : 0, // 0: infinite + contractList : '#contracts_list', + closeConfirmation: '#close_confirmation_container', }; $.extend(true, opt, options); @@ -87,8 +89,13 @@ const Guide = (() => { const setEvents = () => { $(`${opt.guideBtnID} strong`).click(() => { const enjoyhint_instance = new EnjoyHint({}); + const contractList = $(opt.contractList); + const closeConfirmation = $(opt.closeConfirmation); enjoyhint_instance.setScript(getScript(opt.script)); enjoyhint_instance.runScript(); + if (contractList.css('display') === 'none') { + closeConfirmation.click(); + } }); if (opt.autoStart) { From e979c5137651b8fbd989123916f969c97e6b8b2b Mon Sep 17 00:00:00 2001 From: mahdiyeh-fs Date: Wed, 25 Aug 2021 11:39:00 +0430 Subject: [PATCH 2/2] change const naming --- src/javascript/app/common/guide.js | 46 ++++++++++++++---------------- 1 file changed, 22 insertions(+), 24 deletions(-) diff --git a/src/javascript/app/common/guide.js b/src/javascript/app/common/guide.js index 68caeca6358ca..925ed93ff114f 100644 --- a/src/javascript/app/common/guide.js +++ b/src/javascript/app/common/guide.js @@ -19,17 +19,17 @@ const Guide = (() => { const init = (options) => { opt = { - script : '', // the script name in scripts - autoStart : false, // false: start by button click - guideBtnID : '#guideBtn', - btnText : localize('Guide'), // guide start button's text - blink_class : 'highlight', - blink_inDelay : 1000, - blink_outDelay : 1000, - blink_interval : 3000, // 0: continous blinking (blink_inDelay + blink_outDelay) - blink_count : 0, // 0: infinite - contractList : '#contracts_list', - closeConfirmation: '#close_confirmation_container', + script : '', // the script name in scripts + autoStart : false, // false: start by button click + guide_btn_id : '#guideBtn', + btnText : localize('Guide'), // guide start button's text + blink_class : 'highlight', + blink_inDelay : 1000, + blink_outDelay : 1000, + blink_interval : 3000, // 0: continous blinking (blink_inDelay + blink_outDelay) + blink_count : 0, // 0: infinite + contract_list_id : '#contracts_list', + close_confirmation_id: '#close_confirmation_container', }; $.extend(true, opt, options); @@ -37,12 +37,12 @@ const Guide = (() => { btn_next = { className: 'button', html: $('', { text: localize('Next') }) }; btn_finish = { className: 'button btnFinish', html: $('', { text: localize('Finish') }) }; - if ($(opt.guideBtnID).length === 0 || opt.script.length === 0) { + if ($(opt.guide_btn_id).length === 0 || opt.script.length === 0) { return; } if (isDisabled()) { - $(opt.guideBtnID).remove(); + $(opt.guide_btn_id).remove(); return; } @@ -70,15 +70,15 @@ const Guide = (() => { * generate the button's html */ const makeButton = () => { - if ($(opt.guideBtnID).children().length > 0) { + if ($(opt.guide_btn_id).children().length > 0) { return; } - $(opt.guideBtnID) + $(opt.guide_btn_id) .addClass('gr-hide-m pulser') .append($('', { class: 'close', text: 'X' })) .append($('')); - $(`${opt.guideBtnID} strong`).html(`${opt.btnText}`); + $(`${opt.guide_btn_id} strong`).html(`${opt.btnText}`); setEvents(); }; @@ -87,25 +87,23 @@ const Guide = (() => { * both buttons' click event */ const setEvents = () => { - $(`${opt.guideBtnID} strong`).click(() => { + $(`${opt.guide_btn_id} strong`).click(() => { const enjoyhint_instance = new EnjoyHint({}); - const contractList = $(opt.contractList); - const closeConfirmation = $(opt.closeConfirmation); enjoyhint_instance.setScript(getScript(opt.script)); enjoyhint_instance.runScript(); - if (contractList.css('display') === 'none') { - closeConfirmation.click(); + if ($(opt.contract_list_id).css('display') === 'none') { + $(opt.close_confirmation_id).click(); } }); if (opt.autoStart) { - $(opt.guideBtnID).click(); + $(opt.guide_btn_id).click(); } // Hide button - $(`${opt.guideBtnID} span.close`).click(() => { + $(`${opt.guide_btn_id} span.close`).click(() => { setDisabled(); - $(opt.guideBtnID).remove(); + $(opt.guide_btn_id).remove(); }); };