定型文・コア
by
cutfloss
05/01 [2026/05/01 13:11:50]
6連ボタン対応の完璧版
@@ -1,15 +1,12 @@
/*
- * @title 陣取り司令官コア・改
- * @description 編集後の再起動に対応した安定版
+ * @title 陣取り司令官コア:左パネル浮上版
+ * @description 左側が絶対に埋まらないように高さを強制固定
* @private
*/
(function(){
const $id = (id)=>document.getElementById(id);
- // 1. 本家のパネルを探す(「j-all」の中にある場合も考慮)
let chat = $id('tc-panel-chat'), team = $id('tc-panel-team'), log = $id('tc-panel-log');
-
- // もし見つからなければ、すでに展開済みの「j-all」の中から救出を試みる
if(!chat) {
const oldRoot = $id('j-all');
if(oldRoot) {
@@ -18,25 +15,40 @@
log = oldRoot.querySelector('#tc-panel-log');
}
}
+ if(!chat) return console.log("パネル未検出");
- if(!chat) return console.log("チーム戦パネルが見つかりません。リロードして試してください。");
-
- // 2. 二重起動防止(古い枠を消す)
const old = $id('j-all'); if(old) old.remove();
- // 3. 保存された定型文を読み込む
- const defaultMessages = ['攻めましょう!', '守備!', '援護!', '感謝!'];
- let saved = localStorage.getItem('j-phrases');
- let phrases = saved ? JSON.parse(saved) : defaultMessages;
+ const saved = localStorage.getItem('j-phrases');
+ const phrases = saved ? JSON.parse(saved) : ['攻めましょう!', '守備!', '援護!', '感謝!'];
const style = document.createElement('style');
style.innerHTML = `
- .j-box { position:fixed; background:rgba(10,20,40,0.92); border:2px solid #3b82f6; border-radius:5px; padding:5px; z-index:99999; pointer-events:auto; color:#fff; font-size:11px; }
+ /* 共通の箱:bottomを少し上げて埋まりを防止 */
+ .j-box { position:fixed; background:rgba(10,20,40,0.92); border:2px solid #3b82f6; border-radius:5px; padding:5px; z-index:99999; pointer-events:auto; color:#fff; }
+
+ /* 左パネル専用:高さを強制固定して中身をスクロールさせる */
+ .j-left-box {
+ width: 200px !important;
+ height: 180px !important; /* ここの高さを固定 */
+ bottom: 40px !important; /* 画面下から40px浮かせる */
+ overflow-y: auto !important;
+ font-size: 11px;
+ }
+
.j-btn-side { position:fixed; right:10px; top:50%; transform:translateY(-50%); display:flex; flex-direction:column; gap:12px; z-index:100000; pointer-events:auto; }
- .j-btn-round { width:75px; height:75px; background:#2563eb; color:#fff; border:2px solid #93c5fd; border-radius:50%; cursor:pointer; font-size:14px; font-weight:bold; box-shadow:0 4px 10px #000; }
- #tc-panel-chat { display:block !important; visibility:visible !important; width:260px; }
- #tc-panel-team, #tc-panel-log { display:block !important; visibility:visible !important; width:200px; height:150px; overflow-y:auto; }
- #team-chat-messages { height:200px !important; }
+ .j-btn-round { width:75px; height:75px; background:#2563eb; color:#fff; border:2px solid #93c5fd; border-radius:50%; cursor:pointer; font-size:14px; font-weight:bold; }
+
+ /* 本家の中身が枠を突き破らないようにする */
+ #tc-panel-team, #tc-panel-log {
+ display:block !important;
+ width:100% !important;
+ height:auto !important;
+ position:static !important;
+ }
+
+ #tc-panel-chat { display:block !important; width:260px; }
+ #team-chat-messages { height:220px !important; }
`;
document.head.appendChild(style);
@@ -50,26 +62,27 @@
sBtnArea.className = 'j-btn-side';
phrases.forEach((msg) => {
const b = document.createElement('button'); b.className='j-btn-round';
- b.innerText = msg.substring(0, 3); // 3文字まで表示
+ b.innerText = msg.substring(0, 3);
b.onclick=()=>{ const i=$id('team-chat-input'); if(i){i.value=msg; sendTeamChat();} };
sBtnArea.appendChild(b);
});
root.appendChild(sBtnArea);
- // --- 各パネル配置 ---
+ // --- 右側:会話 ---
const r = document.createElement('div'); r.className = 'j-box';
- r.style.right = '100px'; r.style.bottom = '10px';
+ r.style.right = '100px'; r.style.bottom = '20px';
r.appendChild(chat); root.appendChild(r);
+ // --- 左側:状況 + 戦歴(強制浮上&サイズ固定) ---
const l = document.createElement('div');
- l.style.cssText = 'position:absolute; left:10px; bottom:10px; display:flex; gap:5px; pointer-events:auto;';
- const p1 = document.createElement('div'); p1.className='j-box'; p1.appendChild(team);
- const p2 = document.createElement('div'); p2.className='j-box'; p2.appendChild(log);
+ l.style.cssText = 'position:absolute; left:10px; display:flex; gap:8px; pointer-events:auto; bottom:0;';
+
+ const p1 = document.createElement('div'); p1.className='j-box j-left-box'; p1.appendChild(team);
+ const p2 = document.createElement('div'); p2.className='j-box j-left-box'; p2.appendChild(log);
+
l.appendChild(p1); l.appendChild(p2); root.appendChild(l);
const orig = $id('team-chat'); if(orig) orig.style.visibility='hidden';
-
- // 定期更新(一度だけセット)
if(!window.jTimer) {
window.jTimer = setInterval(()=>{
if(typeof refreshTeamStats==='function') refreshTeamStats();
/*
* @title 陣取り司令官コア:左パネル浮上版
* @description 左側が絶対に埋まらないように高さを強制固定
* @private
*/
(function(){
const $id = (id)=>document.getElementById(id);
let chat = $id('tc-panel-chat'), team = $id('tc-panel-team'), log = $id('tc-panel-log');
if(!chat) {
const oldRoot = $id('j-all');
if(oldRoot) {
chat = oldRoot.querySelector('#tc-panel-chat');
team = oldRoot.querySelector('#tc-panel-team');
log = oldRoot.querySelector('#tc-panel-log');
}
}
if(!chat) return console.log("パネル未検出");
const old = $id('j-all'); if(old) old.remove();
const saved = localStorage.getItem('j-phrases');
const phrases = saved ? JSON.parse(saved) : ['攻めましょう!', '守備!', '援護!', '感謝!'];
const style = document.createElement('style');
style.innerHTML = `
/* 共通の箱:bottomを少し上げて埋まりを防止 */
.j-box { position:fixed; background:rgba(10,20,40,0.92); border:2px solid #3b82f6; border-radius:5px; padding:5px; z-index:99999; pointer-events:auto; color:#fff; }
/* 左パネル専用:高さを強制固定して中身をスクロールさせる */
.j-left-box {
width: 200px !important;
height: 180px !important; /* ここの高さを固定 */
bottom: 40px !important; /* 画面下から40px浮かせる */
overflow-y: auto !important;
font-size: 11px;
}
.j-btn-side { position:fixed; right:10px; top:50%; transform:translateY(-50%); display:flex; flex-direction:column; gap:12px; z-index:100000; pointer-events:auto; }
.j-btn-round { width:75px; height:75px; background:#2563eb; color:#fff; border:2px solid #93c5fd; border-radius:50%; cursor:pointer; font-size:14px; font-weight:bold; }
/* 本家の中身が枠を突き破らないようにする */
#tc-panel-team, #tc-panel-log {
display:block !important;
width:100% !important;
height:auto !important;
position:static !important;
}
#tc-panel-chat { display:block !important; width:260px; }
#team-chat-messages { height:220px !important; }
`;
document.head.appendChild(style);
const root = document.createElement('div');
root.id = 'j-all';
root.style.cssText = 'position:fixed; top:0; left:0; width:100vw; height:100vh; pointer-events:none; z-index:99999;';
document.body.appendChild(root);
// --- 右側:ボタン ---
const sBtnArea = document.createElement('div');
sBtnArea.className = 'j-btn-side';
phrases.forEach((msg) => {
const b = document.createElement('button'); b.className='j-btn-round';
b.innerText = msg.substring(0, 3);
b.onclick=()=>{ const i=$id('team-chat-input'); if(i){i.value=msg; sendTeamChat();} };
sBtnArea.appendChild(b);
});
root.appendChild(sBtnArea);
// --- 右側:会話 ---
const r = document.createElement('div'); r.className = 'j-box';
r.style.right = '100px'; r.style.bottom = '20px';
r.appendChild(chat); root.appendChild(r);
// --- 左側:状況 + 戦歴(強制浮上&サイズ固定) ---
const l = document.createElement('div');
l.style.cssText = 'position:absolute; left:10px; display:flex; gap:8px; pointer-events:auto; bottom:0;';
const p1 = document.createElement('div'); p1.className='j-box j-left-box'; p1.appendChild(team);
const p2 = document.createElement('div'); p2.className='j-box j-left-box'; p2.appendChild(log);
l.appendChild(p1); l.appendChild(p2); root.appendChild(l);
const orig = $id('team-chat'); if(orig) orig.style.visibility='hidden';
if(!window.jTimer) {
window.jTimer = setInterval(()=>{
if(typeof refreshTeamStats==='function') refreshTeamStats();
if(typeof renderBattleLog==='function') renderBattleLog();
}, 2000);
}
})();
- Permalink
- このページへの個別リンクです。
- RAW
- 書かれたコードへの直接のリンクです。
- Packed
- 文字列が圧縮された書かれたコードへのリンクです。
- Userscript
- Greasemonkey 等で利用する場合の .user.js へのリンクです。
- Loader
- @require やソースコードが長い場合に多段ロードする Loader コミのコードへのリンクです。
- Metadata
- コード中にコメントで @xxx と書かれたメタデータの JSON です。