Skip to content

Commit

Permalink
🐛 Backwards compatible fix for OctoPrint 1.3.6
Browse files Browse the repository at this point in the history
  • Loading branch information
BillyBlaze committed Dec 5, 2017
1 parent 980730c commit 214dc74
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
22 changes: 11 additions & 11 deletions octoprint_fullscreen/static/js/fullscreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,17 @@ $(function() {
self.printer.fullscreen = function() {
$fullscreenContainer.toggleFullScreen();
}

self.formatBarTemperatureFullscreen = function(toolName, actual, target) {
var output = toolName + ": " + _.sprintf("%.1f°C", actual);

if (target) {
var sign = (target >= actual) ? " \u21D7 " : " \u21D8 ";
output += sign + _.sprintf("%.1f°C", target);
}

return output;
};

$webcam.on("dblclick", function() {
$body.toggleClass('inlineFullscreen');
Expand Down Expand Up @@ -59,14 +70,3 @@ $(function() {
["#fullscreen-info"]
]);
});

function formatBarTemperatureFullscreen(toolName, actual, target) {
var output = toolName + ": " + _.sprintf("%.1f°C", actual);

if (target) {
var sign = (target >= actual) ? " \u21D7 " : " \u21D8 ";
output += sign + _.sprintf("%.1f°C", target);
}

return output;
};
8 changes: 4 additions & 4 deletions octoprint_fullscreen/templates/fullscreen.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
<div id="fullscreen-info">
<div class="temp">
<!-- ko foreach: tempModel.tools -->
<p data-bind="template: { name: 'tempTemplate' }"></p>
<p data-bind="template: { name: 'tempFullscreenTemplate' }"></p>
<!-- /ko -->
<p data-bind="template: { name: 'tempTemplate', data: tempModel.bedTemp }, visible: tempModel.hasBed"></p>
<p data-bind="template: { name: 'tempFullscreenTemplate', data: tempModel.bedTemp }, visible: tempModel.hasBed"></p>
</div>
</div>
<!-- /ko -->
Expand All @@ -29,6 +29,6 @@

</div>

<script type="text/html" id="tempTemplate">
<span data-bind="html: formatBarTemperatureFullscreen(name(), actual(), target())"></span>
<script type="text/html" id="tempFullscreenTemplate">
<span data-bind="html: $parent.formatBarTemperatureFullscreen(name(), actual(), target())"></span>
</script>

0 comments on commit 214dc74

Please sign in to comment.