diff --git a/.env b/.env index e2df1ae2fd01253f8c3a7f993dd8a223a657dd59..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 100644 --- a/.env +++ b/.env @@ -1 +0,0 @@ -VUE_APP_SEARCH_ENDPOINT='https://oda.uib.no/opal/api/' diff --git a/.env.dev_server b/.env.dev_server index 8c9f2bf6a3d82dfdbb6325b70a80b79d300a3a5e..31573c1642cf525ffbcb86d3a26f5c3f8c3a6010 100644 --- a/.env.dev_server +++ b/.env.dev_server @@ -1,3 +1,3 @@ NODE_ENV=production -VUE_APP_API_STAGE=dev VUE_APP_ARTICLE_ENDPOINT='https://oda.uib.no/opal/dev/' +VUE_APP_SEARCH_ENDPOINT='https://oda.uib.no/opal/dev/api/' diff --git a/.env.local b/.env.local index 6750c0ed21db114acd6f7a4c7ae67928f35226c2..53d6b6d7911d76507e18fafad482ea4f6f9237fc 100644 --- a/.env.local +++ b/.env.local @@ -1,4 +1,4 @@ -VUE_APP_API_STAGE=dev VUE_APP_ARTICLE_ENDPOINT='https://oda.uib.no/opal/dev/' +VUE_APP_SEARCH_ENDPOINT='https://oda.uib.no/opal/dev/api/' VUE_APP_VERSION_LABEL=LOCAL VUE_APP_RELEASE=test diff --git a/.env.production b/.env.production index 49ffbcdede3a033d81ec1948aa97c38864ecd66d..e67c7aae3624d404de5bb2442d86222a9a414427 100644 --- a/.env.production +++ b/.env.production @@ -1,4 +1,4 @@ NODE_ENV=production VUE_APP_VERSION_LABEL=Beta -VUE_APP_API_STAGE=prod VUE_APP_ARTICLE_ENDPOINT='https://oda.uib.no/opal/prod/' +VUE_APP_SEARCH_ENDPOINT='https://oda.uib.no/opal/prod/api/' diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 262e9bfa93e493f9e807b751354ab0a9a2f74853..bd2dfd3a99b9993f1740b92777b21ef1f203469f 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -11,7 +11,7 @@ workflow: - if: $CI_COMMIT_TAG != null build-dev: - image: node:latest + image: node:16 tags: - spraaksamlingene_01 stage: build @@ -36,7 +36,7 @@ build-dev: - dist build-prod: - image: node:latest + image: node:16 tags: - spraaksamlingene_01 stage: build @@ -76,7 +76,7 @@ deploy-dev: "AltDomainName=dev.ordbok.uib.no" "DomainName=beta.ordbok-dev.aws.uib.no" "ZoneDomainName=ordbok-dev.aws.uib.no" - "PathRewriteLambdaARN=arn:aws:lambda:us-east-1:${AWS_DEV_ACCOUNT}:function:rewrite_request:5" + "PathRewriteLambdaARN=arn:aws:lambda:us-east-1:${AWS_DEV_ACCOUNT}:function:rewrite_request:6" "OrdbokCacheOriginDomain=8mwl23g34a.execute-api.eu-west-1.amazonaws.com" "OrdbokCacheStage=DEV" --no-fail-on-empty-changeset @@ -107,7 +107,7 @@ deploy-prod: - aws cloudformation deploy --stack-name ${STACK_NAME} --template-file "aws/beta.ordbok.uib.no_stack.yaml" --parameter-overrides "CertificateArn=${CERT_ARN}" - "PathRewriteLambdaARN=arn:aws:lambda:us-east-1:${AWS_PROD_ACCOUNT}:function:path_rewrite:13" + "PathRewriteLambdaARN=arn:aws:lambda:us-east-1:${AWS_PROD_ACCOUNT}:function:path_rewrite:14" "OrdbokCacheOriginDomain=n5speug9cl.execute-api.eu-west-1.amazonaws.com" "OrdbokCacheStage=PROD" --no-fail-on-empty-changeset diff --git a/api_static/api/index.html b/api_static/api/index.html index 37eab75161b8bda983f538a57b72865e62b15d11..4adbe726365bd4f8ec9ad272b1d23d5b82653452 100644 --- a/api_static/api/index.html +++ b/api_static/api/index.html @@ -23,9 +23,6 @@ div#main { text-align: center; } -a { - text-decoration: none; -} a img { diff --git a/package-lock.json b/package-lock.json index 89644a389c38f298c8ed0e93a041430160f4f919..bc8608860789c0d9549786d506ad733070409806 100644 --- a/package-lock.json +++ b/package-lock.json @@ -8,20 +8,15 @@ "name": "ordbok_vue", "version": "0.1.0", "dependencies": { - "@fortawesome/fontawesome-svg-core": "^1.2.35", - "@fortawesome/free-brands-svg-icons": "^5.15.3", - "@fortawesome/free-solid-svg-icons": "^5.15.3", - "@fortawesome/vue-fontawesome": "^2.0.2", "axios": "^0.21.1", "axios-cache-adapter": "^2.7.3", "core-js": "~3.6.5", "debounce": "^1.2.1", - "inflection-table": "https://git.app.uib.no/api/v4/projects/16442/jobs/artifacts/0.2.31/raw/module.tar.gz?job=publish", + "inflection-table": "https://git.app.uib.no/api/v4/projects/16442/jobs/artifacts/0.2.40/raw/module.tar.gz?job=publish", "vue": "^2.6.12", "vue-material-design-icons": "^4.11.0", "vue-plausible": "^1.1.4", "vue-router": "^3.5.1", - "vue-social-sharing": "^3.0.8", "vuetify": "^2.5.8" }, "devDependencies": { @@ -1700,60 +1695,6 @@ "node": ">=6.9.0" } }, - "node_modules/@fortawesome/fontawesome-common-types": { - "version": "0.2.35", - "resolved": "https://registry.npmjs.org/@fortawesome/fontawesome-common-types/-/fontawesome-common-types-0.2.35.tgz", - "integrity": "sha512-IHUfxSEDS9dDGqYwIW7wTN6tn/O8E0n5PcAHz9cAaBoZw6UpG20IG/YM3NNLaGPwPqgjBAFjIURzqoQs3rrtuw==", - "hasInstallScript": true, - "engines": { - "node": ">=6" - } - }, - "node_modules/@fortawesome/fontawesome-svg-core": { - "version": "1.2.35", - "resolved": "https://registry.npmjs.org/@fortawesome/fontawesome-svg-core/-/fontawesome-svg-core-1.2.35.tgz", - "integrity": "sha512-uLEXifXIL7hnh2sNZQrIJWNol7cTVIzwI+4qcBIq9QWaZqUblm0IDrtSqbNg+3SQf8SMGHkiSigD++rHmCHjBg==", - "hasInstallScript": true, - "dependencies": { - "@fortawesome/fontawesome-common-types": "^0.2.35" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/@fortawesome/free-brands-svg-icons": { - "version": "5.15.3", - "resolved": "https://registry.npmjs.org/@fortawesome/free-brands-svg-icons/-/free-brands-svg-icons-5.15.3.tgz", - "integrity": "sha512-1hirPcbjj72ZJtFvdnXGPbAbpn3Ox6mH3g5STbANFp3vGSiE5u5ingAKV06mK6ZVqNYxUPlh4DlTnaIvLtF2kw==", - "hasInstallScript": true, - "dependencies": { - "@fortawesome/fontawesome-common-types": "^0.2.35" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/@fortawesome/free-solid-svg-icons": { - "version": "5.15.3", - "resolved": "https://registry.npmjs.org/@fortawesome/free-solid-svg-icons/-/free-solid-svg-icons-5.15.3.tgz", - "integrity": "sha512-XPeeu1IlGYqz4VWGRAT5ukNMd4VHUEEJ7ysZ7pSSgaEtNvSo+FLurybGJVmiqkQdK50OkSja2bfZXOeyMGRD8Q==", - "hasInstallScript": true, - "dependencies": { - "@fortawesome/fontawesome-common-types": "^0.2.35" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/@fortawesome/vue-fontawesome": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/@fortawesome/vue-fontawesome/-/vue-fontawesome-2.0.2.tgz", - "integrity": "sha512-ecpKSBUWXsxRJVi/dbOds4tkKwEcBQ1JSDZFzE2jTFpF8xIh3OgTX8POIor6bOltjibr3cdEyvnDjecMwUmxhQ==", - "peerDependencies": { - "@fortawesome/fontawesome-svg-core": ">= 1.2.0 < 1.3", - "vue": "~2" - } - }, "node_modules/@hapi/address": { "version": "2.1.4", "resolved": "https://registry.npmjs.org/@hapi/address/-/address-2.1.4.tgz", @@ -8655,9 +8596,9 @@ "dev": true }, "node_modules/inflection-table": { - "version": "0.2.31", - "resolved": "https://git.app.uib.no/api/v4/projects/16442/jobs/artifacts/0.2.31/raw/module.tar.gz?job=publish", - "integrity": "sha512-wB9qG4VFILPhpo3a0YcZWGhGUTtNdcVhw76LJAUNorRlunaAqADznEXDaFoY5qxjuJkRJGxGe1lQZAioX47a1g==", + "version": "0.2.40", + "resolved": "https://git.app.uib.no/api/v4/projects/16442/jobs/artifacts/0.2.40/raw/module.tar.gz?job=publish", + "integrity": "sha512-MOM71YWLmGPerc7ViWSouhWujHuNBaFb9ahnu82TJOSsWQK4qpDAtr791Y85PZgxVQjyneGAaBnQ5UVc+bI2xw==", "dependencies": { "core-js": "~3.6.5", "jquery": "^3.5.1", @@ -15011,14 +14952,6 @@ "resolved": "https://registry.npmjs.org/vue-router/-/vue-router-3.5.2.tgz", "integrity": "sha512-807gn82hTnjCYGrnF3eNmIw/dk7/GE4B5h69BlyCK9KHASwSloD1Sjcn06zg9fVG4fYH2DrsNBZkpLtb25WtaQ==" }, - "node_modules/vue-social-sharing": { - "version": "3.0.8", - "resolved": "https://registry.npmjs.org/vue-social-sharing/-/vue-social-sharing-3.0.8.tgz", - "integrity": "sha512-56gOES9fq7kyzuW7+lVAKtoG9Wi4MGjIfMqXAFZv1QSwW00EN0X5zJDSQjZn1Y2cIU6DUG+1KfJB7r7nTuiISA==", - "peerDependencies": { - "vue": "^2.6.10" - } - }, "node_modules/vue-style-loader": { "version": "4.1.3", "resolved": "https://registry.npmjs.org/vue-style-loader/-/vue-style-loader-4.1.3.tgz", @@ -17209,41 +17142,6 @@ "to-fast-properties": "^2.0.0" } }, - "@fortawesome/fontawesome-common-types": { - "version": "0.2.35", - "resolved": "https://registry.npmjs.org/@fortawesome/fontawesome-common-types/-/fontawesome-common-types-0.2.35.tgz", - "integrity": "sha512-IHUfxSEDS9dDGqYwIW7wTN6tn/O8E0n5PcAHz9cAaBoZw6UpG20IG/YM3NNLaGPwPqgjBAFjIURzqoQs3rrtuw==" - }, - "@fortawesome/fontawesome-svg-core": { - "version": "1.2.35", - "resolved": "https://registry.npmjs.org/@fortawesome/fontawesome-svg-core/-/fontawesome-svg-core-1.2.35.tgz", - "integrity": "sha512-uLEXifXIL7hnh2sNZQrIJWNol7cTVIzwI+4qcBIq9QWaZqUblm0IDrtSqbNg+3SQf8SMGHkiSigD++rHmCHjBg==", - "requires": { - "@fortawesome/fontawesome-common-types": "^0.2.35" - } - }, - "@fortawesome/free-brands-svg-icons": { - "version": "5.15.3", - "resolved": "https://registry.npmjs.org/@fortawesome/free-brands-svg-icons/-/free-brands-svg-icons-5.15.3.tgz", - "integrity": "sha512-1hirPcbjj72ZJtFvdnXGPbAbpn3Ox6mH3g5STbANFp3vGSiE5u5ingAKV06mK6ZVqNYxUPlh4DlTnaIvLtF2kw==", - "requires": { - "@fortawesome/fontawesome-common-types": "^0.2.35" - } - }, - "@fortawesome/free-solid-svg-icons": { - "version": "5.15.3", - "resolved": "https://registry.npmjs.org/@fortawesome/free-solid-svg-icons/-/free-solid-svg-icons-5.15.3.tgz", - "integrity": "sha512-XPeeu1IlGYqz4VWGRAT5ukNMd4VHUEEJ7ysZ7pSSgaEtNvSo+FLurybGJVmiqkQdK50OkSja2bfZXOeyMGRD8Q==", - "requires": { - "@fortawesome/fontawesome-common-types": "^0.2.35" - } - }, - "@fortawesome/vue-fontawesome": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/@fortawesome/vue-fontawesome/-/vue-fontawesome-2.0.2.tgz", - "integrity": "sha512-ecpKSBUWXsxRJVi/dbOds4tkKwEcBQ1JSDZFzE2jTFpF8xIh3OgTX8POIor6bOltjibr3cdEyvnDjecMwUmxhQ==", - "requires": {} - }, "@hapi/address": { "version": "2.1.4", "resolved": "https://registry.npmjs.org/@hapi/address/-/address-2.1.4.tgz", @@ -22851,8 +22749,8 @@ "dev": true }, "inflection-table": { - "version": "https://git.app.uib.no/api/v4/projects/16442/jobs/artifacts/0.2.31/raw/module.tar.gz?job=publish", - "integrity": "sha512-wB9qG4VFILPhpo3a0YcZWGhGUTtNdcVhw76LJAUNorRlunaAqADznEXDaFoY5qxjuJkRJGxGe1lQZAioX47a1g==", + "version": "https://git.app.uib.no/api/v4/projects/16442/jobs/artifacts/0.2.40/raw/module.tar.gz?job=publish", + "integrity": "sha512-MOM71YWLmGPerc7ViWSouhWujHuNBaFb9ahnu82TJOSsWQK4qpDAtr791Y85PZgxVQjyneGAaBnQ5UVc+bI2xw==", "requires": { "core-js": "~3.6.5", "jquery": "^3.5.1", @@ -28006,12 +27904,6 @@ "resolved": "https://registry.npmjs.org/vue-router/-/vue-router-3.5.2.tgz", "integrity": "sha512-807gn82hTnjCYGrnF3eNmIw/dk7/GE4B5h69BlyCK9KHASwSloD1Sjcn06zg9fVG4fYH2DrsNBZkpLtb25WtaQ==" }, - "vue-social-sharing": { - "version": "3.0.8", - "resolved": "https://registry.npmjs.org/vue-social-sharing/-/vue-social-sharing-3.0.8.tgz", - "integrity": "sha512-56gOES9fq7kyzuW7+lVAKtoG9Wi4MGjIfMqXAFZv1QSwW00EN0X5zJDSQjZn1Y2cIU6DUG+1KfJB7r7nTuiISA==", - "requires": {} - }, "vue-style-loader": { "version": "4.1.3", "resolved": "https://registry.npmjs.org/vue-style-loader/-/vue-style-loader-4.1.3.tgz", diff --git a/package.json b/package.json index d489e232afea9b26cc3e9124df30ac62a0949a5d..0b6d0675479349b2f4d65e3442214c8c9de7e570 100644 --- a/package.json +++ b/package.json @@ -8,20 +8,15 @@ "lint": "vue-cli-service lint" }, "dependencies": { - "@fortawesome/fontawesome-svg-core": "^1.2.35", - "@fortawesome/free-brands-svg-icons": "^5.15.3", - "@fortawesome/free-solid-svg-icons": "^5.15.3", - "@fortawesome/vue-fontawesome": "^2.0.2", "axios": "^0.21.1", "axios-cache-adapter": "^2.7.3", "core-js": "~3.6.5", "debounce": "^1.2.1", - "inflection-table": "https://git.app.uib.no/api/v4/projects/16442/jobs/artifacts/0.2.31/raw/module.tar.gz?job=publish", + "inflection-table": "https://git.app.uib.no/api/v4/projects/16442/jobs/artifacts/0.2.40/raw/module.tar.gz?job=publish", "vue": "^2.6.12", "vue-material-design-icons": "^4.11.0", "vue-plausible": "^1.1.4", "vue-router": "^3.5.1", - "vue-social-sharing": "^3.0.8", "vuetify": "^2.5.8" }, "devDependencies": { diff --git a/src/App.vue b/src/App.vue index babc1cf34244452690043737106a9b9e17254636..4e82360e7bdca10917b9b14fe717c4837cd1cc0c 100644 --- a/src/App.vue +++ b/src/App.vue @@ -80,7 +80,6 @@ h1 > a.xs, h1 > a.sm { header > h1 > a { color: var(--v-primary-base) !important; - text-decoration: none; font-size: 48px; margin: 0px; } @@ -97,6 +96,10 @@ header > p { padding-top: 0; } +header a { + text-decoration: none; +} + .beta { position: absolute; top: 2px; @@ -106,7 +109,6 @@ header > p { } .about-link > a{ - text-decoration: none; border-bottom: solid var(--v-primary-base) 2px; font-size: 12px; color: var(--v-primary-base) !important; @@ -125,13 +127,9 @@ footer { } footer a { - text-decoration: underline; color: #ffffff !important; } -a { - text-decoration: none; -} header { padding-top: 20px; @@ -184,24 +182,6 @@ footer > div.sm > div { height: 60px; } -/* -Hyperlink style in about page and article content -*/ -@media (hover: none) { - article a:not(.choose):not(.return_to_results a), .about a { - text-decoration: underline; - } -} - -@media (hover: hover) { - article a, .about a { - text-decoration: none; - } - article a:hover:not(.choose):not(.return_to_results a), .about a:hover { - text-decoration: underline; - } - -} </style> diff --git a/src/components/Article.vue b/src/components/Article.vue index c35f03c145583645005b8e6914e3a7d827887423..12f00cc65cf9cffb6a8b1587c6a5eeb100f75857 100644 --- a/src/components/Article.vue +++ b/src/components/Article.vue @@ -87,10 +87,10 @@ export default { return this.article.dictionary }, def_label: function() { - return this.dictionary == 'bob' ? 'Betydning og bruk' : 'Tyding og bruk' + return this.dictionary == 'bm' ? 'Betydning og bruk' : 'Tyding og bruk' }, example_label: function() { - return this.dictionary == 'bob' ? 'Eksempel' : 'Døme' + return this.dictionary == 'bm' ? 'Eksempel' : 'Døme' }, sub_articles: function() { return this.article.body.definitions.reduce((acc, val) => acc.concat(find_sub_articles(val)), []).sort((s1, s2) => s1.lemmas[0].localeCompare(s2.lemmas[0])) @@ -127,8 +127,16 @@ article { background-color: #ffffff; } +.xs .article_footer, .sm .article_footer { + display: none; +} + +.welcome .article_footer { + display: block; +} + #single_article_container article { - border: solid 2px var(--v-primary-base); + border: solid 1px var(--v-primary-base); } .fade { @@ -141,14 +149,12 @@ section { h3 { color: var(--v-primary-base); - font-variant: small-caps; + font-variant: all-small-caps; } section.etymology > h3, section.pronunciation > h3 { display: inline; - font-size: 14px; - font-variant: revert; } section.etymology ul, section.pronunciation ul, section.etymology li, section.pronunciation li { @@ -218,6 +224,11 @@ ul li.definition { .choose { color: var(--v-primary-base) !important; + text-decoration: none; +} + +.info-card { + padding: 12px; } diff --git a/src/components/ArticleFooter.vue b/src/components/ArticleFooter.vue index 6d5beb55343fef6b90086d946a7a62882c1ad5e2..c91f46bb9043c77abb645762b000186583193767 100644 --- a/src/components/ArticleFooter.vue +++ b/src/components/ArticleFooter.vue @@ -1,57 +1,59 @@ <template> <div class="article_footer"> - <span v-if="hasPointer"> - <button aria-label="Del ordboksartikkel på Facebook" class="share_button" tabindex="0"> - <ShareNetwork network="facebook" - title="" - :url="share_link" - tabindex="-1"> - <v-icon dense>$vuetify.icons.facebook</v-icon> - </ShareNetwork> - </button> - <button aria-label="Del del ordboksartikkel på Twitter" class="share_button" tabindex="0"> - <ShareNetwork - network="twitter" - :url="share_link" - :title="dict_label" - hashtags="#ordbøkene" - tabindex="-1"> - <v-icon dense>$vuetify.icons.twitter</v-icon> - </ShareNetwork> - </button> - </span> - <button v-if="webShareApiSupported" aria-label="Del ordboksartikkelen med andre" class="share_button" tabindex="0" @click="shareViaWebShare"> - <span v-if="!hasPointer" class = "share_text">Del ordet</span> - <v-icon dense>$vuetify.icons.share</v-icon> - </button> - <div class = "footer_title" tabindex="0">Ordbøkene.no - </div> + <v-btn v-if="!webShareApiSupported" x-small depressed class="toolbar-button" rounded tabindex="0" @click="copy_link"> + <v-icon small>link</v-icon> <span class = "button-text">Kopier lenke</span> + </v-btn> + + <v-btn v-if="webShareApiSupported" depressed x-small class="toolbar-button" rounded tabindex="0" @click="shareViaWebShare"> + <v-icon x-small>share</v-icon><span class = "button-text">Del ordet</span> + </v-btn> + <v-dialog max-width="600px" rounded="0" v-model="citation_dialog"> + <template v-slot:activator="{ on, attrs }"> + <v-btn depressed x-small class="toolbar-button" rounded tabindex="0" v-on="on" v-bind="attrs"> + <v-icon x-small>format_quote</v-icon> <span class = "button-text">Siter</span> + </v-btn> + + </template> + + <v-card rounded="0" class="info-card"> + {{{"nn": "Ønskjer du å sitere denne artikkelen i Nynorskordboka, rår vi deg til å gje opp når artikkelen vart henta (lesen), t.d. slik:", + "bm": "Ønsker du å sitere denne artikkelen i Bokmålsordboka, anbefaler vi å oppgi når artikkelen ble hentet (lest), f.eks. slik:"}[this.article.dictionary]}}<br/> + <div id = "citation" v-html="this.create_citation()"/> + <v-btn depressed x-small class="toolbar-button" rounded tabindex="0" @click="copy_citation"><br> + <v-icon x-small icon>content_copy</v-icon> <span class = "button-text">Kopier</span> + </v-btn> + <v-btn depressed x-small class="toolbar-button" rounded tabindex="0" @click="download_ris"><br> + <v-icon x-small icon>get_app</v-icon> <span class = "button-text">Last ned (RIS)</span> + </v-btn> + <v-btn depressed x-small class="toolbar-button" rounded tabindex="0" @click="close_citation_dialog"><br> + <v-icon x-small icon>close</v-icon> <span class = "button-text">Avbryt</span> + </v-btn> + </v-card> + </v-dialog> </div> </template> <script> +const host = window.location.hostname === 'localhost'? 'https://dev.ordbok.uib.no/' : window.location.href + export default { name: 'ArticleFooter', props: { article: Object }, computed: { - dict_label: function() { // TODO: reuse code used in header - return { - 'bob': 'Fra bokmålsordboka', - 'nob': 'Frå nynorskordboka' - }[this.article.dictionary] + ': ' + this.article.lemmas[0].lemma || '' - }, webShareApiSupported() { return navigator.share }, hasPointer() { return window.matchMedia('(hover: hover) and (pointer: fine)').matches }, - share_link: function() { - let host = window.location.hostname === 'localhost'? 'https://dev.ordbok.uib.no/' : window.location.href - return host + this.article.dictionary + '/' + this.article.article_id + '/' + encodeURIComponent(this.article.lemmas[0].lemma) + }, + data: function() { + return { + citation_dialog: false } + }, methods: { shareViaWebShare() { @@ -60,26 +62,71 @@ export default { text: "", url: "/" + this.article.dictionary + '/' + this.article.article_id + '/' + encodeURIComponent(this.article.lemmas[0].lemma) }) - } + }, + create_link() { + return host + this.article.dictionary + '/' + this.article.article_id + '/' + encodeURIComponent(this.article.lemmas[0].lemma) + }, + get_citation_info() { + let date = new Date(); + let dd = (date.getDate() < 10? '0' : '') + date.getDate() + let mm = (date.getMonth() < 9? '0' : '') + (date.getMonth()+1) + let yyyy = date.getFullYear() + let link = this.create_link() + let lemma = this.article.lemmas[0].lemma + return [lemma, dd, mm, yyyy, link] + }, + create_citation() { + const [lemma, dd, mm, yyyy, link] = this.get_citation_info() + let citation = {"bm": `«${lemma}». I: <em>Bokmålsordboka.</em> Språkrådet og Universitetet i Bergen. <<a href='${link}'>${link}</a>> (hentet ${dd}.${mm}.${yyyy}).`, + "nn":`«${lemma}». I: <em>Nynorskordboka.</em> Språkrådet og Universitetet i Bergen. <<a href='${link}'>${link}</a>> (henta ${dd}.${mm}.${yyyy}).` + }[this.article.dictionary] + return citation + }, + copy_link() { + navigator.clipboard.writeText(this.create_link()); + }, + + copy_citation() { + let citation = document.getElementById("citation").textContent; + navigator.clipboard.writeText(citation) + this.citation_dialog = false + }, + + close_citation_dialog() { + this.citation_dialog = false + }, + download_ris() { + const [lemma, dd, mm, yyyy, link] = this.get_citation_info() + const a = document.createElement("a") + a.style = "display: none" + a.setAttribute("download", `${lemma}_${this.article.dictionary}.ris`) + const dict = {"bm":"Bokmålsordboka", "nn": "Nynorskordboka"}[this.article.dictionary] + const text = `TY - DICT\nTI - ${lemma}\nT2 - ${dict}\nPB - Språkrådet og Universitetet i Bergen\nUR - ${link}\nY2 - ${yyyy}/${mm}/${dd}/\nER - ` + a.setAttribute('href', 'data:application/x-research-info-systems;charset=utf-8,' + encodeURIComponent(text)); + document.body.appendChild(a) + a.click() + document.body.removeChild(a) + }, } } </script> <style scoped> -.share_text { - padding-right: 10px; - vertical-align: middle; +.button-text { + padding-left: 3px; + font-size: 12px; + color: var(--v-primary-base) !important; } .v-icon { color: var(--v-primary-base) !important; } -.share_button { - padding-right: 4px; - font-weight: bold; - font-size: 14px; +.toolbar-button { + margin-right: 6px; + margin-top: 6px; + font-size: 12px; } @@ -88,11 +135,11 @@ export default { padding-top: 24px; } -.footer_title { - font-family: Inria Serif; - font-weight: bold; - font-size: 18px; - float: right; +#citation { + margin-top: 12px; + padding: 12px; + background-color: var(--v-button-base) !important; + margin-bottom: 6px; } </style> diff --git a/src/components/Autocomplete.vue b/src/components/Autocomplete.vue index 8249f9d188939cc9252da9c4d668c9851eab6967..5145f92a0200436b13214eda849cfa683f2c8b88 100644 --- a/src/components/Autocomplete.vue +++ b/src/components/Autocomplete.vue @@ -13,6 +13,7 @@ rounded clearable hide-no-data + autofocus auto-select-first no-filter hide-details @@ -30,7 +31,10 @@ <span class="search-hit"> {{data.item.label}} </span> - ({{{"b": "bm", "n": "nn", "bn": "bm, nn" }[data.item.lang] || ["søker...","ingen treff","avansert søk"][data.item.search]}}) + <span v-if="(get_lang()=='bm,nn')"> + ({{{"b": "bm", "n": "nn", "bn": "bm, nn" }[data.item.lang] || + ["søker...","ingen treff","avansert søk"][data.item.search]}}) + </span> </template> <template slot="no-data"> <div></div> @@ -75,13 +79,16 @@ } }, methods: { + get_lang() { + return this.$parent.lang + }, run_query(q, time) { this.suggesting = true // Search options while waiting for response var search = 0 if (this.items[0]) { if (this.items[0].time < time) { - if (/_|\*|\|/.test(q)) { + if (/[_*%|]/.test(q)) { search = 2 } // Whitespace necessary in case option already exists in dropdown @@ -92,13 +99,13 @@ this.items.push({q: q, label: q, time: time, search: search}) } let self = this - self.api.get('suggest?', {params: {q: q, dict: self.$parent.lang, n: 80, scope: 'w', stage: self.$parent.stage, wc: self.$parent.pos_selected.tag}}) + self.api.get('suggest?', {params: {q: q, dict: self.get_lang(), n: 80, scope: 'w', wc: self.$parent.pos_selected.tag}}) .then(async (response) => { if (self.$refs.autocomplete.searchInput == q & self.suggesting) { let suggestions = response.data.a.w.map(item => ({q: q, match: item[0], label: item[0], time: time, lang: item[1]})) - if (/_|\*|\|/.test(q)) { + if (/[_*%|]/.test(q)) { suggestions.unshift({q: q, label: q, time: time, search: 2}) } diff --git a/src/components/CompoundList.vue b/src/components/CompoundList.vue index 0189fc94ac59e5d6d45c91470bcf2b671b372738..fd02c8520342469b2dd9c1ca9ae2aedc03a208f8 100644 --- a/src/components/CompoundList.vue +++ b/src/components/CompoundList.vue @@ -5,10 +5,10 @@ <li :key="index" v-for="(item, index) in body.elements" - ><router-link + >{{' '}}<router-link :to="'/' + dictionary + '/' + item.article_id + (item.definition_id ? '#def'+item.definition_id : '')" @click.native="article_link_click(item)" - > {{item.lemmas[0].lemma}}</router-link> + >{{item.lemmas[0].lemma}}</router-link> </li> </ul> </li> diff --git a/src/components/Definition.vue b/src/components/Definition.vue index 5f47c647884d2ff4df2838e1ca89b40d37ab2e81..fa0a2a2342d59719cf3158a20c1010ea05efc169 100644 --- a/src/components/Definition.vue +++ b/src/components/Definition.vue @@ -47,7 +47,7 @@ var Definition = { return this.body.elements.filter(el => el.type_ == 'compound_list') }, example_header: function() { - return this.dictionary == 'bob' ? 'Eksempel' : 'Døme' + return this.dictionary == 'bm' ? 'Eksempel' : 'Døme' }, subdefs: function() { // filtrerer bort definisjoner som bare inneholder underartikler diff --git a/src/components/DictionaryView.vue b/src/components/DictionaryView.vue index e8f782d7ef2c33a0946cc8170d235af7ae8cded2..e65c34fe632056e2b2a5a4a0d279a722a79b27ed 100644 --- a/src/components/DictionaryView.vue +++ b/src/components/DictionaryView.vue @@ -7,21 +7,21 @@ <template v-slot:label tabindex="1"> <span aria-label="Vis resultat i begge ordbøkene eller bruk radioknapp for bokmålsordboka eller radioknapp for nynorskordboka">VIS</span> </template> - <v-radio value="bob,nob" color="primary"> + <v-radio value="bm,nn" color="primary"> <template v-slot:label> <span> begge{{$vuetify.breakpoint.smAndDown ? '' : ' ordbøkene'}} </span> </template> </v-radio> - <v-radio value="bob" color="primary"> + <v-radio value="bm" color="primary"> <template v-slot:label> <span> {{$vuetify.breakpoint.xs ? 'bm' : 'bokmål (bm)'}} </span> </template> </v-radio> - <v-radio value="nob" color="primary"> + <v-radio value="nn" color="primary"> <template v-slot:label> <span> {{$vuetify.breakpoint.xs ? 'nn' : 'nynorsk (nn)'}} @@ -62,7 +62,7 @@ <div id="single_article_container" v-if="article"> <div class="return_to_results" v-if="search_results && search_results.length"> <router-link :to="article.source" @click.native="return_to_results()"> - <v-icon class="nav_arrow">arrow_left</v-icon>Tilbake til {{article.dictionary == 'bob' ? 'søkeresultater' : 'søkjeresultat'}} + <v-icon class="nav_arrow">arrow_left</v-icon>Tilbake til {{article.dictionary == 'bm' ? 'søkeresultater' : 'søkjeresultat'}} </router-link> </div> <Article :key="article_key" :article="article" @article-click="article_link_click" /> @@ -96,11 +96,10 @@ import { setup } from 'axios-cache-adapter' const SEARCH_ENDPOINT = process.env.VUE_APP_SEARCH_ENDPOINT const ARTICLE_ENDPOINT= process.env.VUE_APP_ARTICLE_ENDPOINT -const API_STAGE = process.env.VUE_APP_API_STAGE -const dicts = {'nob': 'Nynorskorboka', - 'bob': 'Bokmålsordboka', - 'bob,nob': 'ordbøkene'} +const dicts = {'nn': 'Nynorskorboka', + 'bm': 'Bokmålsordboka', + 'bm,nn': 'ordbøkene'} const api = setup({ baseURL: SEARCH_ENDPOINT, @@ -137,9 +136,12 @@ function navigate_to_article(self, source) { if ((self.$route.query.nocache || '').toLowerCase() == 'true') { config.headers.cachebuster = Date.now() }*/ - axios.get(ARTICLE_ENDPOINT + self.$route.params.lang + '/article/' + self.$route.params.id + ".json") + + const lang = self.$route.params.lang + + axios.get(ARTICLE_ENDPOINT + lang + '/article/' + self.$route.params.id + ".json") .then(function(response){ - self.article = Object.assign(response.data, {'dictionary': self.$route.params.lang, results: self.search_results}) + self.article = Object.assign(response.data, {'dictionary': lang, results: self.search_results}) self.search_results = [] self.error = null }) @@ -148,8 +150,8 @@ function navigate_to_article(self, source) { self.error = ["Vi har ingen artikkel med id " + self.$route.params.id] } else { self.error = [] - if (self.lang !== 'bob') self.error.push(`Noko gjekk gale...`) - if (self.lang !== 'nob') self.error.push(`Noe gikk galt...`) + if (self.lang !== 'bm') self.error.push(`Noko gjekk gale...`) + if (self.lang !== 'nn') self.error.push(`Noe gikk galt...`) } }) .then(function(response){ @@ -194,7 +196,7 @@ function navigate_to_query(self, word) { let query = self.event ? self.event : {q: word} // Get article IDs - api.get('articles?', {params: {w: query.match || query.q, dict: self.lang, scope: "w", stage: self.stage, wc: self.pos_selected.tag}}).then((response) => { + api.get('articles?', {params: {w: query.match || query.q, dict: self.lang, scope: "w", wc: self.pos_selected.tag}}).then((response) => { let article_ids = response.data let unwrapped = [] for (const d in article_ids) { @@ -219,18 +221,18 @@ function navigate_to_query(self, word) { if (! self.search_results.length) { if (query.match) { self.error = [] - if (self.lang !== 'bob') { + if (self.lang !== 'bm') { self.error.push(`Ordet «${query.match}» finst ikkje i Nynorskordboka. Bruk knappen «bokmål (bm)» om du har søkt i feil ordbok.`) } - if (self.lang !== 'nob') self.error.push(`Ordet «${query.match}» finnes ikke i Bokmålsordboka. Bruk knappen «nynorsk (nn)» om du har søkt i feil ordbok.`) + if (self.lang !== 'nn') self.error.push(`Ordet «${query.match}» finnes ikke i Bokmålsordboka. Bruk knappen «nynorsk (nn)» om du har søkt i feil ordbok.`) } else { self.error = [`Søk på «${query.q}» gir ingen treff i ${dicts[self.lang]}.`] // If not advanced search if (query.search != 2) self.error[0] += " Søk med * eller % dersom du er usikker på skrivemåten. Søketips kan du finne i «OM ORDBØKENE»." - if (self.lang == "bob") self.error[0] += ` Bruk knappen «nynorsk (nn)» om du har søkt i feil ordbok.` - if (self.lang == "nob") self.error[0] += ` Bruk knappen «bokmål (bm)» om du har søkt i feil ordbok.` + if (self.lang == "bm") self.error[0] += ` Bruk knappen «nynorsk (nn)» om du har søkt i feil ordbok.` + if (self.lang == "nn") self.error[0] += ` Bruk knappen «bokmål (bm)» om du har søkt i feil ordbok.` } } @@ -262,7 +264,7 @@ export default { return { article_key: 0, search_results: [], - lang: 'bob,nob', + lang: 'bm,nn', pos_selected: {label: "Alle ordklasser"}, pos: posOptions, waiting_for_articles: true, @@ -272,7 +274,7 @@ export default { monthly_bm: null, monthly_nn: null, event: null, - stage: API_STAGE + previous: this.$route.fullPath, } }, computed: { @@ -293,12 +295,12 @@ export default { this.search_results = [] if (error.response) { this.error = [] - if (this.lang !== 'bob') this.error.push(`Noko gjekk gale på serversida`) - if (this.lang !== 'nob') this.error.push(`Noe gikk galt på serversiden"`) + if (this.lang !== 'bm') this.error.push(`Noko gjekk gale på serversida`) + if (this.lang !== 'nn') this.error.push(`Noe gikk galt på serversiden"`) } else { this.error = [] - if (this.lang !== 'bob') this.error.push(`Nettverksproblem, prøv igjen`) - if (this.lang !== 'nob') this.error.push(`Nettverksproblemer, prøv igjen`) + if (this.lang !== 'bm') this.error.push(`Nettverksproblem, prøv igjen`) + if (this.lang !== 'nn') this.error.push(`Nettverksproblemer, prøv igjen`) } }, select_result: function (event) { @@ -358,7 +360,7 @@ export default { } }, details_click: function(item) { - item.article.source = this.$route.path + item.article.source = this.previous this.article = item.article history.replaceState({article: this.article, search_results: [], lang: this.lang, error: null}, '') }, @@ -366,18 +368,22 @@ export default { this.article = null } }, + watch: { + $route(to, from) { + this.previous = from.fullPath + } + }, mounted: function(){ let self = this - this.lang = 'bob,nob' - + this.lang = 'bm,nn' Promise.all([ - axios.get(ARTICLE_ENDPOINT + 'bob/concepts.json').then(function(response){ + axios.get(ARTICLE_ENDPOINT + 'bm/concepts.json').then(function(response){ let concepts = response.data.concepts - entities.bob = concepts + entities.bm = concepts }), - axios.get(ARTICLE_ENDPOINT + 'nob/concepts.json').then(function(response){ + axios.get(ARTICLE_ENDPOINT + 'nn/concepts.json').then(function(response){ let concepts = response.data.concepts - entities.nob = concepts + entities.nn = concepts }) ]).then(function(_) { self.waiting_for_metadata = false @@ -393,23 +399,23 @@ export default { navigate_to_article(self, self.$route.path) } else { - self.lang = self.$route.params.lang || 'bob,nob' + self.lang = self.$route.params.lang || self.lang self.waiting_for_articles = false history.replaceState({article: self.article, search_results: self.search_results, lang: self.lang, error: self.error}, '') } // words of the month - axios.get(ARTICLE_ENDPOINT + 'bob/article/5607.json').then(function(response){ - self.monthly_bm = Object.assign(response.data, {dictionary: 'bob'}) + axios.get(ARTICLE_ENDPOINT + 'bm/article/5607.json').then(function(response){ + self.monthly_bm = Object.assign(response.data, {dictionary: 'bm'}) }) - axios.get(ARTICLE_ENDPOINT + 'nob/article/78569.json').then(function(response){ - self.monthly_nn = Object.assign(response.data, {dictionary: 'nob'}) + axios.get(ARTICLE_ENDPOINT + 'nn/article/78569.json').then(function(response){ + self.monthly_nn = Object.assign(response.data, {dictionary: 'nn'}) }) }).catch(function(_){ self.error = [] - if (self.lang !== 'bob') self.error.push(`Eit nettverksproblem hindra lasting av sida. Prøv å laste sida på nytt`) - if (self.lang !== 'nob') self.error.push(`Et nettverksproblem hindret lasting av siden. Prøv å laste siden på nytt`) + if (self.lang !== 'bm') self.error.push(`Eit nettverksproblem hindra lasting av sida. Prøv å laste sida på nytt`) + if (self.lang !== 'nn') self.error.push(`Et nettverksproblem hindret lasting av siden. Prøv å laste siden på nytt`) self.waiting_for_metadata = false self.waiting_for_articles = false }) @@ -438,6 +444,7 @@ main { } div.welcome { + margin-top: 1em; flex-grow: 10; background-image: url('../assets/books.jpg'); background-repeat: no-repeat; @@ -450,7 +457,6 @@ div.welcome article { .search_container { background-color: var(--v-tertiary-base); padding-top: 1px; - padding-bottom: 10px; } #spinner { @@ -483,11 +489,11 @@ div.monthly.sm, div.monthly.xs { flex-direction: column; } -div.monthly article.bob .dict-label::before { +div.monthly article.bm .dict-label::before { content: "fra "; } -div.monthly article.nob .dict-label::before { +div.monthly article.nn .dict-label::before { content: "frå "; } @@ -533,11 +539,13 @@ li.suggestion { } .return_to_results { + padding-top: 10px; display: table-cell; } .return_to_results a { color: var(--v-primary-base) !important; + text-decoration: none; } .nav_arrow { diff --git a/src/components/Header.vue b/src/components/Header.vue index 528ca51700ed20426a292e366314a7ec8e98ce38..961544b78dec56b3f5343555446a481356397179 100644 --- a/src/components/Header.vue +++ b/src/components/Header.vue @@ -19,13 +19,17 @@ </v-card> </v-menu>) </span> - - <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"> + <div class="inflection-wrapper" v-if="inflected"> + + <v-btn class="show-inflection" width="160px" rounded depressed small @click.native="toggle" :class="$vuetify.breakpoint.name"> + <span>{{inflection_button_text}}</span><span class = "inflection-arrow">{{inflection_arrow}}</span> + </v-btn> + <div class="inflection-canvas" v-if="inflection_expanded"> <inflectionTable :lemmaList="lemmas_with_word_class_and_lang" :mq="$vuetify.breakpoint.name" /> </div> - </details> + +</div> + </div> </template> @@ -59,14 +63,23 @@ export default { return a_forms.join(', ') }, inflect_tooltip: function() { - return this.dictionary == 'bob' ? 'Klikk for å se bøyinger' : 'Klikk for å sjå bøyingar' + return this.dictionary == 'bm' ? 'Klikk for å se bøyinger' : 'Klikk for å sjå bøyingar' }, dict_label: function() { return { - 'bob': 'bokmålsordboka', - 'nob': 'nynorskordboka' + 'bm': 'bokmålsordboka', + 'nn': 'nynorskordboka' }[this.dictionary] || '' }, + inflection_button_text: function() { + return { + "bm": {false: "Se bøyning", true: "Skjul bøyning"}, + "nn": {false: "Sjå bøying", true: "Skjul bøying"} + }[this.dictionary][this.inflection_expanded] + }, + inflection_arrow: function() { + return this.inflection_expanded? "▲" : "▼" + }, group_list: function() { return helpers.group_list(this.lemmas, this.dictionary) }, @@ -84,7 +97,7 @@ export default { ) }, lemmas_with_word_class_and_lang: function() { - return this.lemmas.map(lemma => Object.assign({language: this.dictionary == 'bob' ? 'nob' : 'nno', + return this.lemmas.map(lemma => Object.assign({language: this.dictionary == 'bm' ? 'nob' : 'nno', word_class: lemma.paradigm_info[0].inflection_group.split('_')[0]}, lemma)) }, inflected: function() { @@ -100,15 +113,18 @@ export default { data: function() { return { inflect_reported: false, - menu: false + menu: false, + inflection_expanded: false } }, methods: { toggle: function() { + this.inflection_expanded = !this.inflection_expanded if (! this.inflect_reported) { this.$plausible.trackEvent('open inflection', {props: {article: `/${this.dictionary}/${this.article_id}/${this.lemmas[0].lemma}`}}) } this.inflect_reported = true + } } } @@ -118,11 +134,6 @@ export default { <style> -summary { - width: 30em; - text-align: center; -} - article h2 { padding-top: 4px; padding-bottom: 0px; @@ -142,10 +153,6 @@ article h2.secondary_header { width: 10px; } -.info-card { - padding: 12px; -} - .word-classification { text-decoration: underline dashed; } @@ -160,56 +167,18 @@ article h2.secondary_header { font-variant-caps: all-small-caps; } -.header details { - margin-top: 10px; - position: relative; -} - -.header summary { - position: relative; - max-width: 130px; - list-style: none; - border: solid 2px var(--v-primary-base); - border-radius: 30px; - padding-top: 6px; - padding-bottom: 6px; - padding-right: 10px; - color: var(--v-primary-base); - cursor: pointer; -} - -.header details[open] > summary { - box-shadow: 2px 2px 0px var(--v-primary-base) -} - -.header details > summary:after { - content: "⌄"; - font-weight: bold; - position: absolute; - right: 0; - top: 1px; - margin-right: 3px; -} - -.header details > summary.bob:before { - content: "Se "; -} -.header details > summary.nob:before { - content: "Sjå "; +.show-inflection { + color: var(--v-primary-base) !important; + font-weight: bold !important; } -.header details[open] > summary.bob:before, details[open] > summary.nob:before { - content: "Skjul "; -} -.header details[open] > summary:after { - content: "⌃"; - font-weight: bold; +.inflection-arrow { position: absolute; - right: 0; - top: 8px; - margin-right: 3px; + right: -4px; + margin-left: 3px; + font-size: 10px; } @keyframes open { @@ -221,10 +190,6 @@ article h2.secondary_header { } } -.header details[open] summary ~ * { - animation: open 0.3s ease-in-out; -} - .inflection-canvas { overflow-x: auto; /*position: absolute;*/ @@ -234,14 +199,17 @@ article h2.secondary_header { padding-top: 10px; } -.header details > summary::-webkit-details-marker { - display: none; -} -.infl-wrapper { - color: var(--v-primary-base); +.inflection-wrapper { + color: var(--v-text-base); width: min-content; font-size: 14px; + overflow-x: auto; + margin-top: 10px; +} + +#search_results .xs .inflection-wrapper, #search_results .sm .inflection-wrapper { + display: none; } .context { @@ -264,8 +232,8 @@ th, td { } th { - background-color: var(--v-tertiary-darken1); - color: var(--v-primary-darken1); + background-color: var(--v-button-base); + color: var(--v-primary-darken1) } .infl-label { diff --git a/src/components/SearchResults.vue b/src/components/SearchResults.vue index 7bc3d9b079d32a349e8b429b79c5865faeacd2df..18b15f64fa832756942ef2ddaef79347509a55f1 100644 --- a/src/components/SearchResults.vue +++ b/src/components/SearchResults.vue @@ -1,8 +1,8 @@ <template> <section id="search_results"> <div class="flex-container" :class="$vuetify.breakpoint.name"> - <ul class="hits" v-if="results_bob.length"> - <li class="article_container" v-for="(result, index) in results_bob" :key="index + results_hash" tabindex="-1"> + <ul class="hits" v-if="results_bm.length"> + <li class="article_container" v-for="(result, index) in results_bm" :key="index + results_hash" tabindex="-1"> <Article :article="result" @article-click="article_link_click" @@ -10,8 +10,8 @@ </Article> </li> </ul> - <ul class="hits" v-if="results_nob.length"> - <li class="article_container" v-for="(result, index) in results_nob" :key="index + results_hash" tabindex="-1"> + <ul class="hits" v-if="results_nn.length"> + <li class="article_container" v-for="(result, index) in results_nn" :key="index + results_hash" tabindex="-1"> <Article :article="result" @article-click="article_link_click" @@ -36,17 +36,17 @@ export default { computed: { right_col_class_name: function() { if (this.$vuetify.breakpoint.mdAndUp) { - if (this.results_bob.length) { + if (this.results_bm.length) { return 'righ_hand_column' } } return '' }, - results_bob: function(){ - return this.hits.filter(hit => hit.dictionary == 'bob') + results_bm: function(){ + return this.hits.filter(hit => hit.dictionary == 'bm') }, - results_nob: function(){ - return this.hits.filter(hit => hit.dictionary == 'nob') + results_nn: function(){ + return this.hits.filter(hit => hit.dictionary == 'nn') }, results_hash: function(){ return this.hits.reduce((hash, hit) => (hash + hit.article_id) % 10000, 0) diff --git a/src/main.js b/src/main.js index 93f5ffcf4dcd71800c9520f7737b1edf263ce88c..a0da811324956fe266450b425b2249900e45977b 100644 --- a/src/main.js +++ b/src/main.js @@ -7,9 +7,6 @@ import VueRouter from 'vue-router' import { VuePlausible } from 'vue-plausible' import vuetify from './plugins/vuetify' -import VueSocialSharing from 'vue-social-sharing' -Vue.use(VueSocialSharing); - Vue.config.productionTip = false Vue.use(VueRouter) @@ -37,7 +34,7 @@ const router = new VueRouter({ component: DictionaryView, children: [ { - path: ':lang', + path: ':lang(bm|nn|bm,nn)', children: [ { name: 'word', @@ -52,6 +49,25 @@ const router = new VueRouter({ path: 'search/:query' } ] + }, + { + path: 'bob/*', + redirect: to => { + return "bm/" + to.params.pathMatch + } + }, + { + path: 'nob/*', + redirect: to => { + console.log(to) + return "nn/" + to.params.pathMatch + } + }, + { + path: 'bob,nob/*', + redirect: to => { + return "bm,nn/" + to.params.pathMatch + } } ] } diff --git a/src/plugins/vuetify.js b/src/plugins/vuetify.js index e2b9f5391857f18637b1f82198ded3beaa44fd11..b004a608e561a54217ce07c71d9fba4184ce0e9c 100644 --- a/src/plugins/vuetify.js +++ b/src/plugins/vuetify.js @@ -1,41 +1,9 @@ import Vue from 'vue'; import 'material-design-icons-iconfont/dist/material-design-icons.css'; import Vuetify from 'vuetify/lib/framework'; -import { library } from '@fortawesome/fontawesome-svg-core' -import { faShareAltSquare, faInfoCircle} from '@fortawesome/free-solid-svg-icons' -import { faFacebookSquare, faTwitterSquare} from '@fortawesome/free-brands-svg-icons' -import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome' -library.add(faFacebookSquare, faTwitterSquare, faShareAltSquare, faInfoCircle) -Vue.component('font-awesome-icon', FontAwesomeIcon); Vue.use(Vuetify); -const FONTAWESOME_ICONS = { - facebook: { - component: FontAwesomeIcon, - props: { - icon: ["fab", "facebook-square"] - } - }, - twitter: { - component: FontAwesomeIcon, - props: { - icon: ["fab", "twitter-square"] - } - }, - share: { - component: FontAwesomeIcon, - props: { - icon: "share-alt-square" - } - }, - info: { - component: FontAwesomeIcon, - props: { - icon: ["fa", "info-circle"] - } - } -} export default new Vuetify({ breakpoint: { @@ -59,6 +27,7 @@ export default new Vuetify({ anchor: '#880E4F', error: '#FDF4F5', border: '#9E9E9E', + button: '#f5f5f5', text: '#000000' } } @@ -69,6 +38,5 @@ export default new Vuetify({ }, icons: { iconfont: 'md', - values: FONTAWESOME_ICONS, } }); diff --git a/src/utils/entities.js b/src/utils/entities.js index 49f37797a00e2e2142efa136c6168cda23d06469..b48438d98f430a4e1576a12eded0dcd75b9d004d 100644 --- a/src/utils/entities.js +++ b/src/utils/entities.js @@ -1,7 +1,7 @@ var entities = { - 'bob': { + 'bm': { }, - 'nob': { + 'nn': { } } diff --git a/src/utils/helpers.js b/src/utils/helpers.js index ba5ce7a6e740b940ccf903ad9258544dbb76d862..61ef577cb9fde56aba29f108cd2376bcb8887dcb 100644 --- a/src/utils/helpers.js +++ b/src/utils/helpers.js @@ -1,5 +1,5 @@ var mapping = { - "bob": { + "bm": { "NOUN": "substantiv", "VERB": "verb", "ADJ": "adjektiv", @@ -21,7 +21,7 @@ var mapping = { "Neuter": "intetkjønn", "Uninfl": "ubøyelig" }, - "nob": { + "nn": { "NOUN": "substantiv", "VERB": "verb", "ADJ": "adjektiv",