j1-template 2021.2.12 → 2021.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/_layouts/compress.html +12 -4
- data/assets/data/private.json +49 -0
- data/assets/themes/j1/adapter/js/{j1scroll.js → scroller.js} +285 -304
- data/assets/themes/j1/core/js/template.js +4098 -223
- data/assets/themes/j1/core/js/template.min.js +9 -8
- data/assets/themes/j1/core/js/template.min.js.map +1 -1
- data/assets/themes/j1/modules/{j1Deepl/js/j1deepl.js → deeplAPI/js/deeplAPI.js} +36 -11
- data/assets/themes/j1/modules/deeplAPI/js/deeplAPI.min.js +18 -0
- data/assets/themes/j1/modules/{j1Scroll → scroller}/css/theme/uno.css +2 -2
- data/assets/themes/j1/modules/{j1Scroll → scroller}/css/theme/uno.min.css +0 -0
- data/assets/themes/j1/modules/scroller/js/scroller.js +346 -0
- data/assets/themes/j1/modules/scroller/js/scroller.min.js +15 -0
- data/lib/j1/version.rb +1 -1
- data/lib/starter_web/Gemfile +1 -1
- data/lib/starter_web/_config.yml +6 -2
- data/lib/starter_web/_data/modules/{j1scroll.yml → scroller.yml} +30 -5
- data/lib/starter_web/_data/private.default.yml +8 -1
- data/lib/starter_web/_data/private.yml +8 -1
- data/lib/starter_web/_data/resources.yml +14 -35
- data/lib/starter_web/_includes/attributes.asciidoc +1 -1
- data/lib/starter_web/_plugins/lunr_index.rb +1 -1
- data/lib/starter_web/index.html +2 -1
- data/lib/starter_web/package.json +1 -1
- data/lib/starter_web/pages/public/blog/navigator/index.html +1 -1
- data/lib/starter_web/pages/public/manuals/dropdown-help.adoc +743 -743
- data/lib/starter_web/utilsrv/_defaults/package.json +1 -1
- data/lib/starter_web/utilsrv/package.json +1 -1
- metadata +11 -12
- data/assets/themes/j1/modules/j1Deepl/js/j1deepl.min.js +0 -18
- data/assets/themes/j1/modules/j1Scroll/js/j1scroll.js +0 -280
- data/assets/themes/j1/modules/j1Scroll/js/j1scroll.min.js +0 -15
- data/assets/themes/j1/modules/showOnScroll/js/showOnScroll.js +0 -73
- data/assets/themes/j1/modules/showOnScroll/js/showOnScroll.min.js +0 -15
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: j1-template
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2021.
|
4
|
+
version: 2021.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- juergen_jekyll_one
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-11-
|
11
|
+
date: 2021-11-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jekyll
|
@@ -362,6 +362,7 @@ files:
|
|
362
362
|
- assets/data/mmenu_toc.html
|
363
363
|
- assets/data/news_panel_posts/index.html
|
364
364
|
- assets/data/panel.html
|
365
|
+
- assets/data/private.json
|
365
366
|
- assets/data/quicklinks.html
|
366
367
|
- assets/data/rtext_resizer.html
|
367
368
|
- assets/data/themes.json
|
@@ -387,7 +388,6 @@ files:
|
|
387
388
|
- assets/themes/j1/adapter/js/fam.js
|
388
389
|
- assets/themes/j1/adapter/js/framer.js
|
389
390
|
- assets/themes/j1/adapter/js/j1.js
|
390
|
-
- assets/themes/j1/adapter/js/j1scroll.js
|
391
391
|
- assets/themes/j1/adapter/js/justifiedGallery.js
|
392
392
|
- assets/themes/j1/adapter/js/justifiedGalleryCustomizer.js
|
393
393
|
- assets/themes/j1/adapter/js/lightbox.js
|
@@ -398,6 +398,7 @@ files:
|
|
398
398
|
- assets/themes/j1/adapter/js/rouge.js
|
399
399
|
- assets/themes/j1/adapter/js/rtable.js
|
400
400
|
- assets/themes/j1/adapter/js/rtextResizer.js
|
401
|
+
- assets/themes/j1/adapter/js/scroller.js
|
401
402
|
- assets/themes/j1/adapter/js/themer.js
|
402
403
|
- assets/themes/j1/adapter/js/toccer.js
|
403
404
|
- assets/themes/j1/adapter/js/translator.js
|
@@ -1050,6 +1051,8 @@ files:
|
|
1050
1051
|
- assets/themes/j1/modules/datatables/css/theme/uno.css
|
1051
1052
|
- assets/themes/j1/modules/datatables/js/datatables.js
|
1052
1053
|
- assets/themes/j1/modules/datatables/js/datatables.min.js
|
1054
|
+
- assets/themes/j1/modules/deeplAPI/js/deeplAPI.js
|
1055
|
+
- assets/themes/j1/modules/deeplAPI/js/deeplAPI.min.js
|
1053
1056
|
- assets/themes/j1/modules/fam/css/theme/uno/fam.css
|
1054
1057
|
- assets/themes/j1/modules/fam/css/theme/uno/fam.min.css
|
1055
1058
|
- assets/themes/j1/modules/fam/js/fam.js
|
@@ -1069,12 +1072,6 @@ files:
|
|
1069
1072
|
- assets/themes/j1/modules/iframeResizer/js/resizer.js
|
1070
1073
|
- assets/themes/j1/modules/iframeResizer/js/resizer.map
|
1071
1074
|
- assets/themes/j1/modules/iframeResizer/js/resizer.min.js
|
1072
|
-
- assets/themes/j1/modules/j1Deepl/js/j1deepl.js
|
1073
|
-
- assets/themes/j1/modules/j1Deepl/js/j1deepl.min.js
|
1074
|
-
- assets/themes/j1/modules/j1Scroll/css/theme/uno.css
|
1075
|
-
- assets/themes/j1/modules/j1Scroll/css/theme/uno.min.css
|
1076
|
-
- assets/themes/j1/modules/j1Scroll/js/j1scroll.js
|
1077
|
-
- assets/themes/j1/modules/j1Scroll/js/j1scroll.min.js
|
1078
1075
|
- assets/themes/j1/modules/jquery/css/jqueryUI/theme.css
|
1079
1076
|
- assets/themes/j1/modules/jquery/css/jqueryUI/theme.min.css
|
1080
1077
|
- assets/themes/j1/modules/jquery/js/jquery-3.5.1.min.map
|
@@ -1400,8 +1397,10 @@ files:
|
|
1400
1397
|
- assets/themes/j1/modules/rtable/css/theme/uno/rtable.min.css
|
1401
1398
|
- assets/themes/j1/modules/rtable/js/rtable.js
|
1402
1399
|
- assets/themes/j1/modules/rtable/js/rtable.min.js
|
1403
|
-
- assets/themes/j1/modules/
|
1404
|
-
- assets/themes/j1/modules/
|
1400
|
+
- assets/themes/j1/modules/scroller/css/theme/uno.css
|
1401
|
+
- assets/themes/j1/modules/scroller/css/theme/uno.min.css
|
1402
|
+
- assets/themes/j1/modules/scroller/js/scroller.js
|
1403
|
+
- assets/themes/j1/modules/scroller/js/scroller.min.js
|
1405
1404
|
- assets/themes/j1/modules/themeSwitcher/js/switcher.js
|
1406
1405
|
- assets/themes/j1/modules/themeSwitcher/js/switcher.min.js
|
1407
1406
|
- assets/themes/j1/modules/translator/css/translator.css
|
@@ -1598,13 +1597,13 @@ files:
|
|
1598
1597
|
- lib/starter_web/_data/modules/defaults/translator.yml
|
1599
1598
|
- lib/starter_web/_data/modules/fam.yml
|
1600
1599
|
- lib/starter_web/_data/modules/framer.yml
|
1601
|
-
- lib/starter_web/_data/modules/j1scroll.yml
|
1602
1600
|
- lib/starter_web/_data/modules/log4javascript.yml
|
1603
1601
|
- lib/starter_web/_data/modules/log4r.yml
|
1604
1602
|
- lib/starter_web/_data/modules/navigator.yml
|
1605
1603
|
- lib/starter_web/_data/modules/navigator_menu.yml
|
1606
1604
|
- lib/starter_web/_data/modules/quicksearch.yml
|
1607
1605
|
- lib/starter_web/_data/modules/rtable.yml
|
1606
|
+
- lib/starter_web/_data/modules/scroller.yml
|
1608
1607
|
- lib/starter_web/_data/modules/themer.yml
|
1609
1608
|
- lib/starter_web/_data/modules/toccer.yml
|
1610
1609
|
- lib/starter_web/_data/modules/translator.yml
|
@@ -1,18 +0,0 @@
|
|
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="#void"+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("#void"))?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);
|
@@ -1,280 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
# -----------------------------------------------------------------------------
|
3
|
-
# ~/assets/themes/j1/modules/j1Scroll/js/j1scroll.js
|
4
|
-
# J1 core module for j1scroll
|
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 = 'j1Scroll',
|
29
|
-
defaults = {
|
30
|
-
type: 'infiniteScroll',
|
31
|
-
scrollOffset: 100,
|
32
|
-
elementScroll: false,
|
33
|
-
firstPage: 2,
|
34
|
-
lastPage: false,
|
35
|
-
infoLastPage: false,
|
36
|
-
loadStatus: false,
|
37
|
-
onInit: function (){}, // callback after plugin has initialized
|
38
|
-
onBeforeLoad: function (){}, // callback before new items are loaded
|
39
|
-
onAfterLoad: function (){} // callback after new items are loaded
|
40
|
-
};
|
41
|
-
|
42
|
-
// Plugin constructor
|
43
|
-
function Plugin (element, options) {
|
44
|
-
this.element = element;
|
45
|
-
this.settings = $.extend( {}, defaults, options);
|
46
|
-
this.settings.elementID = '#' + this.element.id;
|
47
|
-
|
48
|
-
// call the initializer
|
49
|
-
this.init(this.settings);
|
50
|
-
}
|
51
|
-
|
52
|
-
// Avoid Plugin.prototype conflicts
|
53
|
-
$.extend(Plugin.prototype, {
|
54
|
-
// -------------------------------------------------------------------------
|
55
|
-
// init: initializer
|
56
|
-
// -------------------------------------------------------------------------
|
57
|
-
init: function(options) {
|
58
|
-
var logger = log4javascript.getLogger('j1Scroll');
|
59
|
-
|
60
|
-
logger.info('\n' + 'initializing plugin: started');
|
61
|
-
logger.info('\n' + 'state: started');
|
62
|
-
|
63
|
-
if ( options.elementScroll ) {
|
64
|
-
this.scroller = this.element;
|
65
|
-
} else {
|
66
|
-
this.scroller = window;
|
67
|
-
}
|
68
|
-
|
69
|
-
if (options.loadStatus) {
|
70
|
-
var spinner = '<div class="loader-ellips" style="display: none"> <span class="loader-ellips__dot"></span> <span class="loader-ellips__dot"></span> <span class="loader-ellips__dot"></span> <span class="loader-ellips__dot"></span> </div>';
|
71
|
-
$(spinner).insertAfter(options.elementID);
|
72
|
-
}
|
73
|
-
|
74
|
-
if (options.infoLastPage) {
|
75
|
-
var message = options.lastPageInfo;
|
76
|
-
$(message).insertAfter(options.elementID);
|
77
|
-
}
|
78
|
-
|
79
|
-
// initialize infinite scroll
|
80
|
-
if ( options.type === 'infiniteScroll') {
|
81
|
-
logger.info('\n' + 'processing mode: infiniteScroll');
|
82
|
-
logger.info('\n' + 'loading items from path: ' + options.path + "#void");
|
83
|
-
logger.info('\n' + 'monitoring element set to: ' + this.scroller);
|
84
|
-
this.registerScrollEvent(options);
|
85
|
-
}
|
86
|
-
logger.info('\n' + 'initializing plugin: finished');
|
87
|
-
logger.info('\n' + 'state: finished');
|
88
|
-
},
|
89
|
-
|
90
|
-
// -----------------------------------------------------------------------
|
91
|
-
// bottomReached: detect final scroll position
|
92
|
-
// NOTE: the calculation for BOTTOM position is different for
|
93
|
-
// elementScroll and windowScroll. For elementScroll, the
|
94
|
-
// trigger isBottomReached is TRUE, if the scroll position has
|
95
|
-
// the end of the container PLUS a given scrollOffset.
|
96
|
-
// For windowScroll, the trigger isBottomReached is TRUE, if
|
97
|
-
// the scroll position has the end of the window MINUS
|
98
|
-
// a given scrollOffset.
|
99
|
-
// -----------------------------------------------------------------------
|
100
|
-
isBottomReached: function (options) {
|
101
|
-
var _this = this;
|
102
|
-
var bottom, scrollY;
|
103
|
-
var clientHeight = $(options.elementID).height();
|
104
|
-
|
105
|
-
if ( _this.settings.elementScroll ) {
|
106
|
-
// check scroll position of the container items are to be added
|
107
|
-
var $window = $(window);
|
108
|
-
var viewport_top = $window.scrollTop();
|
109
|
-
var viewport_height = $window.height();
|
110
|
-
var viewport_bottom = viewport_top + viewport_height - options.scrollOffset;
|
111
|
-
var $elm = $(options.elementID);
|
112
|
-
var top = $elm.offset().top + clientHeight;
|
113
|
-
var height = $elm.height();
|
114
|
-
bottom = top + height;
|
115
|
-
|
116
|
-
|
117
|
-
return (top >= viewport_top && top < viewport_bottom) ||
|
118
|
-
(bottom > viewport_top && bottom <= viewport_bottom) ||
|
119
|
-
(height > viewport_height && top <= viewport_top && bottom >= viewport_bottom);
|
120
|
-
} else {
|
121
|
-
// check scroll position of the (overall) window
|
122
|
-
return (window.innerHeight + window.pageYOffset + options.scrollOffset >= document.body.offsetHeight);
|
123
|
-
}
|
124
|
-
},
|
125
|
-
|
126
|
-
// -----------------------------------------------------------------------
|
127
|
-
// detectScroll: EventHandler to load new items for infinite scroll
|
128
|
-
// if final scroll position reached
|
129
|
-
// -----------------------------------------------------------------------
|
130
|
-
registerScrollEvent: function (options) {
|
131
|
-
var _this = this;
|
132
|
-
var logger = log4javascript.getLogger('j1Scroll');
|
133
|
-
|
134
|
-
logger.info('\n' + 'scroll event: register');
|
135
|
-
var eventHandler_onscroll = function (event) {
|
136
|
-
var options = _this.settings;
|
137
|
-
|
138
|
-
if (_this.isBottomReached(options)) {
|
139
|
-
if (options.firstPage > options.lastPage ) {
|
140
|
-
logger.info('\n' + 'last page detected on: ' + options.lastPage);
|
141
|
-
window.removeEventListener('scroll', eventHandler_onscroll);
|
142
|
-
logger.info('\n' + 'scroll event: removed');
|
143
|
-
|
144
|
-
if (options.infoLastPage ) {
|
145
|
-
_this.infoLastPage(options);
|
146
|
-
}
|
147
|
-
return false;
|
148
|
-
}
|
149
|
-
_this.getNewPost(options);
|
150
|
-
}
|
151
|
-
};
|
152
|
-
window.addEventListener('scroll', eventHandler_onscroll);
|
153
|
-
logger.info('\n' + 'scroll event: registered');
|
154
|
-
},
|
155
|
-
|
156
|
-
// -----------------------------------------------------------------------
|
157
|
-
// getNewPost: load new items (from current path)
|
158
|
-
// Note: loader flag prevents to load items if AJAX load in progress
|
159
|
-
// is NOT finished
|
160
|
-
// -----------------------------------------------------------------------
|
161
|
-
getNewPost: function (options) {
|
162
|
-
var _this = this;
|
163
|
-
var logger = log4javascript.getLogger('j1Scroll');
|
164
|
-
|
165
|
-
logger.info('\n' + 'trigger loading ');
|
166
|
-
|
167
|
-
// initialze loader flag
|
168
|
-
if (this.itemsLoaded === false) return false;
|
169
|
-
|
170
|
-
// set loader flag (false == not loaded)
|
171
|
-
this.itemsLoaded = false;
|
172
|
-
|
173
|
-
// display spinner while loading
|
174
|
-
if (options.loadStatus) {
|
175
|
-
logger.info('\n' + 'show: spinner');
|
176
|
-
$('.loader-ellips').show();
|
177
|
-
}
|
178
|
-
|
179
|
-
var xmlhttp = new XMLHttpRequest();
|
180
|
-
xmlhttp.onreadystatechange = function () {
|
181
|
-
if (xmlhttp.readyState == XMLHttpRequest.DONE) {
|
182
|
-
if (xmlhttp.status == 200) {
|
183
|
-
options.firstPage++;
|
184
|
-
var childItems = _this.getChildItemsByAjaxHTML(options, xmlhttp.responseText);
|
185
|
-
_this.appendNewItems(childItems);
|
186
|
-
|
187
|
-
logger.info('\n' + 'loading new items: successful');
|
188
|
-
|
189
|
-
// hide the spinner after loading
|
190
|
-
if (options.loadStatus) {
|
191
|
-
logger.info('\n' + 'hide: spinner');
|
192
|
-
$('.loader-ellips').hide();
|
193
|
-
}
|
194
|
-
|
195
|
-
// set loader flag (true == loaded)
|
196
|
-
// return _this.itemsLoaded = true;
|
197
|
-
_this.itemsLoaded = true;
|
198
|
-
} else {
|
199
|
-
// hide the spinner
|
200
|
-
if (options.loadStatus) {
|
201
|
-
logger.info('\n' + 'hide: spinner');
|
202
|
-
$('.loader-ellips').hide();
|
203
|
-
}
|
204
|
-
|
205
|
-
logger.error('\n' + 'loading new items failed, HTTP response: ' + xmlhttp.status );
|
206
|
-
// set loader flag (true == loaded)
|
207
|
-
// return _this.itemsLoaded = false;
|
208
|
-
_this.itemsLoaded = false;
|
209
|
-
}
|
210
|
-
}
|
211
|
-
};
|
212
|
-
logger.info('\n' + 'loading new items from path: ' + options.path + options.firstPage);
|
213
|
-
xmlhttp.open("GET", location.origin + options.path + options.firstPage + '/index.html', true);
|
214
|
-
xmlhttp.send();
|
215
|
-
},
|
216
|
-
|
217
|
-
// -----------------------------------------------------------------------
|
218
|
-
// getChildItemsByAjaxHTML: extract items from page loaded
|
219
|
-
// -----------------------------------------------------------------------
|
220
|
-
getChildItemsByAjaxHTML: function (options, HTMLText) {
|
221
|
-
var newHTML = document.createElement('html');
|
222
|
-
var logger = log4javascript.getLogger('j1Scroll');
|
223
|
-
|
224
|
-
logger.info('\n' + 'load new items');
|
225
|
-
newHTML.innerHTML = HTMLText;
|
226
|
-
var childItems = newHTML.querySelectorAll(options.elementID + ' > *');
|
227
|
-
return childItems;
|
228
|
-
},
|
229
|
-
|
230
|
-
// -----------------------------------------------------------------------
|
231
|
-
// appendNewItems: append items and run post processing
|
232
|
-
// -----------------------------------------------------------------------
|
233
|
-
appendNewItems: function (items) {
|
234
|
-
var _this = this;
|
235
|
-
var logger = log4javascript.getLogger('j1Scroll');
|
236
|
-
var cookie_names = j1.getCookieNames();
|
237
|
-
var user_translate = j1.readCookie(cookie_names.user_translate);
|
238
|
-
|
239
|
-
logger.info('\n' + 'append new items');
|
240
|
-
items.forEach(function (item) {
|
241
|
-
_this.element.appendChild(item);
|
242
|
-
});
|
243
|
-
|
244
|
-
// no dropcaps if translation enabled
|
245
|
-
if (user_translate.translationEnabled) {
|
246
|
-
logger.info('\n' + 'translation enabled: ' + user_translate.translationEnabled);
|
247
|
-
logger.warn('\n' + 'skipped processing of dropcaps');
|
248
|
-
} else {
|
249
|
-
// initialize dropcaps
|
250
|
-
logger.info('\n' + 'post processing: createDropCap');
|
251
|
-
j1.core.createDropCap();
|
252
|
-
}
|
253
|
-
|
254
|
-
},
|
255
|
-
|
256
|
-
// -----------------------------------------------------------------------
|
257
|
-
// getNewPost: load/append new items
|
258
|
-
// Note: loader flag prevents to load items if AJAX load in progress
|
259
|
-
// is NOT finished
|
260
|
-
// -----------------------------------------------------------------------
|
261
|
-
infoLastPage: function (options) {
|
262
|
-
var _this = this;
|
263
|
-
var logger = log4javascript.getLogger('j1Scroll');
|
264
|
-
|
265
|
-
logger.info('\n' + 'show: infoLastPage');
|
266
|
-
$('.page-scroll-last').show();
|
267
|
-
}
|
268
|
-
}); // END prototype
|
269
|
-
|
270
|
-
// wrapper around the constructor to prevent multiple instantiations
|
271
|
-
$.fn [pluginName] = function(options) {
|
272
|
-
return this.each(function() {
|
273
|
-
if (!$.data( this, "plugin_" + pluginName)) {
|
274
|
-
$.data(this, "plugin_" +
|
275
|
-
pluginName, new Plugin(this, options));
|
276
|
-
}
|
277
|
-
});
|
278
|
-
};
|
279
|
-
|
280
|
-
})(jQuery, window, document);
|
@@ -1,15 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
# -----------------------------------------------------------------------------
|
3
|
-
# ~/assets/themes/j1/modules/j1Scroll/js/j1scroll.min.js
|
4
|
-
# J1 core module for j1scroll
|
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
|
-
*/
|
15
|
-
(function(e,c,a,g){var d="j1Scroll",f={type:"infiniteScroll",scrollOffset:100,elementScroll:false,firstPage:2,lastPage:false,infoLastPage:false,loadStatus:false,onInit:function(){},onBeforeLoad:function(){},onAfterLoad:function(){}};function b(i,h){this.element=i;this.settings=e.extend({},f,h);this.settings.elementID="#"+this.element.id;this.init(this.settings)}e.extend(b.prototype,{init:function(i){var h=log4javascript.getLogger("j1Scroll");h.info("\ninitializing plugin: started");h.info("\nstate: started");if(i.elementScroll){this.scroller=this.element}else{this.scroller=c}if(i.loadStatus){var k='<div class="loader-ellips" style="display: none"> <span class="loader-ellips__dot"></span> <span class="loader-ellips__dot"></span> <span class="loader-ellips__dot"></span> <span class="loader-ellips__dot"></span> </div>';e(k).insertAfter(i.elementID)}if(i.infoLastPage){var j=i.lastPageInfo;e(j).insertAfter(i.elementID)}if(i.type==="infiniteScroll"){h.info("\nprocessing mode: infiniteScroll");h.info("\nloading items from path: "+i.path+"#void");h.info("\nmonitoring element set to: "+this.scroller);this.registerScrollEvent(i)}h.info("\ninitializing plugin: finished");h.info("\nstate: finished")},isBottomReached:function(s){var n=this;var h,p;var m=e(s.elementID).height();if(n.settings.elementScroll){var j=e(c);var r=j.scrollTop();var i=j.height();var l=r+i-s.scrollOffset;var k=e(s.elementID);var o=k.offset().top+m;var q=k.height();h=o+q;return(o>=r&&o<l)||(h>r&&h<=l)||(q>i&&o<=r&&h>=l)}else{return(c.innerHeight+c.pageYOffset+s.scrollOffset>=a.body.offsetHeight)}},registerScrollEvent:function(i){var k=this;var h=log4javascript.getLogger("j1Scroll");h.info("\nscroll event: register");var j=function(m){var l=k.settings;if(k.isBottomReached(l)){if(l.firstPage>l.lastPage){h.info("\nlast page detected on: "+l.lastPage);c.removeEventListener("scroll",j);h.info("\nscroll event: removed");if(l.infoLastPage){k.infoLastPage(l)}return false}k.getNewPost(l)}};c.addEventListener("scroll",j);h.info("\nscroll event: registered")},getNewPost:function(i){var k=this;var h=log4javascript.getLogger("j1Scroll");h.info("\ntrigger loading ");if(this.itemsLoaded===false){return false}this.itemsLoaded=false;if(i.loadStatus){h.info("\nshow: spinner");e(".loader-ellips").show()}var j=new XMLHttpRequest();j.onreadystatechange=function(){if(j.readyState==XMLHttpRequest.DONE){if(j.status==200){i.firstPage++;var l=k.getChildItemsByAjaxHTML(i,j.responseText);k.appendNewItems(l);h.info("\nloading new items: successful");if(i.loadStatus){h.info("\nhide: spinner");e(".loader-ellips").hide()}k.itemsLoaded=true}else{if(i.loadStatus){h.info("\nhide: spinner");e(".loader-ellips").hide()}h.error("\nloading new items failed, HTTP response: "+j.status);k.itemsLoaded=false}}};h.info("\nloading new items from path: "+i.path+i.firstPage);j.open("GET",location.origin+i.path+i.firstPage+"/index.html",true);j.send()},getChildItemsByAjaxHTML:function(j,i){var l=a.createElement("html");var h=log4javascript.getLogger("j1Scroll");h.info("\nload new items");l.innerHTML=i;var k=l.querySelectorAll(j.elementID+" > *");return k},appendNewItems:function(h){var l=this;var i=log4javascript.getLogger("j1Scroll");var k=j1.getCookieNames();var j=j1.readCookie(k.user_translate);i.info("\nappend new items");h.forEach(function(m){l.element.appendChild(m)});if(j.translationEnabled){i.info("\ntranslation enabled: "+j.translationEnabled);i.warn("\nskipped processing of dropcaps")}else{i.info("\npost processing: createDropCap");j1.core.createDropCap()}},infoLastPage:function(i){var j=this;var h=log4javascript.getLogger("j1Scroll");h.info("\nshow: infoLastPage");e(".page-scroll-last").show()}});e.fn[d]=function(h){return this.each(function(){if(!e.data(this,"plugin_"+d)){e.data(this,"plugin_"+d,new b(this,h))}})}})(jQuery,window,document);
|
@@ -1,73 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
# -----------------------------------------------------------------------------
|
3
|
-
# ~/assets/themes/j1/modules/showOnScroll/js/showOnScroll.js
|
4
|
-
# Very simple J1 implementation for showOnScroll
|
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
|
-
*/
|
15
|
-
// -------------------------------------------------------------------------
|
16
|
-
// isInViewport:
|
17
|
-
// Detects if an element is visible in an viewport specified
|
18
|
-
// -------------------------------------------------------------------------
|
19
|
-
function isInViewport(elm, offset) {
|
20
|
-
// if the element doesn't exist, abort
|
21
|
-
if( elm.length == 0 ) {
|
22
|
-
return;
|
23
|
-
}
|
24
|
-
var $window = jQuery(window);
|
25
|
-
var viewport_top = $window.scrollTop();
|
26
|
-
var viewport_height = $window.height();
|
27
|
-
var viewport_bottom = viewport_top + viewport_height;
|
28
|
-
var $elm = jQuery(elm);
|
29
|
-
var top = $elm.offset().top + offset;
|
30
|
-
var height = $elm.height();
|
31
|
-
var bottom = top + height;
|
32
|
-
|
33
|
-
return (top >= viewport_top && top < viewport_bottom) ||
|
34
|
-
(bottom > viewport_top && bottom <= viewport_bottom) ||
|
35
|
-
(height > viewport_height && top <= viewport_top && bottom >= viewport_bottom);
|
36
|
-
}
|
37
|
-
|
38
|
-
// -----------------------------------------------------------------------------
|
39
|
-
// Initializer
|
40
|
-
// -----------------------------------------------------------------------------
|
41
|
-
$(document).ready( function() {
|
42
|
-
|
43
|
-
var showDelay = 700;
|
44
|
-
var yOffset = 500;
|
45
|
-
var logger = log4javascript.getLogger('j1ShowOnScroll');
|
46
|
-
|
47
|
-
// ---------------------------------------------------------------------------
|
48
|
-
// EventHandler: Service Panel
|
49
|
-
// ---------------------------------------------------------------------------
|
50
|
-
var eventHandler_service_panel = function (event) {
|
51
|
-
if (isInViewport ($('#home_service_panel'), yOffset)) {
|
52
|
-
logger.info('\n' + 'specified container is in view: home_service_panel');
|
53
|
-
$(".home_service_panel").show(showDelay);
|
54
|
-
logger.info('\n' + 'remove eventHandler');
|
55
|
-
window.removeEventListener('scroll', eventHandler_service_panel);
|
56
|
-
}
|
57
|
-
}
|
58
|
-
window.addEventListener('scroll', eventHandler_service_panel);
|
59
|
-
|
60
|
-
// ---------------------------------------------------------------------------
|
61
|
-
// EventHandler: Intro Panel
|
62
|
-
// ---------------------------------------------------------------------------
|
63
|
-
var eventHandler_intro_panel = function (event) {
|
64
|
-
if (isInViewport ($('#home_intro_panel'), yOffset)) {
|
65
|
-
logger.info('\n' + 'specified container is in view: home_intro_panel');
|
66
|
-
$(".home_intro_panel").show(showDelay);
|
67
|
-
logger.info('\n' + 'remove eventHandler');
|
68
|
-
window.removeEventListener('scroll', eventHandler_intro_panel);
|
69
|
-
}
|
70
|
-
}
|
71
|
-
window.addEventListener('scroll', eventHandler_intro_panel);
|
72
|
-
|
73
|
-
});
|
@@ -1,15 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
# -----------------------------------------------------------------------------
|
3
|
-
# ~/assets/themes/j1/modules/showOnScroll/js/showOnScroll.min.js
|
4
|
-
# J1 implementation for showOnScroll
|
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
|
-
*/
|
15
|
-
function isInViewport(g,f){if(g.length==0){return}var c=jQuery(window);var j=c.scrollTop();var b=c.height();var d=j+b;var e=jQuery(g);var h=e.offset().top+f;var i=e.height();var a=h+i;return(h>=j&&h<d)||(a>j&&a<=d)||(i>b&&h<=j&&a>=d)}$(document).ready(function(){var a=700;var e=500;var b=log4javascript.getLogger("j1.core.showOnScroll");var c=function(f){if(isInViewport($("#home_service_panel"),e)){b.info("\nThe specified container is in view: home_service_panel");$(".home_service_panel").show(a);window.removeEventListener("scroll",c)}};window.addEventListener("scroll",c);var d=function(f){if(isInViewport($("#home_intro_panel"),e)){b.info("\nThe specified container is in view: home_intro_panel");$(".home_intro_panel").show(a);window.removeEventListener("scroll",d)}};window.addEventListener("scroll",d)});
|