147 lines
6.5 KiB
JavaScript
147 lines
6.5 KiB
JavaScript
const teksty = [
|
|
`<CiscoIPPhoneText>
|
|
<Title>Dokumentacja Cisco</Title>
|
|
<Text>Cisco chyba zdjeło PDFy z dokumentacją dla tych telefonów! Musiałem użyć Wayback Machine żeby napisać ten fragmencik</Text>
|
|
<Description>O nie! Jesteśmy zgubieni.</Description>
|
|
</CiscoIPPhoneText>`,
|
|
`How much do YOU thing this advanced operating environment is worth?
|
|
Wait just one minute before you anwser!
|
|
Watch as Windows integrates Lotus 1-2-3 with Miami Vice!
|
|
Now we can take this Ferrari and paste it right into Windows Write.
|
|
Now how much do you think Microsoft Windows is worth?
|
|
Don't anwser!
|
|
Wait until you see Windows Write and Windows Paint and then listen to what else you get at no extra charge:
|
|
the MS-DOS Executive, an appointment callendar,
|
|
a cardfile, a notepad, a clock, a control panel,
|
|
a terminal, print spooler, RAM drive,
|
|
AND, can you believe it; REVERSI!
|
|
That's right! All those features and Reversi, all for just--
|
|
How much did you guess?
|
|
Five hundred? A thousand?! EVEN MORE?!
|
|
NO it's just $99! That's right! It's $99!
|
|
It's an incredible value, but it's true!
|
|
It's Windows from Microsoft! Order today!
|
|
P.O. Box
|
|
286-DOS
|
|
EXCEPT IN NEBRASKA...`,
|
|
`// https://www.ioccc.org/2024/kurdyukov3/index.html
|
|
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <sys/time.h>
|
|
#include <X11/Xlib.h>
|
|
#include <X11/Xutil.h>
|
|
#define H h[c&7]
|
|
#define C(a,b) case a:b; break;
|
|
#define X(n,t,o) C(n,b=(t)c o(t)b)
|
|
#define R b=m[++d]; n=a&127; if(n){ if(n-1)b=m[b&k]+(n>2?n-65:0); \
|
|
if(n-2){ n=b%4*8; b=b/4&k; b=m[b]>>n|m[b+1]*2<<~n%32; } } a>>=7;
|
|
#define Y(n,t,a,b,c,d)X(n,t,a)X(n+1,t,b)X(n+2,t,c)X(n+3,t,d)
|
|
#define B(i,a,j) if(c==i){ m[1]=E.a.x|E.a.y<<14|E.a.j<<28; b
|
|
#define O(n,t) Y(n,t,+,-,|,^)Y(n+4,t,&,*,/,%)\
|
|
Y(n+8,t,<<,>>,==,!=)Y(n+12,t,<,<=,>,>=)
|
|
#define M(x) x##PressMask|x##ReleaseMask|
|
|
#define W(c) m[d]=(m[d]|n c)^(~b&n)c;
|
|
|
|
int main(int c,char**x){ void*f=c-->1?fopen(x[1],"rb"):0,*h[8]={ stdin,stdout,s\
|
|
tderr} ; unsigned y=0,z=0,a,b=0,d,n=0,k=(1<<24)-1,*m=calloc(k+4,4); struct time\
|
|
val t; char s[33]={ 0} ; Window W=0; GC G=0; Display*D=0; XEvent E; XImage*I=0;
|
|
Atom A=0; if(m&&f){ for(; b<=k&&((a=fgetc(f))<256||(a=x[c][n++]&255)||(n=0,--c))
|
|
; b++)m[b/4]|=a<<b%4*8; ; fclose(f); for(m[1]=b; ; ){ a=m[d=*m&k]; *m+=4; R c=b;
|
|
R d=m[d+1]; switch(a>>9){ default:I?I->data=0:0; return a?1:c; C(1,b=H?c<0?fgetc
|
|
(H):fputc(b,H):-1)C(2,gettimeofday(&t,0); b=t.tv_sec*1000+t.tv_usec/1000)C(3,t.
|
|
tv_sec=0; t.tv_usec=b*1000; select(0,0,0,0,&t))C(4,s[c&31]=b&&b-48>9&&(b|32)-97>
|
|
25&&b-46?95:b)C(5,b=!(H=H?fclose(H),f=0:fopen(s,b?"wb":"rb")))C(6,b=H?c<0?ftell(
|
|
H):fseek(H,(int)b,c/8):-1)C(7,if(!(I||~(-c&-b)>>12)){ XSizeHints h; h.flags=PMi\
|
|
nSize|PMaxSize; h.min_width=h.max_width=c; h.min_height=h.max_height=b; G=XDefa\
|
|
ultGC(D=XOpenDisplay(0),0); W=XCreateSimpleWindow(D,RootWindow(D,0),0,0,c,b,1,0,
|
|
0); XSetStandardProperties(D,W,s,0,0,0,0,&h); XSelectInput(D,W,M(Key)M(Button)P\
|
|
ointerMotionMask); A=XInternAtom(D,"WM_DELETE_WINDOW",0); XSetWMProtocols(D,W,&A
|
|
,1); XMapWindow(D,W); I=XCreateImage(D,DefaultVisual(D,0),24,ZPixmap,0,0,y=c,z=b
|
|
,32,0); } b=I?6:0)C(8,while(b=2,I&&XPending(D)){ XNextEvent(D,&E); c=E.type; if(
|
|
c-ClientMessage||*E.xclient.data.l-A){ b=c==KeyRelease; if(b||c==KeyPress){ m[1]
|
|
=XLookupKeysym(&E.xkey,0); break; } b=c==ButtonRelease; B(ButtonPress||b,xbutton
|
|
,button)+=4; break; } B(MotionNotify,xmotion,x)=6; break; } } else{ b=3; break;
|
|
} } )C(9,b&=k; if(I&&b+y*z<k){ I->data=f=m+b; XPutImage(D,W,G,I,0,0,0,0,y,z); X\
|
|
Sync(D,0); } )C(10,; )O(32,unsigned)O(48,int)O(64,unsigned short)O(80,short)O(96
|
|
,unsigned char)O(112,signed char)} n=a&127; if(n){ c=0; d=n>2?m[d&k]+n-65:d; d=(
|
|
n-2?c=d%4*8,d/4:d)&k; n=-1; n>>=a>>4&24; W(<<c)d++; if(c)W(>>(32-c))} else *m+=b
|
|
?d:0; } } return 1; }`
|
|
];
|
|
|
|
const rozmiary = {
|
|
8: "Najmniejszy",
|
|
12: "Mały",
|
|
14: "Średni",
|
|
16: "Duży",
|
|
20: "Całkiem całkiem",
|
|
24: "Wielki",
|
|
36: "Największy"
|
|
};
|
|
|
|
document.addEventListener("DOMContentLoaded", () => {
|
|
zad1Zsumuj();
|
|
|
|
zad3Inicjalizacja();
|
|
|
|
document.getElementById('zad4-tekst').style.fontSize = '30pt';
|
|
document.getElementById('zad4-tekst').style.margin = '.25rem';
|
|
document.getElementById('zad4-tekst').style.padding = '.5rem';
|
|
document.getElementById('zad4-tekst').style.borderRadius = '1rem';
|
|
});
|
|
|
|
function zad1Zsumuj() {
|
|
const elX = document.getElementById("zad1-x");
|
|
const elY = document.getElementById("zad1-y");
|
|
const elOut = document.getElementById("zad1-output");
|
|
|
|
const x = typeof elX.value == "string" ? Number(elX.value) : 0;
|
|
const y = typeof elY.value == "string" ? Number(elY.value) : 0;
|
|
|
|
elOut.innerText = `${x} + ${y} = ${x + y}`
|
|
}
|
|
|
|
function zad2UstawImie() {
|
|
const imie = prompt("Podaj imię");
|
|
const elOut = document.getElementById("zad2-output");
|
|
if (typeof imie == "null") {
|
|
elOut.innerText = "Bezimienny";
|
|
} else {
|
|
elOut.innerText = imie;
|
|
}
|
|
}
|
|
|
|
function zad3Inicjalizacja() {
|
|
document.getElementById("zad3-tekst").innerText = teksty.at(Math.floor(Math.random() * teksty.length) - 1);
|
|
|
|
const elPrzyciski = document.getElementById("zad3-przyciski");
|
|
for (const rozmiar in rozmiary) {
|
|
const nazwa = rozmiary[rozmiar]
|
|
const przycisk = document.createElement("button");
|
|
przycisk.innerText = nazwa;
|
|
przycisk.onclick = () => {
|
|
document.getElementById("zad3-rozmiar").value = rozmiar;
|
|
zad3ZmienRozmiar();
|
|
};
|
|
elPrzyciski.appendChild(przycisk)
|
|
}
|
|
}
|
|
|
|
function zad3ZmienRozmiar() {
|
|
const elRozmiar = document.getElementById("zad3-rozmiar");
|
|
const rozmiar = typeof elRozmiar.value == "string" ? Number(elRozmiar.value) : 0;
|
|
document.getElementById("zad3-tekst").style.fontSize = `${rozmiar}pt`;
|
|
document.getElementById("zad3-output").innerText = rozmiary[rozmiar] ?? `${rozmiar}pt`;
|
|
}
|
|
|
|
|
|
function koniec() {
|
|
const koniec = `To tak tylko między nami:
|
|
Tą strone zaczynałem robić jakoś po lekcji, zrobiłem do końca 1 i 2, 3 zaczałem
|
|
W momencie w którym to pisze jest 1:40 w poniedziałek :3.
|
|
Zarwałem nocke dlatego że Youpiter zrobił w Pythonie program quizowy z chemi dla klasy i chciałem dla zabawy zrobić wersje przeglądarkową ale on już sie tym zajął.
|
|
No i żeby nie marnować czasu zacząłem robić to zadanie, wiadomo, kto normalny by tak nie zrobił robił?.
|
|
A, Youpiter coś potem wspomniał o chęci dodania "trząśnięcia" formularzem jak jest podana zła odpowiedź, więc zacząłem pisać keyframey CSSowe pod robienie tego. Ba, ten skrawek CSSa nawet tutaj jest, wkleiłem go do akordeonu.
|
|
`;
|
|
alert(koniec);
|
|
} |