@leuffen/themejs1 3.0.2 → 3.0.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.
- package/dist/helper/loader.d.ts +1 -0
- package/dist/helper/loader.js +25 -0
- package/dist/hit-index.d.ts +1 -0
- package/dist/hit-index.js +11 -0
- package/embed.scss +0 -17
- package/embed.ts +4 -0
- package/package.json +1 -1
- package/sections/_defaults.scss +4 -0
- package/sections/hero-max/hero-max.scss +1 -1
- package/sections/navbar-blox/navbar-blox.scss +1 -1
- package/src/default/loader.scss +89 -44
- package/src/helper/loader.ts +27 -0
- package/src/hit-index.ts +8 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function initLoader(): void;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.initLoader = void 0;
|
|
4
|
+
const hit_index_1 = require("../hit-index");
|
|
5
|
+
console.time("loader");
|
|
6
|
+
function initLoader() {
|
|
7
|
+
let interval = setInterval(() => {
|
|
8
|
+
// Detect if body is loaded
|
|
9
|
+
if (document.querySelector("body")) {
|
|
10
|
+
// Cancel interval
|
|
11
|
+
clearInterval(interval);
|
|
12
|
+
let img = document.querySelector("img").cloneNode(true);
|
|
13
|
+
let loader = document.createElement("div");
|
|
14
|
+
loader.classList.add("loader");
|
|
15
|
+
loader.appendChild(img);
|
|
16
|
+
img.setAttribute("class", "");
|
|
17
|
+
img.setAttribute("loading", "eager");
|
|
18
|
+
let loaderBar = document.createElement("div");
|
|
19
|
+
loaderBar.classList.add("loader-bar");
|
|
20
|
+
loader.appendChild(loaderBar);
|
|
21
|
+
document.querySelector("body").appendChild(loader);
|
|
22
|
+
}
|
|
23
|
+
}, hit_index_1.hitIndex === 1 ? 10 : 350); // Wait 350 on subsequent requests to prevent flickering
|
|
24
|
+
}
|
|
25
|
+
exports.initLoader = initLoader;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const hitIndex: number;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var _a, _b;
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.hitIndex = void 0;
|
|
5
|
+
const indexName = "themejs_hit_index";
|
|
6
|
+
let state = sessionStorage.getItem(indexName);
|
|
7
|
+
if (state === null) {
|
|
8
|
+
sessionStorage.setItem(indexName, "0");
|
|
9
|
+
}
|
|
10
|
+
sessionStorage.setItem(indexName, "" + (parseInt((_a = sessionStorage.getItem(indexName)) !== null && _a !== void 0 ? _a : "0") + 1));
|
|
11
|
+
exports.hitIndex = parseInt((_b = sessionStorage.getItem(indexName)) !== null && _b !== void 0 ? _b : "0");
|
package/embed.scss
CHANGED
|
@@ -1,19 +1,2 @@
|
|
|
1
1
|
@import "src/default/loader";
|
|
2
2
|
|
|
3
|
-
body {
|
|
4
|
-
min-height: 5000vh; // 3000vh is enough to make sure the page scrolls to correct position on reload
|
|
5
|
-
opacity: 0;
|
|
6
|
-
transition: opacity 0.25s;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
body.loaded {
|
|
10
|
-
min-height: unset;
|
|
11
|
-
opacity: 1;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
body > * {
|
|
15
|
-
display: none;
|
|
16
|
-
}
|
|
17
|
-
body.loaded > * {
|
|
18
|
-
display: block;
|
|
19
|
-
}
|
package/embed.ts
ADDED
package/package.json
CHANGED
package/sections/_defaults.scss
CHANGED
|
@@ -10,6 +10,10 @@
|
|
|
10
10
|
--t-text-color-accent: var(--bs-gray-900);
|
|
11
11
|
--t-text-color-primary: var(--bs-primary);
|
|
12
12
|
|
|
13
|
+
--t-navbar-height: 88px;
|
|
14
|
+
|
|
15
|
+
/* What to substract from 100vh to start the next elemment after fullsize header */
|
|
16
|
+
--t-fullsize-modifier: 150px;
|
|
13
17
|
|
|
14
18
|
--t-header-margin: 0 0 20px 0;
|
|
15
19
|
--t-paragraf-margin: 0 0 20px 0;
|
package/src/default/loader.scss
CHANGED
|
@@ -1,53 +1,98 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
color: white;
|
|
9
|
-
margin-top: 1px;
|
|
10
|
-
z-index: 2;
|
|
11
|
-
-webkit-animation: leu--site-loader 60s ease-out;
|
|
12
|
-
animation: leu--site-loader 30s ease-out;
|
|
13
|
-
display: block;
|
|
14
|
-
background-color: indianred;
|
|
15
|
-
height: 3px;
|
|
16
|
-
width: 35%;
|
|
1
|
+
body > .loader > .loader-bar {
|
|
2
|
+
position: relative;
|
|
3
|
+
display: block;
|
|
4
|
+
background-color: lightgrey;
|
|
5
|
+
height: 3px;
|
|
6
|
+
width: 70vw;
|
|
7
|
+
max-width: 500px;
|
|
17
8
|
top: 0;
|
|
9
|
+
z-index: 1;
|
|
10
|
+
margin-top: 25vh;
|
|
11
|
+
&::before {
|
|
12
|
+
content: "";
|
|
13
|
+
font-family: sans-serif;
|
|
14
|
+
font-size: 12px;
|
|
15
|
+
line-height: 10px;
|
|
16
|
+
position: relative;
|
|
17
|
+
text-align: center;
|
|
18
|
+
color: white;
|
|
19
|
+
|
|
20
|
+
z-index: 2;
|
|
21
|
+
-webkit-animation: leu--site-loader 60s ease-out;
|
|
22
|
+
animation: leu--site-loader 30s ease-out;
|
|
23
|
+
display: block;
|
|
24
|
+
background-color: indianred;
|
|
25
|
+
height: 100%;
|
|
26
|
+
width: 35%;
|
|
27
|
+
top: 0;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
@keyframes leu--site-loader {
|
|
33
|
+
3% {
|
|
34
|
+
width: 75%;
|
|
35
|
+
|
|
36
|
+
}
|
|
37
|
+
5% {
|
|
38
|
+
width: 90%;
|
|
39
|
+
}
|
|
40
|
+
10% {
|
|
41
|
+
width: 95%;
|
|
42
|
+
}
|
|
43
|
+
100% {
|
|
44
|
+
width: 100%;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
body {
|
|
50
|
+
min-height: 5000vh; // 3000vh is enough to make sure the page scrolls to correct position on reload
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
body.loaded {
|
|
54
|
+
min-height: unset;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
body > joda-content {
|
|
58
|
+
opacity: 0;
|
|
59
|
+
transition: opacity 0.10s;
|
|
18
60
|
}
|
|
61
|
+
body.loaded > joda-content {
|
|
62
|
+
opacity: 1;
|
|
63
|
+
}
|
|
64
|
+
|
|
19
65
|
|
|
20
|
-
|
|
21
|
-
content: "";
|
|
22
|
-
font-family: sans-serif;
|
|
23
|
-
font-size: 12px;
|
|
24
|
-
line-height: 10px;
|
|
66
|
+
body > .loader {
|
|
25
67
|
position: fixed;
|
|
26
|
-
|
|
27
|
-
color: white;
|
|
28
|
-
margin-top: 1px;
|
|
29
|
-
-webkit-animation: leu--site-loader 60s ease-out;
|
|
30
|
-
animation: leu--site-loader 60s ease-out;
|
|
31
|
-
display: block;
|
|
32
|
-
background-color: darkgray;
|
|
33
|
-
height: 3px;
|
|
68
|
+
z-index: -99;
|
|
34
69
|
top: 0;
|
|
70
|
+
left: 0;
|
|
35
71
|
width: 100%;
|
|
36
|
-
|
|
72
|
+
height: 100%;
|
|
73
|
+
background: #fff;
|
|
74
|
+
transition: opacity 0.15s;
|
|
75
|
+
display: flex !important;
|
|
76
|
+
|
|
77
|
+
align-items: center;
|
|
78
|
+
align-content: center;
|
|
79
|
+
justify-content: center;
|
|
80
|
+
opacity: 1;
|
|
81
|
+
flex-wrap: wrap;
|
|
82
|
+
flex-direction: column;
|
|
83
|
+
|
|
84
|
+
& > img {
|
|
85
|
+
flex-direction: column;
|
|
86
|
+
display: block !important;
|
|
87
|
+
height: auto !important;
|
|
88
|
+
width: 70vw !important;
|
|
89
|
+
max-width: 500px;
|
|
90
|
+
|
|
91
|
+
}
|
|
37
92
|
}
|
|
38
93
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
}
|
|
44
|
-
5% {
|
|
45
|
-
width: 90%;
|
|
46
|
-
}
|
|
47
|
-
10% {
|
|
48
|
-
width: 95%;
|
|
49
|
-
}
|
|
50
|
-
100% {
|
|
51
|
-
width: 100%;
|
|
52
|
-
}
|
|
94
|
+
body.loaded > .loader {
|
|
95
|
+
opacity: 0;
|
|
96
|
+
//display: none !important;
|
|
97
|
+
z-index: -99;
|
|
53
98
|
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import {hitIndex} from "../hit-index";
|
|
2
|
+
|
|
3
|
+
console.time("loader");
|
|
4
|
+
export function initLoader() {
|
|
5
|
+
let interval = setInterval(() => {
|
|
6
|
+
// Detect if body is loaded
|
|
7
|
+
if (document.querySelector("body")) {
|
|
8
|
+
// Cancel interval
|
|
9
|
+
clearInterval(interval);
|
|
10
|
+
|
|
11
|
+
let img = document.querySelector("img").cloneNode(true) as HTMLImageElement;
|
|
12
|
+
let loader = document.createElement("div");
|
|
13
|
+
loader.classList.add("loader");
|
|
14
|
+
loader.appendChild(img);
|
|
15
|
+
img.setAttribute("class", "");
|
|
16
|
+
img.setAttribute("loading", "eager");
|
|
17
|
+
|
|
18
|
+
let loaderBar = document.createElement("div");
|
|
19
|
+
loaderBar.classList.add("loader-bar");
|
|
20
|
+
loader.appendChild(loaderBar);
|
|
21
|
+
|
|
22
|
+
document.querySelector("body").appendChild(loader);
|
|
23
|
+
}
|
|
24
|
+
}, hitIndex === 1 ? 10 : 350); // Wait 350 on subsequent requests to prevent flickering
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
|
package/src/hit-index.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
const indexName = "themejs_hit_index";
|
|
2
|
+
let state = sessionStorage.getItem(indexName);
|
|
3
|
+
if (state === null) {
|
|
4
|
+
sessionStorage.setItem(indexName, "0");
|
|
5
|
+
}
|
|
6
|
+
sessionStorage.setItem(indexName, "" + (parseInt(sessionStorage.getItem(indexName) ?? "0") + 1));
|
|
7
|
+
|
|
8
|
+
export const hitIndex = parseInt(sessionStorage.getItem(indexName) ?? "0");
|