2929
3030 const rne = new RussianNouns . Engine ( ) ;
3131
32- $scope . fillForm = ( gender , word , surname , animate , indeclinable , transport , firstname ) => {
32+ $scope . fillForm = ( genderPt , word , surname , animate , indeclinable , transport , firstname ) => {
3333 $scope . input [ "text" ] = word ;
34- $scope . input [ "gender " ] = gender ;
34+ $scope . input [ "genderPt " ] = genderPt ;
3535 $scope . input [ "name" ] = firstname ;
3636 $scope . input [ "surname" ] = surname ;
3737 $scope . input [ "animate" ] = animate ;
4040 $scope . changed ( ) ;
4141 } ;
4242
43- $scope . clean = ( ) => {
44- if ( ! $scope . input . gender ) {
45- delete $scope . input . gender ;
46- }
47-
48- if ( ! $scope . input . pluraleTantum ) {
49- delete $scope . input . pluraleTantum ;
50- }
43+ $scope . clear = ( ) => {
44+ let r = {
45+ text : $scope . input [ "text" ]
46+ } ;
5147
52- if ( ! $scope . input . surname ) {
53- delete $scope . input . surname ;
48+ if ( "мн." === $scope . input [ "genderPt" ] ) {
49+ r [ "pluraleTantum" ] = true ;
50+ } else if ( typeof $scope . input [ "genderPt" ] === "string" ) {
51+ r [ "gender" ] = $scope . input [ "genderPt" ] ;
5452 }
5553
56- if ( ! $scope . input . name ) {
57- delete $scope . input . name ;
58- }
59-
60- if ( ! $scope . input . animate ) {
61- delete $scope . input . animate ;
62- }
63-
64- if ( ! $scope . input . indeclinable ) {
65- delete $scope . input . indeclinable ;
54+ for ( let fieldName of [ 'animate' , 'indeclinable' , 'name' , 'surname' , 'transport' ] ) {
55+ if ( $scope . input [ fieldName ] ) {
56+ r [ fieldName ] = $scope . input [ fieldName ] ;
57+ }
6658 }
6759
68- if ( ! $scope . input . transport ) {
69- delete $scope . input . transport ;
70- }
60+ return r ;
7161 } ;
7262
7363 $scope . getInputCode = ( inputObject ) => {
74- let lines = JSON . stringify ( $scope . input , null , " " ) . split ( '\n' ) ;
64+ let lines = JSON . stringify ( inputObject , null , " " ) . split ( '\n' ) ;
7565 let processed = lines . map ( x => {
7666 if ( x . indexOf ( ':' ) >= 0 ) {
7767 let parts = x . split ( ':' ) ;
8474 } ;
8575
8676 $scope . changed = ( ) => {
87- $scope . clean ( ) ;
88- if ( $scope . input . text && $scope . input . gender ) {
77+ let cleanInput = $scope . clear ( ) ;
8978
90- document . getElementById ( 'inputCode' ) . textContent = $scope . getInputCode ( ) ;
79+ if ( cleanInput . text && ( cleanInput . gender || cleanInput . pluraleTantum ) ) {
9180
92- let lemma = RussianNouns . createLemma ( $scope . input ) ;
81+ document . getElementById ( 'inputCode' ) . textContent = $scope . getInputCode ( cleanInput ) ;
82+
83+ let lemma = RussianNouns . createLemma ( cleanInput ) ;
9384
9485 $scope . result = { } ;
9586 $scope . plural = { } ;
112103
113104 } else {
114105 $scope . result = null ;
106+ document . getElementById ( 'inputCode' ) . textContent = "" ;
115107 }
116108 } ;
117109
147139 user-select : none;
148140 }
149141
142+ /*
143+ Устранение бага Bootstrap с неинтерактивной зоной между чекбоксом и лейблом.
144+ https://github.com/twbs/bootstrap/issues/13003
145+ Чекбокс намеренно сдвинут чуть вправо.
146+ */
147+ .form-check-input {
148+ margin-left : -0.8rem ;
149+ }
150+ .form-check-label {
151+ padding-left : 0.45rem ;
152+ }
153+
150154 h2 {
151155 font-size : small;
152156 }
@@ -209,25 +213,19 @@ <h2 style="padding-left: .1em;">
209213 < div class ="row ">
210214 < div class ="col-12 notranslate " translate ="no ">
211215 < p id ="examples ">
216+ < a href ng-click ="fillForm('средний', 'пальто', null, null, true) "> пальто</ a >
217+
212218 < a href ng-click ="fillForm('мужской', 'арбуз') "> арбуз</ a >
213219 < a href ng-click ="fillForm('средний', 'окно') "> окно</ a >
214220 < a href ng-click ="fillForm('мужской', 'кот', null, true) "> кот</ a >
215221 < a href ng-click ="fillForm('женский', 'кошка', null, true) "> кошка</ a >
216222 < a href ng-click ="fillForm('средний', 'дитя', null, true) "> дитя</ a >
217- < a href ng-click ="fillForm('средний', 'знамя') "> знамя</ a >
218223 < a href ng-click ="fillForm('средний', 'время') "> время</ a >
219- < a href ng-click ="fillForm('средний', 'семя') "> семя</ a >
220- < a href ng-click ="fillForm('средний', 'вымя') "> вымя</ a >
221- < a href ng-click ="fillForm('средний', 'темя') "> темя</ a >
222- < a href ng-click ="fillForm('средний', 'имя') "> имя</ a >
223- < a href ng-click ="fillForm('средний', 'пламя') "> пламя</ a >
224- < a href ng-click ="fillForm('средний', 'стремя') "> стремя</ a >
225224 < a href ng-click ="fillForm('общий', 'задира', null, true) "> задира</ a >
226225 < a href ng-click ="fillForm('общий', 'хитрюга', null, true) "> хитрюга</ a >
227226 < a href ng-click ="fillForm('общий', 'нелюдь', null, true) "> нелюдь</ a >
228227 < a href ng-click ="fillForm('мужской', 'паровоз') "> паровоз</ a >
229228
230- < a href ng-click ="fillForm('мужской', 'ад') "> ад</ a >
231229 < a href ng-click ="fillForm('мужской', 'вид') "> вид</ a >
232230 < a href ng-click ="fillForm('мужской', 'снег') "> снег</ a >
233231
@@ -237,40 +235,24 @@ <h2 style="padding-left: .1em;">
237235 < a href ng-click ="fillForm('женский', 'дочь', null, true) "> дочь</ a >
238236 < a href ng-click ="fillForm('мужской', 'зять', null, true) "> зять</ a >
239237
240- <!--
241- <a href ng-click="fillForm('мужской', 'Георгий', null, true)">Георгий</a>
242- <a href ng-click="fillForm('мужской', 'Устинов', true, true)">Устинов</a>
243- -->
244-
245- < a href ng-click ="fillForm('мужской', 'кий') "> кий</ a >
246- < a href ng-click ="fillForm('женский', 'елка') "> елка</ a >
247- < a href ng-click ="fillForm('мужской', 'еж', null, true) "> еж</ a >
248- < a href ng-click ="fillForm('мужской', 'ерш') "> ерш</ a >
249238 < a href ng-click ="fillForm('мужской', 'морж', null, true) "> морж</ a >
250239
251- <!--
252- <a href ng-click="fillForm('женский', 'Иордания')">Иордания</a>
253- <a href ng-click="fillForm('мужской', 'Будапешт', null, null, true)">Будапешт</a>
254- <a href ng-click="fillForm('мужской', 'Белозёрский', true, true)">Белозёрский</a>
255- <a href ng-click="fillForm('женский', 'Белозёрская', true, true)">Белозёрская</a>
256- -->
257-
258240 < a href ng-click ="fillForm('женский', 'ирония') "> ирония</ a >
259- < a href ng-click =" fillForm('средний', 'пальто', null, null, true) " > пальто </ a >
241+
260242 < a href ng-click ="fillForm('мужской', 'путь') "> путь</ a >
261- < a href ng-click ="fillForm('женский', 'муть') "> муть</ a >
262243 < a href ng-click ="fillForm('женский', 'жуть') "> жуть</ a >
263244 < a href ng-click ="fillForm('женский', 'нефть') "> нефть</ a >
264- < a href ng-click ="fillForm('мужской', 'гений', null, true) "> гений (человек, дух)</ a >
265- < a href ng-click ="fillForm('мужской', 'гений', null, false) "> гений (дар)</ a >
266245
267246 < a href ng-click ="fillForm('средний', 'λ-выражение') "> λ-выражение</ a >
268247 < a href ng-click ="fillForm('женский', 'α-частица') "> α-частица</ a >
269- < a href ng-click =" fillForm('мужской', 'рок-н-ролл') " > рок-н-ролл </ a >
248+
270249 < a href ng-click ="fillForm('женский', 'теле-пресс-конференция') "> теле-пресс-конференция</ a >
271250
272251 < a href ng-click ="fillForm('средний', 'судно', null, null, null, null) "> судно (мед.)</ a >
273252 < a href ng-click ="fillForm('средний', 'судно', null, null, null, true) "> судно (лодка)</ a >
253+
254+ < a href ng-click ="fillForm('мн.', 'ножницы') "> ножницы</ a >
255+ < a href ng-click ="fillForm('мн.', 'ворота') "> ворота</ a >
274256 </ p >
275257 </ div >
276258 </ div >
@@ -298,14 +280,15 @@ <h3>
298280 < div class ="row ">
299281 < div class ="col-12 ">
300282 < select class ="form-control "
301- ng-model ="input.gender "
283+ ng-model ="input.genderPt "
302284 ng-change ="changed() "
303285 ng-required ="true ">
304286 < option value =""> </ option >
305287 < option value ="мужской "> мужской род</ option >
306288 < option value ="женский "> женский род</ option >
307289 < option value ="средний "> средний род</ option >
308290 < option value ="общий "> общий род</ option >
291+ < option value ="мн. "> только множественное</ option >
309292 </ select >
310293 </ div >
311294 </ div >
0 commit comments