diff options
| author | Mhykol <mchaeldonald62@pm.me> | 2024-06-16 23:07:37 -0400 |
|---|---|---|
| committer | Mhykol <mchaeldonald62@pm.me> | 2024-06-16 23:07:37 -0400 |
| commit | 2cd055553b61909703850ff780e852c47bc0c749 (patch) | |
| tree | 034572675ea833dd2953fc1a5af9c4ffc902324c /examples/assets | |
| parent | 1f25435e48e603671d5d75901515f0ac08d81e39 (diff) | |
Added examples for assets
Diffstat (limited to 'examples/assets')
| -rw-r--r-- | examples/assets/js/footer.js | 19 | ||||
| -rw-r--r-- | examples/assets/js/index.js | 22 | ||||
| -rw-r--r-- | examples/assets/js/loading.js | 16 |
3 files changed, 57 insertions, 0 deletions
diff --git a/examples/assets/js/footer.js b/examples/assets/js/footer.js new file mode 100644 index 0000000..df46a42 --- /dev/null +++ b/examples/assets/js/footer.js @@ -0,0 +1,19 @@ +class Footer { + constructor() {} + + Init() {this.#EventListener()} + + #EventListener() { + const links = document.getElementsByClassName('footer-links') + for(let i = 0; i < links.length; i++) {links[i].addEventListener('click', () => this.#Copy(links[i].textContent))} + } + #Copy(x) { + navigator.clipboard.writeText(x).then(() => { + console.log('copied') + }).catch((err) => { + console.error(err) + }) + } +} + +new Footer().Init() diff --git a/examples/assets/js/index.js b/examples/assets/js/index.js new file mode 100644 index 0000000..32e8cf5 --- /dev/null +++ b/examples/assets/js/index.js @@ -0,0 +1,22 @@ +class Index { + constructor() {} + + Init() {this.#EventListener()} + + #EventListener() { + const about = document.getElementById('index-about') + const readBlogs = document.getElementsByClassName('index-readblogs') + const websites = { + helpinghands: document.getElementById('helpinghands'), + goodhandhauling: document.getElementById('goodhandhauling') + } + + for (let i = 0; i < readBlogs.length; i++) readBlogs[i].addEventListener('click', () => window.location.href = '/blog') + + about.addEventListener('click', () => window.location.href = '/about') + websites.helpinghands.addEventListener('click', () => window.location.href = 'https://helpinghandsadultcare.org/') + websites.goodhandhauling.addEventListener('click', () => window.location.href = 'https://goodhandhauling.com/') + } +} + +new Index().Init() diff --git a/examples/assets/js/loading.js b/examples/assets/js/loading.js new file mode 100644 index 0000000..8fff0f3 --- /dev/null +++ b/examples/assets/js/loading.js @@ -0,0 +1,16 @@ +class Loading { + constructor() { + this.object = { + loadingScreen: document.getElementById('loading') + } + } + + Stop() { + this.object.loadingScreen.style.opacity = 0; + this.object.loadingScreen.style.zIndex = -9999; + } + Start() { + this.object.loadingScreen.style.opacity = 1; + this.object.loadingScreen.style.zIndex = 9999; + } +} |
