Some attempts at speeding things up.

Adding plugin cards and list items is **incredibly** slow, and it wasn't
like this in Polymer 0.4.2. I'm not sure if I'm not doing something
right...
This commit is contained in:
Oliver Hamlet
2014-11-12 21:24:51 +00:00
parent 2625c14f92
commit 672ba6bd9d
5 changed files with 32 additions and 63 deletions
+2 -1
View File
@@ -28,6 +28,7 @@
"paper-menu-button": "Polymer/paper-menu-button#~0.5.0",
"Jed": "SlexAxton/Jed#a9d03e1bbca9211a8b29a93a298a7ee9ddb353f0",
"marked": "chjj/marked#~0.3.2",
"requirejs": "jrburke/requirejs-bower#~2.1.15"
"requirejs": "jrburke/requirejs-bower#~2.1.15",
"paper-progress": "Polymer/paper-progress#~0.5.0"
}
}
+2 -21
View File
@@ -261,27 +261,8 @@ progress, .progress {
display: block;
margin: 0 auto;
}
#progressDialog > h1 {
font-size: 1.5em;
}
@-webkit-keyframes indeterminate {
0% { width: 0% }
100% { width: 100% }
}
progress::-webkit-progress-bar, .progress.bar {
background-color: #eee;
border-radius: 2px;
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.25) inset;
}
progress::-webkit-progress-value, .progress .value {
height: 100%;
background-color: green;
-webkit-animation: indeterminate 2s linear 0 infinite alternate paused;
}
.progress.running > .value {
-webkit-animation-play-state: running;
#progressDialog > paper-progress {
width: 100%;
}
:host > span {
+19 -21
View File
@@ -133,21 +133,20 @@ function Plugin(obj) {
}
Plugin.prototype.createCard = function() {
var card = document.createElement('loot-plugin-card');
this.card = card;
this.card = document.createElement('loot-plugin-card');
card.id = this.id;
this.card.id = this.id;
card.setAttribute('data-active', this.isActive);
card.setAttribute('data-dummy', this.isDummy);
card.setAttribute('data-bsa', this.loadsBSA);
card.setAttribute('data-edits', this.userlist != undefined);
this.card.setAttribute('data-active', this.isActive);
this.card.setAttribute('data-dummy', this.isDummy);
this.card.setAttribute('data-bsa', this.loadsBSA);
this.card.setAttribute('data-edits', this.userlist != undefined);
/* Fill in name, version, CRC. */
card.getElementsByTagName('h1')[0].textContent = this.name;
card.getElementsByClassName('version')[0].textContent = this.version;
this.card.getElementsByTagName('h1')[0].textContent = this.name;
this.card.getElementsByClassName('version')[0].textContent = this.version;
if (this.crc != 0) {
card.getElementsByClassName('crc')[0].textContent = this.crc.toString(16).toUpperCase();
this.card.getElementsByClassName('crc')[0].textContent = this.crc.toString(16).toUpperCase();
}
/* Fill in Bash Tag suggestions. */
@@ -156,23 +155,22 @@ function Plugin(obj) {
/* Fill in messages. */
this.updateCardMessages();
document.getElementById('main').appendChild(card);
document.getElementById('main').appendChild(this.card);
}
Plugin.prototype.createListItem = function() {
var li = document.createElement('loot-plugin-item');
this.li = li;
this.li = document.createElement('loot-plugin-item');
li.label = this.name;
li.setLink('#' + this.id);
li.setPriority(this.getPriorityString());
this.li.label = this.name;
this.li.setLink('#' + this.id);
this.li.setPriority(this.getPriorityString());
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);
this.li.setAttribute('data-dummy', this.isDummy);
this.li.setAttribute('data-bsa', this.loadsBSA);
this.li.setAttribute('data-edits', this.userlist != undefined);
this.li.setAttribute('data-global-priority', this.isGlobalPriority);
document.getElementById('cardsNav').appendChild(li);
document.getElementById('cardsNav').appendChild(this.li);
}
Plugin.prototype.observer = function(changes) {
+6 -13
View File
@@ -684,18 +684,16 @@ function sortUIElements(pluginNames) {
function showProgress(message) {
var progressDialog = document.getElementById('progressDialog');
if (message) {
progressDialog.getElementsByTagName('h1')[0].textContent = message;
progressDialog.getElementsByTagName('p')[0].textContent = message;
}
if (!progressDialog.opened) {
progressDialog.showModal();
progressDialog.querySelector('.progress').classList.toggle('running');
}
}
function closeProgressDialog() {
var progressDialog = document.getElementById('progressDialog');
if (progressDialog.opened) {
progressDialog.close();
progressDialog.querySelector('.progress').classList.toggle('running');
}
}
function sortPlugins(evt) {
@@ -1340,16 +1338,11 @@ function initVars() {
});
} else {
promise = loot.query('getGameData').then(function(result){
try {
var game = JSON.parse(result, jsonToPlugin);
loot.game.folder = game.folder;
loot.game.masterlist = game.masterlist;
loot.game.globalMessages = game.globalMessages;
loot.game.plugins = game.plugins;
} catch (e) {
console.log(e);
console.log('getGameData response: ' + result);
}
var game = JSON.parse(result, jsonToPlugin);
loot.game.folder = game.folder;
loot.game.masterlist = game.masterlist;
loot.game.globalMessages = game.globalMessages;
loot.game.plugins = game.plugins;
applySavedFilters();
closeProgressDialog();
+3 -7
View File
@@ -33,6 +33,7 @@
<link rel="import" href="bower_components/paper-dialog/paper-dialog.html">
<link rel="import" href="bower_components/paper-dialog/paper-dialog-transition.html">
<link rel="import" href="bower_components/paper-dropdown/paper-dropdown.html">
<link rel="import" href="bower_components/paper-progress/paper-progress.html">
<script src="bower_components/requirejs/require.js"></script>
</head>
@@ -234,13 +235,8 @@ along with LOOT. If not, see &lt;http://www.gnu.org/licenses/&gt;.
<div id="hoverText" class="hidden"></div>
<loot-dialog id="progressDialog">
<!-- CEF doesn't seem to want to play any animation set through CSS
for <progress>'s internal value pseudo-element, so use this
instead. -->
<div class="progress bar">
<div class="value"></div>
</div>
<h1>Calculating the last digit of &pi;...</h1>
<paper-progress indeterminate></paper-progress>
<p>Calculating the last digit of &pi;...</p>
</loot-dialog>
<loot-dialog id="firstRun" heading="First-Time Tips">