soiz1 commited on
Commit
5af3022
·
verified ·
1 Parent(s): cd1febc

Update dev-tools.js

Browse files
Files changed (1) hide show
  1. dev-tools.js +475 -166
dev-tools.js CHANGED
@@ -1,201 +1,510 @@
1
- // dev-tools.js
2
- document.addEventListener('DOMContentLoaded', () => {
3
- // スタイル定義
4
- const style = document.createElement('style');
5
- style.textContent = `
6
- :root {
7
- --devtools-blue: #1a1c2c;
8
- --neon-blue: #00f3ff;
9
- --dark-layer: rgba(0, 0, 0, 0.9);
10
- }
11
-
12
- .devtools-btn {
13
- position: fixed;
14
- bottom: 20px;
15
- right: 20px;
16
- background: var(--devtools-blue);
17
- color: var(--neon-blue);
18
- border: 2px solid var(--neon-blue);
19
- padding: 10px 20px;
20
- cursor: pointer;
21
- border-radius: 5px;
22
- font-family: 'Courier New', monospace;
23
- z-index: 10000;
24
- transition: all 0.3s;
25
- }
26
-
27
- .devtools-btn:hover {
28
- box-shadow: 0 0 15px var(--neon-blue);
29
  }
30
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
31
  .devtools-panel {
32
- position: fixed;
33
- bottom: 0;
34
- right: 0;
35
- width: 100%;
36
- height: 60vh;
37
- background: var(--dark-layer);
38
- border-top: 3px solid var(--neon-blue);
39
- color: white;
40
- font-family: 'Courier New', monospace;
41
- display: none;
42
- z-index: 9999;
43
  }
44
-
45
- .tabs {
46
- display: flex;
47
- background: var(--devtools-blue);
48
- border-bottom: 1px solid var(--neon-blue);
49
  }
50
-
51
- .tab {
52
- padding: 10px 20px;
53
- cursor: pointer;
54
- border-right: 1px solid var(--neon-blue);
 
55
  }
56
-
57
- .tab.active {
58
- background: var(--neon-blue);
59
- color: var(--devtools-blue);
 
 
 
 
60
  }
61
-
62
- .panel-content {
63
- padding: 15px;
64
- overflow-y: auto;
65
- height: calc(100% - 50px);
66
  }
67
-
68
  .dom-node {
69
- margin-left: 15px;
70
- cursor: pointer;
71
  }
72
-
73
- .dom-node::before {
74
- content: '▶';
75
- margin-right: 5px;
76
- transition: transform 0.2s;
77
  }
78
-
79
- .dom-node.expanded::before {
80
- transform: rotate(90deg);
81
  }
82
-
83
- .console-input {
84
- width: 100%;
85
- background: transparent;
86
- border: 1px solid var(--neon-blue);
87
- color: white;
88
- padding: 5px;
89
- margin-top: 10px;
 
 
 
 
 
 
 
 
 
 
 
 
90
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
91
 
92
- .console-log {
93
- white-space: pre-wrap;
94
- color: var(--neon-blue);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
95
  }
96
- `;
97
- document.head.appendChild(style);
98
 
99
- // 開発者ツール起動ボタン
100
- const openBtn = document.createElement('button');
101
- openBtn.className = 'devtools-btn';
102
- openBtn.textContent = '🛠 Open DevTools';
103
- document.body.appendChild(openBtn);
104
 
105
- // 開発者ツールパネル
 
106
  const panel = document.createElement('div');
107
  panel.className = 'devtools-panel';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
108
 
109
- // タブインターフェイス
110
- const tabs = ['Console', 'Elements', 'Styles'].map(name => {
111
- const tab = document.createElement('div');
112
- tab.className = 'tab';
113
- tab.textContent = name;
114
- return tab;
 
 
115
  });
116
 
117
- const tabContent = document.createElement('div');
118
- tabContent.className = 'panel-content';
 
 
 
 
 
119
 
120
- // コンソールタブ
121
- const consoleInput = document.createElement('input');
122
- consoleInput.className = 'console-input';
123
- consoleInput.placeholder = 'Enter JavaScript...';
124
 
125
- const consoleLog = document.createElement('pre');
126
- consoleLog.className = 'console-log';
 
 
 
127
 
128
- // ログキャプチャ
129
- const originalConsoleLog = console.log;
130
- console.log = (...args) => {
131
- originalConsoleLog(...args);
132
- consoleLog.textContent += args.join(' ') + '\n';
133
- };
134
 
135
- // DOMインスペクタ
136
- function createDOMTree(node, depth = 0) {
 
137
  const element = document.createElement('div');
138
  element.className = 'dom-node';
139
- element.textContent = node.nodeName.toLowerCase();
140
 
141
- if (node.childNodes.length > 0) {
142
- node.childNodes.forEach(child => {
143
- if (child.nodeType === Node.ELEMENT_NODE) {
144
- element.appendChild(createDOMTree(child, depth + 1));
145
- }
146
- });
147
- }
148
 
149
- element.addEventListener('click', (e) => {
150
- e.stopPropagation();
151
- element.classList.toggle('expanded');
 
 
 
152
  });
153
 
154
- return element;
155
- }
156
-
157
- // タブ切り替え
158
- tabs.forEach((tab, index) => {
159
- tab.addEventListener('click', () => {
160
- tabs.forEach(t => t.classList.remove('active'));
161
- tab.classList.add('active');
162
-
163
- tabContent.innerHTML = '';
164
- switch(index) {
165
- case 0:
166
- tabContent.appendChild(consoleLog);
167
- tabContent.appendChild(consoleInput);
168
- break;
169
- case 1:
170
- tabContent.appendChild(createDOMTree(document.documentElement));
171
- break;
172
- }
173
- });
174
- });
175
 
176
- // パネル構成
177
- panel.appendChild(tabs.reduce((container, tab) => {
178
- container.appendChild(tab);
179
- return container;
180
- }, document.createElement('div')));
181
- panel.appendChild(tabContent);
182
-
183
- // イベントハンドラ
184
- openBtn.addEventListener('click', () => {
185
- panel.style.display = 'block';
186
- tabs[0].click();
187
- });
188
 
189
- consoleInput.addEventListener('keypress', (e) => {
190
- if (e.key === 'Enter') {
191
- try {
192
- eval(e.target.value);
193
- } catch (err) {
194
- console.log('Error:', err);
195
- }
196
- e.target.value = '';
197
  }
198
- });
199
 
200
- document.body.appendChild(panel);
201
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ (function() {
2
+ // スタイルの動的追加
3
+ const style = document.createElement('style');
4
+ style.textContent = `
5
+ .devtools-container {
6
+ position: fixed;
7
+ bottom: 0;
8
+ left: 0;
9
+ right: 0;
10
+ height: 300px;
11
+ background: #1a1e24;
12
+ color: #e0e0e0;
13
+ font-family: 'Consolas', 'Courier New', monospace;
14
+ border-top: 2px solid #4fc3f7;
15
+ display: flex;
16
+ flex-direction: column;
17
+ z-index: 9999;
18
+ box-shadow: 0 -5px 15px rgba(0, 0, 0, 0.5);
 
 
 
 
 
 
 
 
 
 
19
  }
20
+
21
+ .devtools-header {
22
+ background: #252a33;
23
+ padding: 8px 15px;
24
+ display: flex;
25
+ justify-content: space-between;
26
+ border-bottom: 1px solid #4fc3f7;
27
+ }
28
+
29
+ .devtools-tabs {
30
+ display: flex;
31
+ gap: 10px;
32
+ }
33
+
34
+ .devtools-tab {
35
+ padding: 5px 10px;
36
+ background: #2c313a;
37
+ border: 1px solid #4fc3f7;
38
+ border-radius: 3px 3px 0 0;
39
+ cursor: pointer;
40
+ transition: all 0.2s;
41
+ }
42
+
43
+ .devtools-tab.active {
44
+ background: #4fc3f7;
45
+ color: #000;
46
+ }
47
+
48
+ .devtools-close {
49
+ background: transparent;
50
+ border: none;
51
+ color: #e0e0e0;
52
+ cursor: pointer;
53
+ }
54
+
55
+ .devtools-content {
56
+ flex: 1;
57
+ display: flex;
58
+ overflow: hidden;
59
+ }
60
+
61
  .devtools-panel {
62
+ flex: 1;
63
+ padding: 10px;
64
+ overflow: auto;
65
+ display: none;
 
 
 
 
 
 
 
66
  }
67
+
68
+ .devtools-panel.active {
69
+ display: block;
 
 
70
  }
71
+
72
+ /* Console スタイル */
73
+ #console-log {
74
+ white-space: pre-wrap;
75
+ margin: 0;
76
+ line-height: 1.4;
77
  }
78
+
79
+ .console-input {
80
+ width: 100%;
81
+ background: #252a33;
82
+ border: 1px solid #4fc3f7;
83
+ color: #e0e0e0;
84
+ padding: 8px;
85
+ margin-top: 10px;
86
  }
87
+
88
+ /* Elements スタイル */
89
+ .dom-tree {
90
+ font-family: monospace;
 
91
  }
92
+
93
  .dom-node {
94
+ margin-left: 15px;
 
95
  }
96
+
97
+ .dom-tag {
98
+ color: #4fc3f7;
 
 
99
  }
100
+
101
+ .dom-attr {
102
+ color: #ff7043;
103
  }
104
+
105
+ /* Storage スタイル */
106
+ .storage-table {
107
+ width: 100%;
108
+ border-collapse: collapse;
109
+ }
110
+
111
+ .storage-table th, .storage-table td {
112
+ border: 1px solid #4fc3f7;
113
+ padding: 5px;
114
+ text-align: left;
115
+ }
116
+
117
+ .storage-table th {
118
+ background: #252a33;
119
+ }
120
+
121
+ .storage-actions {
122
+ display: flex;
123
+ gap: 5px;
124
  }
125
+
126
+ .storage-btn {
127
+ background: #4fc3f7;
128
+ border: none;
129
+ padding: 2px 5px;
130
+ cursor: pointer;
131
+ }
132
+ `;
133
+ document.head.appendChild(style);
134
+
135
+ // 開発者ツールのUI構築
136
+ function createDevTools() {
137
+ const container = document.createElement('div');
138
+ container.className = 'devtools-container';
139
+ container.id = 'devtools-container';
140
+ container.style.display = 'none';
141
+
142
+ // ヘッダー部分
143
+ const header = document.createElement('div');
144
+ header.className = 'devtools-header';
145
+
146
+ const tabs = document.createElement('div');
147
+ tabs.className = 'devtools-tabs';
148
+
149
+ const consoleTab = createTab('Console', 'console');
150
+ const elementsTab = createTab('Elements', 'elements');
151
+ const storageTab = createTab('Storage', 'storage');
152
+
153
+ tabs.appendChild(consoleTab);
154
+ tabs.appendChild(elementsTab);
155
+ tabs.appendChild(storageTab);
156
+
157
+ const closeBtn = document.createElement('button');
158
+ closeBtn.className = 'devtools-close';
159
+ closeBtn.textContent = '×';
160
+ closeBtn.onclick = toggleDevTools;
161
+
162
+ header.appendChild(tabs);
163
+ header.appendChild(closeBtn);
164
+
165
+ // コンテンツ部分
166
+ const content = document.createElement('div');
167
+ content.className = 'devtools-content';
168
+
169
+ const consolePanel = createConsolePanel();
170
+ const elementsPanel = createElementsPanel();
171
+ const storagePanel = createStoragePanel();
172
 
173
+ content.appendChild(consolePanel);
174
+ content.appendChild(elementsPanel);
175
+ content.appendChild(storagePanel);
176
+
177
+ container.appendChild(header);
178
+ container.appendChild(content);
179
+
180
+ document.body.appendChild(container);
181
+
182
+ // タブ切り替え機能
183
+ function createTab(name, panelId) {
184
+ const tab = document.createElement('div');
185
+ tab.className = 'devtools-tab';
186
+ tab.textContent = name;
187
+ tab.onclick = () => {
188
+ document.querySelectorAll('.devtools-tab').forEach(t => t.classList.remove('active'));
189
+ document.querySelectorAll('.devtools-panel').forEach(p => p.classList.remove('active'));
190
+ tab.classList.add('active');
191
+ document.getElementById(panelId + '-panel').classList.add('active');
192
+ };
193
+ return tab;
194
  }
 
 
195
 
196
+ // 初期タブをアクティブに
197
+ consoleTab.click();
198
+ }
 
 
199
 
200
+ // Consoleパネルの作成
201
+ function createConsolePanel() {
202
  const panel = document.createElement('div');
203
  panel.className = 'devtools-panel';
204
+ panel.id = 'console-panel';
205
+
206
+ const log = document.createElement('div');
207
+ log.id = 'console-log';
208
+
209
+ const input = document.createElement('input');
210
+ input.className = 'console-input';
211
+ input.placeholder = 'ここにJavaScriptを入力... (Enterで実行)';
212
+ input.onkeypress = (e) => {
213
+ if (e.key === 'Enter') {
214
+ try {
215
+ const result = eval(e.target.value);
216
+ if (result !== undefined) {
217
+ logMessage('> ' + e.target.value, '#4fc3f7');
218
+ logMessage('← ' + result, '#69f0ae');
219
+ }
220
+ } catch (err) {
221
+ logMessage(err.message, '#ff5252');
222
+ }
223
+ e.target.value = '';
224
+ }
225
+ };
226
+
227
+ panel.appendChild(log);
228
+ panel.appendChild(input);
229
 
230
+ // コンソールログをキャプチャ
231
+ ['log', 'error', 'warn'].forEach(method => {
232
+ const original = console[method];
233
+ console[method] = (...args) => {
234
+ original.apply(console, args);
235
+ const color = method === 'error' ? '#ff5252' : method === 'warn' ? '#ffab40' : '#e0e0e0';
236
+ logMessage(args.join(' '), color);
237
+ };
238
  });
239
 
240
+ function logMessage(message, color) {
241
+ const line = document.createElement('div');
242
+ line.style.color = color;
243
+ line.textContent = message;
244
+ log.appendChild(line);
245
+ log.scrollTop = log.scrollHeight;
246
+ }
247
 
248
+ return panel;
249
+ }
 
 
250
 
251
+ // Elementsパネルの作成
252
+ function createElementsPanel() {
253
+ const panel = document.createElement('div');
254
+ panel.className = 'devtools-panel';
255
+ panel.id = 'elements-panel';
256
 
257
+ const tree = document.createElement('div');
258
+ tree.className = 'dom-tree';
259
+ tree.id = 'dom-tree';
260
+
261
+ panel.appendChild(tree);
 
262
 
263
+ // DOMツリーを構築
264
+ function buildDOMTree(node, parentElement, depth = 0) {
265
+ if (node.nodeType === Node.ELEMENT_NODE) {
266
  const element = document.createElement('div');
267
  element.className = 'dom-node';
268
+ element.style.marginLeft = `${depth * 15}px`;
269
 
270
+ // タグ名
271
+ const tag = document.createElement('span');
272
+ tag.className = 'dom-tag';
273
+ tag.textContent = `<${node.tagName.toLowerCase()}`;
274
+ element.appendChild(tag);
 
 
275
 
276
+ // 属性
277
+ Array.from(node.attributes).forEach(attr => {
278
+ const attrSpan = document.createElement('span');
279
+ attrSpan.className = 'dom-attr';
280
+ attrSpan.textContent = ` ${attr.name}="${attr.value}"`;
281
+ element.appendChild(attrSpan);
282
  });
283
 
284
+ element.appendChild(document.createTextNode('>'));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
285
 
286
+ // 子要素
287
+ if (node.childNodes.length > 0) {
288
+ node.childNodes.forEach(child => {
289
+ buildDOMTree(child, element, depth + 1);
290
+ });
291
+ }
 
 
 
 
 
 
292
 
293
+ // 閉じタグ
294
+ if (node.childNodes.length > 0 || node.tagName.toLowerCase() !== 'br') {
295
+ const closeTag = document.createElement('div');
296
+ closeTag.style.marginLeft = `${depth * 15}px`;
297
+ closeTag.innerHTML = `<span class="dom-tag">&lt;/${node.tagName.toLowerCase()}&gt;</span>`;
298
+ element.appendChild(closeTag);
 
 
299
  }
 
300
 
301
+ parentElement.appendChild(element);
302
+ } else if (node.nodeType === Node.TEXT_NODE && node.textContent.trim()) {
303
+ const text = document.createElement('div');
304
+ text.style.marginLeft = `${depth * 15}px`;
305
+ text.style.color = '#e0e0e0';
306
+ text.textContent = `"${node.textContent.trim()}"`;
307
+ parentElement.appendChild(text);
308
+ }
309
+ }
310
+
311
+ // 初期DOMツリー構築
312
+ buildDOMTree(document.documentElement, tree);
313
+
314
+ return panel;
315
+ }
316
+
317
+ // Storageパネルの作成
318
+ function createStoragePanel() {
319
+ const panel = document.createElement('div');
320
+ panel.className = 'devtools-panel';
321
+ panel.id = 'storage-panel';
322
+
323
+ // LocalStorage表示
324
+ const localStorageTitle = document.createElement('h3');
325
+ localStorageTitle.textContent = 'Local Storage';
326
+ panel.appendChild(localStorageTitle);
327
+
328
+ const localStorageTable = document.createElement('table');
329
+ localStorageTable.className = 'storage-table';
330
+ panel.appendChild(localStorageTable);
331
+
332
+ // SessionStorage表示
333
+ const sessionStorageTitle = document.createElement('h3');
334
+ sessionStorageTitle.style.marginTop = '20px';
335
+ sessionStorageTitle.textContent = 'Session Storage';
336
+ panel.appendChild(sessionStorageTitle);
337
+
338
+ const sessionStorageTable = document.createElement('table');
339
+ sessionStorageTable.className = 'storage-table';
340
+ panel.appendChild(sessionStorageTable);
341
+
342
+ // Cookie表示
343
+ const cookiesTitle = document.createElement('h3');
344
+ cookiesTitle.style.marginTop = '20px';
345
+ cookiesTitle.textContent = 'Cookies';
346
+ panel.appendChild(cookiesTitle);
347
+
348
+ const cookiesTable = document.createElement('table');
349
+ cookiesTable.className = 'storage-table';
350
+ panel.appendChild(cookiesTable);
351
+
352
+ // ストレージを表示する関数
353
+ function renderStorage() {
354
+ renderTable(localStorageTable, localStorage);
355
+ renderTable(sessionStorageTable, sessionStorage);
356
+ renderCookiesTable(cookiesTable);
357
+ }
358
+
359
+ function renderTable(tableElement, storage) {
360
+ tableElement.innerHTML = `
361
+ <thead>
362
+ <tr>
363
+ <th>Key</th>
364
+ <th>Value</th>
365
+ <th>Actions</th>
366
+ </tr>
367
+ </thead>
368
+ <tbody></tbody>
369
+ `;
370
+
371
+ const tbody = tableElement.querySelector('tbody');
372
+
373
+ for (let i = 0; i < storage.length; i++) {
374
+ const key = storage.key(i);
375
+ const value = storage.getItem(key);
376
+
377
+ const row = document.createElement('tr');
378
+
379
+ const keyCell = document.createElement('td');
380
+ keyCell.textContent = key;
381
+
382
+ const valueCell = document.createElement('td');
383
+ valueCell.textContent = value;
384
+
385
+ const actionsCell = document.createElement('td');
386
+ actionsCell.className = 'storage-actions';
387
+
388
+ const editBtn = document.createElement('button');
389
+ editBtn.className = 'storage-btn';
390
+ editBtn.textContent = 'Edit';
391
+ editBtn.onclick = () => {
392
+ const newValue = prompt('Enter new value:', value);
393
+ if (newValue !== null) {
394
+ storage.setItem(key, newValue);
395
+ renderStorage();
396
+ }
397
+ };
398
+
399
+ const deleteBtn = document.createElement('button');
400
+ deleteBtn.className = 'storage-btn';
401
+ deleteBtn.textContent = 'Delete';
402
+ deleteBtn.onclick = () => {
403
+ storage.removeItem(key);
404
+ renderStorage();
405
+ };
406
+
407
+ actionsCell.appendChild(editBtn);
408
+ actionsCell.appendChild(deleteBtn);
409
+
410
+ row.appendChild(keyCell);
411
+ row.appendChild(valueCell);
412
+ row.appendChild(actionsCell);
413
+
414
+ tbody.appendChild(row);
415
+ }
416
+ }
417
+
418
+ function renderCookiesTable(tableElement) {
419
+ tableElement.innerHTML = `
420
+ <thead>
421
+ <tr>
422
+ <th>Name</th>
423
+ <th>Value</th>
424
+ <th>Actions</th>
425
+ </tr>
426
+ </thead>
427
+ <tbody></tbody>
428
+ `;
429
+
430
+ const tbody = tableElement.querySelector('tbody');
431
+
432
+ document.cookie.split(';').forEach(cookie => {
433
+ if (!cookie.trim()) return;
434
+
435
+ const [name, ...valueParts] = cookie.split('=');
436
+ const value = valueParts.join('=').trim();
437
+
438
+ const row = document.createElement('tr');
439
+
440
+ const nameCell = document.createElement('td');
441
+ nameCell.textContent = name.trim();
442
+
443
+ const valueCell = document.createElement('td');
444
+ valueCell.textContent = decodeURIComponent(value);
445
+
446
+ const actionsCell = document.createElement('td');
447
+ actionsCell.className = 'storage-actions';
448
+
449
+ const deleteBtn = document.createElement('button');
450
+ deleteBtn.className = 'storage-btn';
451
+ deleteBtn.textContent = 'Delete';
452
+ deleteBtn.onclick = () => {
453
+ document.cookie = `${name.trim()}=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/`;
454
+ renderStorage();
455
+ };
456
+
457
+ actionsCell.appendChild(deleteBtn);
458
+
459
+ row.appendChild(nameCell);
460
+ row.appendChild(valueCell);
461
+ row.appendChild(actionsCell);
462
+
463
+ tbody.appendChild(row);
464
+ });
465
+ }
466
+
467
+ // 初期表示
468
+ renderStorage();
469
+
470
+ return panel;
471
+ }
472
+
473
+ // 開発者ツールの表示/非表示切り替え
474
+ function toggleDevTools() {
475
+ const container = document.getElementById('devtools-container');
476
+ if (container.style.display === 'none') {
477
+ container.style.display = 'flex';
478
+ } else {
479
+ container.style.display = 'none';
480
+ }
481
+ }
482
+
483
+ // 開発者ツールを開くボタンの作成
484
+ function createOpenButton() {
485
+ const button = document.createElement('button');
486
+ button.id = 'open-devtools-btn';
487
+ button.textContent = '開発者ツールを開く';
488
+ button.style.position = 'fixed';
489
+ button.style.bottom = '10px';
490
+ button.style.right = '10px';
491
+ button.style.padding = '8px 16px';
492
+ button.style.background = '#4fc3f7';
493
+ button.style.color = '#000';
494
+ button.style.border = 'none';
495
+ button.style.borderRadius = '4px';
496
+ button.style.cursor = 'pointer';
497
+ button.style.zIndex = '9998';
498
+ button.onclick = toggleDevTools;
499
+
500
+ document.body.appendChild(button);
501
+ }
502
+
503
+ // 初期化
504
+ createDevTools();
505
+ createOpenButton();
506
+
507
+ // 初期メッセージ
508
+ console.log('開発者ツールが初期化されました');
509
+ console.log('このコンソールでJavaScriptを実行できます');
510
+ })();