From 19c7455171ee582da79917145b8dff3bf7fea5f4 Mon Sep 17 00:00:00 2001 From: David Knights Date: Sat, 21 Oct 2023 10:37:04 +0100 Subject: [PATCH] Set all pages version & copyright year text dynamically --- examples/index.html | 5 +++-- index.html | 1 + playground/index.html | 5 +++-- script.js | 12 ------------ version-year.js | 11 +++++++++++ 5 files changed, 18 insertions(+), 16 deletions(-) create mode 100644 version-year.js diff --git a/examples/index.html b/examples/index.html index 6283ff5..30ac179 100644 --- a/examples/index.html +++ b/examples/index.html @@ -24,7 +24,7 @@
  • Documentation
  • Examples
  • Playground
  • -
  • Install v2.0.0
  • +
  • Install
  • @@ -175,13 +175,14 @@

    JS Code Required

    -

    cre8bitJS v2.0.0 | © Dave Knights 2023

    +

    cre8bitJS | © Dave Knights

    + diff --git a/index.html b/index.html index 709644d..8217898 100644 --- a/index.html +++ b/index.html @@ -163,6 +163,7 @@

    diff --git a/playground/index.html b/playground/index.html index 1dc2b31..17ce182 100644 --- a/playground/index.html +++ b/playground/index.html @@ -24,7 +24,7 @@
  • Documentation
  • Examples
  • Playground
  • -
  • Install v2.0.0
  • +
  • Install
  • @@ -118,13 +118,14 @@

    JS Code Required

    -

    cre8bitJS v2.0.0 | © Dave Knights 2023

    +

    cre8bitJS | © Dave Knights

    + diff --git a/script.js b/script.js index e0e1c23..515f822 100644 --- a/script.js +++ b/script.js @@ -1,17 +1,5 @@ import cre8bit from './cre8bit.min.js' -const setVersionAndYear = async () => { - const res = await fetch('https://api.github.com/repos/daveknights/cre8bit/tags'); - const json = await res.json(); - const version = json[0].name; - - document.querySelector('.v-btn').textContent = version; - document.querySelector('.v-footer').textContent = version; - document.querySelector('.year').textContent = new Date().getFullYear(); -}; - -setVersionAndYear(); - const getSize = size => { switch (true) { case window.innerWidth > 1099: diff --git a/version-year.js b/version-year.js new file mode 100644 index 0000000..90cf84d --- /dev/null +++ b/version-year.js @@ -0,0 +1,11 @@ +const setVersionAndYear = async () => { + const res = await fetch('https://api.github.com/repos/daveknights/cre8bit/tags'); + const json = await res.json(); + const version = json[0].name; + + document.querySelector('.v-btn').textContent = version; + document.querySelector('.v-footer').textContent = version; + document.querySelector('.year').textContent = new Date().getFullYear(); +}; + +setVersionAndYear(); \ No newline at end of file