"use strict"; import {Common} from "../Utils/Common.ecma.js"; import {Div, A} from "../Utils/HTMLDSL.ecma.js"; /** * @typedef {import("../Application/AnP.ecma.js").AnP} AnP */ /** * @constructs LicensesComponent * @param {!AnP} anp * @return {void} * @access public * @static */ export const LicensesComponent = (function(){ /** * @constructs LicensesComponent * @param {!AnP} anp * @return {void} * @access private * @static */ const LicensesComponent = function(anp){ /** @type {LicensesComponent} */ const self = this; /** * @returns {void} * @access private */ const constructor = () => {}; /** * @param {!Object.} licenses * @returns {Array.} * @access public */ this.build = licenses => Div({ class : "licenses", }, Object.entries(licenses).map(([name, inputs]) => ( self[name] ? self[name](...Common.get_array(inputs)) : null))); /** * @param {!(number|[number, number])} years * @param {!(string|Array.)} authors * @returns {Array.} * @access public */ this.copyright = (years, authors) => anp.components.i18n("copyright", "span", { authors : Common.get_array(authors).join(", "), years : Common.get_array(years).join("-") }); /** * @returns {Array.} * @access public */ this.cc_by_nc_sa_4 = () => A({ href : anp.settings.get("cc_by_nc_sa_4_link", null, "https://creativecommons.org/licenses/by-nc-sa/4.0/"), target : "_blank", data_i18n : "cc_by_nc_sa_4", data_i18n_without : true, title : anp.i18n.get("cc_by_nc_sa_4") }, [ anp.components.i18n("cc_by_nc_sa_4"), anp.components.image({ i18n : "cc_by_nc_sa_4", sources : [anp.settings.get("cc_by_nc_sa_4_icon", null, "https://i.creativecommons.org/l/by-nc-sa/4.0/88x31.png")], }) ]) constructor(); }; return LicensesComponent; })();