Skip to content

Commit f7e00d0

Browse files
saran-tcopybara-github
authored andcommitted
Add commit hash and remove "Upload File" button from MuJoCo Live.
PiperOrigin-RevId: 914909503 Change-Id: I084d888eb5093b4278e758697bff43ff941c79d0
1 parent 9230b34 commit f7e00d0

2 files changed

Lines changed: 15 additions & 19 deletions

File tree

.github/workflows/live.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@ jobs:
3333
mkdir -p dist/bin
3434
cp -r build_wasm/bin/* dist/bin/
3535
cp src/experimental/studio/index.html dist/index.html
36+
COMMIT_HASH=$(git rev-parse HEAD 2>/dev/null || true)
37+
if [ -n "$COMMIT_HASH" ]; then
38+
sed -i "s/__COMMIT_HASH_PLACEHOLDER__/$COMMIT_HASH/g" dist/index.html
39+
fi
3640
3741
- name: Upload GitHub Pages artifacts
3842
uses: actions/upload-pages-artifact@v3

src/experimental/studio/index.html

Lines changed: 11 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,17 @@
55
<title>MuJoCo Live</title>
66
</head>
77
<body style="margin: 0; overflow: hidden">
8-
<div style="position: absolute; top: 3px; right: 3px; z-index: 1;">
9-
<button id="uploadButton">Upload Model</button>
10-
<input type="file" id="fileInput" accept=".xml,.mjb,.mjz,.zip" style="display: none;">
11-
</div>
8+
<div id="commitHash" style="
9+
position: absolute; top: 3px; right: 3px; z-index: 1;
10+
font-family: monospace; font-size: 9px; color: #fff;
11+
mix-blend-mode: difference;
12+
padding: 2px 4px; user-select: all;" title="Build commit">__COMMIT_HASH_PLACEHOLDER__</div>
13+
<script>
14+
(function () {
15+
var el = document.getElementById('commitHash');
16+
if (el && el.textContent === '__COMMIT_HASH_PLACEHOLDER__') el.remove();
17+
})();
18+
</script>
1219
<canvas
1320
class="emscripten"
1421
id="canvas"
@@ -188,21 +195,6 @@
188195
}
189196

190197
document.addEventListener('DOMContentLoaded', () => {
191-
const uploadButton = document.getElementById('uploadButton');
192-
const fileInput = document.getElementById('fileInput');
193-
194-
uploadButton.addEventListener('click', () => {
195-
fileInput.click();
196-
});
197-
198-
fileInput.addEventListener('change', (event) => {
199-
const file = event.target.files[0];
200-
if (!file) {
201-
return;
202-
}
203-
handleFile(file);
204-
});
205-
206198
// --- Drag-and-drop support ---
207199
const dropOverlay = document.createElement('div');
208200
dropOverlay.id = 'dropOverlay';

0 commit comments

Comments
 (0)