Compare commits

...

23 Commits

Author SHA1 Message Date
UndeadMaelys
1b43c52f5d adapted to the new words file 2022-06-06 07:14:01 +02:00
UndeadMaelys
ec76802316 fix badges. fix pronouns duals categorization and generated description 2022-05-10 18:36:05 +02:00
UndeadMaelys
6da5e47e5c better fix for possesion of previous commit 2022-05-10 17:38:15 +02:00
UndeadMaelys
4111112ff3 fixed submodules to include heonian ime and QTC separatedly. Also fixed a bug on the converter (now renamed to generator) so it detects formal possesivess 2022-05-10 17:29:20 +02:00
UndeadMaelys
82b751a9e5 improvements to mood detection, fixed missing word types badges, fixed badge definition 2022-05-09 13:24:28 +02:00
UndeadMaelys
1817ac9d9d fixed misllableed moods in js 2022-05-08 20:16:01 +02:00
87f1a59ceb fix le js 2022-05-08 18:46:56 +02:00
UndeadMaelys
941f701d7d changes to badges and types n stuff 2022-05-08 18:31:09 +02:00
Bizcochito
3d0fc9145f added a word not found allert to stderr when word is not in dictionary 2022-05-07 21:26:44 +02:00
Bizcochito
81d25ec8f1 added 2 moods 2022-05-07 20:40:36 +02:00
Bizcochito
ee20f99f9c added 2 moods 2022-05-07 20:38:33 +02:00
f620bcf1f0 yaaaa 2022-05-07 15:06:20 +02:00
8095cae7cb ime bettter 2022-05-07 14:31:50 +02:00
be9fe1e3a3 finished?! 2022-05-07 12:33:35 +02:00
cddd475909 ariririririririri is now supported 2022-05-07 12:08:35 +02:00
ef877a53bd had too n_n 2022-05-07 11:58:21 +02:00
1888f794b1 Merge branch 'master' of https://git.succubi.services/lustlion/heonian-conversation 2022-05-07 11:55:48 +02:00
ad22fd715e working backspace button :) 2022-05-07 11:55:45 +02:00
UndeadMaelys
cd6deac0b4 fixed nouns not being properly checked in database 2022-05-07 10:20:33 +02:00
c01ebee0ae ime - initial version 2022-05-07 00:08:08 +02:00
e775b7d6a2 minor design changes 2022-05-06 17:20:00 +02:00
6823641f73 design changes for popup 2022-05-06 17:07:07 +02:00
UndeadMaelys
cb09f7235d chchanged badge colors, added more badges types, handled formal1 and formal2 separately 2022-05-06 16:55:40 +02:00
18 changed files with 2507 additions and 1035 deletions

6
.gitmodules vendored
View File

@@ -1,3 +1,9 @@
[submodule "heonian-content"]
path = heonian-content
url = https://git.succubi.services/lustlion/heonian-content
[submodule "heonian-ime"]
path = heonian-ime
url = git@ssh.succubi.services:remi/heonian-ime.git
[submodule "quick-terminal-customization"]
path = quick-terminal-customization
url = git@ssh.succubi.services:lustlion/quick-terminal-customization.git

85
color.lua Normal file
View File

@@ -0,0 +1,85 @@
function Enum(tbl)
for i = 1, #tbl do
local v = tbl[i]
tbl[v] = i
end
return tbl
end
COLOR = Enum {
"Black",
"Red",
"Green",
"Yellow",
"Blue",
"Purple",
"Cyan",
"LightGray",
"Gray",
"HighRed",
"HighGreen",
"HighYellow",
"HighBlue",
"HighPurple",
"HighCyan",
"White"
}
EFFECT = Enum {
"Normal",
"Bold",
"Dim",
"Italic",
"Underline",
"BlinkSlow",
"BlinkFast",
"Invert",
"Conceal",
"CrossedOut"
}
function effectText(Effect, ...)
local Text = ""
local tab = false
for _, v in pairs({...}) do
if not tab then
tab = true
else
Text = Text .. "\t"
end
Text = Text .. v
end
return "\027["..tostring(Effect-1).."m"..Text.."\027[0;m"
end
function colorText(Color, ...)
local Text = ""
local tab = false
for _, v in pairs({...}) do
if not tab then
tab = true
else
Text = Text .. "\t"
end
Text = Text .. v
end
return "\027[38;5;"..tostring(Color-1).."m"..Text.."\027[0;m"
end
function colorTextBackground(Color, ...)
local Text = ""
local tab = false
for _, v in pairs({...}) do
if not tab then
tab = true
else
Text = Text .. "\t"
end
Text = Text .. v
end
return "\027[48;5;"..tostring(Color-1).."m"..Text.."\027[0;m"
end
function scrollTerminalUp(amount)
return "\027["..amount.."T"
end

View File

