soiz1 commited on
Commit
9ef005a
·
verified ·
1 Parent(s): 9eed235

Update dev-tools.js

Browse files
Files changed (1) hide show
  1. dev-tools.js +40 -12
dev-tools.js CHANGED
@@ -1505,26 +1505,54 @@
1505
  const button = document.createElement('button');
1506
  button.id = 'open-devtools-btn';
1507
  button.textContent = '開発者ツールを開く';
 
 
1508
  button.style.position = 'fixed';
1509
- button.style.bottom = '10px';
1510
- button.style.right = '10px';
1511
  button.style.padding = '8px 16px';
1512
- button.style.background = 'var(--primary-color)';
1513
  button.style.color = '#000';
1514
  button.style.border = 'none';
1515
  button.style.borderRadius = '4px';
1516
  button.style.cursor = 'pointer';
1517
- button.style.zIndex = '9998';
 
 
 
 
1518
  button.onclick = toggleDevTools;
1519
-
1520
  document.body.appendChild(button);
 
 
1521
  }
1522
 
1523
- // 初期化
1524
- document.addEventListener('DOMContentLoaded', function() {
1525
- createDevTools();
1526
- createOpenButton();
1527
- console.log('開発者ツールが初期化されました');
1528
- console.log('このコンソールでJavaScriptを実行できます');
1529
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1530
  })();
 
1505
  const button = document.createElement('button');
1506
  button.id = 'open-devtools-btn';
1507
  button.textContent = '開発者ツールを開く';
1508
+
1509
+ // スタイルを直接設定(動的CSSに依存しない)
1510
  button.style.position = 'fixed';
1511
+ button.style.bottom = '20px';
1512
+ button.style.right = '20px';
1513
  button.style.padding = '8px 16px';
1514
+ button.style.backgroundColor = '#007acc';
1515
  button.style.color = '#000';
1516
  button.style.border = 'none';
1517
  button.style.borderRadius = '4px';
1518
  button.style.cursor = 'pointer';
1519
+ button.style.zIndex = '2147483647'; // 最大値
1520
+ button.style.fontFamily = 'sans-serif';
1521
+ button.style.fontSize = '14px';
1522
+ button.style.boxShadow = '0 2px 5px rgba(0,0,0,0.2)';
1523
+
1524
  button.onclick = toggleDevTools;
 
1525
  document.body.appendChild(button);
1526
+
1527
+ console.log('開発者ツールボタンが作成されました'); // デバッグ用
1528
  }
1529
 
1530
+ // 初期化関数
1531
+ function initializeDevTools() {
1532
+ try {
1533
+ // 1. スタイルを最初に追加
1534
+ const style = document.createElement('style');
1535
+ style.textContent = `...`; // 前述のスタイル定義
1536
+ document.head.appendChild(style);
1537
+
1538
+ // 2. メインコンテナ作成
1539
+ createDevTools();
1540
+
1541
+ // 3. ボタン作成(setTimeoutで少し遅らせる)
1542
+ setTimeout(() => {
1543
+ createOpenButton();
1544
+ console.log('初期化完了');
1545
+ }, 100);
1546
+
1547
+ } catch (error) {
1548
+ console.error('初期化エラー:', error);
1549
+ }
1550
+ }
1551
+
1552
+ // DOM読み込み完了後に初期化
1553
+ if (document.readyState === 'loading') {
1554
+ document.addEventListener('DOMContentLoaded', initializeDevTools);
1555
+ } else {
1556
+ initializeDevTools();
1557
+ }
1558
  })();