orejime
Advanced tools
Comparing version 2.1.0 to 2.1.1
# CHANGELOG | ||
## 2.1.1 | ||
- fix: string formatting (https://github.com/empreinte-digitale/orejime/pull/71) | ||
- internal: code formatting with prettier (https://github.com/empreinte-digitale/orejime/pull/69) | ||
## 2.1.0 | ||
@@ -4,0 +9,0 @@ |
@@ -43,3 +43,3 @@ import _extends from "@babel/runtime/helpers/extends"; | ||
return t(['purposes', purpose]); | ||
}).join(", "); | ||
}).join(', '); | ||
var optOutText = optOut ? React.createElement("span", { | ||
@@ -55,3 +55,3 @@ className: ns('AppItem-optOut'), | ||
className: ns('AppItem-purposes') | ||
}, t(['app', purposes.length > 1 ? 'purposes' : 'purpose']), ": ", purposesText) : null; | ||
}, t(['app', purposes.length > 1 ? 'purposes' : 'purpose']), ":", ' ', purposesText) : null; | ||
var switchLabel = isChecked ? 'enabled' : 'disabled'; | ||
@@ -72,3 +72,3 @@ return React.createElement("div", { | ||
}, required ? { | ||
tabIndex: "0" | ||
tabIndex: '0' | ||
} : {}), React.createElement("span", { | ||
@@ -75,0 +75,0 @@ className: ns('AppItem-title') |
@@ -37,3 +37,3 @@ import _typeof from "@babel/runtime/helpers/typeof"; | ||
return t(['purposes', purpose]); | ||
}).join(", "); | ||
}).join(', '); | ||
var title = t(['consentNotice', 'title']); | ||
@@ -40,0 +40,0 @@ return React.createElement("div", { |
@@ -239,3 +239,3 @@ import _slicedToArray from "@babel/runtime/helpers/slicedToArray"; | ||
if (dataset.hide === "true") { | ||
if (dataset.hide === 'true') { | ||
if (dataset.originalDisplay === undefined) dataset.originalDisplay = element.style.display; | ||
@@ -261,3 +261,3 @@ element.style.display = 'none'; | ||
function escapeRegexStr(str) { | ||
return str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&"); | ||
return str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, '\\$&'); | ||
} | ||
@@ -264,0 +264,0 @@ |
@@ -6,4 +6,4 @@ require('./scss/orejime.scss'); | ||
function initDefaultInstance() { | ||
if (window.orejimeConfig !== undefined // `window.orejime instanceof Element` means there is a #orejime div in the dom | ||
&& (window.orejime === undefined || window.orejime instanceof Element)) { | ||
if (window.orejimeConfig !== undefined && ( // `window.orejime instanceof Element` means there is a #orejime div in the dom | ||
window.orejime === undefined || window.orejime instanceof Element)) { | ||
window.orejime = Orejime.init(window.orejimeConfig); | ||
@@ -10,0 +10,0 @@ } |
export function getCookies() { | ||
var cookieStrings = document.cookie.split(";"); | ||
var cookieStrings = document.cookie.split(';'); | ||
var cookies = []; | ||
var regex = new RegExp('^\\s*([^=]+)\\s*\=\\s*(.*?)$'); | ||
var regex = new RegExp('^\\s*([^=]+)\\s*=\\s*(.*?)$'); | ||
@@ -6,0 +6,0 @@ for (var i = 0; i < cookieStrings.length; i++) { |
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray"; | ||
import _typeof from "@babel/runtime/helpers/typeof"; | ||
String.prototype.format = function () { | ||
"use strict"; | ||
function format(string) { | ||
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { | ||
args[_key - 1] = arguments[_key]; | ||
} | ||
var str = this.toString(); | ||
var t = _typeof(args[0]); | ||
var t = _typeof(arguments[0]); | ||
var args; | ||
if (arguments.length == 0) args = {};else args = "string" === t || "number" === t ? Array.prototype.slice.call(arguments) : arguments[0]; | ||
var values; | ||
if (args.length == 0) values = {};else values = 'string' === t || 'number' === t ? args : args[0]; | ||
var splits = []; | ||
var s = str; | ||
var s = string; | ||
@@ -28,10 +28,10 @@ while (s.length > 0) { | ||
// not a number | ||
splits.push(args[m[1]]); | ||
splits.push(values[m[1]]); | ||
} else { | ||
// a numbered argument | ||
splits.push(args[n]); | ||
splits.push(values[n]); | ||
} | ||
} else { | ||
splits.push(s); | ||
s = ""; | ||
s = ''; | ||
} | ||
@@ -41,3 +41,3 @@ } | ||
return splits; | ||
}; | ||
} | ||
@@ -69,6 +69,6 @@ export function language() { | ||
if (debug) { | ||
console.log('[missing translation: {lang}/{key}]'.format({ | ||
key: kl.join("/"), | ||
console.log(format('[missing translation: {lang}/{key}]', { | ||
key: kl.join('/'), | ||
lang: lang | ||
}).join("")); | ||
}).join('')); | ||
} | ||
@@ -80,4 +80,4 @@ | ||
var params = Array.prototype.slice.call(arguments, 4); | ||
if (params.length > 0) return value.format.apply(value, _toConsumableArray(params)); | ||
if (params.length > 0) return format.apply(void 0, [value].concat(_toConsumableArray(params))); | ||
return value; | ||
} |
@@ -30,3 +30,3 @@ export function convertToMap(d) { | ||
if (!(ed instanceof Map) || !(d instanceof Map)) throw "Parameters are not maps!"; | ||
if (!(ed instanceof Map) || !(d instanceof Map)) throw 'Parameters are not maps!'; | ||
if (overwrite === undefined) overwrite = true; | ||
@@ -33,0 +33,0 @@ if (clone === undefined) clone = false; |
@@ -57,3 +57,3 @@ "use strict"; | ||
return t(['purposes', purpose]); | ||
}).join(", "); | ||
}).join(', '); | ||
var optOutText = optOut ? _react.default.createElement("span", { | ||
@@ -69,3 +69,3 @@ className: ns('AppItem-optOut'), | ||
className: ns('AppItem-purposes') | ||
}, t(['app', purposes.length > 1 ? 'purposes' : 'purpose']), ": ", purposesText) : null; | ||
}, t(['app', purposes.length > 1 ? 'purposes' : 'purpose']), ":", ' ', purposesText) : null; | ||
var switchLabel = isChecked ? 'enabled' : 'disabled'; | ||
@@ -86,3 +86,3 @@ return _react.default.createElement("div", { | ||
}, required ? { | ||
tabIndex: "0" | ||
tabIndex: '0' | ||
} : {}), _react.default.createElement("span", { | ||
@@ -89,0 +89,0 @@ className: ns('AppItem-title') |
@@ -52,3 +52,3 @@ "use strict"; | ||
return t(['purposes', purpose]); | ||
}).join(", "); | ||
}).join(', '); | ||
var title = t(['consentNotice', 'title']); | ||
@@ -55,0 +55,0 @@ return _react.default.createElement("div", { |
@@ -250,3 +250,3 @@ "use strict"; | ||
if (dataset.hide === "true") { | ||
if (dataset.hide === 'true') { | ||
if (dataset.originalDisplay === undefined) dataset.originalDisplay = element.style.display; | ||
@@ -272,3 +272,3 @@ element.style.display = 'none'; | ||
function escapeRegexStr(str) { | ||
return str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&"); | ||
return str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, '\\$&'); | ||
} | ||
@@ -275,0 +275,0 @@ |
@@ -8,4 +8,4 @@ "use strict"; | ||
function initDefaultInstance() { | ||
if (window.orejimeConfig !== undefined // `window.orejime instanceof Element` means there is a #orejime div in the dom | ||
&& (window.orejime === undefined || window.orejime instanceof Element)) { | ||
if (window.orejimeConfig !== undefined && ( // `window.orejime instanceof Element` means there is a #orejime div in the dom | ||
window.orejime === undefined || window.orejime instanceof Element)) { | ||
window.orejime = Orejime.init(window.orejimeConfig); | ||
@@ -12,0 +12,0 @@ } |
@@ -12,5 +12,5 @@ "use strict"; | ||
function getCookies() { | ||
var cookieStrings = document.cookie.split(";"); | ||
var cookieStrings = document.cookie.split(';'); | ||
var cookies = []; | ||
var regex = new RegExp('^\\s*([^=]+)\\s*\=\\s*(.*?)$'); | ||
var regex = new RegExp('^\\s*([^=]+)\\s*=\\s*(.*?)$'); | ||
@@ -17,0 +17,0 @@ for (var i = 0; i < cookieStrings.length; i++) { |
@@ -15,11 +15,12 @@ "use strict"; | ||
String.prototype.format = function () { | ||
"use strict"; | ||
function format(string) { | ||
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { | ||
args[_key - 1] = arguments[_key]; | ||
} | ||
var str = this.toString(); | ||
var t = (0, _typeof2.default)(arguments[0]); | ||
var args; | ||
if (arguments.length == 0) args = {};else args = "string" === t || "number" === t ? Array.prototype.slice.call(arguments) : arguments[0]; | ||
var t = (0, _typeof2.default)(args[0]); | ||
var values; | ||
if (args.length == 0) values = {};else values = 'string' === t || 'number' === t ? args : args[0]; | ||
var splits = []; | ||
var s = str; | ||
var s = string; | ||
@@ -38,10 +39,10 @@ while (s.length > 0) { | ||
// not a number | ||
splits.push(args[m[1]]); | ||
splits.push(values[m[1]]); | ||
} else { | ||
// a numbered argument | ||
splits.push(args[n]); | ||
splits.push(values[n]); | ||
} | ||
} else { | ||
splits.push(s); | ||
s = ""; | ||
s = ''; | ||
} | ||
@@ -51,3 +52,3 @@ } | ||
return splits; | ||
}; | ||
} | ||
@@ -79,6 +80,6 @@ function language() { | ||
if (debug) { | ||
console.log('[missing translation: {lang}/{key}]'.format({ | ||
key: kl.join("/"), | ||
console.log(format('[missing translation: {lang}/{key}]', { | ||
key: kl.join('/'), | ||
lang: lang | ||
}).join("")); | ||
}).join('')); | ||
} | ||
@@ -90,4 +91,4 @@ | ||
var params = Array.prototype.slice.call(arguments, 4); | ||
if (params.length > 0) return value.format.apply(value, (0, _toConsumableArray2.default)(params)); | ||
if (params.length > 0) return format.apply(void 0, [value].concat((0, _toConsumableArray2.default)(params))); | ||
return value; | ||
} |
@@ -39,3 +39,3 @@ "use strict"; | ||
if (!(ed instanceof Map) || !(d instanceof Map)) throw "Parameters are not maps!"; | ||
if (!(ed instanceof Map) || !(d instanceof Map)) throw 'Parameters are not maps!'; | ||
if (overwrite === undefined) overwrite = true; | ||
@@ -42,0 +42,0 @@ if (clone === undefined) clone = false; |
{ | ||
"name": "orejime", | ||
"version": "2.1.0", | ||
"version": "2.1.1", | ||
"description": "An easy to use consent manager that focuses on accessibility. A fork of Klaro!.", | ||
@@ -53,2 +53,4 @@ "repository": { | ||
"preact-compat": "^3.18.2", | ||
"prettier": "^2.2.1", | ||
"prettier-loader": "^3.3.0", | ||
"sass-loader": "^6.0.7", | ||
@@ -55,0 +57,0 @@ "webpack": "^4.25.1", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
244359
3856
19