Skip to content

Commit 1dc3f6b

Browse files
committed
Encapsulate scripts in header and footer
1 parent 806a9b7 commit 1dc3f6b

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

_includes/footer_custom.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
<script>
2+
(function(){
23
const button = document.getElementById('edit-this-page');
34
const oldUrl = button.href;
45
const newUrl = oldUrl.replace('/main-repo/', '/');
56
button.href = newUrl;
7+
})();
68
</script>

_includes/header_custom.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
<a class="site-button" id="theme-toggle" style="cursor: pointer;"></a>
2828

2929
<script>
30+
(function(){
3031
const light = 'light';
3132
const dark = 'dark';
3233
const system = 'system';
@@ -88,4 +89,5 @@
8889

8990
button.addEventListener('click', toggleTheme);
9091
setTheme(loadedTheme);
92+
})();
9193
</script>

0 commit comments

Comments
 (0)