Add commit hash and remove "Upload File" button from MuJoCo Live.
PiperOrigin-RevId: 914909503 Change-Id: I084d888eb5093b4278e758697bff43ff941c79d0
This commit is contained in:
committed by
Copybara-Service
parent
9230b34fed
commit
f7e00d041e
@@ -33,6 +33,10 @@ jobs:
|
|||||||
mkdir -p dist/bin
|
mkdir -p dist/bin
|
||||||
cp -r build_wasm/bin/* dist/bin/
|
cp -r build_wasm/bin/* dist/bin/
|
||||||
cp src/experimental/studio/index.html dist/index.html
|
cp src/experimental/studio/index.html dist/index.html
|
||||||
|
COMMIT_HASH=$(git rev-parse HEAD 2>/dev/null || true)
|
||||||
|
if [ -n "$COMMIT_HASH" ]; then
|
||||||
|
sed -i "s/__COMMIT_HASH_PLACEHOLDER__/$COMMIT_HASH/g" dist/index.html
|
||||||
|
fi
|
||||||
|
|
||||||
- name: Upload GitHub Pages artifacts
|
- name: Upload GitHub Pages artifacts
|
||||||
uses: actions/upload-pages-artifact@v3
|
uses: actions/upload-pages-artifact@v3
|
||||||
|
|||||||
@@ -5,10 +5,17 @@
|
|||||||
<title>MuJoCo Live</title>
|
<title>MuJoCo Live</title>
|
||||||
</head>
|
</head>
|
||||||
<body style="margin: 0; overflow: hidden">
|
<body style="margin: 0; overflow: hidden">
|
||||||
<div style="position: absolute; top: 3px; right: 3px; z-index: 1;">
|
<div id="commitHash" style="
|
||||||
<button id="uploadButton">Upload Model</button>
|
position: absolute; top: 3px; right: 3px; z-index: 1;
|
||||||
<input type="file" id="fileInput" accept=".xml,.mjb,.mjz,.zip" style="display: none;">
|
font-family: monospace; font-size: 9px; color: #fff;
|
||||||
</div>
|
mix-blend-mode: difference;
|
||||||
|
padding: 2px 4px; user-select: all;" title="Build commit">__COMMIT_HASH_PLACEHOLDER__</div>
|
||||||
|
<script>
|
||||||
|
(function () {
|
||||||
|
var el = document.getElementById('commitHash');
|
||||||
|
if (el && el.textContent === '__COMMIT_HASH_PLACEHOLDER__') el.remove();
|
||||||
|
})();
|
||||||
|
</script>
|
||||||
<canvas
|
<canvas
|
||||||
class="emscripten"
|
class="emscripten"
|
||||||
id="canvas"
|
id="canvas"
|
||||||
@@ -188,21 +195,6 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
document.addEventListener('DOMContentLoaded', () => {
|
document.addEventListener('DOMContentLoaded', () => {
|
||||||
const uploadButton = document.getElementById('uploadButton');
|
|
||||||
const fileInput = document.getElementById('fileInput');
|
|
||||||
|
|
||||||
uploadButton.addEventListener('click', () => {
|
|
||||||
fileInput.click();
|
|
||||||
});
|
|
||||||
|
|
||||||
fileInput.addEventListener('change', (event) => {
|
|
||||||
const file = event.target.files[0];
|
|
||||||
if (!file) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
handleFile(file);
|
|
||||||
});
|
|
||||||
|
|
||||||
// --- Drag-and-drop support ---
|
// --- Drag-and-drop support ---
|
||||||
const dropOverlay = document.createElement('div');
|
const dropOverlay = document.createElement('div');
|
||||||
dropOverlay.id = 'dropOverlay';
|
dropOverlay.id = 'dropOverlay';
|
||||||
|
|||||||
Reference in New Issue
Block a user