From 63733f32206016cf5c820647b806dea537ec67e2 Mon Sep 17 00:00:00 2001 From: Oliver Hamlet Date: Sun, 9 Nov 2014 12:30:28 +0000 Subject: [PATCH] Replaced plugin-li element with . The latter extends . Also split Polymer CSS overrides into a new CSS file, and fixed sidebar plugin item display. --- resources/report/css/overrides.css | 34 +++++++ resources/report/css/style.css | 53 +++------- resources/report/html/loot-plugin-item.html | 102 ++++++++++++++++++++ resources/report/html/plugin-card.html | 4 +- resources/report/html/plugin-li.html | 92 ------------------ resources/report/js/plugin.js | 6 +- resources/report/js/script.js | 12 +-- resources/report/report.html | 12 +-- 8 files changed, 164 insertions(+), 151 deletions(-) create mode 100644 resources/report/css/overrides.css create mode 100644 resources/report/html/loot-plugin-item.html delete mode 100644 resources/report/html/plugin-li.html diff --git a/resources/report/css/overrides.css b/resources/report/css/overrides.css new file mode 100644 index 00000000..2859e710 --- /dev/null +++ b/resources/report/css/overrides.css @@ -0,0 +1,34 @@ +/* These styles override Polymer's own internal styling for certain elements. */ + +/* The following 3 rules are for setting the sizes of the drawer and panel. */ +#container::shadow #main { + left: 33% !important; +} +#container::shadow .narrow-layout #main { + left: 0 !important; +} +#container::shadow #drawer { + width: 33% !important; +} + +/* These overrides change the colour of the game menu's text and underline. */ +#gameMenu::shadow #control { + color: white; + border-bottom-color: #f1f1f1; +} +#gameMenu::shadow #menu { + color: black; +} + +/* These overrides change the colour of the tab ink effect and their underline. */ +paper-tabs::shadow #selectionBar { + background-color: #4285f4; +} +paper-tab::shadow #ink { + color: #4285f4; +} + +/* These overrides change the font size of the sidebar items to be the body text size. */ +#cardsNav /deep/ #label { + font-size: 10pt; +} \ No newline at end of file diff --git a/resources/report/css/style.css b/resources/report/css/style.css index 15e6ace8..cea42c8d 100644 --- a/resources/report/css/style.css +++ b/resources/report/css/style.css @@ -48,47 +48,11 @@ noscript { #gameMenu { background: inherit; } -#gameMenu::shadow #control { - color: white; - border-bottom-color: #f1f1f1; -} -#gameMenu::shadow #menu { - color: black; -} #filtersToggle > span { margin-right: 1em; } -#container { - position: fixed; - top: 64px; - height: calc(100% - 64px); - /*display: flex; - flex-direction: row; - flex-wrap: nowrap; - width: 100%;*/ -} -paper-tabs::shadow #selectionBar { - background-color: #4285f4; -} -paper-tab::shadow #ink { - color: #4285f4; -} -#pluginsNav { - height: 100%; - overflow: auto; - margin: 0; - padding: 0; -} -#pluginsNav li { - padding: 0 0.5em; - white-space:nowrap; -} -#pluginsNav li > span { - display: inline-block; - width: 1.2em; -} div[drawer] > core-tooltip { width: 100%; margin: 0 12px; @@ -100,6 +64,18 @@ div[drawer] > core-tooltip { overflow: auto; position: relative; } +#cardsNav { + margin: 0; + overflow: auto; +} +#cardsNav > paper-item, #cardsNav > loot-plugin-item { + height: 2em; +} +#container { + position: fixed; + top: 64px; + height: calc(100% - 64px); +} section { background:white; @@ -256,11 +232,6 @@ td input { text-overflow: ellipsis; } - - -#pluginsNav .priority { - display: none; -} body.editMode header { color: #999; } diff --git a/resources/report/html/loot-plugin-item.html b/resources/report/html/loot-plugin-item.html new file mode 100644 index 00000000..a18725a1 --- /dev/null +++ b/resources/report/html/loot-plugin-item.html @@ -0,0 +1,102 @@ + + + + + + + + \ No newline at end of file diff --git a/resources/report/html/plugin-card.html b/resources/report/html/plugin-card.html index d029dba6..0f58f371 100644 --- a/resources/report/html/plugin-card.html +++ b/resources/report/html/plugin-card.html @@ -494,7 +494,7 @@ var pluginCardProto = Object.create(HTMLElement.prototype, { /* Remove drag 'n' drop event handlers. */ - var elements = document.getElementById('pluginsNav').children; + var elements = document.getElementById('cardsNav').getElementsByTagName('loot-plugin-item'); for (var i = 0; i < elements.length; ++i) { elements[i].removeAttribute('draggable'); elements[i].removeEventListener('dragstart', elements[i].handleDragStart, false); @@ -694,7 +694,7 @@ var pluginCardProto = Object.create(HTMLElement.prototype, { pluginCard.shadowRoot.getElementById('cancel').addEventListener('click', pluginCard.hideEditor, false); /* Set up drag 'n' drop event handlers. */ - elements = document.getElementById('pluginsNav').children; + elements = document.getElementById('cardsNav').getElementsByTagName('loot-plugin-item'); for (var i = 0; i < elements.length; ++i) { elements[i].draggable = true; elements[i].addEventListener('dragstart', elements[i].handleDragStart, false); diff --git a/resources/report/html/plugin-li.html b/resources/report/html/plugin-li.html deleted file mode 100644 index c74523f8..00000000 --- a/resources/report/html/plugin-li.html +++ /dev/null @@ -1,92 +0,0 @@ - - - \ No newline at end of file diff --git a/resources/report/js/plugin.js b/resources/report/js/plugin.js index 2a2d6575..5ed5415e 100644 --- a/resources/report/js/plugin.js +++ b/resources/report/js/plugin.js @@ -160,10 +160,10 @@ function Plugin(obj) { } Plugin.prototype.createListItem = function() { - var li = new PluginListItem(); + var li = document.createElement('loot-plugin-item'); this.li = li; - li.textContent = this.name; + li.label = this.name; li.setLink('#' + this.id); li.setPriority(this.getPriorityString()); @@ -172,7 +172,7 @@ function Plugin(obj) { li.setAttribute('data-edits', this.userlist != undefined); li.setAttribute('data-global-priority', this.isGlobalPriority); - document.getElementById('pluginsNav').appendChild(li); + document.getElementById('cardsNav').appendChild(li); } Plugin.prototype.observer = function(changes) { diff --git a/resources/report/js/script.js b/resources/report/js/script.js index 60db2642..a4105b70 100644 --- a/resources/report/js/script.js +++ b/resources/report/js/script.js @@ -472,7 +472,7 @@ function getConflictingPluginsFromFilter() { } function applyFilters(evt) { var cards = document.getElementById('main').getElementsByTagName('plugin-card'); - var entries = document.getElementById('pluginsNav').children; + var entries = document.getElementById('cardsNav').getElementsByTagName('loot-plugin-item'); var hiddenPluginNo = 0; var hiddenMessageNo = 0; if (cards.length != entries.length) { @@ -714,8 +714,8 @@ function sortUIElements(pluginNames) { /* pluginNames is an array of plugin names in their sorted order. Rearrange the plugin cards and nav entries to match it. */ var main = document.getElementById('main'); - var pluginsNav = document.getElementById('pluginsNav'); - var entries = pluginsNav.children; + var cardsNav = document.getElementById('cardsNav'); + var entries = cardsNav.getElementsByTagName('loot-plugin-item'); if (main.getElementsByTagName('plugin-card').length != entries.length) { throw Error("Error: Number of plugins in sidebar doesn't match number of plugins in main area!"); } @@ -756,11 +756,11 @@ function sortUIElements(pluginNames) { } else { main.insertBefore(card, main.getElementsByTagName('plugin-card')[0]); } - pluginsNav.removeChild(li); + cardsNav.removeChild(li); if (lastLi) { - pluginsNav.insertBefore(li, lastLi.nextElementSibling); + cardsNav.insertBefore(li, lastLi.nextElementSibling); } else { - pluginsNav.insertBefore(li, pluginsNav.firstElementChild); + cardsNav.insertBefore(li, cardsNav.firstElementChild); } lastLi = li; } else { diff --git a/resources/report/report.html b/resources/report/report.html index 717171d9..b88618d2 100644 --- a/resources/report/report.html +++ b/resources/report/report.html @@ -3,17 +3,18 @@ LOOT + - + @@ -68,18 +69,16 @@ Plugins Filters - + - - - + -