j1-template 2021.2.2 → 2021.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/_layouts/default.html +31 -25
- data/assets/data/quicklinks.html +1 -2
- data/assets/themes/j1/adapter/js/fam.js +1 -1
- data/assets/themes/j1/adapter/js/j1.js +140 -141
- data/assets/themes/j1/core/js/template.js +16 -7
- data/assets/themes/j1/core/js/template.js.map +1 -1
- data/assets/themes/j1/core/js/template.min.js +16 -7
- data/assets/themes/j1/core/js/template.min.js.map +1 -1
- data/assets/themes/j1/modules/j1Deepl/js/j1deepl.js +385 -0
- data/assets/themes/j1/modules/j1Deepl/js/j1deepl.min.js +18 -0
- data/assets/themes/j1/modules/j1Scroll/js/j1scroll.js +3 -0
- data/lib/j1/version.rb +3 -3
- data/lib/starter_web/Gemfile +1 -1
- data/lib/starter_web/_config.yml +1 -1
- data/lib/starter_web/_data/resources.yml +23 -1
- data/lib/starter_web/_includes/attributes.asciidoc +1 -1
- data/lib/starter_web/_plugins/lunr_index.rb +1 -1
- data/lib/starter_web/package.json +2 -2
- data/lib/starter_web/pages/public/blog/navigator/archive/categoryview.html +9 -32
- data/lib/starter_web/pages/public/blog/navigator/archive/dateview.html +0 -22
- data/lib/starter_web/pages/public/blog/navigator/archive/tagview.html +0 -20
- data/lib/starter_web/pages/public/blog/navigator/archive.html +0 -22
- data/lib/starter_web/utilsrv/_defaults/package.json +1 -1
- data/lib/starter_web/utilsrv/package.json +1 -1
- metadata +4 -2
@@ -0,0 +1,385 @@
|
|
1
|
+
/*
|
2
|
+
# -----------------------------------------------------------------------------
|
3
|
+
# ~/assets/themes/j1/modules/j1Deepl/js/j1deepl.js
|
4
|
+
# J1 core module for j1Deepl
|
5
|
+
#
|
6
|
+
# Product/Info:
|
7
|
+
# https://jekyll.one
|
8
|
+
#
|
9
|
+
# Copyright (C) 2021 Juergen Adams
|
10
|
+
#
|
11
|
+
# J1 Template is licensed under the MIT License.
|
12
|
+
# For details, see https://jekyll.one
|
13
|
+
# -----------------------------------------------------------------------------
|
14
|
+
# NOTE: Based on https://github.com/jquery-boilerplate/jquery-boilerplate
|
15
|
+
# See: https://www.dotnetcurry.com/jquery/1069/authoring-jquery-plugins
|
16
|
+
# -----------------------------------------------------------------------------
|
17
|
+
*/
|
18
|
+
|
19
|
+
// the semi-colon before function invocation is a SAFETY method against
|
20
|
+
// concatenated scripts and/or other plugins which may NOT be closed
|
21
|
+
// properly.
|
22
|
+
//
|
23
|
+
;(function($, window, document, undefined) {
|
24
|
+
|
25
|
+
'use strict';
|
26
|
+
|
27
|
+
// Create the defaults
|
28
|
+
var pluginName = 'j1deepl',
|
29
|
+
defaults = {
|
30
|
+
api: 'free', // free (default) | pro
|
31
|
+
auth_key: false, // API authorization key.
|
32
|
+
source_lang: 'auto', // autodetection (default: auto)|supported language. Specifies the language for the input text.
|
33
|
+
target_lang: 'DE', // language to be tranlasted in.
|
34
|
+
max_chars: false, // false (unlimited) or number. Number of chars from the source text passed for translation.
|
35
|
+
split_sentences: '1', // enabled (1, default)|disabled (0)|nonewlines. Sets the translation engine to first split the input text into sentences.
|
36
|
+
preserve_formatting: '0', // disabled (0, default)|enabled (1). Sets the translation engine to respect the original formatting.
|
37
|
+
formality: 'default', // default|more|less. Sets the translated text should lean towards formal or informal language.
|
38
|
+
tag_handling: false, // false (value=0)|xml. Sets which kind of tags should be handled. If set, API is able to process structured XML content.
|
39
|
+
outline_detection: true, // false (value=0) or true (NO value passed). Controls the automatic mechanism on XML tags for splitting. If disabled, all splitting_tags are to be specified.
|
40
|
+
non_splitting_tags: false, // false or comma-separated list of XML tags. Disable automated splitting on the tags specified.
|
41
|
+
splitting_tags: false, // false or comma-separated list of XML tags which always cause splitting.
|
42
|
+
ignore_tags: false, // false or comma-separated list of XML tags that indicate text NOT to be translated.
|
43
|
+
onInit: function (){}, // callback after plugin has initialized.
|
44
|
+
onBeforeTranslation: function (){}, // callback before translation started.
|
45
|
+
onAfterTranslation: function (){} // callback after translation finished.
|
46
|
+
};
|
47
|
+
|
48
|
+
// -------------------------------------------------------------------------
|
49
|
+
// plugin constructor
|
50
|
+
// create the jquery plugin
|
51
|
+
// -------------------------------------------------------------------------
|
52
|
+
function Plugin (element, options) {
|
53
|
+
this.element = element;
|
54
|
+
this.settings = $.extend( {}, defaults, options);
|
55
|
+
this.settings.elementID = '#' + this.element.id;
|
56
|
+
this.xhr = new XMLHttpRequest();
|
57
|
+
|
58
|
+
// call the plugin initializer
|
59
|
+
this.init(this.settings);
|
60
|
+
}
|
61
|
+
|
62
|
+
// Avoid plugin prototype conflicts
|
63
|
+
$.extend(Plugin.prototype, {
|
64
|
+
// -----------------------------------------------------------------------
|
65
|
+
// init
|
66
|
+
// initialize the plugin
|
67
|
+
// -----------------------------------------------------------------------
|
68
|
+
init: function(options) {
|
69
|
+
var logger = log4javascript.getLogger('j1deepl.init');
|
70
|
+
|
71
|
+
logger.info('\n' + 'initializing plugin: started');
|
72
|
+
this.translate(options);
|
73
|
+
logger.info('\n' + 'initializing plugin: finished');
|
74
|
+
},
|
75
|
+
// -----------------------------------------------------------------------
|
76
|
+
// prepareXHR
|
77
|
+
// Prepare a XHR request according to DeepL API specification
|
78
|
+
// for the required HTTP header settings
|
79
|
+
// See: https://www.deepl.com/de/docs-api/simulator/
|
80
|
+
// -----------------------------------------------------------------------
|
81
|
+
// NOTE: "User-Agent" NOT used as the use is qualified UNSECURE
|
82
|
+
// -----------------------------------------------------------------------
|
83
|
+
prepareXHR: function (settings) {
|
84
|
+
if (settings.api === 'free') {
|
85
|
+
this.xhr.open("POST", "https://api-free.deepl.com/v2/translate", true);
|
86
|
+
} else if (settings.api === 'pro') {
|
87
|
+
this.xhr.open("POST", "https://api.deepl.com/v2/translate", true);
|
88
|
+
} else {
|
89
|
+
this.xhr.open("POST", "https://api-free.deepl.com/v2/translate", true);
|
90
|
+
}
|
91
|
+
// Set required header parameters
|
92
|
+
this.xhr.setRequestHeader("Accept", "*/*");
|
93
|
+
this.xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
|
94
|
+
},
|
95
|
+
// -----------------------------------------------------------------------
|
96
|
+
// prepareText
|
97
|
+
// Prepare text function used to parse, or arrange text, designed as
|
98
|
+
// a module. Currently it splits all text whenever a newline ("\n")
|
99
|
+
// is met, so that it preserves the original layout of the text, which
|
100
|
+
// would have otherwise been lost because of the way DeepL accepts
|
101
|
+
// multiple sentences.
|
102
|
+
// -----------------------------------------------------------------------
|
103
|
+
prepareText: function (source_text) {
|
104
|
+
return source_text.split("\n");
|
105
|
+
},
|
106
|
+
// -----------------------------------------------------------------------
|
107
|
+
// translate
|
108
|
+
// Translate text function which uses all the other modules, in order to
|
109
|
+
// create a request, which is sent to the DeepL API to translate, and
|
110
|
+
// then display the result, designed as a module.
|
111
|
+
// -----------------------------------------------------------------------
|
112
|
+
translate: function (settings) {
|
113
|
+
const logger = log4javascript.getLogger('j1deepl.translate');
|
114
|
+
const READYSTATE_DONE = 4;
|
115
|
+
const STATUS_OK = 200;
|
116
|
+
const SUPPORTED_LANG = ['BG', 'CS', 'DA', 'DE', 'EL', 'EN-GB', 'EN-US', 'EN', 'ES', 'ET', 'FI', 'FR', 'HU', 'IT', 'JA', 'LT', 'LV', 'NL', 'PL', 'PT-PT', 'PT-BR', 'PT', 'RO', 'RU', 'SK', 'SL', 'SV', 'ZH'];
|
117
|
+
const ALLOWED_FORMALITY_LANG = ['DE', 'FR', 'IT', 'ES', 'NL', 'PL', 'PT', 'PT-BR', 'RU'];
|
118
|
+
const ALLOWED_TAG_HANDLING = ['xml'];
|
119
|
+
const TARGET_ELEMENT = settings.targetElement;
|
120
|
+
const TARGET_ELEMENT_EXISTS = $(TARGET_ELEMENT).length;
|
121
|
+
const ERROR_TEXT = 'Translation failed.' + '\n' + 'Reason: ';
|
122
|
+
const WARNING_TEXT = 'Translation skipped.' + '\n' + 'Reason: ';
|
123
|
+
|
124
|
+
var BASE_TARGET_ELEMENT;
|
125
|
+
var ELEMENT_TYPE;
|
126
|
+
var SOURCE_TEXT_FOUND;
|
127
|
+
|
128
|
+
var API_RESPONSE = {};
|
129
|
+
API_RESPONSE['400'] = 'Bad request. Please check error message and your parameters.';
|
130
|
+
API_RESPONSE['401'] = 'Authorization failed. Please supply a valid DeepL-Auth-Key.';
|
131
|
+
API_RESPONSE['403'] = 'Forbidden. The access to the requested resource is denied, because of insufficient access rights.';
|
132
|
+
API_RESPONSE['404'] = 'The requested resource could not be found.';
|
133
|
+
API_RESPONSE['413'] = 'The request size exceeds the limit.';
|
134
|
+
API_RESPONSE['415'] = 'The requested entries format specified in the Accept header is not supported.';
|
135
|
+
API_RESPONSE['429'] = 'Too many requests. Please wait and resend your request.';
|
136
|
+
API_RESPONSE['456'] = 'Quota exceeded. The maximum amount of glossaries has been reached.';
|
137
|
+
API_RESPONSE['500'] = 'Internal server error';
|
138
|
+
API_RESPONSE['503'] = 'Resource currently unavailable. Try again later.';
|
139
|
+
API_RESPONSE['529'] = 'Too many requests. Please wait and resend your request.';
|
140
|
+
|
141
|
+
var reason_text;
|
142
|
+
var request = '';
|
143
|
+
var element = '';
|
144
|
+
var source_text = '';
|
145
|
+
var source_text_lines = '';
|
146
|
+
var source_lang;
|
147
|
+
var target_lang;
|
148
|
+
|
149
|
+
// check if passed HTML element or ID exists
|
150
|
+
if (TARGET_ELEMENT_EXISTS) {
|
151
|
+
BASE_TARGET_ELEMENT = (TARGET_ELEMENT.includes('.')||TARGET_ELEMENT.includes('#')) ? TARGET_ELEMENT.substring(1) : TARGET_ELEMENT;
|
152
|
+
ELEMENT_TYPE = $(TARGET_ELEMENT).get(0).nodeName;
|
153
|
+
|
154
|
+
// Read the text to be translated from the given HTML element
|
155
|
+
if (ELEMENT_TYPE === 'TEXTAREA') {
|
156
|
+
source_text = this.element.value;
|
157
|
+
} else if (ELEMENT_TYPE === 'P') {
|
158
|
+
element = this.element;
|
159
|
+
source_text = $(TARGET_ELEMENT).text();
|
160
|
+
}
|
161
|
+
SOURCE_TEXT_FOUND = source_text.length;
|
162
|
+
} else {
|
163
|
+
logger.error('\n' + 'target element does not exists: ' + TARGET_ELEMENT);
|
164
|
+
return false;
|
165
|
+
}
|
166
|
+
|
167
|
+
// limit the source text if required
|
168
|
+
if (settings.max_char && source_text.length > settings.max_char ) {
|
169
|
+
var source_text_limited = source_text.substring(0, settings.max_char -3);
|
170
|
+
source_text = source_text_limited + ' ...';
|
171
|
+
logger.info('\n' + 'limit for source text ' + '(max: ' + settings.max_char + ')' + ' reached: ' + source_text.length);
|
172
|
+
}
|
173
|
+
source_text_lines = this.prepareText(source_text);
|
174
|
+
|
175
|
+
// prepare the XHR request for the API (free/pro) requested
|
176
|
+
this.prepareXHR(settings);
|
177
|
+
|
178
|
+
// Makes a request with every line, as a new text to translate
|
179
|
+
var source_text_request = "";
|
180
|
+
for(var i = 0; i < source_text_lines.length; i++) {
|
181
|
+
source_text_request += "&text=" + source_text_lines[i];
|
182
|
+
}
|
183
|
+
|
184
|
+
this.xhr.onload = function () {
|
185
|
+
if (this.readyState === READYSTATE_DONE) {
|
186
|
+
if (this.status === STATUS_OK) {
|
187
|
+
// JSON parse the response
|
188
|
+
var result = JSON.parse(this.responseText);
|
189
|
+
|
190
|
+
// recreate the response as one text to keep its original layout
|
191
|
+
var translated_text = "";
|
192
|
+
for(var i = 0; i < result.translations.length; i++) {
|
193
|
+
translated_text += result.translations[i].text;
|
194
|
+
translated_text += "\n";
|
195
|
+
}
|
196
|
+
|
197
|
+
// update the HTM element (content) by the tranlation
|
198
|
+
if (ELEMENT_TYPE === 'TEXTAREA') {
|
199
|
+
$(TARGET_ELEMENT).val(translated_text);
|
200
|
+
} else if (ELEMENT_TYPE === 'P') {
|
201
|
+
$(TARGET_ELEMENT).text(translated_text);
|
202
|
+
}
|
203
|
+
} else {
|
204
|
+
logger.error('\n' + 'API returned ' + this.status + ': ' + API_RESPONSE[this.status]);
|
205
|
+
}
|
206
|
+
}
|
207
|
+
};
|
208
|
+
|
209
|
+
// ---------------------------------------------------------------------
|
210
|
+
// preflight (validity check) on given parameters
|
211
|
+
// ---------------------------------------------------------------------
|
212
|
+
|
213
|
+
// Check for SUPPORTED language by option source_lang|target_lang
|
214
|
+
source_lang = this.settings.source_lang;
|
215
|
+
target_lang = this.settings.target_lang;
|
216
|
+
|
217
|
+
if (this.settings.source_lang != 'auto') {
|
218
|
+
this.settings.source_lang = (SUPPORTED_LANG.indexOf(this.settings.source_lang) > -1) ? this.settings.source_lang : false;
|
219
|
+
}
|
220
|
+
this.settings.target_lang = (SUPPORTED_LANG.indexOf(this.settings.target_lang) > -1) ? this.settings.target_lang : false;
|
221
|
+
|
222
|
+
// stop processing if invalid language or NO AUTH key passed
|
223
|
+
if (!this.settings.auth_key || !this.settings.source_lang || !this.settings.target_lang) {
|
224
|
+
if (!this.settings.auth_key) {
|
225
|
+
reason_text = 'NO AUTH key passed.';
|
226
|
+
logger.error('\n' + 'invalid option found. ' + reason_text);
|
227
|
+
}
|
228
|
+
if (!this.settings.source_lang) {
|
229
|
+
reason_text = 'WRONG source language passed: ' + source_lang;
|
230
|
+
logger.error('\n' + 'invalid option found. ' + reason_text);
|
231
|
+
}
|
232
|
+
if (!this.settings.target_lang) {
|
233
|
+
reason_text = 'WRONG target language passed: ' + target_lang;
|
234
|
+
logger.error('\n' + 'invalid option found. ' + reason_text);
|
235
|
+
}
|
236
|
+
|
237
|
+
// update the HTML element (content) by an error text
|
238
|
+
if (ELEMENT_TYPE === 'TEXTAREA') {
|
239
|
+
$(TARGET_ELEMENT).val(ERROR_TEXT + reason_text);
|
240
|
+
} else if (ELEMENT_TYPE === 'P') {
|
241
|
+
$(TARGET_ELEMENT).text(ERROR_TEXT + reason_text);
|
242
|
+
}
|
243
|
+
return false;
|
244
|
+
}
|
245
|
+
|
246
|
+
if(!SOURCE_TEXT_FOUND) {
|
247
|
+
reason_text = 'NO text found for translation';
|
248
|
+
// update the HTML element (content) by an error text
|
249
|
+
if (ELEMENT_TYPE === 'TEXTAREA') {
|
250
|
+
$(TARGET_ELEMENT).val(WARNING_TEXT + reason_text);
|
251
|
+
} else if (ELEMENT_TYPE === 'P') {
|
252
|
+
$(TARGET_ELEMENT).text(WARNING_TEXT + reason_text);
|
253
|
+
}
|
254
|
+
logger.warn('\n' + 'no text found for translation');
|
255
|
+
return false;
|
256
|
+
}
|
257
|
+
|
258
|
+
// Check for VALID language supported by option 'formality'
|
259
|
+
if (this.settings.formality != 'default' ) {
|
260
|
+
if (!(ALLOWED_FORMALITY_LANG.indexOf(this.settings.target_lang) > -1)) {
|
261
|
+
logger.warn('\n' + 'wrong language found for formality setting: ' + this.settings.target_lang);
|
262
|
+
}
|
263
|
+
this.settings.formality = (ALLOWED_FORMALITY_LANG.indexOf(this.settings.target_lang) > -1) ? this.settings.formality : 'default';
|
264
|
+
}
|
265
|
+
|
266
|
+
// Check for VALID tag handling and options
|
267
|
+
if (this.settings.tag_handling) {
|
268
|
+
var tag_handling = this.settings.tag_handling;
|
269
|
+
// check for VALID method
|
270
|
+
this.settings.tag_handling = (ALLOWED_TAG_HANDLING.indexOf(this.settings.tag_handling) > -1) ? this.settings.tag_handling : false;
|
271
|
+
if (this.settings.tag_handling) {
|
272
|
+
this.settings.non_splitting_tags = this.settings.non_splitting_tags ? encodeURIComponent(this.settings.non_splitting_tags) : false;
|
273
|
+
this.settings.splitting_tags = this.settings.splitting_tags ? encodeURIComponent(this.settings.splitting_tags) : false;
|
274
|
+
this.settings.ignore_tags = this.settings.ignore_tags ? encodeURIComponent(this.settings.ignore_tags) : false;
|
275
|
+
} else {
|
276
|
+
logger.error('\n' + 'invalid option found for tag handling : ' + tag_handling);
|
277
|
+
logger.warn('\n' + 'disable option: ' + 'tag_handling');
|
278
|
+
// reset to defaults if WRONG method detected
|
279
|
+
if (this.settings.non_splitting_tags) {
|
280
|
+
logger.warn('\n' + 'disable option: ' + this.settings.non_splitting_tags);
|
281
|
+
this.settings.non_splitting_tags = false;
|
282
|
+
}
|
283
|
+
if (this.settings.splitting_tags) {
|
284
|
+
logger.warn('\n' + 'disable option : ' + this.settings.splitting_tags);
|
285
|
+
this.settings.splitting_tags = false;
|
286
|
+
}
|
287
|
+
if (this.settings.ignore_tags) {
|
288
|
+
logger.warn('\n' + 'disable option: ' + this.settings.ignore_tags);
|
289
|
+
this.settings.ignore_tags = false;
|
290
|
+
}
|
291
|
+
}
|
292
|
+
} else {
|
293
|
+
// reset tags to their defaults if NO tag_handling is enabled but settings passed
|
294
|
+
if (this.settings.non_splitting_tags) {
|
295
|
+
logger.warn('\n' + 'invalid option found: ' + this.settings.non_splitting_tags);
|
296
|
+
this.settings.non_splitting_tags = false;
|
297
|
+
}
|
298
|
+
if (this.settings.splitting_tags) {
|
299
|
+
logger.warn('\n' + 'invalid option found: ' + this.settings.splitting_tags);
|
300
|
+
this.settings.splitting_tags = false;
|
301
|
+
}
|
302
|
+
if (this.settings.ignore_tags) {
|
303
|
+
logger.warn('\n' + 'invalid option found: ' + this.settings.ignore_tags);
|
304
|
+
this.settings.ignore_tags = false;
|
305
|
+
}
|
306
|
+
}
|
307
|
+
|
308
|
+
// ---------------------------------------------------------------------
|
309
|
+
// construct the API request body
|
310
|
+
// ---------------------------------------------------------------------
|
311
|
+
request = "auth_key=" + this.settings.auth_key;
|
312
|
+
request += (this.settings.source_lang != 'auto' ) ? "&source_lang=" + this.settings.source_lang : '';
|
313
|
+
request += "&target_lang=" + this.settings.target_lang;
|
314
|
+
request += (this.settings.formality != 'default' ) ? "&formality=" + this.settings.formality : '';
|
315
|
+
request += (this.settings.split_sentences) ? "&split_sentences=" + this.settings.formality : '';
|
316
|
+
request += (this.settings.tag_handling) ? "&tag_handling=" + this.settings.tag_handling : "&tag_handling=0";
|
317
|
+
request += (this.settings.tag_handling && this.settings.non_splitting_tags) ? "&non_splitting_tags=" + this.settings.non_splitting_tags : '';
|
318
|
+
request += (this.settings.tag_handling && this.settings.splitting_tags) ? "&splitting_tags=" + this.settings.splitting_tags : '';
|
319
|
+
request += (this.settings.tag_handling && this.settings.ignore_tags) ? "&ignore_tags=" + this.settings.ignore_tags : '';
|
320
|
+
request += source_text_request;
|
321
|
+
|
322
|
+
// Send the constructed request to the API for translation
|
323
|
+
this.xhr.send(request);
|
324
|
+
} // END translate
|
325
|
+
|
326
|
+
}); // END prototype
|
327
|
+
|
328
|
+
// ---------------------------------------------------------------------------
|
329
|
+
// plugin wrapper
|
330
|
+
// A really lightweight plugin wrapper around the constructor,
|
331
|
+
// wrapper around the constructor to prevent multiple instantiations
|
332
|
+
// preventing against multiple instantiations and allowing any
|
333
|
+
// public function (ie. a function whose name doesn't start
|
334
|
+
// with an underscore) to be called via the jQuery plugin,
|
335
|
+
// e.g. $(element).defaultPluginName('functionName', arg1, arg2)
|
336
|
+
// ---------------------------------------------------------------------------
|
337
|
+
$.fn[pluginName] = function ( options ) {
|
338
|
+
var args = arguments;
|
339
|
+
|
340
|
+
// Is the first parameter an object (options), or was omitted,
|
341
|
+
// instantiate a new instance of the plugin.
|
342
|
+
//
|
343
|
+
if (options === undefined || typeof options === 'object') {
|
344
|
+
return this.each(function () {
|
345
|
+
// Only allow the plugin to be instantiated once,
|
346
|
+
// so we check that the element has no plugin instantiation yet
|
347
|
+
if (!$.data(this, 'plugin_' + pluginName)) {
|
348
|
+
// if it has no instance, create a new one, pass options to the
|
349
|
+
// plugin constructor, and store the plugin instance in the
|
350
|
+
// elements jQuery data object.
|
351
|
+
$.data(this, 'plugin_' + pluginName, new Plugin( this, options ));
|
352
|
+
}
|
353
|
+
});
|
354
|
+
} else if (typeof options === 'string' && options[0] !== '_' && options !== 'init') {
|
355
|
+
// If the first parameter is a string and it doesn't start
|
356
|
+
// with an underscore or "contains" the `init`-function,
|
357
|
+
// treat this as a call to a public method.
|
358
|
+
|
359
|
+
// Cache the method call to make it possible to return a value
|
360
|
+
var returns;
|
361
|
+
|
362
|
+
this.each(function () {
|
363
|
+
var instance = $.data(this, 'plugin_' + pluginName);
|
364
|
+
|
365
|
+
// Tests that there's already a plugin-instance
|
366
|
+
// and checks that the requested public method exists
|
367
|
+
if (instance instanceof Plugin && typeof instance[options] === 'function') {
|
368
|
+
// Call the method of our plugin instance,
|
369
|
+
// and pass it the supplied arguments.
|
370
|
+
returns = instance[options].apply( instance, Array.prototype.slice.call( args, 1 ) );
|
371
|
+
}
|
372
|
+
|
373
|
+
// Allow instances to be destroyed via the 'destroy' method
|
374
|
+
if (options === 'destroy') {
|
375
|
+
$.data(this, 'plugin_' + pluginName, null);
|
376
|
+
}
|
377
|
+
});
|
378
|
+
|
379
|
+
// If the earlier cached method gives a value back return the value,
|
380
|
+
// otherwise return "this" to preserve chainability.
|
381
|
+
return returns !== undefined ? returns : this;
|
382
|
+
}
|
383
|
+
}; // END plugin wrapper
|
384
|
+
|
385
|
+
})(jQuery, window, document);
|
@@ -0,0 +1,18 @@
|
|
1
|
+
/*
|
2
|
+
# -----------------------------------------------------------------------------
|
3
|
+
# ~/assets/themes/j1/modules/j1Deepl/js/j1deepl.min.js
|
4
|
+
# J1 core module for j1Deepl
|
5
|
+
#
|
6
|
+
# Product/Info:
|
7
|
+
# https://jekyll.one
|
8
|
+
#
|
9
|
+
# Copyright (C) 2021 Juergen Adams
|
10
|
+
#
|
11
|
+
# J1 Template is licensed under the MIT License.
|
12
|
+
# For details, see https://jekyll.one
|
13
|
+
# -----------------------------------------------------------------------------
|
14
|
+
# NOTE: Based on https://github.com/jquery-boilerplate/jquery-boilerplate
|
15
|
+
# See: https://www.dotnetcurry.com/jquery/1069/authoring-jquery-plugins
|
16
|
+
# -----------------------------------------------------------------------------
|
17
|
+
*/
|
18
|
+
(function(e,c,a,g){var d="j1deepl",f={api:"free",auth_key:false,source_lang:"auto",target_lang:"DE",max_chars:false,split_sentences:"1",preserve_formatting:"0",formality:"default",tag_handling:false,outline_detection:true,non_splitting_tags:false,splitting_tags:false,ignore_tags:false,onInit:function(){},onBeforeTranslation:function(){},onAfterTranslation:function(){}};function b(i,h){this.element=i;this.settings=e.extend({},f,h);this.settings.elementID="#"+this.element.id;this.xhr=new XMLHttpRequest();this.init(this.settings)}e.extend(b.prototype,{init:function(i){var h=log4javascript.getLogger("j1deepl.init");h.info("\ninitializing plugin: started");this.translate(i);h.info("\ninitializing plugin: finished")},prepareXHR:function(h){if(h.api==="free"){this.xhr.open("POST","https://api-free.deepl.com/v2/translate",true)}else{if(h.api==="pro"){this.xhr.open("POST","https://api.deepl.com/v2/translate",true)}else{this.xhr.open("POST","https://api-free.deepl.com/v2/translate",true)}}this.xhr.setRequestHeader("Accept","*/*");this.xhr.setRequestHeader("Content-Type","application/x-www-form-urlencoded")},prepareText:function(h){return h.split("\n")},translate:function(C){const H=log4javascript.getLogger("j1deepl.translate");const n=4;const t=200;const u=["BG","CS","DA","DE","EL","EN-GB","EN-US","EN","ES","ET","FI","FR","HU","IT","JA","LT","LV","NL","PL","PT-PT","PT-BR","PT","RO","RU","SK","SL","SV","ZH"];const h=["DE","FR","IT","ES","NL","PL","PT","PT-BR","RU"];const r=["xml"];const w=C.targetElement;const q=e(w).length;const D="Translation failed.\nReason: ";const o="Translation skipped.\nReason: ";var y;var F;var v;var x={};x["400"]="Bad request. Please check error message and your parameters.";x["401"]="Authorization failed. Please supply a valid DeepL-Auth-Key.";x["403"]="Forbidden. The access to the requested resource is denied, because of insufficient access rights.";x["404"]="The requested resource could not be found.";x["413"]="The request size exceeds the limit.";x["415"]="The requested entries format specified in the Accept header is not supported.";x["429"]="Too many requests. Please wait and resend your request.";x["456"]="Quota exceeded. The maximum amount of glossaries has been reached.";x["500"]="Internal server error";x["503"]="Resource currently unavailable. Try again later.";x["529"]="Too many requests. Please wait and resend your request.";var l;var k="";var j="";var B="";var E="";var m;var G;if(q){y=(w.includes(".")||w.includes("#"))?w.substring(1):w;F=e(w).get(0).nodeName;if(F==="TEXTAREA"){B=this.element.value}else{if(F==="P"){j=this.element;B=e(w).text()}}v=B.length}else{H.error("\ntarget element does not exists: "+w);return false}if(C.max_char&&B.length>C.max_char){var s=B.substring(0,C.max_char-3);B=s+" ...";H.info("\nlimit for source text (max: "+C.max_char+") reached: "+B.length)}E=this.prepareText(B);this.prepareXHR(C);var p="";for(var A=0;A<E.length;A++){p+="&text="+E[A]}this.xhr.onload=function(){if(this.readyState===n){if(this.status===t){var I=JSON.parse(this.responseText);var J="";for(var K=0;K<I.translations.length;K++){J+=I.translations[K].text;J+="\n"}if(F==="TEXTAREA"){e(w).val(J)}else{if(F==="P"){e(w).text(J)}}}else{H.error("\nAPI returned "+this.status+": "+x[this.status])}}};m=this.settings.source_lang;G=this.settings.target_lang;if(this.settings.source_lang!="auto"){this.settings.source_lang=(u.indexOf(this.settings.source_lang)>-1)?this.settings.source_lang:false}this.settings.target_lang=(u.indexOf(this.settings.target_lang)>-1)?this.settings.target_lang:false;if(!this.settings.auth_key||!this.settings.source_lang||!this.settings.target_lang){if(!this.settings.auth_key){l="NO AUTH key passed.";H.error("\ninvalid option found. "+l)}if(!this.settings.source_lang){l="WRONG source language passed: "+m;H.error("\ninvalid option found. "+l)}if(!this.settings.target_lang){l="WRONG target language passed: "+G;H.error("\ninvalid option found. "+l)}if(F==="TEXTAREA"){e(w).val(D+l)}else{if(F==="P"){e(w).text(D+l)}}return false}if(!v){l="NO text found for translation";if(F==="TEXTAREA"){e(w).val(o+l)}else{if(F==="P"){e(w).text(o+l)}}H.warn("\nno text found for translation");return false}if(this.settings.formality!="default"){if(!(h.indexOf(this.settings.target_lang)>-1)){H.warn("\nwrong language found for formality setting: "+this.settings.target_lang)}this.settings.formality=(h.indexOf(this.settings.target_lang)>-1)?this.settings.formality:"default"}if(this.settings.tag_handling){var z=this.settings.tag_handling;this.settings.tag_handling=(r.indexOf(this.settings.tag_handling)>-1)?this.settings.tag_handling:false;if(this.settings.tag_handling){this.settings.non_splitting_tags=this.settings.non_splitting_tags?encodeURIComponent(this.settings.non_splitting_tags):false;this.settings.splitting_tags=this.settings.splitting_tags?encodeURIComponent(this.settings.splitting_tags):false;this.settings.ignore_tags=this.settings.ignore_tags?encodeURIComponent(this.settings.ignore_tags):false}else{H.error("\ninvalid option found for tag handling : "+z);H.warn("\ndisable option: tag_handling");if(this.settings.non_splitting_tags){H.warn("\ndisable option: "+this.settings.non_splitting_tags);this.settings.non_splitting_tags=false}if(this.settings.splitting_tags){H.warn("\ndisable option : "+this.settings.splitting_tags);this.settings.splitting_tags=false}if(this.settings.ignore_tags){H.warn("\ndisable option: "+this.settings.ignore_tags);this.settings.ignore_tags=false}}}else{if(this.settings.non_splitting_tags){H.warn("\ninvalid option found: "+this.settings.non_splitting_tags);this.settings.non_splitting_tags=false}if(this.settings.splitting_tags){H.warn("\ninvalid option found: "+this.settings.splitting_tags);this.settings.splitting_tags=false}if(this.settings.ignore_tags){H.warn("\ninvalid option found: "+this.settings.ignore_tags);this.settings.ignore_tags=false}}k="auth_key="+this.settings.auth_key;k+=(this.settings.source_lang!="auto")?"&source_lang="+this.settings.source_lang:"";k+="&target_lang="+this.settings.target_lang;k+=(this.settings.formality!="default")?"&formality="+this.settings.formality:"";k+=(this.settings.split_sentences)?"&split_sentences="+this.settings.formality:"";k+=(this.settings.tag_handling)?"&tag_handling="+this.settings.tag_handling:"&tag_handling=0";k+=(this.settings.tag_handling&&this.settings.non_splitting_tags)?"&non_splitting_tags="+this.settings.non_splitting_tags:"";k+=(this.settings.tag_handling&&this.settings.splitting_tags)?"&splitting_tags="+this.settings.splitting_tags:"";k+=(this.settings.tag_handling&&this.settings.ignore_tags)?"&ignore_tags="+this.settings.ignore_tags:"";k+=p;this.xhr.send(k)}});e.fn[d]=function(i){var h=arguments;if(i===g||typeof i==="object"){return this.each(function(){if(!e.data(this,"plugin_"+d)){e.data(this,"plugin_"+d,new b(this,i))}})}else{if(typeof i==="string"&&i[0]!=="_"&&i!=="init"){var j;this.each(function(){var k=e.data(this,"plugin_"+d);if(k instanceof b&&typeof k[i]==="function"){j=k[i].apply(k,Array.prototype.slice.call(h,1))}if(i==="destroy"){e.data(this,"plugin_"+d,null)}});return j!==g?j:this}}}})(jQuery,window,document);
|
@@ -11,6 +11,9 @@
|
|
11
11
|
# J1 Template is licensed under the MIT License.
|
12
12
|
# For details, see https://jekyll.one
|
13
13
|
# -----------------------------------------------------------------------------
|
14
|
+
# NOTE: Based on https://github.com/jquery-boilerplate/jquery-boilerplate
|
15
|
+
# See: https://www.dotnetcurry.com/jquery/1069/authoring-jquery-plugins
|
16
|
+
# -----------------------------------------------------------------------------
|
14
17
|
*/
|
15
18
|
|
16
19
|
// the semi-colon before function invocation is a SAFETY method against
|
data/lib/j1/version.rb
CHANGED
@@ -1,3 +1,3 @@
|
|
1
|
-
module J1
|
2
|
-
VERSION = '2021.2.
|
3
|
-
end
|
1
|
+
module J1
|
2
|
+
VERSION = '2021.2.3'
|
3
|
+
end
|
data/lib/starter_web/Gemfile
CHANGED
@@ -53,7 +53,7 @@ gem 'jekyll', '~> 4.2'
|
|
53
53
|
|
54
54
|
# Theme Rubies, default: J1 Template (NOT used for the development system)
|
55
55
|
#
|
56
|
-
gem 'j1-template', '~> 2021.2.
|
56
|
+
gem 'j1-template', '~> 2021.2.3'
|
57
57
|
|
58
58
|
# ------------------------------------------------------------------------------
|
59
59
|
# PRODUCTION: Gem needed for the Jekyll and J1 prod environment
|
data/lib/starter_web/_config.yml
CHANGED
@@ -53,7 +53,7 @@ environment: development
|
|
53
53
|
# ------------------------------------------------------------------------------
|
54
54
|
# Sets the build version of J1 Template Gem
|
55
55
|
#
|
56
|
-
version: 2021.2.
|
56
|
+
version: 2021.2.3
|
57
57
|
|
58
58
|
# version
|
59
59
|
# ------------------------------------------------------------------------------
|
@@ -370,7 +370,7 @@ resources:
|
|
370
370
|
modules/jquery/js/jquery,
|
371
371
|
modules/jquery/js/jqueryUI,
|
372
372
|
modules/popper/js/popper,
|
373
|
-
core/js/template
|
373
|
+
core/js/template
|
374
374
|
]
|
375
375
|
init_function: [ j1.init ]
|
376
376
|
|
@@ -1326,5 +1326,27 @@ resources:
|
|
1326
1326
|
js: [ modules/j1Scroll/js/j1scroll ]
|
1327
1327
|
init_function: [ j1.adapter.j1Scroll.init ]
|
1328
1328
|
|
1329
|
+
# ----------------------------------------------------------------------------
|
1330
|
+
# j1Deepl
|
1331
|
+
# NOTE: https://github.com/jquery-boilerplate/jquery-boilerplate
|
1332
|
+
#
|
1333
|
+
- name: j1Deepl
|
1334
|
+
resource:
|
1335
|
+
id: j1deepl
|
1336
|
+
enabled: true
|
1337
|
+
comment: j1Deepl
|
1338
|
+
region: head
|
1339
|
+
layout: [ home, page, post, collection, blog_archive ]
|
1340
|
+
required: ondemand # always | ondemand
|
1341
|
+
preload: false # property currently unused
|
1342
|
+
script_load: defer
|
1343
|
+
dependencies: false
|
1344
|
+
pass_init_data: false
|
1345
|
+
data:
|
1346
|
+
css: []
|
1347
|
+
files: []
|
1348
|
+
js: [ modules/j1Deepl/js/j1deepl ]
|
1349
|
+
init_function: []
|
1350
|
+
|
1329
1351
|
# ------------------------------------------------------------------------------
|
1330
1352
|
# END config
|
@@ -428,7 +428,7 @@ end::tables[]
|
|
428
428
|
// -----------------------------------------------------------------------------
|
429
429
|
tag::products[]
|
430
430
|
:j1--license: MIT License
|
431
|
-
:j1--version: 2021.2.
|
431
|
+
:j1--version: 2021.2.3
|
432
432
|
:j1--site-name: Jekyll One
|
433
433
|
end::products[]
|
434
434
|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"private": true,
|
3
3
|
"name": "j1_starter",
|
4
|
-
"version": "2021.2.
|
4
|
+
"version": "2021.2.3",
|
5
5
|
"description": "J1 Template Starter Web",
|
6
6
|
"homepage": "https://your.site",
|
7
7
|
"author": {
|
@@ -141,7 +141,7 @@
|
|
141
141
|
"if-env": "^1.0.4",
|
142
142
|
"j1-cli": "^2019.0.3",
|
143
143
|
"npm-delay": "^1.0.4",
|
144
|
-
"opn-cli": "^
|
144
|
+
"opn-cli": "^5.0.0"
|
145
145
|
},
|
146
146
|
"devDependencies": {
|
147
147
|
"cross-env": "^7.0.3",
|
@@ -1,10 +1,9 @@
|
|
1
1
|
---
|
2
2
|
layout: page
|
3
|
-
title:
|
4
|
-
tagline:
|
3
|
+
title: Disruptors Blog
|
4
|
+
tagline: artikel nach kategorie
|
5
5
|
date: 2023-01-01 01:00:00 +100
|
6
|
-
description:
|
7
|
-
articles by category
|
6
|
+
description: Artikel nach Kategorie
|
8
7
|
|
9
8
|
categories: [ Blog ]
|
10
9
|
tags: [ Navigator, Categories ]
|
@@ -24,7 +23,7 @@ comments: false
|
|
24
23
|
exclude_from_search: true
|
25
24
|
regenerate: true
|
26
25
|
|
27
|
-
resources: []
|
26
|
+
resources: [ animate ]
|
28
27
|
resource_options:
|
29
28
|
- attic:
|
30
29
|
padding_top: 400
|
@@ -221,22 +220,22 @@ site_category_word_list: {{site_category_word_list | debug}}
|
|
221
220
|
|
222
221
|
{% if post.date %}
|
223
222
|
{% if language == "en" %}
|
224
|
-
<i class="mdi mdi-calendar-blank md-grey-
|
223
|
+
<i class="mdi mdi-calendar-blank md-grey-600 mr-1"></i>{{post.date | localize: "%Y %B, %e"}}
|
225
224
|
{% endif %}
|
226
225
|
{% if language == "de" %}
|
227
|
-
<i class="mdi mdi-calendar-blank md-grey-
|
226
|
+
<i class="mdi mdi-calendar-blank md-grey-600 mr-1"></i>{{post.date | localize: "%-d. %B %Y"}}
|
228
227
|
{% endif %}
|
229
228
|
{% endif %}
|
230
229
|
{% if likes_count %}
|
231
230
|
<span class="font-weight-bold"> · </span>
|
232
|
-
<i class="mdi mdi-heart
|
231
|
+
<i class="mdi mdi-heart mr-1"></i> {{likes_count}}
|
233
232
|
{% endif %}
|
234
233
|
{% if comment_count %}
|
235
234
|
<span class="font-weight-bold"> · </span>
|
236
|
-
<i class="mdi mdi-comment
|
235
|
+
<i class="mdi mdi-comment mr-1"></i> {{comment_count}}
|
237
236
|
{% endif %}
|
238
237
|
</div>
|
239
|
-
<a class="card-link
|
238
|
+
<a class="card-link text-muted text-lowercase"
|
240
239
|
href="{{post.url}}#readmore">
|
241
240
|
{{readmore_text}} · {{post.tagline}}
|
242
241
|
</a>
|
@@ -248,25 +247,3 @@ site_category_word_list: {{site_category_word_list | debug}}
|
|
248
247
|
{% endfor %}
|
249
248
|
{% endfor %}
|
250
249
|
</div>
|
251
|
-
|
252
|
-
<!-- [INFO ] [j1.page.{{page.title}} ] [Save the current page to cookieUserState cookie: {{browser_page_url}}] -->
|
253
|
-
{% comment %} Update cookie for lastpage
|
254
|
-
-------------------------------------------------------------------------------- {% endcomment %}
|
255
|
-
<script>
|
256
|
-
function setLastPage() {
|
257
|
-
var logger = log4javascript.getLogger('j1.BlogNavigator');
|
258
|
-
var cookie_names = j1.getCookieNames();
|
259
|
-
const user_state_cookie_name = cookie_names.user_session;
|
260
|
-
var user_state = j1.readCookie(user_state_cookie_name);
|
261
|
-
var user_state_last_page = "{{browser_page_url}}";
|
262
|
-
user_state.last_page = user_state_last_page;
|
263
|
-
|
264
|
-
j1.writeCookie({
|
265
|
-
name: user_state_cookie_name,
|
266
|
-
data: user_state,
|
267
|
-
samesite: 'Strict'
|
268
|
-
});
|
269
|
-
logger.info('Saved current Post Browser page to cookie: {{browser_page_url}}');
|
270
|
-
}
|
271
|
-
window.onload = setLastPage();
|
272
|
-
</script>
|
@@ -237,25 +237,3 @@ site_category_word_list: {{site_category_word_list | debug}}
|
|
237
237
|
{{closeList}}
|
238
238
|
|
239
239
|
</div>
|
240
|
-
|
241
|
-
<!-- [INFO ] [j1.page.{{page.title}} ] [Save the current page to cookieUserState cookie: {{browser_page_url}}] -->
|
242
|
-
{% comment %} Update cookie for lastpage
|
243
|
-
-------------------------------------------------------------------------------- {% endcomment %}
|
244
|
-
<script type="text/javascript">
|
245
|
-
function setLastPage() {
|
246
|
-
var logger = log4javascript.getLogger('j1.BlogNavigator');
|
247
|
-
var cookie_names = j1.getCookieNames();
|
248
|
-
const user_state_cookie_name = cookie_names.user_session;
|
249
|
-
var user_state = j1.readCookie(user_state_cookie_name);
|
250
|
-
var user_state_last_page = "{{browser_page_url}}";
|
251
|
-
user_state.last_page = user_state_last_page;
|
252
|
-
|
253
|
-
j1.writeCookie({
|
254
|
-
name: user_state_cookie_name,
|
255
|
-
data: user_state,
|
256
|
-
samesite: 'Strict'
|
257
|
-
});
|
258
|
-
logger.info('Saved current Post Browser page to cookie: {{browser_page_url}}');
|
259
|
-
}
|
260
|
-
window.onload = setLastPage();
|
261
|
-
</script>
|