diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..cc84372 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,49 @@ +# Changelog + +## [1.1.0] - 2022-11-13 +### Added +- Added Dutch +- Added Arabic (thanks to [Ahmad Huran](https://github.com/AhmadHuran)) +- Started keeping the changelog. + +### Changed +- Set language preference in cookie as well as browser storage +- Allow Internation in multi deck environments +- Auto-switch reading direction if the language has `direction: "rtl"` added + + +## [1.0.4] - 2020-07-01 +### Added +- Added possibility to have translatable items outside the .slides +### Changed +- Changes of some formatting. +- Verticator now references the Reveal files by CDN. + + + +## [1.0.3] - 2020-06-25 +(Version not published on NPM) +### Added +- Added more demo pages. +### Changed +- Option to change 'langattribute' +- Option to change 'switchselector' + + + +## [1.0.2] - 2020-06-25 +### Changed +- Updated readme +- Bugfixes + + + +## [1.0.1] - 2020-06-24 +### Changed +- Updated readme +- Changed dropdown to custom + + + +## [1.0.0] - 2020-06-24 +- Initial commit \ No newline at end of file diff --git a/LICENSE b/LICENSE index a79fe3a..332bbaf 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2020 Martijn De Jongh (Martino) +Copyright (c) 2022 Martijn De Jongh (Martino) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index e747391..4c99279 100644 --- a/README.md +++ b/README.md @@ -2,11 +2,12 @@ [![Version](https://img.shields.io/npm/v/reveal.js-internation)](#) [![Downloads](https://img.shields.io/npm/dt/reveal.js-internation)](https://github.com/Martinomagnifico/reveal.js-internation/archive/refs/heads/master.zip) -A plugin for [Reveal.js](https://revealjs.com) 4, that can let the end user choose a language for the presentation. Creating additional languages is made easy by letting you tag elements that should be translated. Running the presentation in 'makejson'-mode will generate a full JSON file of the whole current presentation. You can then start translating this file into other languages. +A plugin for [Reveal.js](https://revealjs.com), that can let the end user choose a language for the presentation. Creating additional languages is made easy by letting you tag elements that should be translated. Running the presentation in 'makejson'-mode will generate a full JSON file of the whole current presentation. You can then start translating this file into other languages. You should probably actually know these other languages (or someone who does) to be able to do so :-) -[![Screenshot](https://martinomagnifico.github.io/reveal.js-internation/screenshot.png)](https://martinomagnifico.github.io/reveal.js-internation/demo.html) +[](https://martinomagnifico.github.io/reveal.js-internation/demo.html) + ## Installation @@ -29,11 +30,10 @@ The Internation plugin folder can then be referenced from `node_modules/reveal.j ### JavaScript -The Internation plugin has been written for Reveal.js version 4. Internation also works in setups with multiple Reveal instances. - There are two JavaScript files for Internation, a regular one, `internation.js`, and a module one, `internation.esm.js`. You only need one of them: #### Regular + If you're not using ES modules, for example, to be able to run your presentation from the filesystem, you can add it like this: ```html @@ -159,7 +159,9 @@ Make a copy of your first generated JSON. Give the file a name that is obvious ( ## Step 5A. Refer to your new language file(s)… -A language in Internation contains both a name and a dictionary. This example shows that a JSON file is used for the dictionary. JSON files will only work if there is a server. It will not work with the file:// protocol. +A language in Internation contains both a name, a dictionary and an optional direction. This example shows that a JSON file is used for the dictionary. JSON files will only work if there is a server. It will not work with the file:// protocol. + +The direction can be added if you want to change the HTML reading direction when you change the language to any 'rtl' language like Hebrew or Arabic. ```javascript Reveal.initialize({ @@ -169,6 +171,11 @@ Reveal.initialize({ fr: { name: "Français", dictionary: "fr.json" + }, + ar: { + name: "العربية", + dictionary: "ar.json", + direction: "rtl" } } }, @@ -218,4 +225,4 @@ And if you want to show off what you made with it, please do :-) ## License MIT licensed -Copyright (C) 2021 Martijn De Jongh (Martino) +Copyright (C) 2022 Martijn De Jongh (Martino) diff --git a/ar.json b/ar.json new file mode 100644 index 0000000..058cd9e --- /dev/null +++ b/ar.json @@ -0,0 +1,33 @@ +{ + "slides": { + "examples":{ + "title":"أمثلة" + }, + "intro":{ + "subtitle":"Reveal.js لِ" + }, + "fruit":{ + "title":"الفواكه", + "apple":"تفاحة", + "orange":"برتقالة" + }, + "diner":{ + "title":"مطعم شعبي", + "pizza":"بيتزا", + "hamburger":"هامبرغر" + }, + "animals":{ + "title":"حيوانات", + "dog":"كلب", + "cat":"قطة" + }, + "html":{ + "title":"HTML محتوى", + "paragraph":"هذه فقرة نص عادية", + "htmlparagraph":"HTML هذه فقرة نص تحتوي على عنصر " + } + }, + "menubar": { + "chooselanguage": "اختر اللغة" + } +} diff --git a/css/demo.css b/css/demo.css index bb73465..f54fce6 100644 --- a/css/demo.css +++ b/css/demo.css @@ -1,41 +1,55 @@ @charset "UTF-8"; .slides { opacity: 0; - -webkit-transition: opacity .5s ease; - -o-transition: opacity .5s ease; - transition: opacity .5s ease; } + -webkit-transition: opacity 0.5s ease; + -o-transition: opacity 0.5s ease; + transition: opacity 0.5s ease; +} .reveal.ready .slides { - opacity: 1; } + opacity: 1; +} .backgrounds { - background: #1a1626; } + background: #1a1626; +} .small { - font-size: .7em; } + font-size: 0.7em; +} .smallitalic { - font-size: .7em; - font-style: italic; } + font-size: 0.7em; + font-style: italic; +} .reveal pre { width: 100%; margin: 0 auto; -webkit-box-shadow: none; box-shadow: none; - background: rgba(180, 180, 180, 0.5); } + background: rgba(180, 180, 180, 0.5); +} p code, p kbd, code { background: rgba(180, 180, 180, 0.2); font-size: 0.8em; padding: 5px 10px; - border-radius: 4px; } + border-radius: 4px; +} p kbd { - font-family: monospace; } + font-family: monospace; +} pre code { - line-height: 1.3; } + line-height: 1.3; +} + +.reveal.rtl .slides, .reveal.rtl .slides h1, .reveal.rtl .slides h2, .reveal.rtl .slides h3, .reveal.rtl .slides h4, .reveal.rtl .slides h5, .reveal.rtl .slides h6 { + direction: rtl; + font-family: inherit; +} /* EXAMPLE MENUBAR */ .menubar { @@ -53,102 +67,136 @@ pre code { align-items: center; background: none; padding: 0 3vmin; - z-index: 2; + z-index: 1; border-bottom: 1px solid rgba(255, 255, 255, 0.5); - height: 50px; - min-height: 50px; - top: -55px; - -webkit-transition: all 0.8s cubic-bezier(0.26, 0.86, 0.44, 0.985); - -o-transition: all 0.8s cubic-bezier(0.26, 0.86, 0.44, 0.985); - transition: all 0.8s cubic-bezier(0.26, 0.86, 0.44, 0.985); - opacity: 0; } + height: clamp(50px, 8vmax, 80px); + -webkit-transform: translateY(-100%); + -ms-transform: translateY(-100%); + transform: translateY(-100%); + opacity: 0; + -webkit-transition-property: opacity, -webkit-transform; + transition-property: opacity, -webkit-transform; + -o-transition-property: transform, opacity; + transition-property: transform, opacity; + transition-property: transform, opacity, -webkit-transform; + -webkit-transition-duration: 0.8s; + -o-transition-duration: 0.8s; + transition-duration: 0.8s; + -webkit-transition-timing-function: cubic-bezier(0.26, 0.86, 0.44, 0.985); + -o-transition-timing-function: cubic-bezier(0.26, 0.86, 0.44, 0.985); + transition-timing-function: cubic-bezier(0.26, 0.86, 0.44, 0.985); + margin-top: -1px; +} body:not(.hide-menubar) .reveal.ready .menubar { top: 0; - opacity: 1; } + -webkit-transform: translateY(0); + -ms-transform: translateY(0); + transform: translateY(0); + opacity: 1; +} .reveal .lowercase { - text-transform: none; } + text-transform: none; +} .row { display: -webkit-box; display: -ms-flexbox; - display: flex; } - .row .col { - -webkit-box-flex: 1; - -ms-flex: 1; - flex: 1; } + display: flex; +} +.row .col { + -webkit-box-flex: 1; + -ms-flex: 1; + flex: 1; +} /* EXAMPLE FLAG LANGUAGE CHOOSER */ .reveal .flags { display: block; position: relative; margin-bottom: -80px !important; - margin-top: 80px; } - .reveal .flags label { - display: inline-block; } - .reveal .flags [type=radio] { - position: absolute; - opacity: 0; - width: 0; - height: 0; } - .reveal .flags img { - border-radius: 40px; - border: 4px solid #1a1626; - margin: 0; - width: 60px; - height: 60px; - margin-left: 10px; - margin-right: 10px; - cursor: pointer; - opacity: 0.5; } - .reveal .flags img:hover { - opacity: 1; } - .reveal .flags [type=radio]:checked + img { - pointer-events: none; - opacity: 1; - border: 4px solid white; } + margin-top: 80px; +} +.reveal .flags label { + display: inline-block; +} +.reveal .flags [type=radio] { + position: absolute; + opacity: 0; + width: 0; + height: 0; +} +.reveal .flags img { + border-radius: 40px; + border: 4px solid #1a1626; + margin: 0; + width: 60px; + height: 60px; + margin-left: 10px; + margin-right: 10px; + cursor: pointer; + opacity: 0.5; +} +.reveal .flags img:hover { + opacity: 1; +} +.reveal .flags [type=radio]:checked + img { + background-color: white; + pointer-events: none; + opacity: 1; + border: 4px solid white; +} /* EXAMPLE DROPDOWN WITH LANGUAGE CHOOSER */ +.menubar { + z-index: 2; +} .menubar .dropdown { position: relative; display: inline-block; font-size: 16px; - color: #FFF; } - + color: #FFF; +} +@media screen and (min-width: 768px) { + .menubar .dropdown { + font-size: 20px; + } +} .menubar input[type=checkbox] { - display: none; } - + display: none; +} .menubar input[type=checkbox] + label { background: none; border: 1px solid white; border-radius: 6px; - padding: .4em 1em; + padding: 0.4em 1em; cursor: pointer; - opacity: 0.5; } - .menubar input[type=checkbox] + label:hover { - opacity: 1; } - + opacity: 0.5; +} +.menubar input[type=checkbox] + label:hover { + opacity: 1; +} .menubar input[type=checkbox]:checked + label { - border-radius: 6px 6px 0 0; } - + border-radius: 6px 6px 0 0; +} .menubar input[type=checkbox]:checked ~ .langchooser { - display: block; } - + display: block; +} .menubar label { display: inline-block; text-align: center; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; - user-select: none; } - + user-select: none; +} .menubar [type=radio] { position: absolute; opacity: 0; width: 0; - height: 0; } - + height: 0; +} .menubar .dropdown .langchooser { position: absolute; list-style: none; @@ -163,31 +211,48 @@ body:not(.hide-menubar) .reveal.ready .menubar { -webkit-box-shadow: 0px 1px 10px rgba(0, 0, 0, 0.5); box-shadow: 0px 1px 10px rgba(0, 0, 0, 0.5); display: none; - background: #1a1626; + background: rgba(26, 22, 38, 0.8); + -webkit-backdrop-filter: blur(2px); + backdrop-filter: blur(2px); border: 1px solid white; border-radius: 0 0 6px 6px; - overflow: hidden; } - .menubar .dropdown .langchooser label { - display: block; - padding: 0; } - + overflow: hidden; +} +.menubar .dropdown .langchooser label { + display: block; + padding: 0; +} .menubar .langchooser [type=radio] + span { display: block; - padding: .75em 2em; + padding: 0.75em 2em; cursor: pointer; - opacity: 0.5; } - + opacity: 0.5; +} .menubar .langchooser span:hover { - opacity: 0.75; } - + opacity: 0.75; +} .menubar .langchooser [type=radio]:checked + span { pointer-events: none; color: white; font-weight: bold; opacity: 1; - position: relative; } - .menubar .langchooser [type=radio]:checked + span:before { - content: '√'; - display: block; - position: absolute; - left: 1em; } + position: relative; +} +.menubar .langchooser [type=radio]:checked + span:before { + content: "√"; + display: block; + position: absolute; + left: 1em; +} + +a.github-corner { + position: absolute; + z-index: 1; + width: clamp(50px, 8vmax, 80px); + line-height: 0; + color: rgba(255, 255, 255, 0.5); +} + +a.github-corner:hover { + color: white; +} \ No newline at end of file diff --git a/demo.html b/demo.html index 4fa1f89..32bcaa9 100644 --- a/demo.html +++ b/demo.html @@ -8,15 +8,18 @@ - - - + + + -
-
- + - + \ No newline at end of file diff --git a/img/ar.png b/img/ar.png new file mode 100644 index 0000000..2ffcfd5 Binary files /dev/null and b/img/ar.png differ diff --git a/package.json b/package.json index c1fe67b..1199e87 100644 --- a/package.json +++ b/package.json @@ -1,16 +1,16 @@ { "name": "reveal.js-internation", - "version": "1.0.4", - "description": "Localization of Reveal.js presentations", - "keywords": "reveal, reveal.js, reveal-plugin, plugin, internationalization", + "version": "1.1.0", + "description": "Internation is a localization (i10n) or internationalization (i18n) plugin for Reveal.js that reads language dictionaries from JSON files. The author can add switches to the presentation to let the user choose a language.", + "keywords": "reveal, reveal.js, reveal-plugin, plugin, internationalization, i18n, localization, i10n, rtl", "homepage": "https://github.com/Martinomagnifico/reveal.js-internation", "repository": { "type": "git", "url": "https://github.com/Martinomagnifico/reveal.js-internation.git" }, - "peerDependencies": { - "reveal.js": "^4.0" - }, "author": "Martijn De Jongh", - "license": "MIT, Copyright (C) 2020 Martijn De Jongh" + "license": "MIT, Copyright (C) 2022 Martijn De Jongh", + "peerDependencies": { + "reveal.js": "^4.2" + } } \ No newline at end of file diff --git a/plugin/internation/internation.esm.js b/plugin/internation/internation.esm.js index 020d009..f33cad7 100644 --- a/plugin/internation/internation.esm.js +++ b/plugin/internation/internation.esm.js @@ -4,7 +4,7 @@ * https://github.com/Martinomagnifico * * Internation.js for Reveal.js - * Version 1.0.4 + * Version 1.1.0 * * @license * MIT licensed @@ -17,17 +17,11 @@ function _typeof(obj) { "@babel/helpers - typeof"; - if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { - _typeof = function (obj) { - return typeof obj; - }; - } else { - _typeof = function (obj) { - return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; - }; - } - - return _typeof(obj); + return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { + return typeof obj; + } : function (obj) { + return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; + }, _typeof(obj); } var Plugin = function Plugin() { @@ -54,6 +48,12 @@ var Plugin = function Plugin() { return params; }; + var getCookie = function getCookie(name) { + var value = "; ".concat(document.cookie); + var parts = value.split("; ".concat(name, "=")); + if (parts.length === 2) return parts.pop().split(';').shift(); + }; + var readJson = function readJson(file) { var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : { method: 'get' @@ -184,7 +184,18 @@ var Plugin = function Plugin() { var setText = function setText(pickLang) { var pickdict = langs[pickLang].dictionary; - var origdict = langs[options.locale].dictionary; // Set language for elements outside 'slides' + var origdict = langs[options.locale].dictionary; + + if (langs[pickLang].direction && langs[pickLang].direction == 'rtl') { + deck.configure({ + rtl: true + }); + } else { + deck.configure({ + rtl: false + }); + } // Set language for elements outside 'slides' + var idDivs = revealEl.querySelectorAll(":scope > [id]:not(.slides)"); idDivs.forEach(function (idDiv) { @@ -211,7 +222,7 @@ var Plugin = function Plugin() { var switchSetter = function switchSetter(selects, value) { selects.forEach(function (thisselect) { thisselect.value = value; - document.documentElement.setAttribute('lang', value); + deck.getRevealElement().setAttribute('lang', value); var radio = thisselect.querySelector("input[value='".concat(value, "']")); if (radio) { @@ -223,8 +234,8 @@ var Plugin = function Plugin() { var langSwitcher = function langSwitcher() { var selects = deck.getRevealElement().querySelectorAll(options.switchselector); - if (sessionStorage['InternationSettingsStorage']) { - var langPref = sessionStorage['InternationSettingsStorage']; + if (sessionStorage['InternationSettingsStorage'] || getCookie('InternationSettings')) { + var langPref = sessionStorage['InternationSettingsStorage'] ? sessionStorage['InternationSettingsStorage'] : getCookie('InternationSettings'); switchSetter(selects, langPref); setText(langPref); } @@ -234,6 +245,7 @@ var Plugin = function Plugin() { switchSetter(selects, event.target.value); setText(event.target.value); sessionStorage['InternationSettingsStorage'] = event.target.value; + document.cookie = "InternationSettings=".concat(event.target.value, ";max-age=").concat(60 * 60 * 24 * 14); }); }); }; @@ -247,7 +259,7 @@ var Plugin = function Plugin() { if (Object.keys(langs).length === 0 && langs.constructor === Object) { debugLog("There are no languages defined."); - Reveal.on('ready', function (event) { + deck.on('ready', function (event) { getTextContent(deck, options); }); } @@ -317,4 +329,4 @@ var Plugin = function Plugin() { }; }; -export default Plugin; +export { Plugin as default }; diff --git a/plugin/internation/internation.js b/plugin/internation/internation.js index a5fb766..3587cd5 100644 --- a/plugin/internation/internation.js +++ b/plugin/internation/internation.js @@ -4,7 +4,7 @@ * https://github.com/Martinomagnifico * * Internation.js for Reveal.js - * Version 1.0.4 + * Version 1.1.0 * * @license * MIT licensed @@ -17,23 +17,17 @@ (function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : typeof define === 'function' && define.amd ? define(factory) : - (global = global || self, global.Internation = factory()); -}(this, (function () { 'use strict'; + (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Internation = factory()); +})(this, (function () { 'use strict'; function _typeof(obj) { "@babel/helpers - typeof"; - if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { - _typeof = function (obj) { - return typeof obj; - }; - } else { - _typeof = function (obj) { - return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; - }; - } - - return _typeof(obj); + return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { + return typeof obj; + } : function (obj) { + return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; + }, _typeof(obj); } var Plugin = function Plugin() { @@ -60,6 +54,12 @@ return params; }; + var getCookie = function getCookie(name) { + var value = "; ".concat(document.cookie); + var parts = value.split("; ".concat(name, "=")); + if (parts.length === 2) return parts.pop().split(';').shift(); + }; + var readJson = function readJson(file) { var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : { method: 'get' @@ -190,7 +190,18 @@ var setText = function setText(pickLang) { var pickdict = langs[pickLang].dictionary; - var origdict = langs[options.locale].dictionary; // Set language for elements outside 'slides' + var origdict = langs[options.locale].dictionary; + + if (langs[pickLang].direction && langs[pickLang].direction == 'rtl') { + deck.configure({ + rtl: true + }); + } else { + deck.configure({ + rtl: false + }); + } // Set language for elements outside 'slides' + var idDivs = revealEl.querySelectorAll(":scope > [id]:not(.slides)"); idDivs.forEach(function (idDiv) { @@ -217,7 +228,7 @@ var switchSetter = function switchSetter(selects, value) { selects.forEach(function (thisselect) { thisselect.value = value; - document.documentElement.setAttribute('lang', value); + deck.getRevealElement().setAttribute('lang', value); var radio = thisselect.querySelector("input[value='".concat(value, "']")); if (radio) { @@ -229,8 +240,8 @@ var langSwitcher = function langSwitcher() { var selects = deck.getRevealElement().querySelectorAll(options.switchselector); - if (sessionStorage['InternationSettingsStorage']) { - var langPref = sessionStorage['InternationSettingsStorage']; + if (sessionStorage['InternationSettingsStorage'] || getCookie('InternationSettings')) { + var langPref = sessionStorage['InternationSettingsStorage'] ? sessionStorage['InternationSettingsStorage'] : getCookie('InternationSettings'); switchSetter(selects, langPref); setText(langPref); } @@ -240,6 +251,7 @@ switchSetter(selects, event.target.value); setText(event.target.value); sessionStorage['InternationSettingsStorage'] = event.target.value; + document.cookie = "InternationSettings=".concat(event.target.value, ";max-age=").concat(60 * 60 * 24 * 14); }); }); }; @@ -253,7 +265,7 @@ if (Object.keys(langs).length === 0 && langs.constructor === Object) { debugLog("There are no languages defined."); - Reveal.on('ready', function (event) { + deck.on('ready', function (event) { getTextContent(deck, options); }); } @@ -325,4 +337,4 @@ return Plugin; -}))); +})); diff --git a/plugin/internation/plugin-src.js b/plugin/internation/plugin-src.js index d34e8fe..7e629ca 100755 --- a/plugin/internation/plugin-src.js +++ b/plugin/internation/plugin-src.js @@ -19,10 +19,14 @@ const Plugin = () => { return params; }; + const getCookie = function (name) { + let value = `; ${document.cookie}`; + let parts = value.split(`; ${name}=`); + if (parts.length === 2) return parts.pop().split(';').shift(); + } + - const readJson = (file, options = { - method: 'get' - }) => + const readJson = (file, options = { method: 'get' }) => new Promise((resolve, reject) => { let request = new XMLHttpRequest(); request.onload = resolve; @@ -99,7 +103,6 @@ const Plugin = () => { const getTextContent = function(deck, options) { - let sections = revealEl.querySelectorAll(`section`); let JSON = false; @@ -163,13 +166,18 @@ const Plugin = () => { let pickdict = langs[pickLang].dictionary; let origdict = langs[options.locale].dictionary; + if (langs[pickLang].direction && langs[pickLang].direction == 'rtl') { + deck.configure({rtl:true}) + } else { + deck.configure({rtl:false}) + } + // Set language for elements outside 'slides' let idDivs = revealEl.querySelectorAll(":scope > [id]:not(.slides)"); idDivs.forEach(idDiv => { let divid = idDiv.id; let langattributes = idDiv.querySelectorAll(`[${options.langattribute}]`); attributeLooper(langattributes, pickdict, origdict, divid); - }); // Set language for elements inside 'slides' @@ -189,7 +197,7 @@ const Plugin = () => { const switchSetter = function(selects, value) { selects.forEach(thisselect => { thisselect.value = value; - document.documentElement.setAttribute('lang', value); + deck.getRevealElement().setAttribute('lang', value); let radio = thisselect.querySelector(`input[value='${value}']`); if (radio) { radio.checked = true; @@ -198,11 +206,10 @@ const Plugin = () => { } const langSwitcher = function() { - let selects = deck.getRevealElement().querySelectorAll(options.switchselector); - if (sessionStorage['InternationSettingsStorage']) { - let langPref = sessionStorage['InternationSettingsStorage']; + if (sessionStorage['InternationSettingsStorage'] || getCookie('InternationSettings')) { + let langPref = sessionStorage['InternationSettingsStorage'] ? sessionStorage['InternationSettingsStorage'] : getCookie('InternationSettings'); switchSetter(selects, langPref); setText(langPref); } @@ -213,6 +220,7 @@ const Plugin = () => { switchSetter(selects, event.target.value); setText(event.target.value); sessionStorage['InternationSettingsStorage'] = event.target.value; + document.cookie = `InternationSettings=${event.target.value};max-age=${60 * 60 * 24 * 14}`; }); }); @@ -227,7 +235,7 @@ const Plugin = () => { } if (Object.keys(langs).length === 0 && langs.constructor === Object) { debugLog(`There are no languages defined.`); - Reveal.on( 'ready', event => { + deck.on( 'ready', event => { getTextContent(deck, options); }); diff --git a/screenshot.png b/screenshot.png index 42ed1df..7cfd0cb 100644 Binary files a/screenshot.png and b/screenshot.png differ