Skip to content

Commit 4162e3f

Browse files
committed
Merge branch 'main' into 2d-tutorial-bounty
2 parents e3c768f + c78d6fa commit 4162e3f

File tree

6 files changed

+56
-13
lines changed

6 files changed

+56
-13
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ With your environment setup properly, the following explains how to build from s
1313
1. Clone this repository
1414

1515
```sh
16-
git clone https://github.com/MonoGame/monogame.github.io.git
16+
git clone https://github.com/MonoGame/docs.monogame.github.io.git
1717
```
1818

1919
2. Install DotNet dependencies

templates/monogame/layout/_master.tmpl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@
7878
{{/_enableSearch}}
7979

8080
{{>partials/footer}}
81+
<script type="text/javascript" src="/public/injectDonateButton.js" /
8182
</body>
8283
{{/redirect_url}}
8384
</html>

templates/monogame/partials/topnav.tmpl.partial

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,17 @@
66
{{_appName}}
77
</a>
88
<button class="btn btn-lg d-md-none border-0" type="button" data-bs-toggle="collapse" data-bs-target="#navpanel" aria-controls="navpanel" aria-expanded="false" aria-label="Toggle navigation">
9-
<i class="bi bi-three-dots"></i>
9+
<i class="bi bi-three-dots"></i>
1010
</button>
1111
<div class="collapse navbar-collapse" id="navpanel">
12-
<div id="navbar">
13-
{{#_enableSearch}}
14-
<form class="search" role="search" id="search">
15-
<i class="bi bi-search"></i>
16-
<input class="form-control" id="search-query" type="search" disabled placeholder="{{__global.search}}" autocomplete="off" aria-label="Search">
17-
</form>
18-
{{/_enableSearch}}
19-
</div>
12+
<div id="navbar">
13+
{{#_enableSearch}}
14+
<form class="search" role="search" id="search">
15+
<i class="bi bi-search"></i>
16+
<input class="form-control" id="search-query" type="search" disabled placeholder="{{__global.search}}" autocomplete="off" aria-label="Search">
17+
</form>
18+
{{/_enableSearch}}
19+
</div>
2020
</div>
2121
</div>
2222
</nav>
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/**
2+
* Donate button Injector
3+
*
4+
* This script dynamically adds a "Donate" button to the navigation.
5+
* Since the navbar is dynamically generated **after page load**, it uses a MutationObserver to watch
6+
* for the form.icons element to be added to the DOM, injects the donate button as its first child
7+
* the disconnects the observer.
8+
*/
9+
10+
document.addEventListener('DOMContentLoaded', function() {
11+
const observer = new MutationObserver(function(mutations) {
12+
const iconsForm = document.querySelector('form.icons');
13+
if (iconsForm) {
14+
observer.disconnect();
15+
const donateDiv = document.createElement('div');
16+
donateDiv.innerHTML = '<a class="btn mg-donate-button ms-3" type="button" href="https://monogame.net/donate"><i class="bi bi-heart"></i> Donate</a>';
17+
iconsForm.insertAdjacentElement('afterbegin', donateDiv);
18+
}
19+
});
20+
21+
observer.observe(document.body, {
22+
childList: true,
23+
subtree: true
24+
});
25+
});

templates/monogame/public/main.css

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,17 @@ body[data-disable-toc="true" i] .toc-offcanvas {
7272
color: var(--mg-orange-primary)
7373
}
7474

75+
/*******************************************************************************
76+
*** Section: Navbar Fixes
77+
*** The main monogame website uses bootstrap 5.3.2 while docfx is sitll on
78+
*** bootstrap 3.4.1. The following are fixes for the top navbar specifically
79+
*** so that it looks the same as the main website
80+
*******************************************************************************/
81+
nav#autocollapse > div.container-xxl {
82+
max-width: 1320px;
83+
}
84+
85+
7586
/*******************************************************************************
7687
*** Section: MonoGame Utility Classes
7788
*** Utility classes used throughout the site that provide some MonoGame specific
@@ -182,6 +193,12 @@ box-shadow: 0 8px 16px 0 rgba(0, 0, 0, 0.2);
182193
color: var(--bs-body-color);
183194
}
184195

196+
.mg-donate-button {
197+
--bs-btn-bg: #F1465A;
198+
--bs-btn-hover-bg: #F25265;
199+
--bs-btn-color: #fff;
200+
--bs-btn-hover-color: #fff;
201+
}
185202

186203
/*******************************************************************************
187204
*** Some adjustments to give the content some space.

toc.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
href: https://monogame.net/blog/
1111
- name: Bounties
1212
href: https://monogame.net/bounties/
13+
- name: Resources
14+
href: https://monogame.net/resources/
1315
- name: About
14-
href: https://monogame.net/about/
15-
- name: Donate
16-
href: https://monogame.net/donate/
16+
href: https://monogame.net/about/

0 commit comments

Comments
 (0)