preset loader + bugfixes
This commit is contained in:
parent
5c624df96f
commit
ac264cc82d
2 changed files with 39 additions and 26 deletions
|
|
@ -339,14 +339,7 @@
|
|||
$('#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);
|
||||
|
|
|
|||
|
|
@ -40,6 +40,34 @@ SL.Calendar = (function() {
|
|||
.find('.col-sm-4').remove();
|
||||
}
|
||||
|
||||
/**
|
||||
* loadPreset loads precalculated menubar, modals and hour grid
|
||||
*/
|
||||
function loadPreset() {
|
||||
if ( $("body").attr("use") == "offline" ) {
|
||||
$('#caption .stoke').html("loading preset...please wait.");
|
||||
$.get("presets/filtermenu.html").done(function(html) {
|
||||
$("#filterList").empty();
|
||||
$("#filterList").append(html);
|
||||
});
|
||||
$.get("presets/modals.html").done(function(html) {
|
||||
$("#modals").empty();
|
||||
$("#modals").append(html);
|
||||
});
|
||||
$.get("presets/grid.html").done(function(html) {
|
||||
$("#grid").empty();
|
||||
$("#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;
|
||||
});
|
||||
if ( $('#calendar').data('isotope') ) $('#calendar').isotope('destroy');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* resetWindow function simulates a resizing of the browser window. Needed hack for a display glitch in the modals.
|
||||
*/
|
||||
|
|
@ -262,11 +290,12 @@ SL.Calendar = (function() {
|
|||
NProgress.done();
|
||||
clearTimeout(timeout);
|
||||
$('#caption .stoke').empty();
|
||||
if ( $("body").attr("use") == "download" )
|
||||
if ( $("body").attr("use") == "download" ) {
|
||||
SL.Calendar.download( $("#grid").html(), "grid.html", "skip", "html", "text/html; charset=utf-8");
|
||||
SL.Calendar.download(Hours.moments, "ephemeris");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* info function creates a temporary DOM object to be displayed as hour info upon clicking a planetary hour object
|
||||
|
|
@ -385,10 +414,11 @@ SL.Calendar = (function() {
|
|||
modal(plugin, definitions);
|
||||
}
|
||||
});
|
||||
if ( $("body").attr("use") == "download" )
|
||||
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");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* modal function creates DOM objects to be displayed as navbar menu items and modal hosting all the filter options of a plugin module
|
||||
|
|
@ -522,20 +552,9 @@ 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;
|
||||
});
|
||||
}
|
||||
loadPreset();
|
||||
if ( $("body").attr("use") == "offline" )
|
||||
$("#filterreset").closest('li').before('<li><p class="navbar-btn"><a class="btn btn-default" id="preset" onClick="SL.Calendar.preset()" href="#"><span class="glyphicon glyphicon-open"></span> Load Preset</a></p></li>');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -642,6 +661,7 @@ SL.Calendar = (function() {
|
|||
about : about,
|
||||
getGeoCode : getGeoCode,
|
||||
reset : resetWindow,
|
||||
preset : loadPreset,
|
||||
modules : Module.load,
|
||||
comboFilter : Filter.comboFilter,
|
||||
hourInfo : Hour.info,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue