jshint cleanup, move HTML to a template, add css classes

This commit is contained in:
Julian Descottes
2016-12-24 10:43:12 +01:00
parent 98527c6ded
commit c0f7e7be52
4 changed files with 20 additions and 9 deletions

View File

@@ -24,3 +24,13 @@
color: white; color: white;
font-style: normal; font-style: normal;
} }
.save-status-warning-icon {
float: left;
margin-top: 5px;
}
.save-status-warning-icon {
overflow: hidden;
padding-left: 10px;
}

View File

@@ -54,9 +54,8 @@
ns.SaveController.prototype.updateSaveToGalleryMessage_ = function (spritesheetSize) { ns.SaveController.prototype.updateSaveToGalleryMessage_ = function (spritesheetSize) {
if (pskl.app.performanceReportService.hasProblem()) { if (pskl.app.performanceReportService.hasProblem()) {
document.querySelector('.save-online-status').innerHTML = var warningPartial = pskl.utils.Template.get('save-gallery-warning-partial');
'<div class="icon-common-warning-red" style="float:left; margin-top: 5px">&nbsp;</div>' + document.querySelector('.save-online-status').innerHTML = warningPartial;
'<div style="overflow: hidden; padding-left: 10px">Saving to the gallery might fail due to the sprite size.</div>';
} }
}; };
@@ -76,7 +75,6 @@
} }
// Uncomment this line to test the online save section locally. // Uncomment this line to test the online save section locally.
return [PARTIALS.FILEDOWNLOAD, PARTIALS.LOCALSTORAGE, PARTIALS.GALLERY];
return [PARTIALS.FILEDOWNLOAD, PARTIALS.LOCALSTORAGE, PARTIALS.GALLERY_UNAVAILABLE]; return [PARTIALS.FILEDOWNLOAD, PARTIALS.LOCALSTORAGE, PARTIALS.GALLERY_UNAVAILABLE];
}; };

View File

@@ -3,7 +3,7 @@
var areChunksValid = function (chunks) { var areChunksValid = function (chunks) {
return chunks.length && chunks.every(function (chunk) { return chunks.length && chunks.every(function (chunk) {
return chunk.base64PNG && chunk.base64PNG !== "data:,"; return chunk.base64PNG && chunk.base64PNG !== 'data:,';
}); });
}; };
@@ -84,7 +84,7 @@
var renderer = new pskl.rendering.FramesheetRenderer(frames); var renderer = new pskl.rendering.FramesheetRenderer(frames);
return renderer.renderAsCanvas().toDataURL(); return renderer.renderAsCanvas().toDataURL();
} catch (e) { } catch (e) {
return ""; return '';
} }
} }
}; };

View File

@@ -26,12 +26,15 @@
<div class="settings-title">Save online</div> <div class="settings-title">Save online</div>
<div class="settings-item"> <div class="settings-item">
<input type="button" class="button button-primary" id="save-gallery-button" value="Save to your gallery" /> <input type="button" class="button button-primary" id="save-gallery-button" value="Save to your gallery" />
<div class="save-status save-online-status"> <div class="save-status save-online-status">Your piskel will be stored online in your gallery.</div>
<div>Your piskel will be stored online in your gallery.</div>
</div>
</div> </div>
</script> </script>
<script type="text/template" id="save-gallery-warning-partial">
<div class="save-status-warning-icon icon-common-warning-red">&nbsp;</div>
<div class="save-status-warning-text">Saving to the gallery might fail due to the sprite size.</div>
</script>
<!-- save-gallery-unavailable-partial --> <!-- save-gallery-unavailable-partial -->
<script type="text/template" id="save-gallery-unavailable-partial"> <script type="text/template" id="save-gallery-unavailable-partial">
<div class="settings-title">Save online</div> <div class="settings-title">Save online</div>