♻️ refactor: Move similar javascript inline code out of line

- Move variables oid, oid_likes out of line
- Move background-blur out of line
- Move fetch-repo code out of line
This commit is contained in:
Served Smart
2025-06-04 23:51:03 +02:00
parent 8387c6ea0a
commit 37ab1055e7
18 changed files with 100 additions and 155 deletions

View File

@@ -49,21 +49,9 @@
</div>
</div>
<script>
fetch({{ $codebergURL }}, {
headers: new Headers({
'User-agent': 'Mozilla/4.0 Custom User Agent'
})
})
.then(response => response.json())
.then(data => {
document.getElementById('{{ $id }}-full_name').innerHTML = data.full_name;
document.getElementById('{{ $id }}-description').innerHTML = data.description;
document.getElementById('{{ $id }}-stars_count').innerHTML = data.stars_count;
document.getElementById('{{ $id }}-forks_count').innerHTML = data.forks_count;
})
.catch(error => console.error(error))
</script>
{{ $fetchRepo := resources.Get "js/fetch-repo.js" }}
{{ $fetchRepo = $fetchRepo | resources.Minify | resources.Fingerprint ($.Site.Params.fingerprintAlgorithm | default "sha512") }}
<script type="text/javascript" src="{{ $fetchRepo.RelPermalink }}" integrity="{{ $fetchRepo.Data.Integrity }}" data-url="{{ $codebergURL }}" data-id="{{ $id }}"></script>
</a>
</div>
{{- end -}}