Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hidedetails #30

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ To use this module, add it to the modules array in the `config/config.js` file:
| `maxStreamHeight` | *Optional* Maximum height for stream display in pixels. If set to 0, the stream's actual height is used<br>*Default:* `0` (stream's height)
| `streamUrl` | *Optional* Set a custom url for accessing the MJPEG camera stream. By default it uses: `url:8080/?action=stream`.
| `showTemps` | *Optional* Whether or not so show temperature info<br>*Default:* `true`
| `showDetails` | *Optional* Shows details such as: File name, Elapsed time, Remaining time, and Print percentage. <br> *Default:* `true`. Set to `false` to hide the details.
| `showDetailsWhenOffline` | *Optional* Whether or not to hide the printer details when the printer is offline (file name, time, temps)
| `interactive` | *Optional* Allow interactive control of the printer: choose files to print and upload new files. <br> *Default:* `true`. Set to `false` to hide the drop downs, if you don't use the Mirror to control anything.
| `debugMode` | *Optional* Prints all messages received from the printer socket to the console log, for debugging only and developing more features.
Expand Down
7 changes: 5 additions & 2 deletions octomirror-module.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ Module.register("octomirror-module", {
maxStreamWidth: 0,
maxStreamHeight: 0,
showTemps: true,
showDetails: true,
showDetailsWhenOffline: true,
interactive: true, // Set to false to hide the file drop down and only show the stream.
debugMode: false, // Set to true to log all messages from OctoPrint Socket
Expand Down Expand Up @@ -76,7 +77,8 @@ Module.register("octomirror-module", {
} else {
infoWrapper.innerHTML = `<span id="opPrinterName" class="title bright">${this.config.printerName}</span><br />`;
}
infoWrapper.innerHTML += `<span>${this.translate("STATE")}: </span><span id="opStateIcon"></span> <span id="opState" class="title bright"> </span>
if (this.config.showDetails) {
infoWrapper.innerHTML += `<span>${this.translate("STATE")}: </span><span id="opStateIcon"></span> <span id="opState" class="title bright"> </span>
<br />
<div id="opMoreInfo">
<span>${this.translate("FILE")}: </span><span id="opFile" class="title bright">N/A</span>
Expand All @@ -85,6 +87,7 @@ Module.register("octomirror-module", {
<span> | ${this.translate("REMAINING")}: </span><span id="opPrintTimeRemaining" class="title bright">N/A</span>
<span> | ${this.translate("PERCENT")}: </span><span id="opPercent" class="title bright">N/A</span>
<br />`;
}

if (this.config.showTemps) {
infoWrapper.innerHTML += `
Expand Down Expand Up @@ -227,7 +230,7 @@ Module.register("octomirror-module", {
{
$("#opState")[0].textContent = data.state.text;
}

var icon = $("#opStateIcon")[0];
if (data.state.flags.printing) {
icon.innerHTML = `<i class="fa fa-print" aria-hidden="true" style="color:green;"></i>`;
Expand Down