定型文・コア
by
cutfloss
05/01 [2026/05/01 13:11:50]
6連ボタン対応の完璧版
@@ -1,5 +1,6 @@
/*
- * @title 陣取り司令官:原点回帰
+ * @title 陣取り司令官mini・極
+ * @description 左右パネル+ブラウザ保存の定型文ボタン
* @private
*/
(function(){
@@ -9,20 +10,26 @@
const chat = $id('tc-panel-chat'), team = $id('tc-panel-team'), log = $id('tc-panel-log');
if(!chat) return console.log("チーム戦中に実行してください");
+ // 保存された定型文を読み込む(なければデフォルト)
+ const defaultPhrases = ['⚔️攻', '🛡️守', '🆘援', '✨感'];
+ const defaultMessages = ['攻めましょう!', '守備!', '援護!', '感謝!'];
+ let saved = localStorage.getItem('j-phrases');
+ let phrases = saved ? JSON.parse(saved) : defaultMessages;
+
const style = document.createElement('style');
style.innerHTML = `
- /* 基本の箱(mini版準拠) */
+ /* 基本の箱 */
.j-box { position:fixed; background:rgba(10,20,40,0.9); border:2px solid #3b82f6; border-radius:5px; padding:5px; z-index:99999; pointer-events:auto; color:#fff; font-size:11px; }
- /* 右端の独立ボタン */
- .j-btn-side { position:fixed; right:10px; top:50%; transform:translateY(-50%); display:flex; flex-direction:column; gap:10px; z-index:100000; pointer-events:auto; }
- .j-btn-round { width:70px; height:70px; background:#2563eb; color:#fff; border:2px solid #93c5fd; border-radius:50%; cursor:pointer; font-size:16px; font-weight:bold; box-shadow:0 4px 10px #000; }
+ /* 右端の独立ボタン(大きく押しやすく調整) */
+ .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; transition:0.1s; }
+ .j-btn-round:hover { transform: scale(1.05); background:#1d4ed8; }
- /* 本家パーツのサイズ強制(mini版準拠) */
- #tc-panel-chat { display:block !important; visibility:visible !important; width:250px; }
- #tc-panel-team, #tc-panel-log { display:block !important; visibility:visible !important; width:200px; }
+ /* 本家パーツのサイズ強制 */
+ #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:160px; overflow-y:auto; }
#team-chat-messages { height:200px !important; }
- #tc-team-stats, #tc-panel-log { height:150px !important; }
`;
document.head.appendChild(style);
@@ -31,25 +38,30 @@
root.style.cssText = 'position:fixed; top:0; left:0; width:100vw; height:100vh; pointer-events:none; z-index:99999;';
document.body.appendChild(root);
- // --- 1. 右端:独立ボタン ---
+ // --- 1. 右端:独立ボタン(保存されたテキストを使用) ---
const sBtnArea = document.createElement('div');
sBtnArea.className = 'j-btn-side';
- [['⚔️攻','攻め!'],['🛡️守','守り!'],['🆘援','援護!'],['✨感','感謝!']].forEach(p=>{
- const b = document.createElement('button'); b.className='j-btn-round'; b.innerText=p[0];
- b.onclick=()=>{ const i=$id('team-chat-input'); if(i){i.value=p[1]; sendTeamChat();} };
+
+ // phrases配列(保存データ)を使ってボタンを作成
+ phrases.forEach((msg, i) => {
+ const b = document.createElement('button'); b.className='j-btn-round';
+ // 最初の2文字をラベルにする(例:「🛡️ 守備!」→「🛡️守」)
+ b.innerText = msg.substring(0, 2);
+ b.title = msg; // ホバーで全文を表示
+ b.onclick=()=>{ const i=$id('team-chat-input'); if(i){i.value=msg; sendTeamChat();} };
sBtnArea.appendChild(b);
});
root.appendChild(sBtnArea);
- // --- 2. 右側:会話パネル(mini版の構造) ---
+ // --- 2. 右側:会話パネル(mini版の構造寄り) ---
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);
// --- 3. 左側:状況 + 戦歴(mini版の構造そのまま) ---
const l = document.createElement('div');
- l.style.cssText = 'position:absolute; left:10px; bottom:10px; display:flex; gap:5px; pointer-events:auto;';
+ l.style.cssText = 'position:absolute; left:20px; bottom:20px; display:flex; gap:10px; pointer-events:auto;';
const p1 = document.createElement('div'); p1.className='j-box'; p1.style.position='relative'; p1.appendChild(team);
const p2 = document.createElement('div'); p2.className='j-box'; p2.style.position='relative'; p2.appendChild(log);
/*
* @title 陣取り司令官mini・極
* @description 左右パネル+ブラウザ保存の定型文ボタン
* @private
*/
(function(){
const $id = (id)=>document.getElementById(id);
const old = $id('j-all'); if(old) old.remove();
const chat = $id('tc-panel-chat'), team = $id('tc-panel-team'), log = $id('tc-panel-log');
if(!chat) return console.log("チーム戦中に実行してください");
// 保存された定型文を読み込む(なければデフォルト)
const defaultPhrases = ['⚔️攻', '🛡️守', '🆘援', '✨感'];
const defaultMessages = ['攻めましょう!', '守備!', '援護!', '感謝!'];
let saved = localStorage.getItem('j-phrases');
let phrases = saved ? JSON.parse(saved) : defaultMessages;
const style = document.createElement('style');
style.innerHTML = `
/* 基本の箱 */
.j-box { position:fixed; background:rgba(10,20,40,0.9); border:2px solid #3b82f6; border-radius:5px; padding:5px; z-index:99999; pointer-events:auto; color:#fff; 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; transition:0.1s; }
.j-btn-round:hover { transform: scale(1.05); background:#1d4ed8; }
/* 本家パーツのサイズ強制 */
#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:160px; overflow-y:auto; }
#team-chat-messages { height:200px !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);
// --- 1. 右端:独立ボタン(保存されたテキストを使用) ---
const sBtnArea = document.createElement('div');
sBtnArea.className = 'j-btn-side';
// phrases配列(保存データ)を使ってボタンを作成
phrases.forEach((msg, i) => {
const b = document.createElement('button'); b.className='j-btn-round';
// 最初の2文字をラベルにする(例:「🛡️ 守備!」→「🛡️守」)
b.innerText = msg.substring(0, 2);
b.title = msg; // ホバーで全文を表示
b.onclick=()=>{ const i=$id('team-chat-input'); if(i){i.value=msg; sendTeamChat();} };
sBtnArea.appendChild(b);
});
root.appendChild(sBtnArea);
// --- 2. 右側:会話パネル(mini版の構造寄り) ---
const r = document.createElement('div'); r.className = 'j-box';
r.style.right = '100px'; r.style.bottom = '20px';
r.appendChild(chat);
root.appendChild(r);
// --- 3. 左側:状況 + 戦歴(mini版の構造そのまま) ---
const l = document.createElement('div');
l.style.cssText = 'position:absolute; left:20px; bottom:20px; display:flex; gap:10px; pointer-events:auto;';
const p1 = document.createElement('div'); p1.className='j-box'; p1.style.position='relative'; p1.appendChild(team);
const p2 = document.createElement('div'); p2.className='j-box'; p2.style.position='relative'; p2.appendChild(log);
l.appendChild(p1); l.appendChild(p2);
root.appendChild(l);
// 本家の元を隠す
const orig = $id('team-chat'); if(orig) orig.style.visibility='hidden';
// 更新
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 です。