Added icons for plugin priorities.

This commit is contained in:
WrinklyNinja
2014-08-29 14:27:11 +01:00
parent 1b26a46418
commit 82e68bda91
4 changed files with 19 additions and 21 deletions
-8
View File
@@ -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);
}
},
+8 -9
View File
@@ -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,
+2 -2
View File
@@ -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();
+9 -2
View File
@@ -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">