10
10
< link rel ="icon " href ="img/favicon.png ">
11
11
< title > Numerordĭnātĭo pictūrae</ title >
12
12
< style >
13
+ : root {
14
+ /* --bcp47-language: 'lat,prs'; */
15
+ --bcp47-language : 'lat' ;
16
+ }
17
+
13
18
details > details {
14
19
padding-left : 2em ;
15
20
}
16
21
17
22
[data-hide-significatum = "1" ] dl [data-significatum = "1" ] {
18
- display : none;
19
- /* display: initial; */
20
- }
21
- [data-show-bcp47-language ] dl [bcp47-language = "1" ] {
22
- /* display: none; */
23
- display : initial;
23
+ display : none;
24
24
}
25
25
</ style >
26
+ <!-- https://www.w3.org/wiki/Dynamic_style_-_manipulating_CSS_with_JavaScript -->
27
+ < style id ="picturam-stylesheet ">
28
+
29
+ </ style >
26
30
</ head >
27
31
28
32
< body >
@@ -50,7 +54,8 @@ <h1>Numerordĭnātĭo pictūrae</h1>
50
54
</ label >
51
55
</ div >
52
56
< div class ="form-check form-switch ">
53
- < input class ="form-check-input instrumentum-optionem " type ="checkbox " role ="switch " id ="se " checked >
57
+ <!-- <input class="form-check-input instrumentum-optionem" type="checkbox" role="switch" id="se" checked> -->
58
+ < input class ="form-check-input instrumentum-optionem " type ="checkbox " role ="switch " id ="se ">
54
59
< label class ="form-check-label " for ="se ">
55
60
Expānsiōnem de significātum
56
61
</ label >
@@ -60,7 +65,7 @@ <h1>Numerordĭnātĭo pictūrae</h1>
60
65
< div class ="input-group mb-3 ">
61
66
< span class ="input-group-text " id ="cl_label "> BCP47 linguam</ span >
62
67
< input type ="text " name ="cl " id ="cl " class ="form-control instrumentum-optionem " placeholder ="lat, arb, grk "
63
- aria-label ="BCP47 linguam " aria-describedby ="cl_label " value ="lat, prs ">
68
+ aria-label ="BCP47 linguam " aria-describedby ="cl_label " value ="">
64
69
</ div >
65
70
</ div >
66
71
< div class ="col ">
@@ -81,7 +86,8 @@ <h1>Numerordĭnātĭo pictūrae</h1>
81
86
</ div >
82
87
< textarea style ="width: 100%; height: auto; min-height: 20em; " id ="picturam-form-textarea "> </ textarea >
83
88
</ div >
84
- < div id ="picturam-html " class ="col " data-hide-significatum ="">
89
+ <!-- <div id="picturam-html" class="col" data-hide-significatum=""> -->
90
+ < div id ="picturam-html " class ="col " data-hide-significatum ="1 ">
85
91
</ div >
86
92
</ div >
87
93
@@ -112,11 +118,55 @@ <h1>Numerordĭnātĭo pictūrae</h1>
112
118
render_optionem ( )
113
119
}
114
120
121
+ function picturam_css ( object_de_array , stylesheet_id = 'picturam-stylesheet' ) {
122
+ let picturamStylesheet = document . getElementById ( stylesheet_id )
123
+ let crudumStylesheet = [ ]
124
+ console . log ( picturamStylesheet )
125
+ console . log ( object_de_array )
126
+
127
+ for ( let [ selector , optionem ] of Object . entries ( object_de_array ) ) {
128
+ crudumStylesheet . push ( `${ selector } {\n ${ optionem . join ( ";\n " ) } \n}` )
129
+ }
130
+
131
+ picturamStylesheet . innerHTML = crudumStylesheet . join ( "\n" )
132
+ }
133
+ window . picturam_css = picturam_css
134
+
135
+ // picturam_css({
136
+ // 'dl [data-bcp47-language="Lat" i]': [
137
+ // 'display: none;'
138
+ // ],
139
+ // 'dl [data-bcp47-language="lat" i]': [
140
+ // 'display: none;'
141
+ // ],
142
+ // })
143
+
115
144
function render_optionem ( ) {
145
+ let picturam_css_optionem = { }
116
146
console . log ( 'render_optionem' )
117
147
let details = document . querySelectorAll ( '#picturam-html details' ) ;
118
148
// let significatum = document.querySelectorAll('[data-significatum]');
119
149
[ ...details ] . map ( item => document . getElementById ( 'ce' ) . checked ? item . setAttribute ( "open" , 1 ) : item . removeAttribute ( "open" ) )
150
+
151
+ let cl_val = document . querySelector ( '#cl' )
152
+ let cl_val_list = cl_val . value . split ( ',' ) . map ( item => item . trim ( ) ) . filter ( item => item )
153
+ if ( cl_val_list && cl_val_list . length > 0 ) {
154
+ for ( let rem of cl_val_list ) {
155
+ picturam_css_optionem [ `dl [data-bcp47-language="${ rem } " i]` ] = [ 'display: block !important;' ]
156
+ }
157
+ }
158
+
159
+ let cs_val = document . querySelector ( '#cs' )
160
+ let cs_val_list = cs_val . value . split ( ',' ) . map ( item => item . trim ( ) ) . filter ( item => item )
161
+ if ( cs_val_list && cs_val_list . length > 0 ) {
162
+ for ( let rem of cs_val_list ) {
163
+ picturam_css_optionem [ `dl [data-bcp47-script="${ rem } " i]` ] = [ 'display: block !important;' ]
164
+ }
165
+ }
166
+ console . log ( 'picturam_css_optionem' , picturam_css_optionem )
167
+ picturam_css ( picturam_css_optionem )
168
+
169
+
120
170
// if (document.getElementById('ce').checked) {
121
171
// [...details].map(item => item.setAttribute("open", document.getElementById('ce').checked))
122
172
// }
0 commit comments