lexonomy_custom_editor/src/message/common_accessors.py

36 lines
1.0 KiB
Python
Raw Permalink Normal View History

from browser import document
def generic_list_getter():
result = []
for input_el in document.getElementsByClassName("list-adder-input"):
result_candidate = input_el.value
if result_candidate != "":
result.append(result_candidate)
return result
def label_list_getter():
result = []
for row in document.getElementsByClassName("label-list-row"):
ltype = row.querySelector(".label-type")
lvalue = row.querySelector(".label-value")
lother = row.querySelector(".label-value-other")
2020-03-19 20:02:53 +00:00
if lother is None:
continue
value = lother.value
if not value:
value = lvalue.options[lvalue.selectedIndex].text
if not value:
continue
result.append((ltype.textContent, value))
2020-03-19 20:02:53 +00:00
kontrastivno = document.getElementById("kontrastivno-input").checked;
if kontrastivno:
result.append(("razmerje", "kontrastivno"))
return result