Compare commits
16 Commits
1888f794b1
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1b43c52f5d | ||
|
|
ec76802316 | ||
|
|
6da5e47e5c | ||
|
|
4111112ff3 | ||
|
|
82b751a9e5 | ||
|
|
1817ac9d9d | ||
| 87f1a59ceb | |||
|
|
941f701d7d | ||
|
|
3d0fc9145f | ||
|
|
81d25ec8f1 | ||
|
|
ee20f99f9c | ||
| f620bcf1f0 | |||
| 8095cae7cb | |||
| be9fe1e3a3 | |||
| cddd475909 | |||
| ef877a53bd |
6
.gitmodules
vendored
6
.gitmodules
vendored
@@ -1,3 +1,9 @@
|
|||||||
[submodule "heonian-content"]
|
[submodule "heonian-content"]
|
||||||
path = heonian-content
|
path = heonian-content
|
||||||
url = https://git.succubi.services/lustlion/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
85
color.lua
Normal 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
|
||||||
157
converter.lua
157
converter.lua
@@ -1,12 +1,62 @@
|
|||||||
require "r2h2_modified"
|
require "r2h2_modified"
|
||||||
|
require "color"
|
||||||
|
|
||||||
words = dofile("heonian-content/words.lua")
|
words = dofile("heonian-content/words.lua")
|
||||||
|
|
||||||
|
input = arg[1] or "input.txt"
|
||||||
|
|
||||||
function apply(text)
|
function apply(text)
|
||||||
print(text)
|
print(text)
|
||||||
end
|
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)
|
function process_content(content)
|
||||||
content = content .. " "
|
content = content .. " "
|
||||||
for i=1, 2 do
|
for i=1, 2 do
|
||||||
@@ -31,6 +81,7 @@ function process_content(content)
|
|||||||
new_word = strip_symbols(new_word)
|
new_word = strip_symbols(new_word)
|
||||||
new_word, indicators = revert_verbs(new_word, indicators)
|
new_word, indicators = revert_verbs(new_word, indicators)
|
||||||
new_word, indicators = revert_nouns(new_word,indicators)
|
new_word, indicators = revert_nouns(new_word,indicators)
|
||||||
|
new_word, indicators = categorize_word(new_word,indicators)
|
||||||
add_word(new_word)
|
add_word(new_word)
|
||||||
|
|
||||||
local html_stuff = [[
|
local html_stuff = [[
|
||||||
@@ -48,7 +99,7 @@ function process_content(content)
|
|||||||
html_stuff = string.gsub(html_stuff, "REPLACE_PRINT", REPLACE_PRINT)
|
html_stuff = string.gsub(html_stuff, "REPLACE_PRINT", REPLACE_PRINT)
|
||||||
end
|
end
|
||||||
|
|
||||||
local REPLACE_WORD = print_text
|
local REPLACE_WORD = strip_symbols(print_text)
|
||||||
while string.find(REPLACE_WORD, "%\'") do
|
while string.find(REPLACE_WORD, "%\'") do
|
||||||
REPLACE_WORD = string.gsub(REPLACE_WORD, "%\'", "$")
|
REPLACE_WORD = string.gsub(REPLACE_WORD, "%\'", "$")
|
||||||
end
|
end
|
||||||
@@ -89,7 +140,7 @@ function process_content(content)
|
|||||||
ac = string.sub(ac, string.find(ac, " ")+1)
|
ac = string.sub(ac, string.find(ac, " ")+1)
|
||||||
|
|
||||||
-- now we print the thing with teh appropiate indicators.
|
-- now we print the thing with teh appropiate indicators.
|
||||||
--print(print_text, table.unpack(indicators))
|
-- printD(print_text, table.unpack(indicators))
|
||||||
end
|
end
|
||||||
apply_html("html/convo/text/end.html")
|
apply_html("html/convo/text/end.html")
|
||||||
end
|
end
|
||||||
@@ -126,6 +177,7 @@ function add_word(str)
|
|||||||
end
|
end
|
||||||
if add then
|
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
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -159,11 +211,20 @@ function check_symbol(str)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function find_n_replace(str, tbl,find,repl,indicator)
|
function find_n_replace(str, tbl,find,repl,indicator, caution)
|
||||||
|
if not in_dictionary(str) then
|
||||||
if string.find(str, find) 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)
|
str = string.gsub(str,find, repl)
|
||||||
table.insert(tbl,indicator)
|
table.insert(tbl,indicator)
|
||||||
end
|
end
|
||||||
|
else
|
||||||
|
str = string.gsub(str,find, repl)
|
||||||
|
table.insert(tbl,indicator)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
return str, tbl
|
return str, tbl
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -173,35 +234,95 @@ function in_dictionary(str)
|
|||||||
end
|
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
|
if not in_dictionary(str) then
|
||||||
local flen = string.len(match)
|
local flen = string.len(match)
|
||||||
if string.sub(str, -flen) == match
|
if string.sub(str, -flen) == match then
|
||||||
and string.sub(str,-3) ~= "ton" then
|
str = string.sub(str, 0,string.len(str)-flen) .. repl
|
||||||
str = string.sub(str, 0,string.len(str)-flen)
|
if tbl then
|
||||||
table.insert(tbl,indicator)
|
for _, v in pairs(indicators) do
|
||||||
|
table.insert(tbl,v)
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return str, tbl
|
return str, tbl
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
function revert_nouns(str, tbl)
|
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,"lan","","genitive")
|
||||||
str, tbl = check_morphemes(str,tbl,"la","","possesive")
|
str, tbl = check_morphemes(str,tbl,"la","","possesive")
|
||||||
str, tbl = check_morphemes(str,tbl,"n","","plural")
|
str, tbl = check_morphemes(str,tbl,"n","","plural")
|
||||||
str, tbl = check_morphemes(str,tbl,"lfur","","formal1")
|
|
||||||
str, tbl = check_morphemes(str,tbl,"lafura","","formal2")
|
|
||||||
return str, tbl
|
return str, tbl
|
||||||
end
|
end
|
||||||
|
|
||||||
function revert_verbs(str, tbl)
|
function revert_verbs(str, tbl)
|
||||||
str, tbl = find_n_replace(str, tbl,"kanya","ku","present-tense")
|
-- moods first
|
||||||
str, tbl = find_n_replace(str, tbl,"kome","ku","past-tense")
|
str, tbl = revert_mood(str, tbl,"pash","","volitional-mood")
|
||||||
str, tbl = find_n_replace(str, tbl,"kupash","ku","volitional-mood")
|
str, tbl = revert_mood(str, tbl,"dash","","imperative-mood")
|
||||||
str, tbl = find_n_replace(str, tbl,"kudash","ku","imperative-mood")
|
str, tbl = revert_mood(str, tbl,"bash","","shy-mood")
|
||||||
str, tbl = find_n_replace(str, tbl,"kubash","ku","shy-mood")
|
str, tbl = revert_mood(str, tbl,"tash","","threat-mood")
|
||||||
str, tbl = find_n_replace(str, tbl,"kutash","ku","threat-mood")
|
str, tbl = revert_mood(str, tbl,"shu","","comfy-mood")
|
||||||
str, tbl = find_n_replace(str, tbl,"faku","ku","negated")
|
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
|
return str, tbl
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -283,7 +404,7 @@ end
|
|||||||
-- lets make the html
|
-- lets make the html
|
||||||
apply_html("html/start.html")
|
apply_html("html/start.html")
|
||||||
-- get text
|
-- get text
|
||||||
local file = io.open("input.txt","r")
|
local file = io.open(input,"r")
|
||||||
local text = file:read("*all")
|
local text = file:read("*all")
|
||||||
file:close()
|
file:close()
|
||||||
|
|
||||||
|
|||||||
574
generator.lua
Normal file
574
generator.lua
Normal 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
49
get_words.lua
Normal 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
|
||||||
Submodule heonian-content updated: 6a40a51d6e...d0d8345c1f
1
heonian-ime
Submodule
1
heonian-ime
Submodule
Submodule heonian-ime added at c8157f53b1
@@ -2,9 +2,8 @@
|
|||||||
<div id="popup">
|
<div id="popup">
|
||||||
<h1>um</h1>
|
<h1>um</h1>
|
||||||
<p id="popup-heo"></p>
|
<p id="popup-heo"></p>
|
||||||
<div class="spacer"></div>
|
<div id="spacerhide" class="spacer"></div>
|
||||||
<div id="popup-middle">
|
<div id="popup-middle">
|
||||||
<b>type: </b><span id="popup-type"></span><br>
|
|
||||||
<div id="popup-quirks-container"><span id="popup-quirks"></span></div>
|
<div id="popup-quirks-container"><span id="popup-quirks"></span></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="spacer"></div>
|
<div class="spacer"></div>
|
||||||
|
|||||||
2
ime.html
2
ime.html
@@ -23,6 +23,6 @@
|
|||||||
<textarea type="text" class="ime">
|
<textarea type="text" class="ime">
|
||||||
</textarea>
|
</textarea>
|
||||||
|
|
||||||
<script src="./ime.js" async defer></script>
|
<script src="./heonian-ime/ime.js" async defer></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
599
ime.js
599
ime.js
@@ -1,161 +1,38 @@
|
|||||||
let input = [];
|
// 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 currentWord = [];
|
// let h;
|
||||||
|
|
||||||
let selected = -1;
|
|
||||||
|
|
||||||
window.onload = () => {
|
window.onload = () => {
|
||||||
document.querySelectorAll(".ime").forEach(input => {
|
document.querySelectorAll(".ime").forEach(input => {
|
||||||
input.addEventListener("keydown", (key) => {
|
h = new HeonianIME(input);
|
||||||
imeDown(key, input);
|
|
||||||
});
|
|
||||||
input.addEventListener("mousedown", (e) => {
|
|
||||||
e.preventDefault();
|
|
||||||
input.focus();
|
|
||||||
imeUpdate(input);
|
|
||||||
})
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function imeDown(keyEvent, inputField) {
|
class HeonianIME {
|
||||||
keyEvent.preventDefault();
|
constructor(what) {
|
||||||
switch (keyEvent.key) {
|
this.input = [];
|
||||||
case "Backspace":
|
this.currentWord = [];
|
||||||
if (selected == -1) {
|
this.selected = -1;
|
||||||
if (currentWord.join("") == "") {
|
|
||||||
currentWord = input.pop() || [];
|
|
||||||
} else {
|
|
||||||
imeRestore(currentWord);
|
|
||||||
// currentWord.pop();
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
imeRestore(input[selected]);
|
|
||||||
// input[selected].pop();
|
|
||||||
if (input[selected].join("") == "") {
|
|
||||||
input.splice(selected,1);
|
|
||||||
imeMove("left");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case "Enter":
|
|
||||||
if (selected == -1) {
|
|
||||||
if (currentWord.join() == "") { //blame js :)
|
|
||||||
let s = document.createElement("p");
|
|
||||||
s.innerText = input.join("");
|
|
||||||
document.body.appendChild(s);
|
|
||||||
input = [];
|
|
||||||
selected = -1;
|
|
||||||
} else {
|
|
||||||
input.push(currentWord);
|
|
||||||
currentWord = [];
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (selected+1 >= input.length) {
|
|
||||||
selected = -1;
|
|
||||||
} else {
|
|
||||||
selected += 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
imeReset();
|
|
||||||
break;
|
|
||||||
case "Space":
|
|
||||||
//adds a '
|
|
||||||
break;
|
|
||||||
case "ArrowLeft":
|
|
||||||
imeMove("left");
|
|
||||||
break;
|
|
||||||
case "ArrowRight":
|
|
||||||
imeMove("right");
|
|
||||||
break;
|
|
||||||
case "ArrowDown":
|
|
||||||
imeMove("start");
|
|
||||||
break;
|
|
||||||
case "ArrowUp":
|
|
||||||
imeMove("end");
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
imeInput(keyEvent.key);
|
|
||||||
if (selected == -1) {
|
|
||||||
currentWord = inputFull;
|
|
||||||
} else {
|
|
||||||
input[selected] = inputFull;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
imeUpdate(inputField);
|
|
||||||
}
|
|
||||||
|
|
||||||
function imeUpdate(inputField) {
|
this.inputState = 0; //STARTING, COMPOSTING, TRAILING, Fucking Nothing, ...cleanup
|
||||||
let renderText = "";
|
this.stateState = 0; //depends on the state
|
||||||
input.forEach((w) => {
|
this.inputFull = [];
|
||||||
renderText += w.join("");
|
this.inputCurrent = "";
|
||||||
})
|
|
||||||
inputField.value = renderText + currentWord.join("");
|
|
||||||
if (selected == -1) {
|
|
||||||
inputField.setSelectionRange(renderText.length, renderText.length+currentWord.join("").length);
|
|
||||||
} else {
|
|
||||||
from = 0;
|
|
||||||
for (let x = 0; x < selected; x++) {
|
|
||||||
from += input[x].join("").length;
|
|
||||||
}
|
|
||||||
to = from+input[selected].join("").length;
|
|
||||||
inputField.setSelectionRange(from, to);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function clamp(min, max, value) {
|
this.ourHtml;
|
||||||
return Math.max(min, Math.min(max, value));
|
this.oldText = [];
|
||||||
}
|
|
||||||
|
|
||||||
function imeMove(direction) {
|
this.hVowels = { //standalone, composing, trailing
|
||||||
let d = 1;
|
|
||||||
if (currentWord.join("") != "") {
|
|
||||||
input.push(currentWord);
|
|
||||||
currentWord = [];
|
|
||||||
d = 2;
|
|
||||||
}
|
|
||||||
switch (direction) {
|
|
||||||
case "start":
|
|
||||||
selected = 0;
|
|
||||||
break;
|
|
||||||
case "end":
|
|
||||||
selected = -1;
|
|
||||||
break;
|
|
||||||
case "left":
|
|
||||||
if (selected == -1) selected = input.length;
|
|
||||||
selected -= 1 * d;
|
|
||||||
if (selected != -1) {
|
|
||||||
selected = clamp(0,input.length,selected);
|
|
||||||
//is there even a point in clamping it here,,,,
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case "right":
|
|
||||||
selected += 1 * d;
|
|
||||||
selected = clamp(0,input.length,selected);
|
|
||||||
//tbh same here, like.
|
|
||||||
//oh well ig ???/
|
|
||||||
if (selected == input.length) {
|
|
||||||
selected = -1;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
imeReset();
|
|
||||||
}
|
|
||||||
|
|
||||||
let inputState = 0; //STARTING, COMPOSTING, TRAILING, Fucking Nothing, ...cleanup
|
|
||||||
let stateState = 0; //depends on the state
|
|
||||||
let inputFull = [];
|
|
||||||
let inputCurrent = "";
|
|
||||||
|
|
||||||
let hVowels = { //standalone, composing, trailing
|
|
||||||
"a": ["0", "5", "A"],
|
"a": ["0", "5", "A"],
|
||||||
"e": ["1", "6", "B"],
|
"e": ["1", "6", "B"],
|
||||||
"i": ["2", "7", "C"],
|
"i": ["2", "7", "C"],
|
||||||
"o": ["3", "8", "D"],
|
"o": ["3", "8", "D"],
|
||||||
"u": ["4", "9", "E"]
|
"u": ["4", "9", "E"]
|
||||||
};
|
};
|
||||||
|
|
||||||
let hConsonants = { //0 = standalone, 1 = composing, 2-6 = vowels
|
this.hConsonants = { //0 = standalone, 1 = composing, 2-6 = vowels
|
||||||
"g": "01",
|
"g": "01",
|
||||||
"s": "02",
|
"s": "02",
|
||||||
"r": "03",
|
"r": "03",
|
||||||
@@ -172,226 +49,424 @@ let hConsonants = { //0 = standalone, 1 = composing, 2-6 = vowels
|
|||||||
"b": "0E",
|
"b": "0E",
|
||||||
"d": "0F",
|
"d": "0F",
|
||||||
"h": "10",
|
"h": "10",
|
||||||
};
|
};
|
||||||
|
|
||||||
function getUnicodeVowel(vowel, sot) {
|
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 == "standalone") sot = 0;
|
||||||
if (sot == "composing") sot = 1;
|
if (sot == "composing") sot = 1;
|
||||||
if (sot == "trailing") sot = 2;
|
if (sot == "trailing") sot = 2;
|
||||||
return String.fromCharCode(parseInt("E00" + hVowels[vowel][sot], 16));
|
return String.fromCharCode(parseInt("E00" + this.hVowels[vowel][sot], 16));
|
||||||
}
|
}
|
||||||
|
|
||||||
function getUnicodeConsonant(consonant, scv) {
|
getUnicodeConsonant(consonant, scv) {
|
||||||
if (scv == "standalone") {scv = 0;}
|
if (scv == "standalone") { scv = 0; }
|
||||||
else if (scv == "trailing") {scv = 1;}
|
else if (scv == "trailing") { scv = 1; }
|
||||||
else {scv = Number(hVowels[scv][0])+2}
|
else {
|
||||||
return String.fromCharCode(parseInt("E" + hConsonants[consonant] + "" + scv, 16));
|
scv = Number(this.hVowels[scv][0]) + 2
|
||||||
}
|
}
|
||||||
|
return String.fromCharCode(parseInt("E" + this.hConsonants[consonant] + "" + scv, 16));
|
||||||
|
}
|
||||||
|
|
||||||
function inverse(obj){
|
inverse(obj) {
|
||||||
var retobj = {};
|
var retobj = {};
|
||||||
for(var key in obj){
|
for (var key in obj) {
|
||||||
retobj[obj[key]] = key;
|
retobj[obj[key]] = key;
|
||||||
}
|
}
|
||||||
return retobj;
|
return retobj;
|
||||||
}
|
|
||||||
|
|
||||||
let hVowelsK = Object.keys(hVowels)
|
|
||||||
let hConsonantsK = Object.keys(hConsonants);
|
|
||||||
let hConsonantsR = inverse(hConsonants);
|
|
||||||
|
|
||||||
function debugInput(key) {
|
|
||||||
console.log("pre "+key+": inputstate - "+inputState +", statestate - "+ stateState);
|
|
||||||
console.log("inputfull: " + inputFull.join(" ") + ", inputcurrent:" + inputCurrent);
|
|
||||||
imeInput(key);
|
|
||||||
console.log("post "+key+": inputstate - "+inputState +", statestate - "+ stateState);
|
|
||||||
console.log("inputfull: " + inputFull.join(" ") + ", inputcurrent:" + inputCurrent);
|
|
||||||
console.log("------------------------------")
|
|
||||||
}
|
|
||||||
|
|
||||||
function imeReset() {
|
|
||||||
stateState = 0;
|
|
||||||
inputState = 0;
|
|
||||||
inputFull = [];
|
|
||||||
inputCurrent = "";
|
|
||||||
if (selected == -1) {
|
|
||||||
currentWord = [];
|
|
||||||
} else {
|
|
||||||
input[selected] = [];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
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] = [];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function imeInfo(decHex) {
|
imeInfo(decHex) {
|
||||||
try {
|
try {
|
||||||
let hex = decHex.codePointAt(0).toString(16);
|
let hex = decHex.codePointAt(0).toString(16).split("");
|
||||||
hex[1] = parseInt(hex[1], 16);
|
hex[1] = hex[1].toString(16);//parseInt(hex[1], 16);
|
||||||
hex[2] = parseInt(hex[2], 16);
|
hex[2] = hex[2].toString(16);//parseInt(hex[2], 16);
|
||||||
hex[3] = parseInt(hex[3], 16);
|
hex[3] = hex[3].toString(16);//parseInt(hex[3], 16);
|
||||||
let ka = (hex[1] == 0 && hex[2] == 0) ? "a" : "k";
|
let ka = (hex[1] == 0 && hex[2] == 0) ? "a" : "k";
|
||||||
if (ka == "k") {
|
if (ka == "k") {
|
||||||
if (hex[3] == 1) {
|
if (hex[3] == 1) {
|
||||||
//trailing
|
//trailing
|
||||||
return([ka,"trailing"])
|
return ([ka, "trailing"])
|
||||||
} else if (hex[3] == 0) {
|
} else if (hex[3] == 0) {
|
||||||
//standalone
|
//standalone
|
||||||
//full reset / no restore necessary
|
//full reset / no restore necessary
|
||||||
return([ka,"standalone"])
|
return ([ka, "standalone"])
|
||||||
} else {
|
} else {
|
||||||
//composing
|
//composing
|
||||||
return([ka,"composing"])
|
return ([ka, "composing"])
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (hex[3] <= 8) {
|
if (hex[3] <= 8) {
|
||||||
//standalone
|
//standalone
|
||||||
return([ka,"standalone"])
|
return ([ka, "standalone"])
|
||||||
} else {
|
} else {
|
||||||
//trailing
|
//trailing
|
||||||
return([ka,"trailing"])
|
return ([ka, "trailing"])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch {
|
} catch {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function imeChange(inState, stState, pop, array) {
|
imeChange(inState, stState, pop, array) {
|
||||||
inputState = inState;
|
this.inputState = inState;
|
||||||
stateState = stState;
|
this.stateState = stState;
|
||||||
if (pop) {
|
if (pop) {
|
||||||
array.pop();
|
array.pop();
|
||||||
}
|
}
|
||||||
inputFull = array;
|
this.inputFull = array;
|
||||||
}
|
}
|
||||||
|
|
||||||
function imeRestore(array) {
|
// @remi@snug.moe:
|
||||||
let hex = array[array.length-1].codePointAt(0).toString(16);
|
// we made a backspace key that works!!!!!!!
|
||||||
hex[1] = parseInt(hex[1], 16);
|
// @meduelelateta@sweet.succubi.services:
|
||||||
hex[2] = parseInt(hex[2], 16);
|
// ari fell asleep
|
||||||
hex[3] = parseInt(hex[3], 16);
|
|
||||||
let previous = imeInfo(array[array.length-2])[1];
|
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";
|
let ka = (hex[1] == 0 && hex[2] == 0) ? "a" : "k";
|
||||||
if (ka == "k") {
|
if (ka == "k") {
|
||||||
if (hex[3] == 1) {
|
if (hex[3] == 1) {
|
||||||
//trailing
|
//trailing
|
||||||
if (previous == "trailing") {
|
if (previous == "trailing") {
|
||||||
//trailing twice
|
//trailing twice
|
||||||
console.log("2.1");
|
// console.log("2.1");
|
||||||
imeChange(2,1,true,array);
|
this.imeChange(2, 1, true, array);
|
||||||
} else {
|
} else {
|
||||||
//trailing once
|
//trailing once
|
||||||
console.log("2.0");
|
// console.log("2.0");
|
||||||
imeChange(2,0,true,array);
|
this.imeChange(2, 0, true, array);
|
||||||
}
|
}
|
||||||
} else if (hex[3] == 0) {
|
} else if (hex[3] == 0) {
|
||||||
console.log(array.length);
|
|
||||||
if (array.length != 1) {
|
if (array.length != 1) {
|
||||||
//0.1, i think?
|
//0.1, i think?
|
||||||
console.log("0.1");
|
// console.log("0.1");
|
||||||
imeChange(0,1,true,array);
|
this.imeChange(0, 1, true, array);
|
||||||
} else {
|
} else {
|
||||||
//standalone
|
//standalone
|
||||||
console.log("full reset");
|
// console.log("full reset");
|
||||||
imeReset();
|
this.imeReset();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
//composing
|
//composing
|
||||||
if (previous == "standalone") {
|
if (previous == "standalone") {
|
||||||
//0.1??
|
//0.1??
|
||||||
//recreate?? last digit???
|
//recreate?? last digit???
|
||||||
let c = hConsonantsR[[hex[1], hex[2]].join("").toUpperCase()];
|
let c = this.hConsonantsR[[hex[1], hex[2]].join("").toUpperCase()];
|
||||||
array.pop();
|
array.pop();
|
||||||
array.push(getUnicodeConsonant(c, "standalone"));
|
array.push(this.getUnicodeConsonant(c, "standalone"));
|
||||||
inputCurrent = c;
|
this.inputCurrent = c;
|
||||||
|
|
||||||
console.log("0.1");
|
// console.log("0.1");
|
||||||
imeChange(0,1,false,array);
|
this.imeChange(0, 1, false, array);
|
||||||
} else {
|
} else {
|
||||||
//0.2???? fuck it lets try and find out ig
|
//0.2???? fuck it lets try and find out ig
|
||||||
//recreate?? last digit???
|
//recreate?? last digit???
|
||||||
let c = hConsonantsR[[hex[1], hex[2]].join("").toUpperCase()];
|
let c = this.hConsonantsR[[hex[1], hex[2]].join("").toUpperCase()];
|
||||||
array.pop();
|
array.pop();
|
||||||
array.push(getUnicodeConsonant(c, "standalone"));
|
array.push(this.getUnicodeConsonant(c, "standalone"));
|
||||||
inputCurrent = c;
|
this.inputCurrent = c;
|
||||||
|
|
||||||
console.log("0.2");
|
// console.log("0.2");
|
||||||
imeChange(0,2,false,array);
|
this.imeChange(0, 2, false, array);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (hex[3] <= 8) {
|
if (hex[3] <= 8) {
|
||||||
//standalone
|
//standalone
|
||||||
console.log("full reset");
|
// console.log("full reset");
|
||||||
imeReset();
|
this.imeReset();
|
||||||
} else {
|
} else {
|
||||||
//trailing
|
//trailing
|
||||||
if (previous == "trailing") {
|
if (previous == "trailing") {
|
||||||
//trailing twice
|
//trailing twice
|
||||||
console.log("2.1");
|
// console.log("2.1");
|
||||||
imeChange(2,1,true,array);
|
this.imeChange(2, 1, true, array);
|
||||||
} else {
|
} else {
|
||||||
//trailing once
|
//trailing once
|
||||||
console.log("2.0");
|
// console.log("2.0");
|
||||||
imeChange(2,0,true,array);
|
this.imeChange(2, 0, true, array);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
function imeInput(key) {
|
imeInput(key) {
|
||||||
key = key.toLowerCase();
|
key = key.toLowerCase();
|
||||||
if (!hConsonantsK.includes(key) && !hVowelsK.includes(key)) return;
|
if (!this.hConsonantsK.includes(key) && !this.hVowelsK.includes(key)) return;
|
||||||
switch (inputState) {
|
switch (this.inputState) {
|
||||||
case 0: //starting
|
case 0: //starting
|
||||||
if (stateState == 0) {
|
if (this.stateState == 0) {
|
||||||
if (hVowelsK.includes(key)) {
|
if (this.hVowelsK.includes(key)) {
|
||||||
inputFull.push(getUnicodeVowel(key, "standalone"));
|
this.inputFull.push(this.getUnicodeVowel(key, "standalone"));
|
||||||
inputState = 2;
|
this.inputState = 2;
|
||||||
} else {
|
} else {
|
||||||
inputFull.push(getUnicodeConsonant(key, "standalone"));
|
this.inputFull.push(this.getUnicodeConsonant(key, "standalone"));
|
||||||
stateState = 1;
|
this.stateState = 1;
|
||||||
inputCurrent = key;
|
this.inputCurrent = key;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
} else if (stateState == 1) {
|
} else if (this.stateState == 1) {
|
||||||
if (hVowelsK.includes(key)) {
|
if (this.hVowelsK.includes(key)) {
|
||||||
inputState = 1;
|
this.inputState = 1;
|
||||||
stateState = 0;
|
this.stateState = 0;
|
||||||
} else {
|
} else {
|
||||||
inputFull.push(getUnicodeConsonant(key, "trailing"));
|
this.inputFull.push(this.getUnicodeConsonant(key, "trailing"));
|
||||||
inputCurrent = key;
|
this.inputCurrent = key;
|
||||||
stateState = 2;
|
this.stateState = 2;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else if (stateState == 2) {
|
} else if (this.stateState == 2) {
|
||||||
if (hVowelsK.includes(key)) {
|
if (this.hVowelsK.includes(key)) {
|
||||||
inputState = 1;
|
this.inputState = 1;
|
||||||
stateState = 0;
|
this.stateState = 0;
|
||||||
} else break;
|
} else break;
|
||||||
}
|
}
|
||||||
case 1: //composing
|
case 1: //composing
|
||||||
if (hVowelsK.includes(key)) {
|
if (this.hVowelsK.includes(key)) {
|
||||||
inputState = 2;
|
this.inputState = 2;
|
||||||
inputFull.pop();
|
this.inputFull.pop();
|
||||||
inputFull.push(getUnicodeConsonant(inputCurrent, key));
|
this.inputFull.push(this.getUnicodeConsonant(this.inputCurrent, key));
|
||||||
inputCurrent = "";
|
this.inputCurrent = "";
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 2: //trailing
|
case 2: //trailing
|
||||||
if (hVowelsK.includes(key)) {
|
if (this.hVowelsK.includes(key)) {
|
||||||
inputFull.push(getUnicodeVowel(key, "trailing"));
|
if (this.stateState == 1 && this.inputCurrent != "") {
|
||||||
stateState += 1;
|
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 {
|
} else {
|
||||||
inputFull.push(getUnicodeConsonant(key, "trailing"));
|
this.inputFull.push(this.getUnicodeVowel(key, "trailing"));
|
||||||
stateState += 1;
|
this.inputCurrent = "";
|
||||||
|
this.stateState += 1;
|
||||||
}
|
}
|
||||||
if (stateState == 2) {
|
} else {
|
||||||
stateState = 0;
|
this.inputFull.push(this.getUnicodeConsonant(key, "trailing"));
|
||||||
inputState = 3;
|
this.inputCurrent = key;
|
||||||
|
this.stateState += 1;
|
||||||
}
|
}
|
||||||
|
if (this.stateState == 2) {
|
||||||
|
this.stateState = 0;
|
||||||
|
this.inputState = 3;
|
||||||
|
};
|
||||||
break;
|
break;
|
||||||
case 3: //go to next word uwu
|
case 3: //go to next word uwu
|
||||||
//todo :)
|
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;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
14
input.txt
14
input.txt
@@ -20,7 +20,7 @@ LU'NYA
|
|||||||
relfur chu mya pu yu mya relfur lup apatka'nya faka'nya'pash ponme mya wawote polika'nya peekaka'nya'pash.
|
relfur chu mya pu yu mya relfur lup apatka'nya faka'nya'pash ponme mya wawote polika'nya peekaka'nya'pash.
|
||||||
|
|
||||||
ESH'NYUI
|
ESH'NYUI
|
||||||
mi'shi'pash~
|
mi'shi'pashshu
|
||||||
balfur yu e ton polika'nya dre?
|
balfur yu e ton polika'nya dre?
|
||||||
|
|
||||||
LU'NYA
|
LU'NYA
|
||||||
@@ -29,15 +29,15 @@ LU'NYA
|
|||||||
balfurla yu dra?
|
balfurla yu dra?
|
||||||
|
|
||||||
ESH'NYUI
|
ESH'NYUI
|
||||||
relfurla yu esh'dre mya ton polika'nya yu puroton ka'nya~
|
relfurla yu esh'dre mya ton polika'nya yu puroton ka'nyashu
|
||||||
relfur yu shi'ro'bae'pu yu pon'ya ka'nya~
|
relfur yu shi'ro'bae'pu yu pon'ya ka'nyashu
|
||||||
|
|
||||||
LU'NYA
|
LU'NYA
|
||||||
puroton yu ponya ton ka'nya!
|
puroton yu ponya ton ka'nya!
|
||||||
|
|
||||||
ESH'NYUI
|
ESH'NYUI
|
||||||
be'nyui-rerenlafura yu meluton mimifaka'nya…
|
be'nyui-rerenlafura yu meluton mimifaka'nya…
|
||||||
relfur yu meluton mimiku'pash~
|
relfur yu meluton mimiku'pashshu
|
||||||
|
|
||||||
LU'NYA
|
LU'NYA
|
||||||
o'o, relfur chu parefaka'nya…
|
o'o, relfur chu parefaka'nya…
|
||||||
@@ -46,7 +46,7 @@ LU'NYA
|
|||||||
ESH'NYUI
|
ESH'NYUI
|
||||||
uu, relfur yu naomiminku mya mimifuku mya ton ka'nya...
|
uu, relfur yu naomiminku mya mimifuku mya ton ka'nya...
|
||||||
relfur yu guraton to meluton mimifuku..
|
relfur yu guraton to meluton mimifuku..
|
||||||
relfur yu ton mimiku'pash~
|
relfur yu ton mimiku'pashshu
|
||||||
|
|
||||||
LU'NYA
|
LU'NYA
|
||||||
ishi-balfur yu mishi'pash!
|
ishi-balfur yu mishi'pash!
|
||||||
@@ -54,8 +54,8 @@ LU'NYA
|
|||||||
|
|
||||||
ESH'NYUI
|
ESH'NYUI
|
||||||
i eshnyui_blush.png
|
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?
|
relfur yu ari'laen parefaka'nya, balfur yu pareka'nya dra?
|
||||||
|
|
||||||
LU'NYA
|
LU'NYA
|
||||||
|
|||||||
@@ -1,23 +1,40 @@
|
|||||||
ITS ME PEKORA
|
NOUNS
|
||||||
d deez
|
d nya
|
||||||
r hiiiii!!!!
|
ren
|
||||||
! uwu
|
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
|
HOLY SHIT REMI
|
||||||
d a
|
d a
|
||||||
amogus
|
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
|
|
||||||
206
main.js
206
main.js
@@ -4,6 +4,7 @@ let currentFont = "r";
|
|||||||
|
|
||||||
let timeout = "";
|
let timeout = "";
|
||||||
|
|
||||||
|
let badge_type = "#696969"
|
||||||
let badge_generic = "#393939"
|
let badge_generic = "#393939"
|
||||||
let badge_register= "#fed100"
|
let badge_register= "#fed100"
|
||||||
let badge_number = "#420690"
|
let badge_number = "#420690"
|
||||||
@@ -13,20 +14,94 @@ let badge_mood = "#dd00dd"
|
|||||||
let badge_negation = "#133337"
|
let badge_negation = "#133337"
|
||||||
|
|
||||||
let quirkBadges = {
|
let quirkBadges = {
|
||||||
"formal1": {
|
// TYPES
|
||||||
|
"verb": {
|
||||||
|
"name": "Verb",
|
||||||
|
"description": "This word expresses an action that the subject of the sentence performs.",
|
||||||
|
"color": badge_type,
|
||||||
|
"type": "Type",
|
||||||
|
"bending": "-ku"
|
||||||
|
},
|
||||||
|
"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",
|
"name": "Formal",
|
||||||
"description": "This word is used in formal or sincere settings.",
|
"description": "This word is used in formal or sincere settings.",
|
||||||
"color": badge_register,
|
"color": badge_register,
|
||||||
"type": "Register",
|
"type": "Register",
|
||||||
"bending": "-lfur"
|
"bending": "-lfur"
|
||||||
},
|
},
|
||||||
"formal2": {
|
"formal-n2": {
|
||||||
"name": "Formal",
|
"name": "Formal",
|
||||||
"description": "This word is used in formal or sincere settings.",
|
"description": "This word is used in formal or sincere settings.",
|
||||||
"color": badge_register,
|
"color": badge_register,
|
||||||
"type": "Register",
|
"type": "Register",
|
||||||
"bending": "-lafura"
|
"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": {
|
"genitive": {
|
||||||
"name": "Generic Possesive",
|
"name": "Generic Possesive",
|
||||||
"description": "This word is describing a generic possesive relationship.",
|
"description": "This word is describing a generic possesive relationship.",
|
||||||
@@ -39,29 +114,54 @@ let quirkBadges = {
|
|||||||
"description": "This word is describing a specific possesive relationship.",
|
"description": "This word is describing a specific possesive relationship.",
|
||||||
"color": badge_case,
|
"color": badge_case,
|
||||||
"type": "Case",
|
"type": "Case",
|
||||||
"bending": "la"
|
"bending": "-la"
|
||||||
|
},
|
||||||
|
// NUMBER
|
||||||
|
"dual": {
|
||||||
|
"name": "Dual",
|
||||||
|
"description": "This word is denoted as refering to exactly two entities.",
|
||||||
|
"color": badge_number,
|
||||||
|
"type": "Number",
|
||||||
|
"bending": ""
|
||||||
},
|
},
|
||||||
"plural": {
|
"plural": {
|
||||||
"name": "Plural",
|
"name": "Plural",
|
||||||
"description": "This word is denoted as more than one",
|
"description": "This word is denoted as refering to at least more than one entity.",
|
||||||
"color": badge_number,
|
"color": badge_number,
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
"bending": "n"
|
"bending": "-n"
|
||||||
},
|
},
|
||||||
"present-tense": {
|
// PRESENT TENSE
|
||||||
|
"present-tense-formal": {
|
||||||
"name": "Present",
|
"name": "Present",
|
||||||
"description": "This word is in the present tense.",
|
"description": "This word is in the present tense.",
|
||||||
"color": badge_tense,
|
"color": badge_tense,
|
||||||
"type": "Tense",
|
"type": "Tense",
|
||||||
"bending": "ku → ka'nya"
|
"bending": "ku → ka'nya"
|
||||||
},
|
},
|
||||||
"past-tense": {
|
"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",
|
"name": "Past",
|
||||||
"description": "This word is in the past tense.",
|
"description": "This word is in the past tense.",
|
||||||
"color": badge_tense,
|
"color": badge_tense,
|
||||||
"type": "Tense",
|
"type": "Tense",
|
||||||
"bending": "ku → kome"
|
"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": {
|
"volitional-mood": {
|
||||||
"name": "Feeling",
|
"name": "Feeling",
|
||||||
"description": "This word expresses a feeling or craving mood.",
|
"description": "This word expresses a feeling or craving mood.",
|
||||||
@@ -69,6 +169,14 @@ let quirkBadges = {
|
|||||||
"type": "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": {
|
"imperative-mood": {
|
||||||
"name": "Imperative",
|
"name": "Imperative",
|
||||||
"description": "This word expresses a imperative mood.",
|
"description": "This word expresses a imperative mood.",
|
||||||
@@ -76,27 +184,82 @@ let quirkBadges = {
|
|||||||
"type": "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": {
|
"shy-mood": {
|
||||||
"name": "Shy",
|
"name": "Shy",
|
||||||
"description": "This word expresses a shy mood..",
|
"description": "This word expresses a shy mood.",
|
||||||
"color": badge_mood,
|
"color": badge_mood,
|
||||||
"type": "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": {
|
"threat-mood": {
|
||||||
"name": "Threat",
|
"name": "Threat",
|
||||||
"description": "This word expresses a threatening mood..",
|
"description": "This word expresses a threatening mood.",
|
||||||
"color": badge_mood,
|
"color": badge_mood,
|
||||||
"type": "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": {
|
"negated": {
|
||||||
"name": "Negative",
|
"name": "Negative",
|
||||||
"description": "The word is expressing a negated meaning.",
|
"description": "The word is expressing a negated meaning.",
|
||||||
"color": badge_negation,
|
"color": badge_negation,
|
||||||
"type": "Negation",
|
"type": "Negation",
|
||||||
"bending": "-fa-"
|
"bending": "fa-"
|
||||||
},
|
},
|
||||||
|
// UNKNOWN
|
||||||
"unknown-tag": {
|
"unknown-tag": {
|
||||||
"name": "Unknown tag",
|
"name": "Unknown tag",
|
||||||
"color": "#393939",
|
"color": "#393939",
|
||||||
@@ -128,19 +291,19 @@ function showPopup(ogword, word, quirks = "") {
|
|||||||
let c = document.querySelector("#popup-container");
|
let c = document.querySelector("#popup-container");
|
||||||
word = cleanWord(word);
|
word = cleanWord(word);
|
||||||
if (currentFont == "r") {
|
if (currentFont == "r") {
|
||||||
p.querySelector("h1").innerText = words[word]["romanizationProper"];
|
p.querySelector("h1").innerText = ogword;
|
||||||
p.querySelector("#popup-heo").innerText = words[word]["heonian"];
|
p.querySelector("#popup-heo").innerText = words[word]["romanizationProper"] + " | " + words[word]["heonian"];
|
||||||
p.querySelector("h1").style.fontFamily = "var(--font-normal)";
|
p.querySelector("h1").style.fontFamily = "var(--font-normal)";
|
||||||
} else {
|
} else {
|
||||||
p.querySelector("h1").innerText = words[word]["heonian"];
|
p.querySelector("h1").innerText = ogword;
|
||||||
p.querySelector("#popup-heo").innerText = words[word]["romanizationProper"];
|
p.querySelector("#popup-heo").innerText = words[word]["heonian"] + " | " + words[word]["romanizationProper"];
|
||||||
p.querySelector("h1").style.fontFamily = "var(--font-heonian)";
|
p.querySelector("h1").style.fontFamily = "var(--font-heonian)";
|
||||||
}
|
}
|
||||||
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-meaning").innerText = words[word]["meaning"];
|
||||||
p.querySelector("#popup-quirks").innerHTML = "";
|
p.querySelector("#popup-quirks").innerHTML = "";
|
||||||
if (quirks.trim() != "") {
|
if (quirks.trim() != "") {
|
||||||
p.querySelector("#popup-quirks-container").style.display = "block";
|
p.querySelector("#popup-middle").style.display = "block";
|
||||||
let qyuirks = quirks.split(" ");
|
let qyuirks = quirks.split(" ");
|
||||||
qyuirks.forEach(quirk => {
|
qyuirks.forEach(quirk => {
|
||||||
let badge = document.createElement("div");
|
let badge = document.createElement("div");
|
||||||
@@ -150,10 +313,11 @@ function showPopup(ogword, word, quirks = "") {
|
|||||||
badge.style.boxShadow = "0px 0px 4px " + quirkBadges[quirk]["color"] + "cc";
|
badge.style.boxShadow = "0px 0px 4px " + quirkBadges[quirk]["color"] + "cc";
|
||||||
badge.innerText = quirkBadges[quirk]["name"];
|
badge.innerText = quirkBadges[quirk]["name"];
|
||||||
badge.onclick = () => {
|
badge.onclick = () => {
|
||||||
|
p.querySelector("#spacerhide").style.display = "none";
|
||||||
|
p.querySelector("#popup-middle").style.display = "none";
|
||||||
p.querySelector("h1").innerText = quirkBadges[quirk]["name"];
|
p.querySelector("h1").innerText = quirkBadges[quirk]["name"];
|
||||||
p.querySelector("#popup-meaning").innerText = quirkBadges[quirk]["description"];
|
p.querySelector("#popup-meaning").innerText = quirkBadges[quirk]["description"];
|
||||||
p.querySelector("#popup-type").innerText = quirkBadges[quirk]["type"];
|
//p.querySelector("#popup-type").innerText = quirkBadges[quirk]["type"];
|
||||||
p.querySelector("#popup-quirks-container").style.display = "none";
|
|
||||||
p.querySelector("#popup-heo").innerText = quirkBadges[quirk]["bending"];
|
p.querySelector("#popup-heo").innerText = quirkBadges[quirk]["bending"];
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
@@ -162,9 +326,11 @@ function showPopup(ogword, word, quirks = "") {
|
|||||||
badge.innerText = quirkBadges["unknown-tag"]["name"];
|
badge.innerText = quirkBadges["unknown-tag"]["name"];
|
||||||
}
|
}
|
||||||
p.querySelector("#popup-quirks").appendChild(badge);
|
p.querySelector("#popup-quirks").appendChild(badge);
|
||||||
|
p.querySelector("#spacerhide").style.display = "block";
|
||||||
});
|
});
|
||||||
} else {
|
} 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.opacity = 1;
|
||||||
c.style.pointerEvents = "all";
|
c.style.pointerEvents = "all";
|
||||||
@@ -230,7 +396,7 @@ function createWordList() { //sometimes i really dislike javascript..
|
|||||||
words[n]["heonian"] = e[0].innerText;
|
words[n]["heonian"] = e[0].innerText;
|
||||||
words[n]["romanization"] = e[1].innerText.replace(". ", "");
|
words[n]["romanization"] = e[1].innerText.replace(". ", "");
|
||||||
words[n]["romanizationProper"] = e[1].innerText;
|
words[n]["romanizationProper"] = e[1].innerText;
|
||||||
words[n]["type"] = e[2].innerText;
|
//words[n]["type"] = e[2].innerText;
|
||||||
words[n]["meaning"] = e[3].innerText;
|
words[n]["meaning"] = e[3].innerText;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
1
quick-terminal-customization
Submodule
1
quick-terminal-customization
Submodule
Submodule quick-terminal-customization added at 5224963a64
@@ -223,7 +223,7 @@ main {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#popup-heo, #smol-heo {
|
#popup-heo, #smol-heo {
|
||||||
font-family: "heonian";
|
font-family: var(--font-heonian);
|
||||||
text-align: center;
|
text-align: center;
|
||||||
margin: 4px;
|
margin: 4px;
|
||||||
margin-bottom: 8px;
|
margin-bottom: 8px;
|
||||||
|
|||||||
Reference in New Issue
Block a user