From 82e68bda91fd7df4fc65455ab3cfb1866f50bcb9 Mon Sep 17 00:00:00 2001 From: WrinklyNinja Date: Thu, 28 Aug 2014 12:42:14 +0100 Subject: [PATCH] Added icons for plugin priorities. --- resources/report/js/custom.js | 8 -------- resources/report/js/plugin.js | 17 ++++++++--------- resources/report/js/script.js | 4 ++-- resources/report/report.html | 11 +++++++++-- 4 files changed, 19 insertions(+), 21 deletions(-) diff --git a/resources/report/js/custom.js b/resources/report/js/custom.js index 81bc1a45..bec62942 100644 --- a/resources/report/js/custom.js +++ b/resources/report/js/custom.js @@ -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); } }, diff --git a/resources/report/js/plugin.js b/resources/report/js/plugin.js index 6188d20b..1f5caa07 100644 --- a/resources/report/js/plugin.js +++ b/resources/report/js/plugin.js @@ -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, diff --git a/resources/report/js/script.js b/resources/report/js/script.js index 0f60aaf6..1d1fbdc0 100644 --- a/resources/report/js/script.js +++ b/resources/report/js/script.js @@ -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(); diff --git a/resources/report/report.html b/resources/report/report.html index f3af7254..f625b8e2 100644 --- a/resources/report/report.html +++ b/resources/report/report.html @@ -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 @@ + + - - +