mirror of
https://github.com/neocities/neocities.git
synced 2025-04-25 01:32:36 +02:00
56 lines
1.6 KiB
Text
56 lines
1.6 KiB
Text
<% if (request.path == '/' && !signed_in?) || request.path == '/education' %>
|
|
<li>
|
|
<a href="/">Neocities</a>
|
|
</li>
|
|
<% end %>
|
|
<li>
|
|
<a href="/browse" id="browse-link">Websites</a>
|
|
<script>
|
|
document.addEventListener('DOMContentLoaded', () => {
|
|
const browseLink = document.getElementById('browse-link');
|
|
|
|
if (window.location.pathname === '/browse') {
|
|
const params = new URLSearchParams(window.location.search);
|
|
const persistParams = new URLSearchParams();
|
|
const validPattern = /^[a-zA-Z0-9 ]+$/;
|
|
|
|
['sort_by', 'tag'].forEach(key => {
|
|
if (params.has(key)) {
|
|
const value = params.get(key);
|
|
if (value.length <= <%= Tag::NAME_LENGTH_MAX %> && validPattern.test(value)) {
|
|
persistParams.set(key, value);
|
|
}
|
|
}
|
|
});
|
|
|
|
localStorage.setItem('browseQuery', persistParams.toString());
|
|
}
|
|
|
|
const savedQuery = localStorage.getItem('browseQuery');
|
|
|
|
if (savedQuery) {
|
|
browseLink.href = `/browse?${savedQuery}`;
|
|
}
|
|
});
|
|
</script>
|
|
</li>
|
|
<% unless is_education? %>
|
|
<li>
|
|
<a href="/activity">Activity</a>
|
|
</li>
|
|
<% end %>
|
|
<li>
|
|
<a href="/tutorials">Learn</a>
|
|
</li>
|
|
|
|
<% if signed_in? %>
|
|
<% unless current_site.supporter? %>
|
|
<li>
|
|
<a href="/supporter">Upgrade to Supporter<i class="fa fa-heart"><i class="fa fa-heart"></i></i></a>
|
|
</li>
|
|
<% end %>
|
|
<% else %>
|
|
<li>
|
|
<a href="/supporter">Support Us<i class="fa fa-heart"></i></i></a>
|
|
</li>
|
|
<% end %>
|