workaround because chrome doesn't support onclick in select options
This commit is contained in:
@@ -77,12 +77,9 @@ function filter_selection_indexes(menu, indexes, reverse, add) {
|
||||
function is_element_unchecked(element) {
|
||||
if (typeof(element) === "undefined")
|
||||
return false;
|
||||
if (typeof(element.attributes) === "undefined")
|
||||
if (typeof(element.type) === "undefined")
|
||||
return false;
|
||||
if (typeof(element.attributes.type) === "undefined")
|
||||
return false;
|
||||
value = element.attributes.type.value;
|
||||
if (value === "checkbox") {
|
||||
if (element.type === "checkbox") {
|
||||
return ! element.checked;
|
||||
}
|
||||
return false;
|
||||
@@ -96,6 +93,17 @@ function is_element_unchecked(element) {
|
||||
|
||||
function filter_show_only_selection(element, indexes, menu, add = false, zoom_in = true) {
|
||||
|
||||
// temp solution because we can't actually put onclick event inside select options
|
||||
// on chrome, so I have to recover the indexes another way
|
||||
if (element.type == "select-one") {
|
||||
if (element.value == menu)
|
||||
indexes = [];
|
||||
else {
|
||||
indexes = element.children[element.selectedIndex].title;
|
||||
indexes = JSON.parse(indexes);
|
||||
}
|
||||
}
|
||||
|
||||
let reverse = is_element_unchecked(element);
|
||||
|
||||
let index_array = filter_selection_indexes(menu, indexes, reverse, add);
|
||||
|
||||
Reference in New Issue
Block a user