Skip to content

Commit

Permalink
Add scope menu
Browse files Browse the repository at this point in the history
  • Loading branch information
ModelEarth committed Oct 6, 2024
1 parent be56eaa commit 92be35f
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 1 deletion.
10 changes: 10 additions & 0 deletions info/template-main.html
Original file line number Diff line number Diff line change
Expand Up @@ -949,6 +949,16 @@
<option value="country">United States</option>
<option value="state" selected>State</option><!-- was counties -->
</select>
<select id="datascope_select" class="local" style="float:left; display:none">
<option value="none">Granularity...</option>
<option value="continent">Countinents</option>
<option value="country">Countries</option>
<option value="state">States/Territories</option>
<option value="county">Counties</option>
<option value="zip">Postal Codes</option>
<option value="person">People</option>
<option value="voxel">Brain Voxels</option>
</select>

<b><!--States--></b>
<div id="state_select_holder" class="earth" style="displayX:none;float:left">
Expand Down
3 changes: 3 additions & 0 deletions js/localsite.js
Original file line number Diff line number Diff line change
Expand Up @@ -704,6 +704,9 @@ function loadLocalTemplate() {
relocatedStateMenu.appendChild(state_select); // For apps hero
$(".stateFilters").hide();
}
if (typeof relocatedScopeMenu != "undefined") {
relocatedScopeMenu.appendChild(datascope_select); // For apps hero
}
waitForElm('#filterClickLocation').then((elm) => {
if (param.showstates != "false") {
$("#filterClickLocation").show();
Expand Down
36 changes: 35 additions & 1 deletion js/navigation.js
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,13 @@ function hashChanged() {
$("#hero_holder").show(); // Didn't work, so kept #hero_holder visible.
}
}
if (hash.scope != priorHash.scope) {
if (hash.scope) {
waitForElm('#datascope_select').then((elm) => {
$("#datascope_select").val(hash.scope);
})
}
}
if (hash.state != priorHash.state) {
if (hash.geoview) {
loadGeomap = true;
Expand Down Expand Up @@ -343,6 +350,11 @@ function hashChanged() {
relocatedStateMenu.appendChild(state_select); // For apps hero
});
}
if (typeof relocatedScopeMenu != "undefined") {
waitForElm('#scope_select').then((elm) => {
relocatedScopeMenu.appendChild(scope_select); // For apps hero
});
}
$("#hero_holder").show();
}
}
Expand Down Expand Up @@ -1196,14 +1208,22 @@ $(document).ready(function() {
} else {
goHash({"geoview":this.value});
}

});
$(document).on("change", "#datascope_select", function(event) {
//alert("#datascope_select changed")

goHash({"scope":this.value});
});
$('.selected_state').on('change', function() {
//alert("selected_state " + this.getAttribute("id"))
$("#state_select").val(this.getAttribute("id"));
goHash({'name':'','state':this.getAttribute("id")}); // triggers renderGeomapShapes("geomap", hash); // County select map
});
$('#region_select').on('change', function() {
if(location.host.indexOf('localhost') >= 0) {
alert("localhost: #region_select change")
}
let hash = getHash();
//alert($(this).attr("geo"))
//goHash({'regiontitle':this.value,'lat':this.options[this.selectedIndex].getAttribute('lat'),'lon':this.options[this.selectedIndex].getAttribute('lon'),'geo':this.options[this.selectedIndex].getAttribute('geo')});
hiddenhash.geo = this.options[this.selectedIndex].getAttribute('geo');
Expand Down Expand Up @@ -5038,6 +5058,14 @@ $(document).on("change", ".sitebasemap", function(event) {
//event.stopPropagation();
});

waitForElm('#mainHero').then((elm) => {
waitForElm('#mapFilters').then((elm) => {
$("#datascape").prependTo($("#mainHero"));
$("#filterFieldsHolder").show();
$("#filterFieldsHolder").addClass("dark");
//alert("mainhero")
});
});
$(document).on("change", "#mainhero", function(event) { // Public or Dev
if (typeof Cookies != 'undefined') {
Cookies.set('mainhero', $("#mainhero").val());
Expand Down Expand Up @@ -6008,6 +6036,9 @@ function openMapLocationFilter() {
if (typeof state_select_holder != "undefined") {
state_select_holder.appendChild(state_select); // For apps hero
}
if (typeof scope_select_holder != "undefined") {
scope_select_holder.appendChild(scope_select); // For apps hero
}

if (hash.geo) {
let geoDeselect = "";
Expand Down Expand Up @@ -6059,6 +6090,9 @@ function closeLocationFilter() {
if (typeof relocatedStateMenu != "undefined") {
relocatedStateMenu.appendChild(state_select); // For apps hero
}
if (typeof relocatedScopeMenu != "undefined") {
relocatedScopeMenu.appendChild(scope_select); // For apps hero
}
$("#hero_holder").show();
}

Expand Down

0 comments on commit 92be35f

Please sign in to comment.