asdf-j4
<body id ="gg" bgcolor=black text=white onKeyDown="K=event.keyCode-37">
<style>
body, tt, input, font, span {
-webkit-text-size-adjust: 100%; /* Safari, Chrome on iOS */
text-size-adjust: 100%; /* Standard */
}
</style>
<tt id=F style="font-size: 200%;">
<script>
function R(H){while(D.all["F"+(S=40+Math.ceil(ccc(i)*319))].innerHTML!=C);I(S,H)}
function I(T,H){D.all["F"+T].innerHTML=H}
function ccc(cc){j=j+1;a=Math.sin((cc+0.1+j/100)/24);a=""+a;b=a.slice(-8,-2);a=eval(b)/1000000;return a}
// ★修正点3 (推奨): タッチ判定の基準を画面幅に応じたものに変更
function HT(event) {
tX = event.touches[0].clientX;
K = 0; // デフォルトは左
if (tX > window.innerWidth / 2) { // 画面の右半分をタッチしたら右へ
K = 2;
}
}
function Y(){if(K+1){M=[-1,0,1,0][K];}Z=P;P=P+M;
X=D.all["F"+P].innerHTML;P2=P+20;XX=D.all["F"+P2].innerHTML;
if(XX==C && M==0){P=P+20;}
if(X==O || XX==O){alert("GAME OVER SCORE: "+SC*10);return}
// ★修正点2: Qの再定義時にも font-size: inherit を適用
if(X==T || XX==T){KY=1;Q="<font color=\"Purple\" style=\"font-size: inherit;\">●</font>";P=P+20;}
if(X==U || XX==U){if(KY==1){SC++;YY();}else{P=P-20;}}
if(X==W){P=P-M;}
if(X==N || XX==N){P=P-(20*6);while(P<0){P=P+20;}
while(C!=D.all["F"+P].innerHTML){P=P-20;} }
I(Z,C);I(P,Q);K=-1;M=0;ID=setTimeout(Y,100); }
function YY(){D=document;M=0;P=370;S="";K=-1;P2=0;C=" ";
// ★修正点2: 各要素の定義に font-size: inherit を適用
U="<font color=\"Lime\" style=\"font-size: inherit;\">門</font>";
Q="<font color=\"blue\" style=\"font-size: inherit;\">●</font>";
W="<font color=\"Maroon\" style=\"font-size: inherit;\">■</font>";
N="<font color=\"aqua\" style=\"font-size: inherit;\">=</font>";
O="<font color=\"white\" style=\"font-size: inherit;\">*</font>";
T="<font color=\"yellow\" style=\"font-size: inherit;\">ー</font>";
E="<INPUT TYPE=\"button\" VALUE=\"☆\" STYLE=\"font-size: inherit;\" ONCLICK=\"clearTimeout(ID);YYY()\">"; // STYLE追加
for(i=0;i<400;i++)
S+=(i%20?"":"<br>")+"<span id=F"+i+">"+((i+1)%20>1&&i<379?C:W)+"</span>";I("",S);
for(i=0;i<51;i++)I(20+Math.ceil(ccc(i)*339),W);for(i=0;i<11;i++)R(N);I(399,E);
for(i=0;i<(2+SC);i++)R(O);for(i=0;i<2;i++)I(Math.ceil(360+ccc(i)*18),N);R(U);R(T);KY=0;
// HT関数内でpreventDefaultを使用していないため、passive: true を指定してパフォー}ンスを改善
gg.addEventListener("touchmove", HT, { passive: true });
// 必要に応じてtouchstartも同様に設定 (スワイプの始点を重視する場合)
// gg.addEventListener("touchstart", HT, { passive: true });
}
function YYY(){j=0;SC=0;YY();Y();}
// (参考) ダブルタップによる拡大防止が必要な場合は以下のコメントを解除してください
/*
let lastTouchEnd = 0;
document.documentElement.addEventListener('touchend', function (event) {
const now = (new Date()).getTime();
if (now - lastTouchEnd <= 300) {
event.preventDefault();
}
lastTouchEnd = now;
}, { passive: false });
*/
YYY();
</script>
</tt>
</body>
使用変数
<body id ="gg" bgcolor=black text=white onKeyDown="K=event.keyCode-37">
<style>
body, tt, input, font, span {
-webkit-text-size-adjust: 100%; /* Safari, Chrome on iOS */
text-size-adjust: 100%; /* Standard */
}
</style>
<tt id=F style="font-size: 200%;">
<script>
function R(H){while(D.all["F"+(S=40+Math.ceil(ccc(i)*319))].innerHTML!=C);I(S,H)}
function I(T,H){D.all["F"+T].innerHTML=H}
function ccc(cc){j=j+1;a=Math.sin((cc+0.1+j/100)/24);a=""+a;b=a.slice(-8,-2);a=eval(b)/1000000;return a}
// ★修正点3 (推奨): タッチ判定の基準を画面幅に応じたものに変更
function HT(event) {
tX = event.touches[0].clientX;
K = 0; // デフォルトは左
if (tX > window.innerWidth / 2) { // 画面の右半分をタッチしたら右へ
K = 2;
}
}
function Y(){if(K+1){M=[-1,0,1,0][K];}Z=P;P=P+M;
X=D.all["F"+P].innerHTML;P2=P+20;XX=D.all["F"+P2].innerHTML;
if(XX==C && M==0){P=P+20;}
if(X==O || XX==O){alert("GAME OVER SCORE: "+SC*10);return}
// ★修正点2: Qの再定義時にも font-size: inherit を適用
if(X==T || XX==T){KY=1;Q="<font color=\"Purple\" style=\"font-size: inherit;\">●</font>";P=P+20;}
if(X==U || XX==U){if(KY==1){SC++;YY();}else{P=P-20;}}
if(X==W){P=P-M;}
if(X==N || XX==N){P=P-(20*6);while(P<0){P=P+20;}
while(C!=D.all["F"+P].innerHTML){P=P-20;} }
I(Z,C);I(P,Q);K=-1;M=0;ID=setTimeout(Y,100); }
function YY(){D=document;M=0;P=370;S="";K=-1;P2=0;C=" ";
// ★修正点2: 各要素の定義に font-size: inherit を適用
U="<font color=\"Lime\" style=\"font-size: inherit;\">門</font>";
Q="<font color=\"blue\" style=\"font-size: inherit;\">●</font>";
W="<font color=\"Maroon\" style=\"font-size: inherit;\">■</font>";
N="<font color=\"aqua\" style=\"font-size: inherit;\">=</font>";
O="<font color=\"white\" style=\"font-size: inherit;\">*</font>";
T="<font color=\"yellow\" style=\"font-size: inherit;\">ー</font>";
E="<INPUT TYPE=\"button\" VALUE=\"☆\" STYLE=\"font-size: inherit;\" ONCLICK=\"clearTimeout(ID);YYY()\">"; // STYLE追加
for(i=0;i<400;i++)
S+=(i%20?"":"<br>")+"<span id=F"+i+">"+((i+1)%20>1&&i<379?C:W)+"</span>";I("",S);
for(i=0;i<51;i++)I(20+Math.ceil(ccc(i)*339),W);for(i=0;i<11;i++)R(N);I(399,E);
for(i=0;i<(2+SC);i++)R(O);for(i=0;i<2;i++)I(Math.ceil(360+ccc(i)*18),N);R(U);R(T);KY=0;
// HT関数内でpreventDefaultを使用していないため、passive: true を指定してパフォー}ンスを改善
gg.addEventListener("touchmove", HT, { passive: true });
// 必要に応じてtouchstartも同様に設定 (スワイプの始点を重視する場合)
// gg.addEventListener("touchstart", HT, { passive: true });
}
function YYY(){j=0;SC=0;YY();Y();}
// (参考) ダブルタップによる拡大防止が必要な場合は以下のコメントを解除してください
/*
let lastTouchEnd = 0;
document.documentElement.addEventListener('touchend', function (event) {
const now = (new Date()).getTime();
if (now - lastTouchEnd <= 300) {
event.preventDefault();
}
lastTouchEnd = now;
}, { passive: false });
*/
YYY();
</script>
</tt>
</body>
使用変数
-------( Function ) | |
a | |
b | |
bgcolor | |
C | |
ccc -------( Function ) | |
color | |
D | |
E | |
HT -------( Function ) | |
I -------( Function ) | |
i | |
id | |
ID | |
innerHTML | |
j | |
K | |
KY | |
lastTouchEnd | |
M | |
N | |
now | |
O | |
ONCLICK | |
onKeyDown | |
P2 | |
P | |
Q | |
R -------( Function ) | |
S | |
SC | |
style | |
STYLE | |
T | |
text | |
tX | |
TYPE | |
U | |
VALUE | |
W | |
X | |
XX | |
Y -------( Function ) | |
YY -------( Function ) | |
YYY -------( Function ) | |
Z |