@@ -1,12 +1,62 @@
require "r2h2_modified"
require "color"
words = dofile("heonian-content/words.lua")
input = arg[1] or "input.txt"
function apply(text)
print(text)
end
function printD(...)
io.stderr:write(
effectText(
EFFECT.Bold,
colorText(
COLOR.HighPurple,
"\tDEBUG:\t"
)
) ..
colorText(
COLOR.HighPurple,
table.unpack({...}) , "\n"
)
)
end
function printW(...)
io.stderr:write(
effectText(
EFFECT.Bold,
colorText(
COLOR.HighYellow,
"\t WARN:\t"
)
) ..
colorText(
COLOR.HighYellow,
table.unpack({...}) .. "\n"
)
)
end
function printE(...)
io.stderr:write(
effectText(
EFFECT.Bold,
colorText(
COLOR.HighRed,
"\tERROR:\t"
)
) ..
colorText(
COLOR.HighRed,
table.unpack({...}) .. "\n"
)
)
end
function process_content(content)
content = content .. " "
for i=1, 2 do
@@ -31,6 +81,7 @@ function process_content(content)
new_word = strip_symbols(new_word)
new_word, indicators = revert_verbs(new_word, indicators)
new_word, indicators = revert_nouns(new_word,indicators)
new_word, indicators = categorize_word(new_word,indicators)
add_word(new_word)
local html_stuff = [[
@@ -48,7 +99,7 @@ function process_content(content)
html_stuff = string.gsub(html_stuff, "REPLACE_PRINT", REPLACE_PRINT)
end
local REPLACE_WORD = print_text
local REPLACE_WORD = strip_symbols(print_text)
while string.find(REPLACE_WORD, "%\'") do
REPLACE_WORD = string.gsub(REPLACE_WORD, "%\'", "$")
end
@@ -89,7 +140,7 @@ function process_content(content)
ac = string.sub(ac, string.find(ac, " ")+1)
-- now we print the thing with teh appropiate indicators.
--print(print_text, table.unpack(indicators))
-- printD(print_text, table.unpack(indicators))
end
apply_html("html/convo/text/end.html")
end
@@ -125,7 +176,8 @@ function add_word(str)
end
end
if add then
table.insert(word_list,str)
table.insert(word_list,str)
if not in_dictionary(str) then printW("\"" .. str .. "\" is not known") end
end
end
@@ -159,49 +211,118 @@ function check_symbol(str)
end
end
function find_n_replace(str, tbl,find,repl,indicator)
if string.find(str, find) then
str = string.gsub(str,find, repl)
table.insert(tbl,indicator)
function find_n_replace(str, tbl,find,repl,indicator, caution)
if not in_dictionary(str) then
if string.find(str, find) then
if caution then
if not string.find(str, caution, string.find(str, find)+string.len(find)-string.len(caution)) then -- sometimes you want to avoid certain false positives
str = string.gsub(str,find, repl)
table.insert(tbl,indicator)
end
else
str = string.gsub(str,find, repl)
table.insert(tbl,indicator)
end
end
end
return str, tbl
end
function in_dictionary(str)
for i=1, #words do
if words[i][1] == str then return true end
if strip_symbols(words[i][1]) == str then return true end
end
end
function check_morphemes(str, tbl,match,repl,indicator)
function string.split(str, find, tbl)
split = tbl or {}
local p = 0
local continue = true
while continue do
word = string.sub(str,p,string.find(str,find,p+1,-1))
table.insert(split,strip_spaces(word))
if string.find(str,find,p) then
str = string.sub(str,p)
p = string.find(str,find,p)
continue = true
p = p + 1
else
continue = false
end
end
return split
end
function categorize_word(str,indicators)
local ind = {}
for _, v in pairs(words) do
if strip_symbols(v[1]) == strip_spaces(str) then -- if word is present
local ac = string.lower(v[3])
ind = string.split(strip_symbols(ac), " ", ind) -- store types are indicators
end
end
for _, v in pairs(indicators) do
table.insert(ind, v)
end
return str, ind
end
function check_morphemes(str, tbl,match,repl,indicators)
if type(indicators) ~= "table" then
indicators = {indicators}
end
if not in_dictionary(str) then
local flen = string.len(match)
if string.sub(str, -flen) == match
and string.sub(str,-3) ~= "ton" then
str = string.sub(str, 0,string.len(str)-flen)
table.insert(tbl,indicator)
if string.sub(str, -flen) == match then
str = string.sub(str, 0,string.len(str)-flen) .. repl
if tbl then
for _, v in pairs(indicators) do
table.insert(tbl,v)
end
end
end
end
return str, tbl
end
function revert_nouns(str, tbl)
str, tbl = check_morphemes(str,tbl,"lfur","","formal-n1")
str, tbl = check_morphemes(str,tbl,"lafura","","formal-n2")
str, tbl = check_morphemes(str,tbl,"lan","","genitive")
str, tbl = check_morphemes(str,tbl,"la","","possesive")
str, tbl = check_morphemes(str,tbl,"n","","plural")
str, tbl = check_morphemes(str,tbl,"lfur","","formal")
str, tbl = check_morphemes(str,tbl,"lafura","","formal")
str, tbl = check_morphemes(str,tbl,"n","","plural")
return str, tbl
end
function revert_verbs(str, tbl)
str, tbl = find_n_replace(str, tbl,"kanya","ku","present-tense")
str, tbl = find_n_replace(str, tbl,"kome","ku","past-tense")
str, tbl = find_n_replace(str, tbl,"kupash","ku","volitional-mood")
str, tbl = find_n_replace(str, tbl,"kudash","ku","imperative-mood")
str, tbl = find_n_replace(str, tbl,"kubash","ku","shy-mood")
str, tbl = find_n_replace(str, tbl,"kutash","ku","threat-mood")
str, tbl = find_n_replace(str, tbl,"faku","ku","negated")
-- moods first
str, tbl = revert_mood(str, tbl,"pash","","volitional-mood")
str, tbl = revert_mood(str, tbl,"dash","","imperative-mood")
str, tbl = revert_mood(str, tbl,"bash","","shy-mood")
str, tbl = revert_mood(str, tbl,"tash","","threat-mood")
str, tbl = revert_mood(str, tbl,"shu","","comfy-mood")
str, tbl = revert_mood(str, tbl,"ha","","excited-mood", "sha")
-- once we've cleaned moods lets try to get tense
str, tbl = check_morphemes(str, tbl,"kanya","ku",{"present-tense-formal","formal-v1"})
str, tbl = check_morphemes(str, tbl,"kome","ku",{"past-tense-formal","formal-v2"})
-- maybe it's informal?
str, tbl = check_morphemes(str, tbl,"nya","",{"present-tense-informal","informal-v1"})
str, tbl = check_morphemes(str, tbl,"me","",{"past-tense-informal","informal-v2"})
for _, v in pairs(tbl) do
if v == "informal-v1"
or v == "informal-v2" then
str = str .. "ku"
end
end
-- negate
str, tbl = check_morphemes(str, tbl,"faku","ku","negated")
return str, tbl
end
function revert_mood(str, tbl,match,repl,indicator, caution)
str, tbl = find_n_replace(str, tbl,"fa"..match,repl,indicator.."-negated",caution)
str, tbl = find_n_replace(str, tbl,match,repl,indicator,caution)
return str, tbl
end
@@ -283,7 +404,7 @@ end
-- lets make the html
apply_html("html/start.html")
-- get text
local file = io.open("input.txt","r")
local file = io.open(input,"r")
local text = file:read("*all")
file:close()

574
generator.lua Normal file
View File

@@ -0,0 +1,574 @@
require "r2h2_modified"
require "quick-terminal-customization"
require "get_words"
words = getWords("heonian-content/words")
input = arg[1] or "input.txt"
function apply(text)
print(text)
end
function printD(...)
io.stderr:write(
string.effect(
TERMINAL_EFFECT.Bold,
string.color(
TERMINAL_COLOR.HighPurple,
"\tDEBUG:\t"
)
) ..
string.color(
TERMINAL_COLOR.HighPurple,
table.unpack({...}) , "\n"
)
)
end
function printW(...)
io.stderr:write(
string.effect(
TERMINAL_EFFECT.Bold,
string.color(
TERMINAL_COLOR.HighYellow,
"\t WARN:\t"
)
) ..
string.color(
TERMINAL_COLOR.HighYellow,
table.unpack({...}) .. "\n"
)
)
end
function printE(...)
io.stderr:write(
string.effect(
TERMINAL_EFFECT.Bold,
string.color(
TERMINAL_COLOR.HighRed,
"\tERROR:\t"
)
) ..
string.color(
TERMINAL_COLOR.HighRed,
table.unpack({...}) .. "\n"
)
)
end
function process_content(content)
content = content .. " "
for i=1, 2 do
if i == 1 then
apply_html("html/convo/text/start_roman.html")
else
apply_html("html/convo/text/start_heonian.html")
end
local ac = check_symbol(content)
while string.find(ac, " ") do
local new_word = string.sub(ac, 0, string.find(ac, " ")-1)
local indicators = {}
if i == 1 then
print_text = new_word
else
print_text = mod_convertToHeonian(new_word)
end
new_word = strip_symbols(new_word)
new_word, indicators = revert_verbs(new_word, indicators)
new_word, indicators = revert_nouns(new_word,indicators)
new_word, indicators = categorize_word(new_word,indicators)
add_word(new_word)
local REPLACE_WORD = strip_symbols(print_text)
local REPLACE_SEARCH = new_word
local REPLACE_PRINT = print_text
local REPLACE_DATA = ""
local k = 0
for _, v in pairs(indicators) do
if k > 0 then
REPLACE_DATA = REPLACE_DATA .. " "
end
REPLACE_DATA = REPLACE_DATA .. v
k = k + 1
end
local html_stuff = [[
<span
class="clickable"
onclick="showPopup('REPLACE_WORD','REPLACE_SEARCH','REPLACE_DATA')"
onmouseover="checkHover('REPLACE_WORD','REPLACE_SEARCH',this,'REPLACE_DATA')"
onmouseout="clearHover()">
REPLACE_PRINT
</span>
]]
while string.find(html_stuff, "REPLACE_PRINT") do
html_stuff = string.gsub(html_stuff, "REPLACE_PRINT", REPLACE_PRINT)
end
while string.find(REPLACE_WORD, "%\'") do
REPLACE_WORD = string.gsub(REPLACE_WORD, "%\'", "$")
end
while string.find(REPLACE_WORD, "%$") do
REPLACE_WORD = string.gsub(REPLACE_WORD, "%$", "\\\'")
end
while string.find(html_stuff, "REPLACE_WORD") do
html_stuff = string.gsub(html_stuff, "REPLACE_WORD", REPLACE_WORD)
end
while string.find(html_stuff, "REPLACE_SEARCH") do
html_stuff = string.gsub(html_stuff, "REPLACE_SEARCH", REPLACE_SEARCH)
end
if REPLACE_DATA and REPLACE_DATA ~= "" then
while string.find(REPLACE_DATA, "\t") do
REPLACE_DATA = string.gsub(REPLACE_DATA, "\t", " ")
end
while string.find(html_stuff, "REPLACE_DATA") do
html_stuff = string.gsub(html_stuff, "REPLACE_DATA", REPLACE_DATA)
end
else
html_stuff = string.gsub(html_stuff, ",'REPLACE_DATA'","")
end
apply(html_stuff)
ac = string.sub(ac, string.find(ac, " ")+1)
-- now we print the thing with teh appropiate indicators.
-- printD(print_text, table.unpack(indicators))
end
apply_html("html/convo/text/end.html")
end
end
function cell_builder(...)
arg = {...}
for i=1, #arg do
apply_html("html/words/definition/cell_start.html")
apply(arg[i])
apply_html("html/words/definition/cell_end.html")
end
end
function print_word_stuff(word)
apply_html("html/words/definition/start.html")
local exit = false
for _, v in pairs(words) do
if strip_symbols(v[1]) == strip_spaces(word) then
cell_builder(mod_convertToHeonian(word),v[1],v[3],v[2])
exit = true
end
end
if not exit then
-- personal pronuns
local PP = {
{"re","re","the speaker"," and someone else the listener doesn't know about"},
{"ba","ba","the listener"," and someone else the speaker doesn't know about"},
{"ima","ma","someone else","s who neither the speaker or the listener know about"}
}
for _, v1 in pairs(PP) do
for _, v2 in pairs(PP) do
if word == v1[1]..v2[2] then
exit = true
cell_builder(
mod_convertToHeonian(word),
word,
"Pronoun",
"This word refers to both "..v1[3] .. v2[4] .. ". \n\nIf in plural form, it refers to a group of people who all fit this definition."
)
end
end
end
if not exit then
cell_builder(mod_convertToHeonian(word),word, "???","???")
printW("\"" .. word .. "\" is not known")
end
end
apply_html("html/words/definition/end.html")
end
function add_word(str)
local add = true
for _, v in pairs(word_list) do
if v == str then
add = false
end
end
if add then
table.insert(word_list,str)
end
end
function strip_spaces(str)
while string.find(str, "% ") do
str = string.gsub(str, " ","")
end
return str
end
function strip_symbols(str)
local symbol_table = "'~()!?:></.,\t"
for i=1, #symbol_table do
while string.find(str, "%"..string.sub(symbol_table,i,i)) do
str = string.gsub(str, "%"..string.sub(symbol_table,i,i),"")
end
end
return str
end
function replace_sign(str)
while string.find(str, "%-") do
str = string.gsub(str, "%-"," ")
end
return str
end
function check_symbol(str)
if not in_dictionary(str) then
return replace_sign(str)
end
end
function find_n_replace(str, tbl,find,repl,indicator, caution)
if not in_dictionary(str) then
if string.find(str, find) then
if caution then
if not string.find(str, caution, string.find(str, find)+string.len(find)-string.len(caution)) then -- sometimes you want to avoid certain false positives
str = string.gsub(str,find, repl)
table.insert(tbl,indicator)
end
else
str = string.gsub(str,find, repl)
table.insert(tbl,indicator)
end
end
end
return str, tbl
end
function in_dictionary(str)
for i=1, #words do
if strip_symbols(words[i][1]) == str then return true end
end
end
function string.split(str, find, tbl)
split = tbl or {}
local p = 0
local continue = true
while continue do
word = string.sub(str,p,string.find(str,find,p+1,-1))
table.insert(split,strip_spaces(word))
if string.find(str,find,p) then
str = string.sub(str,p)
p = string.find(str,find,p)
continue = true
p = p + 1
else
continue = false
end
end
return split
end
function categorize_word(str,indicators)
local ind = {}
for _, v in pairs(words) do
if strip_symbols(v[1]) == strip_spaces(str) then -- if word is present
local ac = string.lower(v[3])
ind = string.split(strip_symbols(ac), " ", ind) -- store types are indicators
end
end
for _, v in pairs(indicators) do
table.insert(ind, v)
end
return str, ind
end
function check_morphemes(str, tbl,match,repl,indicators)
if type(indicators) ~= "table" then
indicators = {indicators}
end
if not in_dictionary(str) then
local flen = string.len(match)
if string.sub(str, -flen) == match then
str = string.sub(str, 0,string.len(str)-flen) .. repl
if tbl then
for _, v in pairs(indicators) do
table.insert(tbl,v)
end
end
end
end
return str, tbl
end
function revert_nouns(str, tbl)
-- possesion first
str, tbl = check_morphemes(str,tbl,"lan","","genitive")
str, tbl = check_morphemes(str,tbl,"la","","possesive")
-- then politeness
str, tbl = check_morphemes(str,tbl,"lfur","","formal-n1")
str, tbl = check_morphemes(str,tbl,"lafura","","formal-n2")
-- then plural
str, tbl = check_morphemes(str,tbl,"n","","plural")
-- personal pronuns
local PP = {
{"re","re"},
{"ba","ba"},
{"ima","ma"}
}
for _, v1 in pairs(PP) do
for _, v2 in pairs(PP) do
if str == v1[1]..v2[2] then
table.insert(tbl,"dual")
for _, vtbl in pairs(tbl) do
if vtbl == "plural" then
table.remove(tbl, #tbl)
break
end
end
table.insert(tbl,"pronoun")
end
end
end
return str, tbl
end
function revert_verbs(str, tbl)
-- moods first
str, tbl = revert_mood(str, tbl,"pash","","volitional-mood")
str, tbl = revert_mood(str, tbl,"dash","","imperative-mood")
str, tbl = revert_mood(str, tbl,"bash","","shy-mood")
str, tbl = revert_mood(str, tbl,"tash","","threat-mood")
str, tbl = revert_mood(str, tbl,"shu","","comfy-mood")
str, tbl = revert_mood(str, tbl,"ha","","excited-mood", "sha")
-- once we've cleaned moods lets try to get tense
str, tbl = check_morphemes(str, tbl,"kanya","ku",{"present-tense-formal","formal-v1"})
str, tbl = check_morphemes(str, tbl,"kome","ku",{"past-tense-formal","formal-v2"})
-- maybe it's informal?
str, tbl = check_morphemes(str, tbl,"nya","",{"present-tense-informal","informal-v1"})
str, tbl = check_morphemes(str, tbl,"me","",{"past-tense-informal","informal-v2"})
for _, v in pairs(tbl) do
if v == "informal-v1"
or v == "informal-v2" then
str = str .. "ku"
end
end
-- negate
str, tbl = check_morphemes(str, tbl,"faku","ku","negated")
return str, tbl
end
function revert_mood(str, tbl,match,repl,indicator, caution)
str, tbl = find_n_replace(str, tbl,"fa"..match,repl,indicator.."-negated",caution)
str, tbl = find_n_replace(str, tbl,match,repl,indicator,caution)
return str, tbl
end
function apply_html(path)
-- copy
local file = io.open(path,"r")
local html = file:read("*all")
file:close()
-- paste
apply(html)
end
function convo_image(string,alt_text)
if string then
apply_html("html/convo/header/image/start.html")
apply(string)
apply_html("html/convo/header/image/middle.html")
apply(alt_text)
apply_html("html/convo/header/image/end.html")
end
end
function convo_notes(string)
apply_html("html/convo/middle.html")
if string then
apply_html("html/convo/notes/start.html")
apply(string)
apply_html("html/convo/notes/end.html")
end
end
function convo_date(string)
if string then
apply_html("html/convo/header/date/start.html")
apply(string)
apply_html("html/convo/header/date/end.html")
end
end
function convo_header_start()
if not header then
header = true
apply_html("html/convo/header/start.html")
end
end
function convo_header_end()
if header then
header = false
apply_html("html/convo/header/end.html")
end
end
function convo_start(color)
convo_header_end()
if not convo then
if color then
apply_html("html/convo/start_green.html")
else
apply_html("html/convo/start_gray.html")
end
convo = true
end
end
function convo_end()
convo_header_end()
if convo then
if not notes then
apply_html("html/convo/middle.html")
end
notes = false
apply_html("html/convo/end.html")
convo = false
end
end
-- lets make the html
apply_html("html/start.html")
-- get text
local file = io.open(input,"r")
local text = file:read("*all")
file:close()
-- first analyze text
-- (this is the fun part)
word_list = {}
local p = 0
local s = 0
local convo = false
local header = false
local notes = false
local green = true
local skip = 1
local user = {}
while p ~= nil do
s = s + 1
local np = string.find(text,"\n",p+1)
if np and p - np ~= 1 then
if p then
skip = 1
if string.sub(text,p+1,p+1) == "\n"
or string.sub(text,p+1,p+1) == "/" then
-- end of new bubble
convo_end()
elseif string.sub(text,p+1,p+1) == "\t" then
-- its tabbed so its spoken?
convo_start()
process_content(string.sub(text,p+2,np-1))
elseif string.sub(text,p+1,p+1) == "h" then
-- spoken but forced to h
convo_start()
apply_html("html/convo/text/start_raw.html")
apply(mod_convertToHeonian(string.sub(text,p+3,np-1)).."")
apply_html("html/convo/text/end.html")
elseif string.sub(text,p+1,p+1) == "r" then
-- spoken but forced to r
convo_start()
apply_html("html/convo/text/start_raw.html")
apply(string.sub(text,p+3,np-1))
apply_html("html/convo/text/end.html")
elseif string.sub(text,p+1,p+1) == "i" then -- independant image, no username
convo_start(green)
convo_header_start()
convo_image(string.sub(text,p+3,np-1))
elseif string.sub(text,p+1,p+1) == "!" then -- independant image, no username
convo_notes(string.sub(text,p+3,np-1))
notes = true
else
-- new user name
convo_end()
if green then
green = false
else
green = true
end
convo_start(green)
-- this is a header section
convo_header_start()
-- lets check for images
local nl = string.find(text,"\n",p+1)
local nlp = string.find(text,"\n",nl+1)
current_user = string.sub(text,p+1,np-1)
user[current_user] = user[current_user] or {image = nil}
if nlp and string.sub(text,nl+1,nl+1) == "i" then
user[current_user].image = string.sub(text,nl+3,nlp-1)
skip = skip + 1
nl = string.find(text,"\n",nl+1)
nlp = string.find(text,"\n",nlp+1)
end
convo_image(user[current_user].image)
-- print name
apply_html("html/convo/header/name/start.html")
apply(string.sub(text,p+1,np-1))
apply_html("html/convo/header/name/end.html")
-- lets check for dates
if nlp and string.sub(text,nl+1,nl+1) == "d" then
convo_date(string.sub(text,nl+3,nlp-1))
skip = skip + 1
else
convo_date("")
end
header = true
end
end
while skip > 0 do
p = string.find(text,"\n",p+1)
skip = skip - 1
end
else
break
end
end
convo_end()
-- 3.5 separation
apply_html("html/spacer.html")
-- fourth lets make word lists
-- process contents
-- lets print the words
apply_html("html/spacer.html")
apply_html("html/words/start.html")
for i=1, #word_list do
print_word_stuff(word_list[i])
end
apply_html("html/words/end.html")
-- pop up
apply_html("html/pop_up.html")
-- lets end the html
apply_html("html/end.html")

49
get_words.lua Normal file
View File

@@ -0,0 +1,49 @@
function getWords(path)
local file = io.open(path,"r")
local text = file:read("*all")
file:close()
local t = {} -- this table will hold our words!!! words format is {word, translation, types, canon origin, meta origin, notes} last three are optional.
local p = 0 -- current position, nil if at end of file
while p do
p = p + 1
local new_word_data = ""
-- this isnt the whole word yet, but all the data around it separated with tabs, so lets get what we want.
-- careful if its uh end of file tho!
local np = string.find(text,"\n",p) -- np is the next word. this is so we can slice it
if np then
new_word_data = string.sub(text, p, np-1)
else
new_word_data = string.sub(text, p)
end
if new_word_data ~= "" then
local new_word = {} -- we'll hold it all here once spliced
local wp = 0 -- word data position!
while wp do -- nil if at end of string so.
wp = wp + 1 -- lets move past the tab we just found
local wnp = string.find(new_word_data, " ",wp)
local stuff = ""
-- we now splice the word every tab and add it to the uhhh
if wnp then
stuff = string.sub(new_word_data, wp, wnp-1) or stuff
else
stuff = string.sub(new_word_data,wp) or stuff
end
table.insert(new_word,stuff)
wp = wnp
end
-- now we add the word ot the word table
table.insert(t, new_word)
end
-- and move on the next
p = np
end
-- now we just. return the table.
return t
end

1
heonian-ime Submodule

Submodule heonian-ime added at c8157f53b1

View File

@@ -1,16 +1,17 @@
<div id="popup-container" style="opacity: 0; pointer-events: none;">
<div id="popup">
<h1>um</h1>
<div>
<b><span id="popup-e">heonian: </span></b><span id="popup-heo"></span><br>
<b>type: </b><span id="popup-type"></span><br>
<div id="popup-quirks-container"><b>quirks:</b> <span id="popup-quirks"></span></div>
<p id="popup-heo"></p>
<div id="spacerhide" class="spacer"></div>
<div id="popup-middle">
<div id="popup-quirks-container"><span id="popup-quirks"></span></div>
</div>
<div class="spacer"></div>
<p id="popup-meaning"></p>
</div>
</div>
<div id="smol-popup" style="opacity: 0; pointer-events: none;">
<h1>um</h1>
<p id="smol-meaning"></p>
<p style="font-size:0.75rem">click for more info!</p>
<p>click for more info!</p>
</div>

28
ime.html Normal file
View File

@@ -0,0 +1,28 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>ime test</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
@font-face {
font-family: "heonian";
src: url('HeonianAlone.otf');
}
textarea {
font-family: "heonian";
font-size: 32px;
}
</style>
</head>
<body>
<p>type in ime, wow!!!!!!!!!!!</p>
<textarea type="text" class="ime">
</textarea>
<script src="./heonian-ime/ime.js" async defer></script>
</body>
</html>

472
ime.js Normal file
View File

@@ -0,0 +1,472 @@
// bug: if you fuck up input really badly, you might get a ??? unicode to print.
// it successfully breaks everything. however, im not managing to repro it so...
// (shruggie)
// let h;
window.onload = () => {
document.querySelectorAll(".ime").forEach(input => {
h = new HeonianIME(input);
});
}
class HeonianIME {
constructor(what) {
this.input = [];
this.currentWord = [];
this.selected = -1;
this.inputState = 0; //STARTING, COMPOSTING, TRAILING, Fucking Nothing, ...cleanup
this.stateState = 0; //depends on the state
this.inputFull = [];
this.inputCurrent = "";
this.ourHtml;
this.oldText = [];
this.hVowels = { //standalone, composing, trailing
"a": ["0", "5", "A"],
"e": ["1", "6", "B"],
"i": ["2", "7", "C"],
"o": ["3", "8", "D"],
"u": ["4", "9", "E"]
};
this.hConsonants = { //0 = standalone, 1 = composing, 2-6 = vowels
"g": "01",
"s": "02",
"r": "03",
"n": "04",
"c": "05",
"m": "06",
"j": "07",
"f": "08",
"t": "09",
"k": "0A",
"w": "0B",
"l": "0C",
"p": "0D",
"b": "0E",
"d": "0F",
"h": "10",
};
this.hVowelsK = Object.keys(this.hVowels)
this.hConsonantsK = Object.keys(this.hConsonants);
this.hConsonantsR = this.inverse(this.hConsonants);
this.ourHtml = what;
this.oldText = [what.value.slice(0, what.selectionStart), what.value.slice(what.selectionStart)];
what.addEventListener("keydown", (key) => {
this.imeDown(key, what);
});
what.addEventListener("mousedown", (e) => {
this.mouse(e, what);
});
}
mouse(e, what) {
e.preventDefault();
what.focus();
this.imeUpdate(what);
}
imeDetach() {
//how do we detach this without . uh,
let renderText = "";
this.input.forEach((w) => {
renderText += w.join("");
})
if (this.selected == -1) {
this.ourHtml.setSelectionRange(this.oldText[0].length+renderText.length, this.oldText[0].length+renderText.length);
} else {
if (this.input.join("") != "") {
let from = 0;
for (let x = 0; x < this.selected; x++) {
from += this.input[x].join("").length;
}
this.ourHtml.setSelectionRange(this.oldText[0].length+from, this.oldText[0].length+from);
}
}
this.imeDown = ()=>{};
this.mouse = ()=>{};
//close enough?
}
imePush() {
//basically equavlient to pressing enter.
if (this.selected == -1) {
if (this.currentWord.join() == "") { //blame js :)
let s = document.createElement("p");
s.innerText = this.input.join("");
document.body.appendChild(s);
this.input = [];
this.selected = -1;
} else {
this.input.push(this.currentWord);
this.currentWord = [];
}
this.imeReset();
} else {
if (this.selected + 1 >= this.input.length) {
this.selected = -1;
} else {
this.selected += 1;
}
this.imeReset(true);
}
}
imeDown(keyEvent, inputField) {
keyEvent.preventDefault();
switch (keyEvent.key) {
case "Backspace":
if (this.selected == -1) {
if (this.currentWord.join("") == "") {
this.currentWord = this.input.pop() || [];
} else {
this.imeRestore(this.currentWord);
// this.currentWord.pop();
}
} else {
this.imeRestore(this.input[this.selected]);
// this.input[this.selected].pop();
if (this.input[this.selected].join("") == "") {
this.input.splice(this.selected, 1);
this.imeMove("left");
}
}
break;
case "Enter":
this.imePush()
break;
case "Space":
//adds a ', on second press . an actual space
break;
case "ArrowLeft":
this.imeMove("left");
break;
case "ArrowRight":
this.imeMove("right");
break;
case "ArrowDown":
this.imeMove("start");
break;
case "ArrowUp":
this.imeMove("end");
break;
case "Escape":
this.imeDetach();
return;
default:
this.imeInput(keyEvent.key);
if (this.selected == -1) {
this.currentWord = this.inputFull;
} else {
this.input[this.selected] = this.inputFull;
}
break;
}
this.imeUpdate(inputField);
}
imeUpdate(inputField) {
let renderText = "";
this.input.forEach((w) => {
renderText += w.join("");
})
inputField.value = this.oldText[0] + renderText + this.currentWord.join("") + this.oldText[1];
if (this.selected == -1) {
inputField.setSelectionRange(this.oldText[0].length+renderText.length, this.oldText[0].length+renderText.length + this.currentWord.join("").length);
} else {
if (this.input.join("") != "") {
let from = 0;
for (let x = 0; x < this.selected; x++) {
from += this.input[x].join("").length;
}
let to = from + this.input[this.selected].join("").length;
inputField.setSelectionRange(this.oldText[0].length+from, this.oldText[0].length+to);
}
}
}
clamp(min, max, value) {
return Math.max(min, Math.min(max, value));
}
imeMove(direction) {
let d = 1;
if (this.currentWord.join("") != "") {
this.input.push(this.currentWord);
this.currentWord = [];
d = 2;
}
switch (direction) {
case "start":
this.selected = 0;
break;
case "end":
this.selected = -1;
break;
case "left":
if (this.selected == -1) this.selected = this.input.length;
this.selected -= 1 * d;
if (this.selected != -1) {
this.selected = this.clamp(0, this.input.length, this.selected);
//is there even a point in clamping it here,,,,
}
break;
case "right":
this.selected += 1 * d;
this.selected = this.clamp(0, this.input.length, this.selected);
//tbh same here, like.
//oh well ig ???/
if (this.selected == this.input.length) {
this.selected = -1;
}
break;
}
this.imeReset(true);
}
getUnicodeVowel(vowel, sot) {
if (sot == "standalone") sot = 0;
if (sot == "composing") sot = 1;
if (sot == "trailing") sot = 2;
return String.fromCharCode(parseInt("E00" + this.hVowels[vowel][sot], 16));
}
getUnicodeConsonant(consonant, scv) {
if (scv == "standalone") { scv = 0; }
else if (scv == "trailing") { scv = 1; }
else {
scv = Number(this.hVowels[scv][0]) + 2
}
return String.fromCharCode(parseInt("E" + this.hConsonants[consonant] + "" + scv, 16));
}
inverse(obj) {
var retobj = {};
for (var key in obj) {
retobj[obj[key]] = key;
}
return retobj;
}
imeReset(soft = false) {
this.stateState = 0;
this.inputState = 0;
this.inputFull = [];
this.inputCurrent = "";
if (!soft) {
if (this.selected == -1) {
this.currentWord = [];
} else {
this.input[this.selected] = [];
}
}
}
imeInfo(decHex) {
try {
let hex = decHex.codePointAt(0).toString(16).split("");
hex[1] = hex[1].toString(16);//parseInt(hex[1], 16);
hex[2] = hex[2].toString(16);//parseInt(hex[2], 16);
hex[3] = hex[3].toString(16);//parseInt(hex[3], 16);
let ka = (hex[1] == 0 && hex[2] == 0) ? "a" : "k";
if (ka == "k") {
if (hex[3] == 1) {
//trailing
return ([ka, "trailing"])
} else if (hex[3] == 0) {
//standalone
//full reset / no restore necessary
return ([ka, "standalone"])
} else {
//composing
return ([ka, "composing"])
}
} else {
if (hex[3] <= 8) {
//standalone
return ([ka, "standalone"])
} else {
//trailing
return ([ka, "trailing"])
}
}
} catch {
return "";
}
}
imeChange(inState, stState, pop, array) {
this.inputState = inState;
this.stateState = stState;
if (pop) {
array.pop();
}
this.inputFull = array;
}
// @remi@snug.moe:
// we made a backspace key that works!!!!!!!
// @meduelelateta@sweet.succubi.services:
// ari fell asleep
imeRestore(array) {
let hex = array[array.length - 1].codePointAt(0).toString(16).split("");
hex[1] = hex[1].toString(16);//parseInt(hex[1], 16);
hex[2] = hex[2].toString(16);//parseInt(hex[2], 16);
hex[3] = hex[3].toString(16);//parseInt(hex[3], 16);
let previous = this.imeInfo(array[array.length - 2])[1];
let ka = (hex[1] == 0 && hex[2] == 0) ? "a" : "k";
if (ka == "k") {
if (hex[3] == 1) {
//trailing
if (previous == "trailing") {
//trailing twice
// console.log("2.1");
this.imeChange(2, 1, true, array);
} else {
//trailing once
// console.log("2.0");
this.imeChange(2, 0, true, array);
}
} else if (hex[3] == 0) {
if (array.length != 1) {
//0.1, i think?
// console.log("0.1");
this.imeChange(0, 1, true, array);
} else {
//standalone
// console.log("full reset");
this.imeReset();
}
} else {
//composing
if (previous == "standalone") {
//0.1??
//recreate?? last digit???
let c = this.hConsonantsR[[hex[1], hex[2]].join("").toUpperCase()];
array.pop();
array.push(this.getUnicodeConsonant(c, "standalone"));
this.inputCurrent = c;
// console.log("0.1");
this.imeChange(0, 1, false, array);
} else {
//0.2???? fuck it lets try and find out ig
//recreate?? last digit???
let c = this.hConsonantsR[[hex[1], hex[2]].join("").toUpperCase()];
array.pop();
array.push(this.getUnicodeConsonant(c, "standalone"));
this.inputCurrent = c;
// console.log("0.2");
this.imeChange(0, 2, false, array);
}
}
} else {
if (hex[3] <= 8) {
//standalone
// console.log("full reset");
this.imeReset();
} else {
//trailing
if (previous == "trailing") {
//trailing twice
// console.log("2.1");
this.imeChange(2, 1, true, array);
} else {
//trailing once
// console.log("2.0");
this.imeChange(2, 0, true, array);
}
}
}
}
imeInput(key) {
key = key.toLowerCase();
if (!this.hConsonantsK.includes(key) && !this.hVowelsK.includes(key)) return;
switch (this.inputState) {
case 0: //starting
if (this.stateState == 0) {
if (this.hVowelsK.includes(key)) {
this.inputFull.push(this.getUnicodeVowel(key, "standalone"));
this.inputState = 2;
} else {
this.inputFull.push(this.getUnicodeConsonant(key, "standalone"));
this.stateState = 1;
this.inputCurrent = key;
}
break;
} else if (this.stateState == 1) {
if (this.hVowelsK.includes(key)) {
this.inputState = 1;
this.stateState = 0;
} else {
this.inputFull.push(this.getUnicodeConsonant(key, "trailing"));
this.inputCurrent = key;
this.stateState = 2;
break;
}
} else if (this.stateState == 2) {
if (this.hVowelsK.includes(key)) {
this.inputState = 1;
this.stateState = 0;
} else break;
}
case 1: //composing
if (this.hVowelsK.includes(key)) {
this.inputState = 2;
this.inputFull.pop();
this.inputFull.push(this.getUnicodeConsonant(this.inputCurrent, key));
this.inputCurrent = "";
}
break;
case 2: //trailing
if (this.hVowelsK.includes(key)) {
if (this.stateState == 1 && this.inputCurrent != "") {
this.inputFull.pop();
let ic = this.inputCurrent;
let k = key;
this.imePush();
this.inputFull.pop();
this.inputFull.push(this.getUnicodeConsonant(ic, k));
this.inputCurrent = "";
this.inputState = 2;
} else {
this.inputFull.push(this.getUnicodeVowel(key, "trailing"));
this.inputCurrent = "";
this.stateState += 1;
}
} else {
this.inputFull.push(this.getUnicodeConsonant(key, "trailing"));
this.inputCurrent = key;
this.stateState += 1;
}
if (this.stateState == 2) {
this.stateState = 0;
this.inputState = 3;
};
break;
case 3: //go to next word uwu
if (this.hVowelsK.includes(key)) {
this.inputFull.pop();
let ic = this.inputCurrent;
let k = key;
this.imePush();
this.inputFull.pop();
this.inputFull.push(this.getUnicodeConsonant(ic, k));
this.inputCurrent = "";
this.inputState = 2;
} else {
this.imePush();
this.imeInput(key);
}
break;
}
}
}

56
ime.txt Normal file
View File

@@ -0,0 +1,56 @@
Description of IME:
5 states:
- STARTING
- COMPOSING
- TRAILING
Nomenclature: [Whole] / [Up|Down]
At any times, enter can be pressed to finish the input process.
Pressing enter with input process already finished will send the message.
STATE 1 - STARTING
Any first letter input is displayed as non-composing non-trailing symbol.
The big standalone variant.
Consonant [K]
Vowel [A]
If CONSONANT was inputted:
- Move to COMPOSING if next a VOWEL is inputted.
- Repeat this step if not, but adding the input as a trailing letter instead (uppercase). This can only happen once.
If VOWEL was inputted, move to TRAILING.
STATE 2 - COMPOSING
Only vowels are inputted. It is transcribed to heonian as a downside letter.
Vowel -> [K|A]
Move to TRAILING.
STATE 3 - TRAILING. (UP TO 2 TIMES)
Any letter input is displayed as a trailing symbol.
Aka uppercase.
1-3 -> [A][N| ]
1-3-3 -> [A][N| ][N| ]
1-2-3 -> [K|A][N| ]
1-2-3-3 -> [K|A][N| ][N| ]
1-1-2-3 -> [K][K|A][N| ]
1-1-2-3-3 -> [K][K|A][N| ][N| ]
This process can be repeated up to two times.
https://cronut.cafe/~lustlion/myrheon/test/
0xE -> Heonian Letter
next two digits: Vowels / What Consonant
last digit: Standalone / Trailing / Composing
simplified:
1. First letter inputted is standalone except if composing.
2. There can only be one composing per syllable, if it manages to go composing it goes to trailing.
3. You can input up to two letters before either composing or ending the syllable.
4. You can have 0, 1 or 2 trailing letters.

View File

@@ -13,31 +13,31 @@ LU'NYA
(po'nyash!)
ESH'NYUI
ba yu e wawote to pu mipura lili'nya dre?
ba yu e wawote to pu mipura lili'nya dre?
r uwu
LU'NYA
relfur chu mya pu yu mya relfur lup apatka'nya faka'nya'pash ponme mya wawote polika'nya peekaka'nya'pash.
ESH'NYUI
mi'shi'pash~
mi'shi'pashshu
balfur yu e ton polika'nya dre?
LU'NYA
mishi'pash!!
relfurla mya ton polika'nya yu meluton ka'nya!
mishi'pash!!
relfurla mya ton polika'nya yu meluton ka'nya!
balfurla yu dra?
ESH'NYUI
relfurla yu esh'dre mya ton polika'nya yu puroton ka'nya~
relfur yu shi'ro'bae'pu yu pon'ya ka'nya~
relfurla yu esh'dre mya ton polika'nya yu puroton ka'nyashu
relfur yu shi'ro'bae'pu yu pon'ya ka'nyashu
LU'NYA
puroton yu ponya ton ka'nya!
ESH'NYUI
be'nyui-rerenlafura yu meluton mimifaka'nya…
relfur yu meluton mimiku'pash~
relfur yu meluton mimiku'pashshu
LU'NYA
o'o, relfur chu parefaka'nya…
@@ -45,23 +45,23 @@ LU'NYA
ESH'NYUI
uu, relfur yu naomiminku mya mimifuku mya ton ka'nya...
relfur yu guraton to meluton mimifuku..
relfur yu ton mimiku'pash~
relfur yu guraton to meluton mimifuku..
relfur yu ton mimiku'pashshu
LU'NYA
ishi-balfur yu mishi'pash!
ishi-balfur yu mishi'pash!
balfur chu mya arilaen yu en ka'nya peekaka'nya fa'dre?
ESH'NYUI
i eshnyui_blush.png
yesh-balfur yu mishi'pash~
(>///////////////<)
yesh-balfur yu mishi'pashshu
r (>///////////////<)
relfur yu ari'laen parefaka'nya, balfur yu pareka'nya dra?
LU'NYA
relfur chu arilaen dedaka'nya.
imanla rila shashka'nya'pash.
imanla shoo chu ike to pikeshe ka'nya.
relfur chu arilaen dedaka'nya.
imanla rila shashka'nya'pash.
imanla shoo chu ike to pikeshe ka'nya.
/
relfur chu arilaenlan luka'nya'pash.
@@ -70,5 +70,5 @@ i eshnyui.png
arilaenla shoo chu pikeshe fuka'nya'bash dra?
LU'NYA
gao chu relfur yu fayu kan'ya.
gao chu relfur yu fayu kan'ya.
relfur chu arilaen dedaka'nya.

View File

@@ -1,23 +1,40 @@
ITS ME PEKORA
d deez
r hiiiii!!!!
! uwu
NOUNS
d nya
ren
renla
renlan
relfur
renlafura
m
VERBS
r TENSES
utiku
utikanya
utikome
/
r FORMAL
utika'nya
utikome
/
r INFORMAL
uti'nya
uti'me
/
r FEELING
utikupash
utifakupash
utikufapash
utifakufapash
/
r IMPERATIVE
utikudash
utifakudash
utikufadash
utifaku
HOLY SHIT REMI
d a
amogus
it's meee pekora!!!!
i eshnyui.png
d yolo
so cool
so cool
so cool
how this work owo
so cool
so uwu
very good

304
main.js
View File

@@ -1,64 +1,265 @@
//since this _entire thing_ will be generated,
//you could "theoretically" (you definitive can)
//just sorta. skip the whole "scan all words" bit,
//which is why that's in a separate function
let words = {}
let currentFont = "r";
let timeout = "";
let badge_type = "#696969"
let badge_generic = "#393939"
let badge_register= "#fed100"
let badge_number = "#420690"
let badge_case = "#690420"
let badge_tense = "#00dd00"
let badge_mood = "#dd00dd"
let badge_negation = "#133337"
let quirkBadges = {
"present-tense": {
"name": "Present tense",
"description": "The word is in the present tense.",
"color": "#00dd00",
"type": "Tense",
"bending": "ka'nya"
// TYPES
"verb": {
"name": "Verb",
"description": "This word expresses an action that the subject of the sentence performs.",
"color": badge_type,
"type": "Type",
"bending": "-ku"
},
"past-tense": {
"name": "Past tense",
"description": "The word is in the past tense.",
"color": "#dd00dd",
"type": "Tense",
"bending": "kome"
"marker": {
"name": "marker",
"description": "This word accomplishes some syntactic purpose in the sentence.",
"color": badge_type,
"type": "Type",
"bending": ""
},
"noun": {
"name": "Noun",
"description": "This word refers to a concept.",
"color": badge_type,
"type": "Type",
"bending": ""
},
"pronoun": {
"name": "Pronoun",
"description": "This word occupies the place of a noun.",
"color": badge_type,
"type": "Type",
"bending": ""
},
"modifier": {
"name": "Modifier",
"description": "This word modifies another word to specify meaning.",
"color": badge_type,
"type": "Type",
"bending": ""
},
"expression": {
"name": "Expression",
"description": "This is an idiomatic expression.",
"color": badge_type,
"type": "Type",
"bending": ""
},
// FORMAL REGISTER
"formal-n1": {
"name": "Formal",
"description": "This word is used in formal or sincere settings.",
"color": badge_register,
"type": "Register",
"bending": "-lfur"
},
"formal-n2": {
"name": "Formal",
"description": "This word is used in formal or sincere settings.",
"color": badge_register,
"type": "Register",
"bending": "-lafura"
},
"formal-v1": {
"name": "Formal",
"description": "This word is used in formal or sincere settings.",
"color": badge_register,
"type": "Register",
"bending": "ku -> kanya"
},
"formal-v2": {
"name": "Formal",
"description": "This word is used in formal or sincere settings.",
"color": badge_register,
"type": "Register",
"bending": "ku -> kome"
},
// INFORMAL REGISTER
"informal-v1": {
"name": "Informal",
"description": "This word is NOT used in formal or sincere settings.",
"color": badge_register,
"type": "Register",
"bending": "ku -> nya"
},
"informal-v2": {
"name": "Informal",
"description": "This word is NOT used in formal or sincere settings.",
"color": badge_register,
"type": "Register",
"bending": "ku -> me"
},
// POSSESIVES
"genitive": {
"name": "Generic Possesive",
"description": "This word is describing a generic possesive relationship.",
"color": badge_case,
"type": "Case",
"bending": "-lan"
},
"possesive": {
"name": "Specific Possesive",
"description": "This word is describing a specific possesive relationship.",
"color": badge_case,
"type": "Case",
"bending": "-la"
},
// NUMBER
"dual": {
"name": "Dual",
"description": "This word is denoted as refering to exactly two entities.",
"color": badge_number,
"type": "Number",
"bending": ""
},
"plural": {
"name": "Plural",
"description": "This word is denoted as refering to at least more than one entity.",
"color": badge_number,
"type": "Number",
"bending": "-n"
},
// PRESENT TENSE
"present-tense-formal": {
"name": "Present",
"description": "This word is in the present tense.",
"color": badge_tense,
"type": "Tense",
"bending": "ku → ka'nya"
},
"present-tense-informal": {
"name": "Present",
"description": "This word is in the present tense.",
"color": badge_tense,
"type": "Tense",
"bending": "ku → nya"
},
// PAST TENSE
"past-tense-formal": {
"name": "Past",
"description": "This word is in the past tense.",
"color": badge_tense,
"type": "Tense",
"bending": "ku → kome"
},
"past-tense-informal": {
"name": "Past",
"description": "This word is in the past tense.",
"color": badge_tense,
"type": "Tense",
"bending": "ku → me"
},
// VOLITIONAL
"volitional-mood": {
"name": "Feeling mood",
"description": "A feeling,",
"color": "#dd00dd",
"name": "Feeling",
"description": "This word expresses a feeling or craving mood.",
"color": badge_mood,
"type": "Mood",
"bending": "pash"
"bending": "-pash"
},
"volitional-mood-negated": {
"name": "Negated Feeling",
"description": "This word denies feeling or craving mood.",
"color": badge_mood,
"type": "Mood",
"bending": "-fapash"
},
// IMPERATIVE
"imperative-mood": {
"name": "Imperative mood",
"description": "Commanding mood.",
"color": "#dd0000",
"name": "Imperative",
"description": "This word expresses a imperative mood.",
"color": badge_mood,
"type": "Mood",
"bending": "dash"
"bending": "-dash"
},
"imperative-mood-negated": {
"name": "Negated Imperative",
"description": "This word denies a imperative mood.",
"color": badge_mood,
"type": "Mood",
"bending": "-fadash"
},
// SHY
"shy-mood": {
"name": "Shy mood",
"description": "Shy mood.",
"color": "#dddd00",
"name": "Shy",
"description": "This word expresses a shy mood.",
"color": badge_mood,
"type": "Mood",
"bending": "bash"
"bending": "-bash"
},
"shy-mood-negated": {
"name": "Negated Shy",
"description": "This word denies a shy mood.",
"color": badge_mood,
"type": "Mood",
"bending": "-fabash"
},
// THREAT
"threat-mood": {
"name": "Threat mood",
"description": "Threat mood.",
"color": "#00dddd",
"name": "Threat",
"description": "This word expresses a threatening mood.",
"color": badge_mood,
"type": "Mood",
"bending": "tash"
"bending": "-tash"
},
"threat-mood-negated": {
"name": "Negated Threat",
"description": "This word denies a threatening mood.",
"color": badge_mood,
"type": "Mood",
"bending": "-fatash"
},
// COMF
"comfy-mood": {
"name": "Comfort",
"description": "This word expresses a comfortable mood.",
"color": badge_mood,
"type": "Mood",
"bending": "-shu"
},
"comfy-mood-negated": {
"name": "Negated Comfort",
"description": "This word denies a comfortable mood.",
"color": badge_mood,
"type": "Mood",
"bending": "-fashu"
},
// EXCITEMENT
"excited-mood": {
"name": "Excitement",
"description": "This word expresses a excited mood.",
"color": badge_mood,
"type": "Mood",
"bending": "-ha"
},
"excited-mood-negated": {
"name": "Negated Excitement",
"description": "This word denies a excited mood.",
"color": badge_mood,
"type": "Mood",
"bending": "-faha"
},
// NEGATION
"negated": {
"name": "Negated",
"description": "The word is negated.",
"color": "#7777dd",
"name": "Negative",
"description": "The word is expressing a negated meaning.",
"color": badge_negation,
"type": "Negation",
"bending": "fa"
"bending": "fa-"
},
// UNKNOWN
"unknown-tag": {
"name": "Unknown tag",
"color": "#393939",
@@ -73,7 +274,6 @@ function init() {
document.querySelector("#popup-container").style.pointerEvents = "none";
}
});
// above are commented out until wordlist is added~
document.querySelector("#font-button").addEventListener("click", () => {fontButton();});
}
@@ -91,44 +291,46 @@ function showPopup(ogword, word, quirks = "") {
let c = document.querySelector("#popup-container");
word = cleanWord(word);
if (currentFont == "r") {
p.querySelector("h1").innerText = words[word]["romanizationProper"];
p.querySelector("#popup-heo").innerText = words[word]["heonian"];
p.querySelector("h1").innerText = ogword;
p.querySelector("#popup-heo").innerText = words[word]["romanizationProper"] + " | " + words[word]["heonian"];
p.querySelector("h1").style.fontFamily = "var(--font-normal)";
p.querySelector("#popup-e").innerText = "heonian: ";
} else {
p.querySelector("h1").innerText = words[word]["heonian"];
p.querySelector("#popup-heo").innerText = words[word]["romanizationProper"];
p.querySelector("h1").innerText = ogword;
p.querySelector("#popup-heo").innerText = words[word]["heonian"] + " | " + words[word]["romanizationProper"];
p.querySelector("h1").style.fontFamily = "var(--font-heonian)";
p.querySelector("#popup-e").innerText = "romanization: ";
}
p.querySelector("#popup-type").innerText = words[word]["type"];
//p.querySelector("#popup-type").innerText = words[word]["type"];
p.querySelector("#popup-meaning").innerText = words[word]["meaning"];
p.querySelector("#popup-quirks").innerHTML = "";
if (quirks.trim() != "") {
p.querySelector("#popup-quirks-container").style.display = "block";
p.querySelector("#popup-middle").style.display = "block";
let qyuirks = quirks.split(" ");
qyuirks.forEach(quirk => {
let badge = document.createElement("div");
badge.classList.add("badge");
try {
badge.style.backgroundColor = quirkBadges[quirk]["color"];
badge.style.boxShadow = "0px 0px 4px " + quirkBadges[quirk]["color"] + "cc";
badge.innerText = quirkBadges[quirk]["name"];
badge.onclick = () => {
p.querySelector("#spacerhide").style.display = "none";
p.querySelector("#popup-middle").style.display = "none";
p.querySelector("h1").innerText = quirkBadges[quirk]["name"];
p.querySelector("#popup-meaning").innerText = quirkBadges[quirk]["description"];
p.querySelector("#popup-type").innerText = quirkBadges[quirk]["type"];
p.querySelector("#popup-quirks-container").style.display = "none";
p.querySelector("#popup-e").innerText = "bending: ";
//p.querySelector("#popup-type").innerText = quirkBadges[quirk]["type"];
p.querySelector("#popup-heo").innerText = quirkBadges[quirk]["bending"];
}
} catch (e) {
badge.style.backgroundColor = quirkBadges["unknown-tag"]["color"];
badge.style.boxShadow = "0px 0px 4px #" + quirkBadges["unknown-tag"]["color"] + "cc";
badge.innerText = quirkBadges["unknown-tag"]["name"];
}
p.querySelector("#popup-quirks").appendChild(badge);
p.querySelector("#spacerhide").style.display = "block";
});
} else {
p.querySelector("#popup-quirks-container").style.display = "none";
p.querySelector("#spacerhide").style.display = "none";
p.querySelector("#popup-middle").style.display = "none";
}
c.style.opacity = 1;
c.style.pointerEvents = "all";
@@ -194,7 +396,7 @@ function createWordList() { //sometimes i really dislike javascript..
words[n]["heonian"] = e[0].innerText;
words[n]["romanization"] = e[1].innerText.replace(". ", "");
words[n]["romanizationProper"] = e[1].innerText;
words[n]["type"] = e[2].innerText;
//words[n]["type"] = e[2].innerText;
words[n]["meaning"] = e[3].innerText;
}
});

0
test.htm Normal file
View File

1658
test.html

File diff suppressed because it is too large Load Diff

View File

@@ -13,6 +13,7 @@
--right-color: #61ce61;
--font-normal: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
--font-heonian: "heonian", -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
--popup-bg: rgba(255,255,255,0.6);
}
@media (prefers-color-scheme: dark) {
@@ -24,6 +25,7 @@
--spacer-color-2: rgba(255, 255, 255, 0.2);
--left-color: rgb(38,37,40);
--right-color: #61ce61;
--popup-bg: rgba(30,30,30,0.6);
}
}
@@ -175,6 +177,8 @@ main {
#popup {
width: 300px;
background-color: var(--left-color);
-webkit-backdrop-filter: blur(20px);
backdrop-filter: blur(20px);
border-radius: 8px;
padding: 8px;
box-shadow: 0 0 8px rgba(0, 0, 0, 0.2);
@@ -184,6 +188,8 @@ main {
#smol-popup {
width: 200px;
background-color: var(--left-color);
-webkit-backdrop-filter: blur(20px);
backdrop-filter: blur(20px);
border-radius: 8px;
padding: 8px;
box-shadow: 0 0 8px rgba(0, 0, 0, 0.2);
@@ -192,24 +198,47 @@ main {
left: 0;
transition: opacity 0.3s;
text-align: center;
/* padding-top: 0px; account for Funny */
}
#popup h1 {
@supports (backdrop-filter: blur(10px)) or (--webkit-backdrop-filter: blur(10px)) {
#popup, #smol-popup {
background-color: var(--popup-bg);
}
}
#popup h1, #smol-popup h1 {
text-align: center;
}
#smol-popup h1 {
margin: 0;
}
#smol-popup p {
margin: 0;
}
#smol-popup p:last-child {
font-size: 0.75rem;
color: var(--spacer-color);
margin-top: 4px;
}
#popup-heo, #smol-heo {
font-family: "heonian";
font-family: var(--font-heonian);
text-align: center;
margin: 4px;
margin-bottom: 8px;
}
#popup-middle, #popup-meaning {
padding: 8px;
margin: 0;
}
#popup-quirks {
display: flex;
flex-flow: row wrap;
justify-content: space-around;
margin-top: 8px;
}
#popup-quirks * {