Skip to content

Commit

Permalink
Enable Christmas themed featured panel
Browse files Browse the repository at this point in the history
  • Loading branch information
mitchts committed Dec 10, 2023
1 parent bc829e0 commit cab859a
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 15 deletions.
18 changes: 18 additions & 0 deletions src/assets/js/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,22 @@ $(function() {
})
})

// will eventually replace all this other jQuery
document.addEventListener('DOMContentLoaded', async () => {
document.querySelectorAll('[data-action="filter-custom"]').forEach(el => {
el.addEventListener('click', e => {
console.log(el.getAttribute('filters'))
filters = el.getAttribute('filters') ? el.getAttribute('filters').split(',') || [] : [];
options.match = el.getAttribute('match') || 'all';
options.invert = el.getAttribute('invert') == 'true' || false;
options.highest_version = el.getAttribute('highest-version') == 'true' || true;

updateUrl();
parseUrl();
});
});
});

function setupSearch(config, type) {
searchable = config
searchable_type = type
Expand Down Expand Up @@ -303,6 +319,7 @@ function countMatching() {
function updateUrl() {
var string = "?"
var search = $('#search').val()
filters = [...new Set(filters)]
var filterArr = encodeURIComponent(filters)
var authorFilterArr = encodeURIComponent(filtered_authors)
if (search || filters.length > 0 || filtered_authors.length > 0) {
Expand Down Expand Up @@ -334,6 +351,7 @@ function parseUrl() {
var highest_version = (getUrlParam('highest_version') == 'true')
if (urlFilters || searchInput || urlAuthorFilters || match || invert || highest_version) {
if (urlFilters) {
$('.filter.active').removeClass('active')
urlFilters = urlFilters.split(',')
for (i = 0; i < urlFilters.length; i++) {
$('.filter:contains("' + urlFilters[i] + '")').filter(function() {
Expand Down
30 changes: 15 additions & 15 deletions src/data/maps/pgm.json
Original file line number Diff line number Diff line change
Expand Up @@ -159,21 +159,21 @@
},
"data": {
"featured": {
"enabled": false,
"title": "Halloween Apocalypse",
"description": "Get ready for Halloween with these spooky themed maps! Check out all themed maps <a href='?filters=halloween&match=all&invert=false&highest_version=true#searchable-collection'>here</a>.",
"enabled": true,
"title": "❄️ Candy Cane Carnival ❄️",
"description": "Get in the Christmas spirit with these festive themed maps! Check out all themed maps <a href='#searchable-collection' data-action='filter-custom' filters='christmas' highest-version='true'>here</a>.",
"maps": [
"overcastcommunity_publicmaps_concursed",
"overcastcommunity_communitymaps_spooky_sanctum",
"overcastcommunity_publicmaps_witchy_woods",
"overcastcommunity_publicmaps_circus_dtc_halloween",
"overcastcommunity_publicmaps_dynabooo",
"overcastcommunity_communitymaps_hearts_of_hades",
"overcastcommunity_publicmaps_deepwind_horror",
"overcastcommunity_publicmaps_haunted_blocks",
"overcastcommunity_publicmaps_snowy_wars_halloween",
"overcastcommunity_communitymaps_bewitched",
"overcastcommunity_publicmaps_jungle_spook"
"overcastcommunity_publicmaps_candy_cane_valley",
"overcastcommunity_publicmaps_holiday_blocks",
"overcastcommunity_communitymaps_hobbitmas",
"overcastcommunity_communitymaps_winter_gem_ctw",
"overcastcommunity_publicmaps_two_trees",
"overcastcommunity_communitymaps_extraterrestrial_subzero",
"overcastcommunity_publicmaps_danagal_valley_dtm",
"overcastcommunity_publicmaps_arablizzardia",
"overcastcommunity_communitymaps_chilla",
"overcastcommunity_publicmaps_christmas_sanctuary",
"overcastcommunity_communitymaps_iti_marshmallow_moai"
]
},
"maps": [
Expand Down Expand Up @@ -131393,4 +131393,4 @@
}
]
}
}
}

0 comments on commit cab859a

Please sign in to comment.