Newer
Older
<span class="dict-label" tabindex="0">{{dict_label}}</span>
<h2 class="article_header" tabindex="0">{{header_text}}</h2>
<h2 class="secondary_header" v-if="secondary_header_text.length" tabindex="0">{{secondary_header_text}}</h2>
<span class="header_group_list" v-if="group_list.length" tabindex="0">{{group_list}}</span>
<span v-if="split_inf" tabindex="0"> (kløyvd infinitiv: <i>-a</i>
<v-menu rounded="0" v-model="menu" offset-x max-width="200px">
<template v-slot:activator="{ on, attrs }">
<v-btn aria-label="Mer informasjon om kløyvd infinitiv" x-small icon v-on="on" v-bind="attrs" class="info-button">
<v-icon color="primary" size="14px">$vuetify.icons.value.info</v-icon>
Dersom du bruker kløyvd infinitiv, skal dette verbet ha <i>-a</i> i infinitiv. Les meir
<a target="_blank" href="https://www.sprakradet.no/svardatabase/sporsmal-og-svar/kloyvd-infinitiv-/">her</a>.
</v-card>
<details :title="inflect_tooltip" @toggle="toggle()" v-if="inflected" :class="$vuetify.breakpoint.name">
<summary :class="dictionary" onclick="this.blur()" tabindex="0">bøying</summary>
<div class="inflection-canvas">
<inflectionTable :lemmaList="lemmas_with_word_class_and_lang" :mq="$vuetify.breakpoint.name" />
</div>
</details>
import inflectionTable from 'inflection-table'
export default {
name: 'Header',
props: {
dictionary: String,
article_id: Number
header_text: function() {
return this.lemmas.map(lemma => lemma.lemma).join(', ')
},
secondary_header_text: function() {
let a_forms = []
this.lemmas.forEach((lemma, i) => {
if (lemma.paradigm_info[0] && lemma.paradigm_info[0].inflection_group == 'VERB') {
let inf2 = lemma.paradigm_info[0].inflection[1] && lemma.paradigm_info[0].inflection[1].word_form
if (inf2 && inf2.length) {
a_forms.push(inf2)
}
}
});
return a_forms.join(', ')
},
inflect_tooltip: function() {
return this.dictionary == 'bob' ? 'Klikk for å se bøyinger' : 'Klikk for å sjå bøyingar'
},
'bob': 'bokmålsordboka',
'nob': 'nynorskordboka'
return helpers.group_list(this.lemmas, this.dictionary)
},
inflection_groups_by_lemma: function() {
let components = Object.keys(this.$options.components)
return this.lemmas.map(
function(lemma_){
let inflection_groups = lemma_.paradigm_info.reduce((acc, std) => Object.assign(acc, {[std.inflection_group]: []}), {})
lemma_.paradigm_info.forEach(std => inflection_groups[std.inflection_group].push(std))
return {
lemma: lemma_.lemma,
inflection_groups: Object.fromEntries(Object.entries(inflection_groups).filter(e => components.includes(e[0].replace('/', '_'))))
},
lemmas_with_word_class_and_lang: function() {
return this.lemmas.map(lemma => Object.assign({language: this.dictionary == 'bob' ? 'nob' : 'nno',
word_class: lemma.paradigm_info[0].inflection_group.split('_')[0]}, lemma))
},
inflected: function() {
return this.lemmas.reduce((acc, lemma) => acc += lemma.paradigm_info.reduce((acc2, digm) => acc2 += digm.inflection.length, 0), 0) > 0
},
split_inf: function() {
return this.lemmas[0].split_inf
},
data: function() {
return {
inflect_reported: false,
menu: false
}
},
methods: {
toggle: function() {
if (! this.inflect_reported) {
this.$plausible.trackEvent('open inflection', {props: {article: `/${this.dictionary}/${this.article_id}/${this.lemmas[0].lemma}`}})
}
this.inflect_reported = true
}
text-align: center;
font-family: Inria Serif;
font-size: 30px;
article h2.secondary_header {
padding-top: 0px;
padding-bottom: 4px;
}
margin-right: -2px;
height: 10px;
width: 10px;
.info-card {
padding: 12px;
}
.word-classification {
text-decoration: underline dashed;
}

Ole Voldsæter
committed
font-weight: bold;

Ole Voldsæter
committed
left: 15px;

Ole Voldsæter
committed
position: relative;
list-style: none;
border: solid 2px var(--v-primary-base);
padding-top: 6px;
padding-bottom: 6px;
padding-right: 10px;
color: var(--v-primary-base);
.header details[open] > summary {
box-shadow: 2px 2px 0px var(--v-primary-base)
font-weight: bold;
position: absolute;
right: 0;
top: 1px;
margin-right: 3px;
}
.header details[open] > summary.bob:before, details[open] > summary.nob:before {
content: "⌃";
font-weight: bold;
position: absolute;
right: 0;
top: 8px;
margin-right: 3px;
}
@keyframes open {
0% {
opacity: 0;
}
100% {
opacity: 1;
}
}

Ole Voldsæter
committed
background-color: rgba(255, 255, 255, 0);
.infl-wrapper {
color: var(--v-primary-base);
.context {
color: var(--v-primary-lighten4) !important;
}
display: none;
}
table {
border-collapse: collapse;

Ole Voldsæter
committed
margin-top: 5px;

Ole Voldsæter
committed
}
th, td {
border: solid 1px;
padding: 5px;
}
background-color: var(--v-tertiary-darken1);
color: var(--v-primary-darken1);
}
.infl-label {
text-align: center;
vertical-align: top;
}
article:not(.righ_hand_column) .inflection-canvas {

Ole Voldsæter
committed
left: -35px;
background-color: var(--v-tertiary-base);
text-align: center