Fix more than one plugin highlighted at once.

When switching the conflict filter between different plugins. Fixes
#420.
This commit is contained in:
Oliver Hamlet
2015-04-24 16:04:18 +01:00
parent 35bc15b8c9
commit 13a7908794
2 changed files with 11 additions and 14 deletions
@@ -355,10 +355,6 @@ loot-clear-metadata
return this.shadowRoot.getElementById('editor').readFromEditor(oldData);
},
deactivateConflictFilter: function() {
this.shadowRoot.getElementById('showOnlyConflicts').checked = false;
},
onShowOnlyConflicts: function(evt) {
evt.target.dispatchEvent(new CustomEvent('loot-filter-conflicts', {
bubbles: true,
+11 -10
View File
@@ -470,20 +470,21 @@ function onEditorClose(evt) {
document.getElementById('cardsNav').updateSize();
}
function onConflictsFilter(evt) {
/* Deactivate any existing plugin conflict filter. */
for (var i = 0; i < loot.game.plugins.length; ++i) {
if (loot.game.plugins[i].id != evt.target.id) {
loot.game.plugins[i].isConflictFilterChecked = false;
}
}
/* Un-highlight any existing filter plugin. */
var cards = document.getElementById('main').getElementsByTagName('loot-plugin-card');
for (var i = 0; i < cards.length; ++i) {
cards[i].classList.toggle('highlight', false);
}
/* evt.detail is true if the filter has been activated. */
if (evt.detail) {
/* Un-highlight any existing filter plugin. */
var cards = document.getElementById('main').getElementsByTagName('loot-plugin-card');
for (var i = 0; i < cards.length; ++i) {
cards[i].classList.toggle('highlight', false);
if (cards[i] != evt.target) {
cards[i].deactivateConflictFilter();
}
}
evt.target.classList.toggle('highlight', true);
document.body.setAttribute('data-conflicts', evt.target.getName());
} else {
evt.target.classList.toggle('highlight', false);
document.body.removeAttribute('data-conflicts');
}
setFilteredUIData(evt);