Skip to content

Commit 99a3d58

Browse files
Add MS Footer (#160)
* Add logic for Vietnam region for cookie compliance and add footer * PR update * pr review update * update links * check mark update and remove | * Update appsettings.Development.json * align manage cookie * remove manually usage apply wcp api script * initialized instance or falls back to WcpConsent.siteConsent * remove hard coded display none * align logic * add logic to observer * Wrap site.js in an IIFE to avoid leaking globals Encapsulate site.js in an IIFE so internal helpers (siteConsent, setCookieManagementVisibility, initializeCookieConsent, scrollIntoMainContent, observer) no longer leak onto window and risk name collisions. openCookiePreferences is still explicitly exported via window.openCookiePreferences since it is invoked from the footer "Manage cookies" link. Also adds "use strict". --------- Co-authored-by: Dan Zhu <33338258+danzhu54@users.noreply.github.com>
1 parent 2b07b67 commit 99a3d58

4 files changed

Lines changed: 332 additions & 173 deletions

File tree

src/apisof.net/Pages/_Host.cshtml

Lines changed: 4 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,11 @@
1616
<link rel="stylesheet" media="(prefers-color-scheme: light)" href="~/css/bootstrap/bootstrap.min.css" />
1717
<link rel="stylesheet" media="(prefers-color-scheme: dark)" href="~/lib/forevolve/bootstrap-dark/dist/css/bootstrap-dark.min.css" />
1818
<link href="css/site.css" rel="stylesheet" />
19+
<script src="https://consentdeliveryfd.azurefd.net/mscc/lib/v2/wcp-consent.js"></script>
1920
</head>
2021
<body>
22+
<div id="cookie-banner"></div>
23+
2124
<app>
2225
<component type="typeof(App)" render-mode="ServerPrerendered" />
2326
</app>
@@ -36,44 +39,6 @@
3639
<script src="_framework/blazor.server.js"></script>
3740
<script src="~/lib/jquery/jquery.min.js"></script>
3841
<script src="~/lib/twitter-bootstrap/js/bootstrap.bundle.min.js"></script>
39-
<script type="text/javascript">
40-
41-
function scrollIntoMainContent(){
42-
var mainContent = document.getElementById("main-content");
43-
if (mainContent) {
44-
mainContent.scrollIntoView({ behavior: "smooth" });
45-
mainContent.focus();
46-
}
47-
}
48-
49-
var observer = new MutationObserver(function (mutations, observer) {
50-
$('[data-toggle="popover"]').popover({
51-
placement: 'top',
52-
trigger: 'hover',
53-
boundary: 'body'
54-
});
55-
$('[data-toggle="popover"]').on('click', function () {
56-
$('[data-toggle="popover"]').popover('dispose');
57-
});
58-
$('.search-result-row.selected').each(function () {
59-
this.scrollIntoView({block: "nearest"});
60-
});
61-
$("#skipToMain").on('keydown', function(e){
62-
if (e.key === "Enter" || e.key === " ") {
63-
scrollIntoMainContent();
64-
e.preventDefault();
65-
}
66-
});
67-
$("#skipToMain").on('click', function(e){
68-
scrollIntoMainContent();
69-
e.preventDefault();
70-
});
71-
});
72-
observer.observe(document, {
73-
subtree: true,
74-
childList: true,
75-
attributes: true
76-
});
77-
</script>
42+
<script src="~/js/site.js"></script>
7843
</body>
7944
</html>

src/apisof.net/Shared/MainLayout.razor

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
@inherits LayoutComponentBase
22

3+
<div class="page-shell">
34
<a href="javascript:void(0);" id="skipToMain" class="skip-to-main" target="_self">Skip to main content</a>
45

56
<nav class="navbar navbar-expand-lg navbar-dark bg-dotnet">
@@ -55,7 +56,7 @@
5556
</div>
5657
</nav>
5758

58-
<div class="nofocus" role="main" id="main-content" tabindex="-1">
59+
<div class="layout-main nofocus" role="main" id="main-content" tabindex="-1">
5960
<CascadingValue Value="this">
6061
@Body
6162
</CascadingValue>
@@ -82,4 +83,42 @@
8283
{
8384
<a href="@CatalogJobInfo.DetailsUrl" class="text-underline">@CatalogJobInfo.Date.Date.ToShortDateString()</a>
8485
}
86+
</div>
87+
88+
<footer id="footer-site" class="uhf-footer" role="contentinfo" aria-label="Microsoft footer">
89+
<div class="uhf-footer-row">
90+
<span>This site is managed by Microsoft | &copy; @DateTime.UtcNow.Year Microsoft. All rights reserved.</span>
91+
</div>
92+
<ul class="uhf-footer-links">
93+
<li>
94+
<a href="https://go.microsoft.com/fwlink/?LinkId=521839" data-mscc-ic="false">Privacy Statement</a>
95+
</li>
96+
<li>
97+
<a href="https://go.microsoft.com/fwlink/?linkid=2259814" data-mscc-ic="false">Consumer Health Privacy</a>
98+
</li>
99+
<li>
100+
<a href="https://www.microsoft.com/en-us/legal/terms-of-use" data-mscc-ic="false">Terms of Use</a>
101+
</li>
102+
<li>
103+
<a href="https://support.microsoft.com/contactus" data-mscc-ic="false">Contact Us</a>
104+
</li>
105+
<li>
106+
<a href="https://azure.microsoft.com/" data-mscc-ic="false">Hosted on Microsoft Azure</a>
107+
</li>
108+
<li class="manageCookieChoice" style="display: none">
109+
<a href="javascript:openCookiePreferences();" data-mscc-ic="false">Manage cookies</a>
110+
</li>
111+
<li>
112+
<a href="https://aka.ms/yourcaliforniaprivacychoices" class="uhf-privacy-choices" data-mscc-ic="false">
113+
<svg aria-hidden="true" class="uhf-privacy-icon" viewBox="0 0 26 14" xmlns="http://www.w3.org/2000/svg" focusable="false">
114+
<path d="M7.4 12.8h6.8l3.1-11.6H7.4C4.2 1.2 1.6 3.8 1.6 7s2.6 5.8 5.8 5.8z" fill="#fff"></path>
115+
<path d="M22.6 0H7.4c-3.9 0-7 3.1-7 7s3.1 7 7 7h15.2c3.9 0 7-3.1 7-7s-3.2-7-7-7zm-21 7c0-3.2 2.6-5.8 5.8-5.8h9.9l-3.1 11.6H7.4c-3.2 0-5.8-2.6-5.8-5.8z" fill="#06f"></path>
116+
<path d="M24.6 4c.2.2.2.6 0 .8L22.5 7l2.2 2.2c.2.2.2.6 0 .8-.2.2-.6.2-.8 0l-2.2-2.2-2.2 2.2c-.2.2-.6.2-.8 0-.2-.2-.2-.6 0-.8L20.8 7l-2.2-2.2c-.2-.2-.2-.6 0-.8s.6-.2.8 0L21.6 6l2.2-2.2c.2-.2.6-.2.8 0z" fill="#fff"></path>
117+
<path d="M12.7 4.1c.2.2.3.6.1.8L8.6 9.8c-.1.1-.2.2-.3.2-.2.1-.5.1-.7-.1L5.4 7.7c-.2-.2-.2-.6 0-.8s.6-.2.8 0l1.8 1.8 3.9-4.4c.2-.2.5-.3.8-.2z" fill="#06f"></path>
118+
</svg>
119+
<span>Your Privacy Choices</span>
120+
</a>
121+
</li>
122+
</ul>
123+
</footer>
85124
</div>

0 commit comments

Comments
 (0)