diff --git a/resources/js/CustomHandling/CustomHandling.js b/resources/js/CustomHandling/CustomHandling.js new file mode 100644 index 000000000..22bd17670 --- /dev/null +++ b/resources/js/CustomHandling/CustomHandling.js @@ -0,0 +1,57 @@ +$(document).ready(function() { + + $('#stereo_a-psp-tree-trajectory .button, #soho-psp-tree-trajectory .button').click(function(){ + + $.getJSON("https://api.beta.helioviewer.org/resources/JSON/celestial-objects/soho/psp/soho_psp_dictionary.json?rndnm=", function(pspdata){ + + var pspencnum=0; + + // loop through each encounter + $.each(pspdata, function(pspvalue, pspkey){ + //console.log(pspkey, pspvalue); + + pspencnum++; + + $('#showjsondata').append('Dates: '+JSON.stringify(pspvalue)+'
'); + + //JSON.stringify(pspkey.start); + + // parse the JSON data: get the "start" value + var myPSPObj = JSON.parse(pspkey.start); + var pspstartenc = myPSPObj; + + + // if the very first appropriate encounter div exists + if($('#soho-psp-container-hover-date-'+pspstartenc).length > 0 || $('#stereo_a-psp-trajectory-hover-date-'+pspstartenc).length > 0) { + + if($('#soho-psp-container-hover-date-'+pspstartenc).length > 0) { + var numEncPoints= $('#soho-psp-trajectory .hover-date-container').length; + else if($('#stereo_a-psp-trajectory-hover-date-'+pspstartenc).length > 0) { + var numEncPoints= $('#soho-psp-trajectory .hover-date-container').length; + } + + + // go through each encounter unix time and append the Encounter to each label + for(var psp_subenc=1;psp_subenc<=numEncPoints;psp_subenc++) { + $('#soho-psp-trajectory .hover-date-container, #stereo_a-psp-trajectory .hover-date-container').css('height','33px'); + $('#soho-psp-trajectory .hover-date-container, #stereo_a-psp-trajectory .hover-date-container').append('
Encounter '+pspencnum); + $('#showjsondata').append('#stereo_a-psp-trajectory-hover-date-'+pspstartenc+' // Encounter '+pspencnum+'
'); + pspstartenc+=21600000; + } + + + } + + }); + + + + + }).fail(function(){ + //console.log(''); + }); + + + }); + +});