Skip to content

Commit

Permalink
Refactor: move style and script to files
Browse files Browse the repository at this point in the history
  • Loading branch information
Chimildic committed Jul 28, 2024
1 parent 65cc768 commit bb2679a
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 41 deletions.
43 changes: 2 additions & 41 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Livelib Backup</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
<style>
iframe {
width: 100%;
height: 100vh;
display: none;
border: 0;
background-color: var(--bs-body-bg) !important;
}

@media (min-width: 576px) {
iframe {
height: 65vh;
}
}
</style>
<link href="./style.css" rel="stylesheet">
</head>

<body>
Expand Down Expand Up @@ -55,32 +41,7 @@
<a class="text-center nav-link px-2 text-muted" id="copyright" href="https://t.me/p_chimildic" target="_blank"></a>
</footer>
</div>
<script>
const spinnerElement = document.getElementById('spinner-root')
const iframeElement = document.getElementById('iframe-service')

window.onbeforeunload = onLoading
iframeElement.onload = onReady
setCopyright()

function onLoading() {
spinnerElement.style.display = 'block'
iframeElement.style.display = 'none'
}

function onReady() {
spinnerElement.style.display = 'none'
iframeElement.style.display = 'block'
}

function setCopyright() {
let year = new Date().getFullYear()
if (year != 2024) {
year = `2024 - ${year}`
}
document.getElementById('copyright').innerText = `${year} © Chimildic`
}
</script>
<script src="script.js"></script>
</body>

</html>
24 changes: 24 additions & 0 deletions script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
const spinnerElement = document.getElementById('spinner-root')
const iframeElement = document.getElementById('iframe-service')

window.onbeforeunload = onLoading
iframeElement.onload = onReady
setCopyright()

function onLoading() {
spinnerElement.style.display = 'block'
iframeElement.style.display = 'none'
}

function onReady() {
spinnerElement.style.display = 'none'
iframeElement.style.display = 'block'
}

function setCopyright() {
let year = new Date().getFullYear()
if (year != 2024) {
year = `2024 - ${year}`
}
document.getElementById('copyright').innerText = `${year} © Chimildic`
}
13 changes: 13 additions & 0 deletions style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
iframe {
width: 100%;
height: 100vh;
display: none;
border: 0;
background-color: var(--bs-body-bg) !important;
}

@media (min-width: 576px) {
iframe {
height: 65vh;
}
}

0 comments on commit bb2679a

Please sign in to comment.