- download usecase

- select all or no modules
- better reset for offline usecase
- preset loader for offline usecase
This commit is contained in:
Sublunar Space 2019-01-02 22:39:51 +01:00
parent 08a6d31d32
commit 5c624df96f
2 changed files with 124 additions and 85 deletions

View file

@ -104,10 +104,6 @@
</div>
<a id="downloadAnchorElem" style="display:none"></a>
<!--
* DOM object with all modal templates
*-->
<div id="modals">
<!--
* Settings Modal
@ -173,11 +169,11 @@
</div>
<div class="form-group col-md-12">
<label for="lon">Modules to Use</label>
<p><a id="allModules">All</a> <a id="noModules">None</a></p>
<div id="moduleSelect" class="checkbox form-check form-check-inline">
</div>
</div>
</div>
<div class="modal-footer">
<label class="btn btn-default pull-left" id="fileInputLabel" for="fileInput">
<input id="fileInput" type="file" style="display:none"
@ -192,6 +188,11 @@
</div>
</div>
<!--
* DOM object with all modal templates
*-->
<div id="modals"></div>
<!--
* jQuery.loadTemplate templates
*-->
@ -296,6 +297,14 @@
}
});
$("#allModules").on("click", function() {
$('#moduleSelect input:checkbox').prop('checked', true);
});
$("#noModules").on("click", function() {
$('#moduleSelect input:checkbox').prop('checked', false);
});
// OSMNAmes OsmNamesAutocomplete
var autocomplete = new kt.OsmNamesAutocomplete('search', 'https://geocoder.tilehosting.com/', 'kqIwOXlhKKgBoR5zVAnm');
autocomplete.registerCallback(function(item) {
@ -328,6 +337,18 @@
// "Reset" button in navbar menu bar
$('#filterreset').on('click', function() {
if ( $("body").attr("use") == "offline" ) {
$("#grid").empty();
$('#caption .stoke').html("resetting...please wait.");
$.get("presets/grid.html").done(function(html) {
$("#grid").append(html);
$('#caption .stoke').empty();
$('#moduleSelect input:checkbox').prop('checked', true);
$('.planetaryhour').on('click', SL.Calendar.hourInfo);
if ( $('#calendar').data('isotope') ) $('#calendar').isotope('destroy');
});
}
$('.actionlistfilter input').prop('checked', false);
$('.filteroptions input').prop('checked', false);
filters = {};
$('#calendar').isotope({ filter: '*' });

View file

@ -263,7 +263,8 @@ SL.Calendar = (function() {
clearTimeout(timeout);
$('#caption .stoke').empty();
if ( $("body").attr("use") == "download" )
SL.Calendar.download( $("#grid").html(), fname, "skip", "html", "text/html; charset=utf-8");
SL.Calendar.download( $("#grid").html(), "grid.html", "skip", "html", "text/html; charset=utf-8");
SL.Calendar.download(Hours.moments, "ephemeris");
}
}
@ -384,6 +385,9 @@ SL.Calendar = (function() {
modal(plugin, definitions);
}
});
if ( $("body").attr("use") == "download" )
SL.Calendar.download( $("#filterList").html(), "filtermenu.html", "skip", "html", "text/html; charset=utf-8");
SL.Calendar.download( $("#modals").html(), "modals.html", "skip", "html", "text/html; charset=utf-8");
}
/**
@ -518,6 +522,20 @@ SL.Calendar = (function() {
extend(m, eval('module_'+m));
});
$('[data-toggle="tooltip"]').tooltip();
if ( $("body").attr("use") == "offline" ) {
$('#caption .stoke').html("loading preset...please wait.");
$.get("presets/filtermenu.html").done(function(html) {$("#filterList").append(html);});
$.get("presets/modals.html").done(function(html) {$("#modals").append(html);});
$.get("presets/grid.html").done(function(html) {
$("#grid").append(html);
$('#caption .stoke').empty();
$('#moduleSelect input:checkbox').prop('checked', true);
$('.planetaryhour').on('click', SL.Calendar.hourInfo);
});
$.getJSON("presets/ephemeris.json", function(json) {
Hours.moments = json.query;
});
}
}
/**