Compare commits
8 Commits
06a1e083f5
...
2c5c79ae05
Author | SHA1 | Date | |
---|---|---|---|
|
2c5c79ae05 | ||
|
615aa36d60 | ||
|
1c1a8af60b | ||
|
da0eba7393 | ||
|
f4f0939cee | ||
|
9168154c79 | ||
|
065a127c36 | ||
|
adde9ccc55 |
91
exercise/index.html
Normal file
91
exercise/index.html
Normal file
@ -0,0 +1,91 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<link rel="stylesheet" href="/style.css">
|
||||||
|
<title>Exercise</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h1>The meaning of exercise</h1>
|
||||||
|
<p>I haven't always like exercising.</p>
|
||||||
|
<p>For a long time, anything more intensive than the running I had done on the playground was seemingly so out of reach.
|
||||||
|
I could only look on at people in the track and field teams and their performances, labelling them in my head as
|
||||||
|
someone of a different class.
|
||||||
|
</p>
|
||||||
|
<p>Someone beneath me.</p>
|
||||||
|
<p>I'll admit, it was an ugly emotion. I prided myself on academics, and was only moderately good at anything
|
||||||
|
sporty — and only by virtue of brute effort. I saw physical exertion as a lower function, something to be done
|
||||||
|
by those whose intellect couldn't take first place.
|
||||||
|
</p>
|
||||||
|
<p>But, slowly, this entrenched idea began to be chipped and hacked at, until some years ago it was finally dislodged.
|
||||||
|
I came to regret looking down, deep down in jealousy, upon people who could do better than the bare minimum of
|
||||||
|
physical achievements. I started to want to also claim that ability for myself.
|
||||||
|
</p>
|
||||||
|
<p>So, over time, I've decided that I also need to start exercising, regardless of how <a href="/exercise/weakness.html">hopelessly
|
||||||
|
weak</a> I really was. After it occurred to me that, in addition to the mind, there was the body, just waiting
|
||||||
|
to be taken to its limits, it did make me, who tended to be a bit competitive, feel somewhat left behind,
|
||||||
|
as it was. I wanted to do much, much better, and now I've decided that's exactly what will happen.
|
||||||
|
</p>
|
||||||
|
<p>I'm sorry to everyone I looked down on before; I've written down my feelings here to express how
|
||||||
|
shameful and disgraceful this jealousy is, but also to document this stage in what I today perceive as
|
||||||
|
a chance for me to evolve: a chance, also, to penetrate new boundaries and make the most of the body
|
||||||
|
I've been given. Everyone, I'm gonna join you up there at the top!
|
||||||
|
</p>
|
||||||
|
<h1>My fitness goals</h1>
|
||||||
|
<p>Well, that theatrical speech aside, I do still take this stuff seriously, and I've got a number of physical
|
||||||
|
goals I'd like to attain as part of my overall journey in life; in exercise, my ultimate goal is to
|
||||||
|
to maximise the strength and physique I can feasibly build, slowly working up to the highest levels of
|
||||||
|
fitness and health. Ultimately, it's all for the health, so I'm looking primarily for both strength and
|
||||||
|
hypertrophy, and only to a lesser extent endurance and conditioning. Nevertheless, I also want to supplement
|
||||||
|
the above with hearty development of the cardiovascular.
|
||||||
|
</p>
|
||||||
|
<p>Despite talking big game, at the beginning of my journey in ~2020, I probably started off at a place of
|
||||||
|
lamentable weakness: I could, yes, do a pull-up and a push-up, but, lacking any sense of motivation or direction,
|
||||||
|
I never made considerable progress until I started taking it seriously—in 2024. Even in 2024, I'm still weak beyond
|
||||||
|
belief, but my progress is coming along: in addition to building up my pull-up repetitions to about 10+,
|
||||||
|
and push-ups to the 10s or 20s, I'm taking steps to build towards muscle-ups and, eventually, planche,
|
||||||
|
and one-armed variations of the above. To this day, my legs are still poorly developed, which I've been
|
||||||
|
more conscious of lately, so I'm thinking of doing more squats to remedy this. I can't say if it'll be enough,
|
||||||
|
though, and I also don't have any plans yet what to do when simple squats stop making any progress.
|
||||||
|
</p>
|
||||||
|
<h2>Final targets</h2>
|
||||||
|
My goal repertory of exercises I want to be able to do are:
|
||||||
|
<ul>
|
||||||
|
<li>Back exercises</li>
|
||||||
|
<ul>
|
||||||
|
<li>Muscle-up</li>
|
||||||
|
<li>Slow muscle-up</li>
|
||||||
|
<li>One-arm pull-up</li>
|
||||||
|
</ul>
|
||||||
|
<li>Chest exercises</li>
|
||||||
|
<ul>
|
||||||
|
<li>Planche</li>
|
||||||
|
<li>Plance push-up</li>
|
||||||
|
</ul>
|
||||||
|
<li>Shoulder exercises</li>
|
||||||
|
<ul>
|
||||||
|
<li>Iron cross</li>
|
||||||
|
<li>Handstand pushups</li>
|
||||||
|
<li>One-arm handstand</li>
|
||||||
|
</ul>
|
||||||
|
<li>Core exercises</li>
|
||||||
|
<ul>
|
||||||
|
<li>Dragon flag</li>
|
||||||
|
<li>Human flag</li>
|
||||||
|
<li>L sit</li>
|
||||||
|
<li>Front lever</li>
|
||||||
|
</ul>
|
||||||
|
<li>Leg exercises</li>
|
||||||
|
<ul>
|
||||||
|
<li>Pistol squat</li>
|
||||||
|
</ul>
|
||||||
|
</ul>
|
||||||
|
<p>The truth is, with just the above, it would be insolent to high hell to call myself much of anything,
|
||||||
|
but it's probably the most I can do without sacrificing something else. I'm nowhere near there at all yet,
|
||||||
|
and I apologise if I've been arrogant in listing these goals and with my feelings and all,
|
||||||
|
but I will try in future to vindicate these ambitions and make this page more than just a burst of hot air.
|
||||||
|
</p>
|
||||||
|
</body>
|
||||||
|
</html>
|
43
exercise/weakness.html
Normal file
43
exercise/weakness.html
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<link rel="stylesheet" href="/style.css">
|
||||||
|
<title>Weakness</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h1>How weak I am</h1>
|
||||||
|
<p>You start to realise how pathetic any normal person like us really is when you glance towards the top.
|
||||||
|
You see people lifting 200kg or more on their shoulders, hanging effortlessly apparently in defiance of gravity
|
||||||
|
off the side of a pole, climbing trees like their ancestral DNA had been fully unlocked, running at breakneck
|
||||||
|
pace as though it were a mere footrace; basically, I feel very, very weak in comparison.
|
||||||
|
</p>
|
||||||
|
<p>Obviously, it's no surprise that the rank amateur can't compare himself to the masters,
|
||||||
|
but it does make me ashamed to think that, with my current level of strength, should a time come
|
||||||
|
when it is put to the test, it will most certainly yield to most anyone my better.
|
||||||
|
If something were at stake in an altercation, like an encounter with violence, I couldn't do much
|
||||||
|
to protect anything. I resolved as I began to make some minor progress that that has to change.
|
||||||
|
</p>
|
||||||
|
<p>It's far too arrogant still for me to claim anything of the sort, but they say that as one progresses
|
||||||
|
in something, they contrarily realise just how far away they really are from being capable of the very
|
||||||
|
best; the more competent, the more humble and reserved, and the more inadequate, the more arrogant.
|
||||||
|
In the end, I'm glad at least to have been able to witness, through places like YouTube,
|
||||||
|
just how hopelessly far away from the top I am as I am now, and how impossible it likely is
|
||||||
|
to make it there. The redeeming silver lining, however, is that that all isn't necessary at all.
|
||||||
|
</p>
|
||||||
|
<p>My personal goals revolve around the same notional goal as "calisthenics": to maximise the beauty of the body.
|
||||||
|
Again, I must apologise for the grandiosity I seem to be exuding, but my dream is not to stun people in the
|
||||||
|
streets with a six-pack of abs or a tanned-up beach bod, but rather to make the most of what the body already has
|
||||||
|
inside it; to unlock first of all its strength, and secondly to harness it in synergistic beauty so as to
|
||||||
|
control it elegantly and handle it with grace. To be able to walk around with every muscle efficiently
|
||||||
|
supporting my gait, and to bend in gentle loci described by a body that's in total control of its movements.
|
||||||
|
That's all i really mean. However pretentious that still does sound, though…
|
||||||
|
</p>
|
||||||
|
<p>So, even though once I do reach such a stage, it'll be very dubious to claim any level of strength at all,
|
||||||
|
I can still be glad that my goal is achieved. Even if unable to master the heights of professional athletics,
|
||||||
|
I can still master my own body.
|
||||||
|
</p>
|
||||||
|
</body>
|
||||||
|
</html>
|
15
index.html
15
index.html
@ -85,6 +85,21 @@
|
|||||||
<span>Password: public</span>
|
<span>Password: public</span>
|
||||||
</article>
|
</article>
|
||||||
|
|
||||||
|
<h2>Personal targets</h2>
|
||||||
|
<p>There are a number of goals I'd like to eventually attain, some of which a good deal into the present.
|
||||||
|
Regardless, I've resolved to do the following:
|
||||||
|
</p>
|
||||||
|
<ul>
|
||||||
|
<li>Career: become a senior software developer</li>
|
||||||
|
<ul><li>Become skilled enough to make projects of my own on large scale that satisfy me</li>
|
||||||
|
<li>Make my own operating system</li>
|
||||||
|
</ul>
|
||||||
|
<li>Master the German language</li><ul><li>Pass the Goethe Institut C2 exam</li></ul>
|
||||||
|
<li>Master the Japanese language</li><ul><li>Pass <a href="kanken/">level 1</a></li><li>Pass Nihongo Kentei level 1</li></ul>
|
||||||
|
<li>Attain a high level of <a href="exercise/">calisthenics</a> profiency (qualified on the exercise page)</li>
|
||||||
|
<li>Make Wiktionary a worthy Bulgarian dictionary</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
|
80
kanken/index.html
Normal file
80
kanken/index.html
Normal file
@ -0,0 +1,80 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
|
<link rel="stylesheet" href="/style.css">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>Kanken</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h1>Kanji Kentei</h1>
|
||||||
|
<p>The <em>Kanji Kentei</em> is an exam available in Japan to test the examinee's knowledge of Chinese characters (kanji)
|
||||||
|
as they appear in Japanese. The test comes in 12 levels, spanning from level 10 (the easiest) to level 1 (the hardest),
|
||||||
|
with levels 2 and 1 have easier versions called pre-1 and pre-2.
|
||||||
|
</p>
|
||||||
|
<p>It's said that the hardest level, level 1, is also functionally the hardest credential to achieve
|
||||||
|
among the Japanese culture's rich array of similar exams (such as on geography, cultural heritage, etc.),
|
||||||
|
lining up with the <em>Nihongo Kentei</em> as the top of the hardest Japanese-language-testing exams.
|
||||||
|
</p>
|
||||||
|
<p>Evgeny Uskov, via his website <a href="https://roshiajin.jp">Roshijin.jp</a>, has been my ambassador in learning
|
||||||
|
more about this exam through his <a href="https://www.youtube.com/@EvgenyUskov">YouTube channel</a> and website expounding details of the exam in English.
|
||||||
|
Thanks to Evgeny, it's become clear to me that I, too, wish to take up the gauntlet and achieve a pass (80% or more)
|
||||||
|
on the hardest exam of its kind, namely level 1. At this time (15 August 2024), only 5 non-Sinosphere foreigners
|
||||||
|
appear to have passed it, according to Evgeny's most recent information, so I aim to hopefully line up somewhere
|
||||||
|
in the top 10 my the time I eventually finish! :)</p>
|
||||||
|
<h2>My resources</h2>
|
||||||
|
<p>
|
||||||
|
Due to the illumination of people who came before me, the task of passing the exam has, in my opinion,
|
||||||
|
been significantly lessened in ardour, because I am able to view comprehensive details about each part of the
|
||||||
|
exam and its precise details ahead of time, as well as the fact that many resources have already been
|
||||||
|
made widely available that weren't as accessible before.
|
||||||
|
</p>
|
||||||
|
<p>In keeping with this trend, I would like to also share my own offering in the Kanken resource space,
|
||||||
|
namely a massive dataset adequate for comprehensive study of the Kanken level 1 material,
|
||||||
|
all in one centralized location. I'm still working on this in various aspects, but for now,
|
||||||
|
an Anki deck and a general data sheet (in CSV/spreadsheet-friendly form) are in the works.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
These will contain the contents of the Kanken Kanji Jiten, i.e. the (relatively) exhaustive authority on the
|
||||||
|
Kanken level 1 (and below) exam, to whose contained kanji the exam will be constrained, in Japanese.
|
||||||
|
Ultimately, the exam may feature some vocabulary outside the scope of the dictionary, but the large part of
|
||||||
|
the exam should come from the contents of the dictionary. I will also, over the course of my personal studies,
|
||||||
|
build up the English Wiktionary's coverage of the Kanken material, with the late-stage goal of
|
||||||
|
transforming Wiktionary into an adequate resource for Kanken study, albeit allowing you to study the same
|
||||||
|
material in English for more efficiency for us English-speakers. However, if the deck itself is to take a while
|
||||||
|
to be produced, then the English version I prepare only after I've basically finished studying will take
|
||||||
|
literal years. Please be patient if waiting for this one!
|
||||||
|
</p>
|
||||||
|
<p>I also intend to provide the following extra resources for help in Kanken study: </p>
|
||||||
|
<ul>
|
||||||
|
<li>A copy of the chart in the Kanken Kanji Jiten listing the kanji radicals (as used on the exam)</li>
|
||||||
|
<li>A list of all phonetic series for helping to remember the <em>on</em> readings for the characters</li>
|
||||||
|
<li>A list of all undecomposable characters out of the 6300, which effectively breaks down recognition and writing into a simple game of composition</li>
|
||||||
|
<li>Along with the data and Anki deck: differentiated <em>go-on</em> and <em>kan-on</em> readings, to help learners grasp the connection between the two, as well as predictably use one or the other, e.g. to read an already-analysed Buddhist term</li>
|
||||||
|
</ul>
|
||||||
|
<h2>Personal study</h2>
|
||||||
|
<p>
|
||||||
|
As for my own course of study, I intend to work through the 42,000 vocabulary entries and 6300 kanji
|
||||||
|
over a course of a bit less than 2 and half years, with the hope of getting a high coverage of the full
|
||||||
|
exam material. This would equate to 50 cards a day, which, from my experience of prior study in Anki,
|
||||||
|
would amount to several hours of study a day by a year in; however, thanks to the "FSRS" algorithm's
|
||||||
|
recent development, which vastly improves scheduling in Anki, it may be possible to push back that
|
||||||
|
inevitable inkstone-grinding labor a year or so, so that only towards the end will the study truly
|
||||||
|
reach any laborious heights.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
Additionally, once the deck and data have been prepared, I would like to offer a website to provide
|
||||||
|
(a) practice exams, and (b) the ability to perform online practice ad-hoc in each of the exam categories,
|
||||||
|
and have the computer tell you if you're right, etc.
|
||||||
|
Since the Kanken exam always follows the same format, it's possible to make this generation very
|
||||||
|
programmatically, and this will allow one to gauge one's own progress with a quite satisfactory degree of accuracy.
|
||||||
|
</p>
|
||||||
|
<p>Perhaps if I'm feeling up to it, I might also consider offering a tracker to let you note which kanji you've
|
||||||
|
learnt, and which words, etc. you now "know", or even expand the service to a live online SRS like Anki,
|
||||||
|
but ultimately these functions would be largely unneeded given the reasonable efficiency of Anki itself.
|
||||||
|
It can at most be a fun game if a leaderboard, etc. were to be implemented.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
51
reading/index.html
Normal file
51
reading/index.html
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>Reading</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h1>Reading</h1>
|
||||||
|
<p>I really love reading, because it's one of the only hobbies that I can just totally immerse
|
||||||
|
myself into without worrying at all about anything else. Reading for fun is literally like
|
||||||
|
getting teleported into a world of peace, comfort, and exhilaration, being able to enjoy a lifetime
|
||||||
|
of exhilarating events in just a few hours.</p>
|
||||||
|
<p>The thing I love about it the most is that it feels like it even makes real life more exciting,
|
||||||
|
because you can start to see how even the mundane everyday is just like a book, too!
|
||||||
|
It might be a bit embarrassing, but at times I do end up mimicking heroes from the books
|
||||||
|
I've read, and in my opinion it ends up all the better for it, since it imbues my
|
||||||
|
usually more aimless conversation with passion and enthusiasm... in any case,
|
||||||
|
it can help to animate even a boring moment by likening it all to just a fragment of the
|
||||||
|
overall very exciting storyline.
|
||||||
|
</p>
|
||||||
|
<p>In that way, I must say I take a special loving to <a href="./lightnovels">light novels</a>, because
|
||||||
|
they eschew all the complicated bits of using any overly flowery language (unlike me…) and get directly
|
||||||
|
to the drama, suspense, character action, and the like! The juicy bits! I even used to basically
|
||||||
|
desire the same thing from regular books, since I remember skim-reading some of the early Harry Potter
|
||||||
|
books (a bit before I was really grown-up enough to read them) and only reading the dialogue!</p>
|
||||||
|
<p>No matter what, I wouldn't mind being able to just read fiction every day for many hours, although
|
||||||
|
sometimes other things do get in the way. The greatest joy of having gone on holiday and sworn
|
||||||
|
not to use my laptop was being able to throw all those distractions away and read for at least 4 hours
|
||||||
|
a day, not by force, but totally out of my own desire, and it was great. I felt like I enjoyed myself
|
||||||
|
unbelievably well, and learnt a lot of new words and funny turns of phrase along the way.
|
||||||
|
</p>
|
||||||
|
<p>And reading also gives you a time of slow pause, to let you drink in the nuances of language
|
||||||
|
and to think about what each word means. Unlike a movie, it won't skip ahead without you,
|
||||||
|
and in that regard it's totally at your own pace, letting you also match your thinking and reading
|
||||||
|
together to go as fast or slow as you want. Moreover the imagery I'm able to see because of
|
||||||
|
even the simplest of texts is so beautiful and stunning and immersive, I'm just ashamed
|
||||||
|
I haven't been making <i>more</i> use of this ability until more recently!
|
||||||
|
</p>
|
||||||
|
<p>I've fallen into various periods where I've not read awfully much, which has sadly
|
||||||
|
atrophied my vocabulary over time; it probably peaked in year 11, where I'd known so
|
||||||
|
many words as to always leave an impression on my English teacher. If I had to repeat my essays
|
||||||
|
today, I'm not so sure I'd still be anywhere near as compelling… but, that's at least a little bit
|
||||||
|
excuses by the thought that in the meantime, I have read in Japanese and German a fair bit,
|
||||||
|
and I've been able to instead focus on learning to read those two more naturally, even to the detriment
|
||||||
|
to my vocabulary in any one of them. It is my ultimate goal to master all of them, though,
|
||||||
|
so I don't intend to compromise like this forever, at any rate.
|
||||||
|
</p>
|
||||||
|
</body>
|
||||||
|
</html>
|
219
wiktionary/quotes.html
Normal file
219
wiktionary/quotes.html
Normal file
@ -0,0 +1,219 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>Quote generator</title>
|
||||||
|
<style>
|
||||||
|
label {
|
||||||
|
display: block
|
||||||
|
}
|
||||||
|
.gloss {
|
||||||
|
text-decoration-style: dotted;
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
|
html {
|
||||||
|
background-color: black;
|
||||||
|
filter: invert(1);
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<script>
|
||||||
|
const basic = "basic";
|
||||||
|
const additional = "additional";
|
||||||
|
const parameters = {
|
||||||
|
"type": {label: "Type", section: basic, type: "dropdown", fields: {
|
||||||
|
"book": "Book",
|
||||||
|
"web": "Web",
|
||||||
|
"song": "Song",
|
||||||
|
"journal": "Journal",
|
||||||
|
"wikipedia": "Wikipedia"
|
||||||
|
}},
|
||||||
|
"language": {label: "Language(s)", section: basic},
|
||||||
|
"text": {label: "Text", section: basic, type: "textarea"},
|
||||||
|
"t": {label: "Translation or re-wording", section: basic, type: "textarea"},
|
||||||
|
"year": {label: "Year", section: basic},
|
||||||
|
"author": {label: "Author", section: basic},
|
||||||
|
"title": {label: "Title", section: basic},
|
||||||
|
"volume": {label: "Volume", section: additional},
|
||||||
|
"chapter": {label: "Chapter", section: additional},
|
||||||
|
"page": {label: "Page", section: additional},
|
||||||
|
"publisher": {label: "Publisher", section: additional},
|
||||||
|
"location": {label: "Location", section: additional},
|
||||||
|
"url": {label: "URL", section: additional},
|
||||||
|
"pageurl": {label: "Page URL", section: additional},
|
||||||
|
"original": {label: "Original title", section: additional},
|
||||||
|
"origlang": {label: "Original language", section: additional},
|
||||||
|
"origyear": {label: "Original year", section: additional},
|
||||||
|
"translator": {label: "Translator", section: additional},
|
||||||
|
"trans-title": {label: "Translated title", section: additional},
|
||||||
|
"series": {label: "Series", section: additional},
|
||||||
|
"isbn": {label: "ISBN", section: additional},
|
||||||
|
"format": {label: "Format", section: additional, type: "dropdown", fields: {
|
||||||
|
"": "(unspecified)",
|
||||||
|
"hardcover": "Hardcover",
|
||||||
|
"paperback": "Paperback",
|
||||||
|
"blog": "Blog"
|
||||||
|
}},
|
||||||
|
"genre": {label: "Genre", section: additional, type: "dropdown", fields: {
|
||||||
|
"": "(unspecified)",
|
||||||
|
"fiction": "Fiction",
|
||||||
|
"non-fiction": "Non-fiction"
|
||||||
|
}}
|
||||||
|
}
|
||||||
|
let presetMenu;
|
||||||
|
addEventListener("DOMContentLoaded", (event) => {
|
||||||
|
presetMenu = document.getElementById("presets");
|
||||||
|
presetMenu.addEventListener("change", () => loadPreset(presetMenu.value));
|
||||||
|
generatePropertyInputs();
|
||||||
|
loadPresetList();
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h1 style="display: inline-block">en.wiktionary Quote Generator</h1> <span class="gloss" title="Enter values for each of the quote template fields. Once you're done, click Generate or Copy to clipboard to get the output as wikitext. You may set presets to skip out the repetitive bits if quoting from the same book many times.">(?)</span>
|
||||||
|
<form>
|
||||||
|
<hr>
|
||||||
|
<div id="basic">
|
||||||
|
<h2>Basic information</h2>
|
||||||
|
<hr>
|
||||||
|
</div>
|
||||||
|
<hr>
|
||||||
|
<div id="additional">
|
||||||
|
<h2>Additional information</h2>
|
||||||
|
<hr>
|
||||||
|
<br>
|
||||||
|
</div>
|
||||||
|
<br>
|
||||||
|
<input type="button" onclick="generate()" value="Generate" title="Generate">
|
||||||
|
<input type="button" onclick="copy()" value="Copy to clipboard" title="Copy to clipboard">
|
||||||
|
<br>
|
||||||
|
<textarea readonly="true" id="out" cols="60" rows="6"></textarea>
|
||||||
|
|
||||||
|
<hr>
|
||||||
|
<label>Preset <span class="gloss" title="When a preset name is input in the 'preset name' box below, you can save the current state of each option as a preset, which will be loaded again even if the page is refreshed.">(?)</span></label>
|
||||||
|
<select id="presets">
|
||||||
|
|
||||||
|
</select>
|
||||||
|
<label>Preset name</label> <input type="text" id="preset-name">
|
||||||
|
<input type="button" value="Save" onclick="savePreset()">
|
||||||
|
<input type="button" value="Delete" onclick="deletePreset()">
|
||||||
|
</form>
|
||||||
|
<script>
|
||||||
|
function getTemplateName(type) {
|
||||||
|
return `quote-${type}`;
|
||||||
|
}
|
||||||
|
function generate() {
|
||||||
|
// Template type chosen
|
||||||
|
const type = document.getElementById("type").value;
|
||||||
|
const templateName = getTemplateName(type);
|
||||||
|
|
||||||
|
// Language name passed as a positional parameter
|
||||||
|
const languages = document.getElementById("language").value;
|
||||||
|
|
||||||
|
// Generate template object
|
||||||
|
let out = `{{${templateName}|${languages}`;
|
||||||
|
out += addNamedParameters(getParameterObject());
|
||||||
|
out += "}}";
|
||||||
|
|
||||||
|
document.getElementById("out").innerText = out;
|
||||||
|
}
|
||||||
|
function copy() {
|
||||||
|
generate();
|
||||||
|
navigator.clipboard.writeText(document.getElementById("out").innerHTML);
|
||||||
|
}
|
||||||
|
function addNamedParameters(obj, ignore = ["type", "language"]) {
|
||||||
|
let out = "";
|
||||||
|
for (const key in obj) {
|
||||||
|
if (obj[key] == "" || ignore.includes(key)) continue;
|
||||||
|
out += `|${key}=${obj[key]}`;
|
||||||
|
}
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
function loadPresetList() {
|
||||||
|
const items = {...localStorage}; delete items.latestPreset;
|
||||||
|
for (const key in items) {
|
||||||
|
addPresetToMenu(key);
|
||||||
|
}
|
||||||
|
console.log(localStorage.getItem("latestPreset"));
|
||||||
|
loadPreset(localStorage.getItem("latestPreset"));
|
||||||
|
}
|
||||||
|
function generatePropertyInputs() {
|
||||||
|
for (const key in parameters) {
|
||||||
|
const label = document.createElement("label");
|
||||||
|
label.innerText = parameters[key].label;
|
||||||
|
|
||||||
|
let input;
|
||||||
|
if (parameters[key].type === "dropdown") {
|
||||||
|
input = document.createElement("select");
|
||||||
|
for (const optionName in parameters[key].fields) {
|
||||||
|
const option = document.createElement("option");
|
||||||
|
option.value = optionName;
|
||||||
|
option.innerText = parameters[key].fields[optionName];
|
||||||
|
input.appendChild(option)
|
||||||
|
}
|
||||||
|
} else if (parameters[key].type === "textarea") {
|
||||||
|
input = document.createElement("textarea");
|
||||||
|
input.cols = 60;
|
||||||
|
input.rows = 6;
|
||||||
|
} else {
|
||||||
|
input = document.createElement("input");
|
||||||
|
input.type = "text";
|
||||||
|
}
|
||||||
|
input.id = key;
|
||||||
|
document.getElementById(parameters[key].section).appendChild(label);
|
||||||
|
document.getElementById(parameters[key].section).appendChild(input);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function addPresetToMenu(key) {
|
||||||
|
const existingPresets = document.querySelectorAll("#presets option");
|
||||||
|
for (const node of existingPresets) {
|
||||||
|
if (node.value === key) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const elem = document.createElement("option");
|
||||||
|
elem.value = key;
|
||||||
|
elem.innerText = key;
|
||||||
|
presetMenu.appendChild(elem);
|
||||||
|
}
|
||||||
|
function savePreset() {
|
||||||
|
const presetName = document.getElementById("preset-name").value;
|
||||||
|
localStorage.setItem(presetName, JSON.stringify(getParameterObject()));
|
||||||
|
addPresetToMenu(presetName);
|
||||||
|
presetMenu.value = presetName;
|
||||||
|
}
|
||||||
|
function getParameterObject() {
|
||||||
|
const out = {}
|
||||||
|
for (const key in parameters) {
|
||||||
|
out[key] = document.getElementById(key).value;
|
||||||
|
}
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
function loadPreset(presetName) {
|
||||||
|
document.getElementById("preset-name").value = presetMenu.value;
|
||||||
|
const parameterValues = JSON.parse(localStorage.getItem(presetName));
|
||||||
|
for (const key in parameterValues) {
|
||||||
|
document.getElementById(key).value = parameterValues[key];
|
||||||
|
}
|
||||||
|
localStorage.setItem("latestPreset", presetName);
|
||||||
|
}
|
||||||
|
function deletePreset() {
|
||||||
|
const presetName = document.getElementById("preset-name").value;
|
||||||
|
localStorage.removeItem(presetName);
|
||||||
|
const existingPresets = presetMenu.children;
|
||||||
|
let currentPresetOptionNode;
|
||||||
|
for (const node of existingPresets) {
|
||||||
|
if (node.value === presetName) {
|
||||||
|
currentPresetOptionNode = node;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
presetMenu.removeChild(currentPresetOptionNode);
|
||||||
|
if (presetMenu.children.length === 1) {
|
||||||
|
document.getElementById("preset-name").value = presetMenu.children[0].value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
Loading…
Reference in New Issue
Block a user