Skip to content
This repository was archived by the owner on Jan 19, 2025. It is now read-only.

Commit 62a56a5

Browse files
committed
removed lazy load image animation definition 🚀
1 parent 643a4b8 commit 62a56a5

File tree

9 files changed

+66
-34
lines changed

9 files changed

+66
-34
lines changed

_includes/critical.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

_js/common/lazy-load-image-animation.js

Lines changed: 0 additions & 11 deletions
This file was deleted.

_js/common/lazy-load-images.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,30 +2,30 @@
22
import 'intersection-observer'
33
import { addCssClass, removeCssClass } from './css-class'
44

5-
const lazyLoadImages = (selector: string, loadCompleted: (image: HTMLImageElement) => void) => {
5+
const lazyLoadImages = (selector: string): void => {
66
const intersectionObserver: IntersectionObserver = new IntersectionObserver(
7-
(entries: IntersectionObserverEntry[], observer: IntersectionObserver) => onIntersection(entries, observer, loadCompleted),
7+
onIntersection,
88
{ rootMargin: '50px 0px', threshold: 0.01 }
99
)
1010
document.querySelectorAll(selector).forEach(image => intersectionObserver.observe(image))
1111
}
1212

13-
const onIntersection = (entries: IntersectionObserverEntry[], observer: IntersectionObserver, loadCompleted: (image: HTMLImageElement) => void) => {
13+
const onIntersection = (entries: IntersectionObserverEntry[], observer: IntersectionObserver): void => {
1414
entries.forEach(entry => {
1515
if (entry.intersectionRatio > 0) {
1616
observer.unobserve(entry.target)
17-
eventuallyLoadImage(entry.target, loadCompleted)
17+
eventuallyLoadImage(entry.target)
1818
}
1919
})
2020
}
2121

22-
const eventuallyLoadImage = (element: HTMLElement, loadCompleted: (image: HTMLImageElement) => void) => {
22+
const eventuallyLoadImage = (element: HTMLElement): void => {
2323
if (element instanceof HTMLImageElement) {
24-
loadImage(element, loadCompleted)
24+
loadImage(element)
2525
}
2626
}
2727

28-
const loadImage = (image: HTMLImageElement, loadCompleted: (image: HTMLImageElement) => void) => {
28+
const loadImage = (image: HTMLImageElement): void => {
2929
image.src = image.dataset.src
3030
image.onload = () => {
3131
removeCssClass(image, 'lazy')

_js/index.blog.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,9 @@
22
import { cookieConsent } from './common/cookie-consent.js'
33
import { loadFont } from './common/load-font'
44
import { lazyLoadImages } from './common/lazy-load-images'
5-
import { lazyLoadImageAnimation } from './common/lazy-load-image-animation'
65

76
document.addEventListener('DOMContentLoaded', () => {
87
loadFont()
98
cookieConsent()
10-
lazyLoadImages('.blog-image', (image: Element) => lazyLoadImageAnimation(image, 0.5))
9+
lazyLoadImages('.blog-image')
1110
})

_js/index.home.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,11 @@ import { loadFont } from './common/load-font'
44
import { tabs } from './home/tabs'
55
import { homeHeaderAnimation } from './home/home-header-animation'
66
import { lazyLoadImages } from './common/lazy-load-images'
7-
import { lazyLoadImageAnimation } from './common/lazy-load-image-animation'
87

98
document.addEventListener('DOMContentLoaded', () => {
109
loadFont()
1110
cookieConsent()
1211
homeHeaderAnimation()
1312
tabs()
14-
lazyLoadImages('.profile-image, .who-am-i-icon, .project-image, .timeline-image', (image: Element) => lazyLoadImageAnimation(image, 0.2))
13+
lazyLoadImages('.profile-image, .who-am-i-icon, .project-image, .timeline-image')
1514
})

_jsbuild/common/lazy-load-images.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,30 +2,30 @@
22
import 'intersection-observer'
33
import { addCssClass, removeCssClass } from './css-class'
44

5-
const lazyLoadImages = (selector, loadCompleted) => {
5+
const lazyLoadImages = (selector) => {
66
const intersectionObserver = new IntersectionObserver(
7-
(entries, observer) => onIntersection(entries, observer, loadCompleted),
7+
onIntersection,
88
{ rootMargin: '50px 0px', threshold: 0.01 }
99
)
1010
document.querySelectorAll(selector).forEach(image => intersectionObserver.observe(image))
1111
}
1212

13-
const onIntersection = (entries, observer, loadCompleted) => {
13+
const onIntersection = (entries, observer) => {
1414
entries.forEach(entry => {
1515
if (entry.intersectionRatio > 0) {
1616
observer.unobserve(entry.target)
17-
eventuallyLoadImage(entry.target, loadCompleted)
17+
eventuallyLoadImage(entry.target)
1818
}
1919
})
2020
}
2121

22-
const eventuallyLoadImage = (element, loadCompleted) => {
22+
const eventuallyLoadImage = (element) => {
2323
if (element instanceof HTMLImageElement) {
24-
loadImage(element, loadCompleted)
24+
loadImage(element)
2525
}
2626
}
2727

28-
const loadImage = (image, loadCompleted) => {
28+
const loadImage = (image) => {
2929
image.src = image.dataset.src
3030
image.onload = () => {
3131
removeCssClass(image, 'lazy')

_jsbuild/index.blog.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,9 @@
22
import { cookieConsent } from './common/cookie-consent.js'
33
import { loadFont } from './common/load-font'
44
import { lazyLoadImages } from './common/lazy-load-images'
5-
import { lazyLoadImageAnimation } from './common/lazy-load-image-animation'
65

76
document.addEventListener('DOMContentLoaded', () => {
87
loadFont()
98
cookieConsent()
10-
lazyLoadImages('.blog-image', (image) => lazyLoadImageAnimation(image, 0.5))
9+
lazyLoadImages('.blog-image')
1110
})

_jsbuild/index.home.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,11 @@ import { loadFont } from './common/load-font'
44
import { tabs } from './home/tabs'
55
import { homeHeaderAnimation } from './home/home-header-animation'
66
import { lazyLoadImages } from './common/lazy-load-images'
7-
import { lazyLoadImageAnimation } from './common/lazy-load-image-animation'
87

98
document.addEventListener('DOMContentLoaded', () => {
109
loadFont()
1110
cookieConsent()
1211
homeHeaderAnimation()
1312
tabs()
14-
lazyLoadImages('.profile-image, .who-am-i-icon, .project-image, .timeline-image', (image) => lazyLoadImageAnimation(image, 0.2))
13+
lazyLoadImages('.profile-image, .who-am-i-icon, .project-image, .timeline-image')
1514
})

npm-debug.log

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
0 info it worked if it ends with ok
2+
1 verbose cli [ '/usr/local/bin/node',
3+
1 verbose cli '/Users/fduroni/Work/chicio.github.io/node_modules/.bin/npm',
4+
1 verbose cli 'run',
5+
1 verbose cli 'flow' ]
6+
2 info using npm@3.10.10
7+
3 info using node@v11.6.0
8+
4 warn invalid config loglevel="notice"
9+
5 verbose run-script [ 'preflow', 'flow', 'postflow' ]
10+
6 info lifecycle fabrizio-duroni@1.8.0~preflow: fabrizio-duroni@1.8.0
11+
7 silly lifecycle fabrizio-duroni@1.8.0~preflow: no script for preflow, continuing
12+
8 info lifecycle fabrizio-duroni@1.8.0~flow: fabrizio-duroni@1.8.0
13+
9 verbose lifecycle fabrizio-duroni@1.8.0~flow: unsafe-perm in lifecycle true
14+
10 verbose lifecycle fabrizio-duroni@1.8.0~flow: PATH: /Users/fduroni/Work/chicio.github.io/node_modules/npm/bin/node-gyp-bin:/Users/fduroni/Work/chicio.github.io/node_modules/.bin:/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/Users/fduroni/Work/chicio.github.io/node_modules/.bin:/Users/fduroni/.rvm/gems/ruby-2.6.0/bin:/Users/fduroni/.rvm/gems/ruby-2.6.0@global/bin:/Users/fduroni/.rvm/rubies/ruby-2.6.0/bin:/Users/fduroni/bin:/usr/local/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Frameworks/Mono.framework/Versions/Current/Commands:/Users/fduroni/.rvm/gems/ruby-2.6.0/bin:/Users/fduroni/.rvm/gems/ruby-2.6.0@global/bin:/Users/fduroni/.rvm/rubies/ruby-2.6.0/bin:/Users/fduroni/bin:/Users/fduroni/Library/Android/sdk/emulator:/Users/fduroni/Library/Android/sdk/tools:/Users/fduroni/Library/Android/sdk/platform-tools:/Users/fduroni/Library/Android/sdk/tools/bin:/Users/fduroni/.scripts:/Users/fduroni/.rvm/bin:/Users/fduroni/Library/Android/sdk/emulator:/Users/fduroni/Library/Android/sdk/tools:/Users/fduroni/Library/Android/sdk/platform-tools:/Users/fduroni/Library/Android/sdk/tools/bin:/Users/fduroni/.scripts:/Users/fduroni/.rvm/bin
15+
11 verbose lifecycle fabrizio-duroni@1.8.0~flow: CWD: /Users/fduroni/Work/chicio.github.io
16+
12 silly lifecycle fabrizio-duroni@1.8.0~flow: Args: [ '-c', '_scripts/flow.sh' ]
17+
13 silly lifecycle fabrizio-duroni@1.8.0~flow: Returned: code: 1 signal: null
18+
14 info lifecycle fabrizio-duroni@1.8.0~flow: Failed to exec flow script
19+
15 verbose stack Error: fabrizio-duroni@1.8.0 flow: `_scripts/flow.sh`
20+
15 verbose stack Exit status 1
21+
15 verbose stack at EventEmitter.<anonymous> (/Users/fduroni/Work/chicio.github.io/node_modules/npm/lib/utils/lifecycle.js:255:16)
22+
15 verbose stack at EventEmitter.emit (events.js:188:13)
23+
15 verbose stack at ChildProcess.<anonymous> (/Users/fduroni/Work/chicio.github.io/node_modules/npm/lib/utils/spawn.js:40:14)
24+
15 verbose stack at ChildProcess.emit (events.js:188:13)
25+
15 verbose stack at maybeClose (internal/child_process.js:978:16)
26+
15 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:265:5)
27+
16 verbose pkgid fabrizio-duroni@1.8.0
28+
17 verbose cwd /Users/fduroni/Work/chicio.github.io
29+
18 error Darwin 18.5.0
30+
19 error argv "/usr/local/bin/node" "/Users/fduroni/Work/chicio.github.io/node_modules/.bin/npm" "run" "flow"
31+
20 error node v11.6.0
32+
21 error npm v3.10.10
33+
22 error code ELIFECYCLE
34+
23 error fabrizio-duroni@1.8.0 flow: `_scripts/flow.sh`
35+
23 error Exit status 1
36+
24 error Failed at the fabrizio-duroni@1.8.0 flow script '_scripts/flow.sh'.
37+
24 error Make sure you have the latest version of node.js and npm installed.
38+
24 error If you do, this is most likely a problem with the fabrizio-duroni package,
39+
24 error not with npm itself.
40+
24 error Tell the author that this fails on your system:
41+
24 error _scripts/flow.sh
42+
24 error You can get information on how to open an issue for this project with:
43+
24 error npm bugs fabrizio-duroni
44+
24 error Or if that isn't available, you can get their info via:
45+
24 error npm owner ls fabrizio-duroni
46+
24 error There is likely additional logging output above.
47+
25 verbose exit [ 1, true ]

0 commit comments

Comments
 (0)