Skip to content

Commit 06c5bfa

Browse files
authored
Blank Site Filters should act as ALL selected #9
Signed-off-by: Ryan Hilbert <Ryan.J.Hilbert@gmail.com>
1 parent 3bcaa91 commit 06c5bfa

1 file changed

Lines changed: 10 additions & 10 deletions

File tree

Main.kt

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ val DIRCTN_ID=CharDirectionality::class.simpleName!!.uppercase().last{it!in Char
2121
val CONDENSED=setOf(CJK_UNIFIED_IDEOGRAPHS_EXTENSION_A,CJK_UNIFIED_IDEOGRAPHS,HANGUL_SYLLABLES,HIGH_SURROGATES,HIGH_PRIVATE_USE_SURROGATES,LOW_SURROGATES,PRIVATE_USE_AREA)
2222

2323
//selects all options when associated label is interacted with
24-
val FN="for(var g of document.getElementById(this.htmlFor).children)for(var o of g.children)o.selected=true"
24+
val FN="for(var g of document.getElementById(this.htmlFor).children)for(var o of g.children)o.selected=false"
2525
val JS="onclick='$FN' onkeypress='$FN'"
2626

2727
val html = StringBuilder("""<!DOCTYPE html>
@@ -39,7 +39,7 @@ val html = StringBuilder("""<!DOCTYPE html>
3939
>input{ direction:initial; position:sticky; top:2em; margin-right:1em; float:right; font-size:xx-large; width:1em; height:1em; box-shadow:0 0 0 1px canvas}
4040
>label{ direction:initial; text-align:center; font-size:large; font-weight:bold; display:block; width:100%; padding-top:1mm; white-space:pre;
4141
&:first-of-type{ text-align:right; font-size:revert; font-weight:revert; padding-top:revert }
42-
&:is(:target,:active,:hover,:focus)+select>optgroup>option:not(:checked){ background-color:highlight }
42+
&:is(:target,:active,:hover,:focus)+select>optgroup>option{ background-color:graytext }
4343
}
4444
>select{ direction:initial; display:block; width:100%; overflow-y:auto; text-align-last:justify;
4545
option{ padding-right:1mm }
@@ -78,10 +78,10 @@ val html = StringBuilder("""<!DOCTYPE html>
7878
}
7979
}
8080
}}}}${(CharDirectionality.entries.map{it.code}.toSet()+CharCategory.entries.map{it.code}+UnicodeScriptFamily.values().flatMap{it}.map{it.code}).joinToString(""){"""
81-
search#$SEARCH_ID:has(#$it:not(:checked))+main>section>span.$it,"""}}${UnicodeBlockGroup.values().flatMap{it}.joinToString(""){"""
82-
search#$SEARCH_ID:has(#_${it.id}:not(:checked))+main>section#${it.cssID},"""}}
83-
search#$SEARCH_ID:has(#$SEQ_ID:checked)+main>section>span>button:not([$SEQ_ID]),
84-
search#$SEARCH_ID:has(#$SEQ_ID:indeterminate)+main>section>span>button[$SEQ_ID]{display:none}
81+
#$SEARCH_ID:has(#${when(it.toString().length){1->DIRCTN_ID;2->CATGRY_ID;else->SCRIPT_ID}} :checked):has(#$it:not(:checked))+main>section>span.$it,"""}}${UnicodeBlockGroup.values().flatMap{it}.joinToString(""){"""
82+
#$SEARCH_ID:has(#$BLOCK_ID :checked):has(#_${it.id}:not(:checked))+main>section#${it.cssID},"""}}
83+
#$SEARCH_ID:has(#$SEQ_ID:checked)+main>section>span>button:not([$SEQ_ID]),
84+
#$SEARCH_ID:has(#$SEQ_ID:indeterminate)+main>section>span>button[$SEQ_ID]{display:none}
8585
</style>
8686
<form>
8787
<search id=$SEARCH_ID>
@@ -94,22 +94,22 @@ search#$SEARCH_ID:has(#$SEQ_ID:indeterminate)+main>section>span>button[$SEQ_ID]{
9494
<label for=$CATGRY_ID tabindex=0 $JS>Category</label>
9595
<select id=$CATGRY_ID multiple size=${CharCategory.entries.size+CharCategory.entries.map{it.code.first()}.toSet().size}>${CharCategory.entries.map{when(val c=it.code.first()){'C'->'L' else->c}}.toSet().plus('C').joinToString(""){ g->"""
9696
<optgroup label=${CharCategory.entries.first{it.code.startsWith(g)}.name.substringAfterLast('_',"Other").lowercase().capitalize()}>"""+CharCategory.entries.drop(1).plus(UNASSIGNED).filter{it.code.startsWith(g)}.joinToString(""){"""
97-
<option selected id=${it.code} label=${it.label}>"""}}}
97+
<option id=${it.code} label=${it.label}>"""}}}
9898
</select>
9999
<label for=$SCRIPT_ID tabindex=0 $JS>Script </label>
100100
<select id=$SCRIPT_ID multiple size=${UnicodeScriptFamily.values().sumOf{it.size+1}}>${UnicodeScriptFamily.values().joinToString(""){g->"""
101101
<optgroup label=${g.label}>"""+g.joinToString(""){"""
102-
<option selected id=${it.code} label=${it.label}>"""}}}
102+
<option id=${it.code} label=${it.label}>"""}}}
103103
</select>
104104
<label for=$DIRCTN_ID tabindex=0 $JS>Direction </label>
105105
<select id=$DIRCTN_ID multiple size=${CharDirectionality.entries.map{it.code}.toSet().size+CharDirectionality.entries.map{it.strength}.toSet().size}>${CharDirectionality.entries.drop(1).map{it.strength}.toSet().joinToString(""){g->"""
106106
<optgroup label=$g>"""+CharDirectionality.entries.drop(1).plus(UNDEFINED).filter{it.strength==g&&it<=LEFT_TO_RIGHT_EMBEDDING}.joinToString(""){"""
107-
<option selected id=${it.code} label=${it.label}>"""}}}
107+
<option id=${it.code} label=${it.label}>"""}}}
108108
</select>
109109
<label for=$BLOCK_ID tabindex=0 $JS>Block </label>
110110
<select id=$BLOCK_ID multiple size=${UnicodeBlockGroup.values().sumOf{it.size+1}}>${UnicodeBlockGroup.values().joinToString(""){g->"""
111111
<optgroup label=${g.label}>"""+g.joinToString(""){"""
112-
<option selected id=_${it.id} label=${it.label}>"""}}}
112+
<option id=_${it.id} label=${it.label}>"""}}}
113113
</select>
114114
</search>
115115
<main>

0 commit comments

Comments
 (0)