Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- src/UI/Components/ShortCut/ShortCut.js | 9 +++++++--
- src/UI/Components/SkillDescription/SkillDescription.js | 13 +++++++++++++
- src/UI/Components/SkillList/SkillList.js | 7 +++++++
- 3 files changed, 27 insertions(+), 2 deletions(-)
- diff --git a/src/UI/Components/ShortCut/ShortCut.js b/src/UI/Components/ShortCut/ShortCut.js
- index ba61833..5b74c56 100644
- --- a/src/UI/Components/ShortCut/ShortCut.js
- +++ b/src/UI/Components/ShortCut/ShortCut.js
- @@ -455,8 +455,13 @@ define(function(require)
- // Display skill informations
- if (element.isSkill) {
- - SkillDescription.append();
- - SkillDescription.setSkill( _list[index].ID );
- + if (SkillDescription.uid === _list[index].ID) {
- + SkillDescription.remove();
- + }
- + else {
- + SkillDescription.append();
- + SkillDescription.setSkill( _list[index].ID );
- + }
- }
- // Display item informations
- diff --git a/src/UI/Components/SkillDescription/SkillDescription.js b/src/UI/Components/SkillDescription/SkillDescription.js
- index 4775206..b5279fe 100644
- --- a/src/UI/Components/SkillDescription/SkillDescription.js
- +++ b/src/UI/Components/SkillDescription/SkillDescription.js
- @@ -33,6 +33,11 @@ define(function(require)
- /**
- + * @var {number} SkillDescription unique id
- + */
- + SkillDescription.uid = -1;
- +
- + /**
- * Once append to the DOM
- */
- SkillDescription.onKeyDown = function onKeyDown( event )
- @@ -57,6 +62,13 @@ define(function(require)
- events.unshift( events.pop() );
- };
- + /**
- + * Once removed from html
- + */
- + SkillDescription.onRemove = function onRemove()
- + {
- + this.uid = -1;
- + };
- /**
- * Initialize UI
- @@ -78,6 +90,7 @@ define(function(require)
- */
- SkillDescription.setSkill = function setSkill( id )
- {
- + this.uid = id;
- this.ui.find('.content').text(SkillDB[id] || '...');
- this.ui.css({
- diff --git a/src/UI/Components/SkillList/SkillList.js b/src/UI/Components/SkillList/SkillList.js
- index 5147059..6025577 100644
- --- a/src/UI/Components/SkillList/SkillList.js
- +++ b/src/UI/Components/SkillList/SkillList.js
- @@ -521,6 +521,13 @@ define(function(require)
- skill = getSkillById(parseInt(main.data('index'), 10));
- + // Don't add the same UI twice, remove it
- + if (SkillDescription.uid === skill.SKID) {
- + SkillDescription.remove();
- + return false;
- + }
- +
- + // Add ui to window
- SkillDescription.append();
- SkillDescription.setSkill(skill.SKID);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement