Lashtw commited on
Commit
7acb110
·
verified ·
1 Parent(s): 569a720

Upload skyscraper.html

Browse files
Files changed (1) hide show
  1. skyscraper.html +27 -0
skyscraper.html CHANGED
@@ -376,6 +376,33 @@
376
  </head>
377
 
378
  <body>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
379
  <canvas id="gameCanvas"></canvas>
380
  <div id="hud" class="hidden">
381
  <div class="glass hud-box">
 
376
  </head>
377
 
378
  <body>
379
+ <!-- 清除 Hugging Face 注入的可見文字 -->
380
+ <script>
381
+ (function () {
382
+ // 已知的合法子元素 ID 列表
383
+ const allowedIds = new Set([
384
+ 'gameCanvas', 'hud', 'timer-bar', 'hint-panel', 'bottom-panel',
385
+ 'start-screen', 'brief-screen', 'tut-modal', 'summary-screen', 'back-btn'
386
+ ]);
387
+ function cleanBody() {
388
+ Array.from(document.body.childNodes).forEach(function (node) {
389
+ // 移除裸文字節點
390
+ if (node.nodeType === 3 && node.textContent.trim()) {
391
+ node.textContent = '';
392
+ }
393
+ // 移除非預期的元素(不是 script/style/已知ID)
394
+ if (node.nodeType === 1 && node.tagName !== 'SCRIPT' && node.tagName !== 'STYLE'
395
+ && !allowedIds.has(node.id) && !node.classList.contains('toast')) {
396
+ node.style.display = 'none';
397
+ }
398
+ });
399
+ }
400
+ // 立即執行 + DOM載入後執行 + 持續監控
401
+ cleanBody();
402
+ document.addEventListener('DOMContentLoaded', cleanBody);
403
+ new MutationObserver(cleanBody).observe(document.documentElement, { childList: true, subtree: true });
404
+ })();
405
+ </script>
406
  <canvas id="gameCanvas"></canvas>
407
  <div id="hud" class="hidden">
408
  <div class="glass hud-box">