mirror of
https://github.com/loot/libloot.git
synced 2026-07-27 14:16:01 -07:00
Added icons for plugin priorities.
This commit is contained in:
@@ -624,15 +624,7 @@ var pluginLIProto = Object.create(HTMLLIElement.prototype, {
|
||||
|
||||
var template = document.getElementById('pluginLI');
|
||||
var clone = document.importNode(template.content, true);
|
||||
|
||||
this.createShadowRoot().appendChild(clone);
|
||||
|
||||
var name = document.createElement('span');
|
||||
name.className = 'name';
|
||||
this.appendChild(name);
|
||||
var priority = document.createElement('span');
|
||||
priority.className = 'priority';
|
||||
this.appendChild(priority);
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
@@ -103,13 +103,11 @@ function Plugin(obj) {
|
||||
}
|
||||
|
||||
Plugin.prototype.getPriorityString = function() {
|
||||
var priorityText = 'Priority: ' + this.modPriority + ', Global: ';
|
||||
if (this.isGlobalPriority) {
|
||||
priorityText += '✓';
|
||||
if (this.modPriority != 0) {
|
||||
return 'Priority: ' + this.modPriority;
|
||||
} else {
|
||||
priorityText += '✗';
|
||||
return '';
|
||||
}
|
||||
return priorityText;
|
||||
}
|
||||
|
||||
Plugin.prototype.updateCardMessages = function() {
|
||||
@@ -166,12 +164,13 @@ function Plugin(obj) {
|
||||
|
||||
li.shadowRoot.getElementsByTagName('a')[0].href = '#' + this.id;
|
||||
|
||||
li.getElementsByClassName('name')[0].textContent = this.name;
|
||||
li.getElementsByClassName('priority')[0].textContent = this.getPriorityString();
|
||||
li.textContent = this.name;
|
||||
|
||||
li.setAttribute('data-dummy', this.isDummy);
|
||||
li.setAttribute('data-bsa', this.loadsBSA);
|
||||
li.setAttribute('data-edits', this.userlist != undefined);
|
||||
li.setAttribute('data-global-priority', this.isGlobalPriority);
|
||||
li.shadowRoot.getElementsByClassName('hasPriority')[0].title = this.getPriorityString();
|
||||
|
||||
document.getElementById('pluginsNav').appendChild(li);
|
||||
}
|
||||
@@ -182,10 +181,10 @@ function Plugin(obj) {
|
||||
change.object.li.setAttribute('data-edits', change.object[change.name] != undefined);
|
||||
change.object.card.setAttribute('data-edits', change.object[change.name] != undefined);
|
||||
} else if (change.name == 'modPriority') {
|
||||
change.object.li.getElementsByClassName('priority')[0].textContent = change.object.getPriorityString();
|
||||
change.object.li.shadowRoot.getElementsByClassName('hasPriority')[0].title = this.getPriorityString();
|
||||
change.object.card.shadowRoot.getElementById('priorityValue').value = change.object[change.name];
|
||||
} else if (change.name == 'isGlobalPriority') {
|
||||
change.object.li.getElementsByClassName('priority')[0].textContent = change.object.getPriorityString();
|
||||
change.object.li.shadowRoot.getElementsByClassName('hasPriority')[0].title = this.getPriorityString();
|
||||
} else if (change.name == 'messages') {
|
||||
change.object.updateCardMessages();
|
||||
/* For messages, the card's messages need updating,
|
||||
|
||||
@@ -735,7 +735,7 @@ function sortUIElements(pluginNames) {
|
||||
/* Also need to move plugin sidebar entry. */
|
||||
var li;
|
||||
for (var i = 0; i < entries.length; ++i) {
|
||||
if (entries[i].getElementsByClassName('name')[0].textContent == name) {
|
||||
if (entries[i].textContent == name) {
|
||||
li = entries[i];
|
||||
}
|
||||
}
|
||||
@@ -959,7 +959,7 @@ function handlePluginDrop(evt) {
|
||||
}
|
||||
function handlePluginDragStart(evt) {
|
||||
evt.dataTransfer.effectAllowed = 'copy';
|
||||
evt.dataTransfer.setData('text/plain', evt.target.getElementsByClassName('name')[0].textContent);
|
||||
evt.dataTransfer.setData('text/plain', evt.target.textContent);
|
||||
}
|
||||
function handlePluginDragOver(evt) {
|
||||
evt.preventDefault();
|
||||
|
||||
@@ -300,6 +300,12 @@
|
||||
:host([data-edits=false]) .hasUserEdits {
|
||||
visibility: hidden;
|
||||
}
|
||||
:host([data-global-priority=false]) .hasGlobalPriority {
|
||||
visibility: hidden;
|
||||
}
|
||||
.hasPriority:not([title^=Priority]) {
|
||||
visibility: hidden;
|
||||
}
|
||||
a {
|
||||
text-decoration: none;
|
||||
color: black;
|
||||
@@ -308,9 +314,10 @@
|
||||
<span class="dummyPlugin fa fa-eye-slash" title="Dummy Plugin"></span>
|
||||
<span class="loadsBSA fa fa-paperclip" title="Loads BSA"></span>
|
||||
<span class="hasUserEdits fa fa-user" title="Has User Metadata"></span>
|
||||
<span class="hasGlobalPriority fa fa-globe" title="Priority Is Global"></span>
|
||||
<span class="hasPriority fa fa-exclamation"></span>
|
||||
<a href="">
|
||||
<content select=".name"></content>
|
||||
<content select=".priority"></content>
|
||||
<content></content>
|
||||
</a>
|
||||
</template>
|
||||
<template id="pluginMenu">
|
||||
|
||||
Reference in New Issue
Block a user