//Jquery should already be loaded. //Just because IE incase the console doesn't exist (LTE IE9). var console = console ? console : { log: function () {}, info: function () {}, warn: function () {}, error: function () {} }; jQuery(function () { //WARNING: THIS METHOD WILL NOT WORK IF YOU UPGRADE JQUERY TOO FAR //if( jQuery.browser.msie || ( jQuery.browser.version=='11.0' && jQuery.browser.mozilla )/* IE 11 is weird and reporting mozilla flag?.*/ ){ if( window.document.documentMode ) { console.warn('Using Internet Explorer!'); jQuery('#play-slider-1').on('change', function () { //console.log('Changed slider 1'); navi_helper.pause_images(1); navi_helper.go_to_picture(1, jQuery(this).val() ); }); jQuery('#play-slider-2').on('change', function () { //console.log('Changed slider 2'); navi_helper.pause_images(2); navi_helper.go_to_picture(2, jQuery(this).val() ); }); }else { jQuery('#play-slider-1').on('input', function () { //console.log('Changed slider 1'); navi_helper.pause_images(1); navi_helper.go_to_picture(1, jQuery(this).val() ); }); jQuery('#play-slider-2').on('input', function () { //console.log('Changed slider 2'); navi_helper.pause_images(2); navi_helper.go_to_picture(2, jQuery(this).val() ); }); } }); var navi_helper = { current_page:0, min_page:0, max_page:14, contentSets:{ //index: content set 0:0, 1:1, 2:2, 3:2, 4:3, 5:3, //6:3, 6:7, // changed slide, changed set 7:4, 8:4, //9:4, 9: 8, //changed slide changed set 10:5, 11:5, 12:6, 13:6, 13:6, 14:6, }, picRotName: '{0}map.jpg', //use replace{} supportsTouch: (typeof Touch == "object"), contentSetInfo:{ 1: { 1:'

Landsat satellites take pictures of the Earth as they orbit our planet, regardless of the weather. This produces great images of the Earth below, when it is a clear day. If there are clouds between the satellite and the ground, then the image will be of the clouds not the Earth’s surface. The more clouds there are in an area, that more challenging it can be to capture good images of the complete images of features on the Earth.', }, 2: { 9: '

Landsat satellites take pictures of the Earth as they orbit our planet, regardless of the weather. This produces great images of the Earth below, when it is a clear day. If there are clouds between the satellite and the ground, then the image will be of the clouds not the Earth’s surface. The more clouds there are in an area, that more challenging it can be to capture good images of the complete images of features on the Earth.', 10: '

Although we often thinking of glaciers shrinking or falling apart as an iconic image of the impacts of climate change, it can be hard to know that global climate change is causing the changes in glaciers. That is until recently...

In December 2016, Gerard H. Roe, Marcia B. Baker and Florian Herla <'+ String.fromCharCode(97) + ' href="https://www.nature.com/articles/ngeo2863" target="_blank">published their research in Nature: Geosciences looking at 37 glaciers from around the world. They used numerical modeling and statistics, with a combination of direct measurement observations and theory, to ask the question: is anthropogenic climate change causing glaciers to retreat (aka get smaller). The answer overwhelming is yes!

For all 37 glaciers that they looked at, the same overall pattern emerges: changes in the length of the glacier can be explained by climate change.

' }, 5: { 11:'

Carbon dioxide mixes throughout the atmosphere all over our globe, regardless of where it entered the atmosphere. Because of this natural mixing, we can use the long-term measurements taken at the Mauna Loa Laboratory in Hawaii as a great example what of is going on everywhere in the atmosphere.

Scientists actually calculate the global trend of the amount of carbon dioxide in the atmosphere using data from hundreds of instruments from around the world and compare the trend taken from the ground observations to data taken from satellites. This calculated global trend is almost exactly the same as the trend at Mauna Loa. Therefore, scientists are confident that you can use the data from Mauna Loa as a good “<'+ String.fromCharCode(97) + ' href="https://youtu.be/vBU14vy9mEg" target="_blank">proxy” of what is going on everywhere.

Check out this great <'+ String.fromCharCode(97) + ' href="https://youtu.be/rEbE5fcnFVs" target="_blank">animation from the Scripps Institution of Oceanography at UC San Diego of the Keeling Curve.

', 12:'

The relationship between greenhouse gases (like carbon dioxide, methane, water vapor, etc.) in the atmosphere and air temperature is complex. While there are many things that impact air temperature on our planet, the great benefit of greenhouse gases is that they absorb some heat energy before it leaves our Earth’s system and enters space. The more greenhouse gases in the atmosphere, the more heat energy they can “trap,” and thus the warmer the air temperature on Earth becomes.

' }, 6:{ 13:'

(Photo Credit: <'+ String.fromCharCode(97) + ' href="https://commons.wikimedia.org/wiki/File:Rutgers_Stadium.jpg" target="_blank">Ruman Fuchs) 9,186 feet is long! You would need to put 25.6 football fields end-to-end to reach that distance. It is also just under a 3K road race.' } }, fps: 3, //show two frames every second. (1000 ms/#) my_timer: { 1: null, 2: null }, dynamic_images:{ //You'll need to update if you want dynamic year and month. Currently hardcoded into feb 2015 }, //This module is for pictures only. (e.g. slide 4) pictureModule: { myFPS:1.5, //a picture will be shown ever ( 1000 / myFPS ) ms picturePointer: { //index is content set 2: { imgID:'#set-2-dynamo-image', sliderID:'#graph-slider-set-2', imgSet:[ '1972','1973' ,'1985','1986','1988','1989' ,'1990','1991','1999' ,'2000','2001','2003','2004','2005','2006','2007','2009' ,'2011','2014','2015' ], currentPointer:0, syncToGraph: false, }, 3: { imgID:'#set-3-dynamo-image', sliderID:'#graph-slider-set-3', imgSet:[ '1972','1973' ,'1985','1986','1988','1989' ,'1990','1991','1999' ,'2000','2001','2003','2004','2005','2006','2007','2009' ,'2011','2014','2015' ], currentPointer:0, syncToGraph: true, }, }, pictureTimer: { //Slide number 2: null, 3: null, }, resetImg: function (setNum){ console.log('Resetting Image for set `',setNum,'`'); this.picturePointer[setNum].currentPointer = 0; var newSrc = navi_helper.picRotName.replace('{0}', this.picturePointer[setNum].imgSet[this.picturePointer[setNum].currentPointer] ); jQuery(this.picturePointer[setNum].imgID).prop({ src: 'http://polar-ice.org/wp-content/uploads/2018/02/' + newSrc }); jQuery(this.picturePointer[setNum].imgID+'-title').text( this.picturePointer[setNum].imgSet[this.picturePointer[setNum].currentPointer] ); }, stopAll: function () { for(var i in this.pictureTimer) { if(this.pictureTimer[i]){ this.pause(i); } this.resetImg(i); /*if( this.picturePointer[i].syncToGraph ) { this.synchronizeGraph(i); }*/ } return true; }, play: function ( setNum ) { console.log('[Set: '+ setNum +'] Play'); //let's stop whatever is going on this.pause(setNum); if( this.pictureTimer[setNum] ) { console.log('Already playing...'); return true; } this.pictureTimer[setNum] = setInterval( function () { //Make sure this works on other browsers. navi_helper.pictureModule.picturePointer[setNum].currentPointer++; if ( navi_helper.pictureModule.picturePointer[setNum].currentPointer > navi_helper.pictureModule.picturePointer[setNum].imgSet.length-1 ) { //If we go over to the next one, we'll stop here. navi_helper.pictureModule.picturePointer[setNum].currentPointer = navi_helper.pictureModule.picturePointer[setNum].imgSet.length-1; navi_helper.pictureModule.pause(setNum); return true; } var newSrc = navi_helper.picRotName.replace('{0}', navi_helper.pictureModule.picturePointer[setNum].imgSet[navi_helper.pictureModule.picturePointer[setNum].currentPointer] ); jQuery(navi_helper.pictureModule.picturePointer[setNum].imgID).prop({ src: './images/story2/hinter-maps/' + newSrc }); jQuery(navi_helper.pictureModule.picturePointer[setNum].imgID+'-title').text( navi_helper.pictureModule.picturePointer[setNum].imgSet[navi_helper.pictureModule.picturePointer[setNum].currentPointer] ); jQuery(navi_helper.pictureModule.picturePointer[setNum].sliderID).val(navi_helper.pictureModule.picturePointer[setNum].currentPointer); if( navi_helper.pictureModule.picturePointer[setNum].syncToGraph ) { navi_helper.pictureModule.synchronizeGraph(setNum); } }, (1000 / this.myFPS)); //Let's now refresh }, pause: function (setNum) { console.log('[Set: '+ setNum +'] Pause'); if( !this.pictureTimer[setNum] ) { console.log('Already paused or stopped...'); } clearInterval(this.pictureTimer[setNum]); this.pictureTimer[setNum]=null; /* if( this.pictureTimer[page_num] ) { clearInterval(this.pictureTimer[page_num]); this.pictureTimer[page_num]=null; } */ }, sliderGoTo: function (setNum, value) { console.log('[Set: '+ setNum +'] Slider Value: {'+value+'}'); this.pause(setNum); navi_helper.pictureModule.picturePointer[setNum].currentPointer = value; if ( navi_helper.pictureModule.picturePointer[setNum].currentPointer > navi_helper.pictureModule.picturePointer[setNum].imgSet.length-1 ) { //stop here. navi_helper.pictureModule.picturePointer[setNum].currentPointer = navi_helper.pictureModule.picturePointer[setNum].imgSet.length-1; return true; //navi_helper.pictureModule.picturePointer[setNum].currentPointer = 0; }else if ( navi_helper.pictureModule.picturePointer[setNum].currentPointer < 0 ) { navi_helper.pictureModule.picturePointer[setNum].currentPointer = 0; return true; //navi_helper.pictureModule.picturePointer[setNum].currentPointer = navi_helper.pictureModule.picturePointer[setNum].imgSet.length-1; } jQuery(navi_helper.pictureModule.picturePointer[setNum].sliderID).val(navi_helper.pictureModule.picturePointer[setNum].currentPointer); var newSrc = navi_helper.picRotName.replace('{0}', this.picturePointer[setNum].imgSet[this.picturePointer[setNum].currentPointer] ); jQuery(this.picturePointer[setNum].imgID).prop({ src: './images/story2/hinter-maps/' + newSrc }); jQuery(this.picturePointer[setNum].imgID+'-title').text( this.picturePointer[setNum].imgSet[this.picturePointer[setNum].currentPointer] ); if( navi_helper.pictureModule.picturePointer[setNum].syncToGraph ) { navi_helper.pictureModule.synchronizeGraph(setNum); } }, step: function (setNum, stepUp) { console.log('[Set: '+ setNum +'] Step: {'+(stepUp ? 'Up' : 'Back')+'}'); this.pause(setNum); if( stepUp ){ //Next year navi_helper.pictureModule.picturePointer[setNum].currentPointer++; if ( navi_helper.pictureModule.picturePointer[setNum].currentPointer > navi_helper.pictureModule.picturePointer[setNum].imgSet.length-1 ) { //stop here. navi_helper.pictureModule.picturePointer[setNum].currentPointer = navi_helper.pictureModule.picturePointer[setNum].imgSet.length-1; return true; //navi_helper.pictureModule.picturePointer[setNum].currentPointer = 0; } }else{ //previous year navi_helper.pictureModule.picturePointer[setNum].currentPointer--; if ( navi_helper.pictureModule.picturePointer[setNum].currentPointer < 0 ) { navi_helper.pictureModule.picturePointer[setNum].currentPointer = 0; return true; //navi_helper.pictureModule.picturePointer[setNum].currentPointer = navi_helper.pictureModule.picturePointer[setNum].imgSet.length-1; } } jQuery(navi_helper.pictureModule.picturePointer[setNum].sliderID).val(navi_helper.pictureModule.picturePointer[setNum].currentPointer); var newSrc = navi_helper.picRotName.replace('{0}', this.picturePointer[setNum].imgSet[this.picturePointer[setNum].currentPointer] ); jQuery(this.picturePointer[setNum].imgID).prop({ src: './images/story2/hinter-maps/' + newSrc }); jQuery(this.picturePointer[setNum].imgID+'-title').text( this.picturePointer[setNum].imgSet[this.picturePointer[setNum].currentPointer] ); if( navi_helper.pictureModule.picturePointer[setNum].syncToGraph ) { navi_helper.pictureModule.synchronizeGraph(setNum); } return true; }, synchronizeGraph: function (setNum) { //alert(setNum); if( setNum == 1 || setNum == 2 || setNum == 4 || setNum == 5 ) { console.log('[synchronizeGraph] No graphs to synchronize in this set ('+ navi_helper.contentSets[navi_helper.current_page] +').') }else if( setNum == 3 ) { console.log('[synchronizeGraph] Synchronizing Graph to Picture Set 3'); if( !navi_helper.chartModule.chart ) { console.log('Chart not initialized yet, leaving function.'); return true; } //We can just set the data to what we have. var findYear = this.picturePointer[setNum].imgSet[this.picturePointer[setNum].currentPointer]; for(var i=0;i 0) { this.my_chart.series[0].remove(true); } }, clickEnabled:false, chartClickEvent: function ( event ) { }, myFPS:1.5, //a picture will be shown ever ( 1000 / myFPS ) ms chartPointer: { //index is content set 2: { //imgIDs:['#set-2-dynami-image-1', '#set-2-dynami-image-2'], imgID:'#set-2-dynamo-image-1', labelID:'#set-2-year-label', sliderID:'#graph-slider-set-2', useChart:'arctic-mean', min:1979, max:2016, currentPointer:1979, syncToPic: true, syncToSubchart: false, subchartDetails: [] }, 3: { imgIDs:['#set-3-dynamo-image-1', '#set-3-dynamo-image-2'], //imgID:'#set-3-dynamo-image-1', labelID:'#set-3-year-label', sliderID:'#graph-slider-set-3', useChart:'arctic-sea-ice-extent', min:1979, max:2016, currentPointer:1979, syncToPic: true, syncToSubchart: true, subchartDetails: [{ subchart:'1', useSubchart:'arctic-mean' }] }, 4: { imgID:'#set-4-dynamo-image', labelID:'#set-4-year-label', sliderID:'#graph-slider-set-4', useChart:'sea-ice-vol', min:1979, max:2016, currentPointer:1979, syncToPic: false, syncToSubchart: true, subchartDetails: [{ subchart:'1', useSubchart:'arctic-sea-ice-extent' }/*,{ subchart:'2', useSubchart:'arctic-mean' }*/] /*syncToPic: true, syncToSubchart: false, */ }, /* 5: { imgID:null, labelID:'#set-5-year-label', sliderID:'#graph-slider-set-5', useChart:'chart-3', min:1980, max:2016, currentPointer:1980, syncToPic: false, syncToSubchart: true, subchartDetails: [{ subchart:'1', useSubchart:'chart-2' }] },*/ 6: { imgID:'#set-6-dynamo-image', labelID:'#set-6-year-label', sliderID:'#graph-slider-set-6', useChart:'sea-ice-vol', min:1979, max:2016, currentPointer:1979, syncToPic: true, syncToSubchart: true, subchartDetails: [{ subchart:'1', useSubchart:'arctic-sea-ice-extent' },{ subchart:'2', useSubchart:'arctic-mean' }] }, 7: { //imgIDs:['#set-7-dynamo-image'], imgID:'#set-7-dynamo-image', labelID:'#set-7-year-label', sliderID:'#graph-slider-set-7', useChart:'arctic-sea-ice-extent', min:1979, max:2016, currentPointer:1979, syncToPic: true, syncToSubchart: false, subchartDetails: [] }, 8: { //imgIDs:['#set-7-dynamo-image'], imgID:'#set-8-dynamo-image', labelID:'#set-8-year-label', sliderID:'#graph-slider-set-8', useChart:'sea-ice-vol', min:1979, max:2016, currentPointer:1979, syncToPic: true, syncToSubchart: false, subchartDetails: [] }, }, imgBreakPoints:[ {min:0,max:1972, img:'1972'}, {min:1973,max:1984, img:'1973'}, {min:1985,max:1985, img:'1985'}, {min:1986,max:1987, img:'1986'}, {min:1988,max:1988, img:'1988'}, {min:1989,max:1989, img:'1989'}, {min:1990,max:1990, img:'1990'}, {min:1991,max:1998, img:'1991'}, {min:1999,max:1999, img:'1999'}, {min:2000,max:2000, img:'2000'}, {min:2001,max:2002, img:'2001'}, {min:2003,max:2003, img:'2003'}, {min:2004,max:2004, img:'2004'}, {min:2005,max:2005, img:'2005'}, {min:2006,max:2006, img:'2006'}, {min:2007,max:2008, img:'2007'}, {min:2009,max:2010, img:'2009'}, {min:2011,max:2013, img:'2011'}, {min:2014,max:2014, img:'2014'}, {min:2015,max:2025, img:'2015'}, ], chartTimer: { //Set number 2:null, 4: null, 6: null }, stopAll: function () { for(var i in this.chartTimer) { if(this.chartTimer[i]){ this.pause(i); } this.resetImg(i); /*if( this.picturePointer[i].syncToGraph ) { this.synchronizeGraph(i); }*/ } return true; }, resetImg: function (setNum){ console.log('Graph: Reset Image for set `',setNum,'`') this.chartPointer[setNum].currentPointer = navi_helper.chartModule.chartPointer[setNum].min; if(this.chartPointer[setNum].syncToPic){ jQuery(navi_helper.chartModule.chartPointer[setNum].imgID+'-title').text( this.findImgBreakpoint(navi_helper.chartModule.chartPointer[setNum].currentPointer) ); jQuery(navi_helper.chartModule.chartPointer[setNum].imgID).prop({ src:'http://polar-ice.org/wp-content/uploads/2018/02/'+ this.findImgBreakpoint(navi_helper.chartModule.chartPointer[setNum].currentPointer) +'_ice-loss-anim_revised.jpg' }); } }, findImgBreakpoint: function (myYear){ var i=0; //console.log('findImgBreakpoint: `'+ myYear +'`'); for(i;i navi_helper.chartModule.chartPointer[setNum].max ) { //console.log('Chart pointer is maxxed out. Stopping...',navi_helper.chartModule.chartPointer[setNum].currentPointer, navi_helper.chartModule.chartPointer[setNum].max ); navi_helper.chartModule.chartPointer[setNum].currentPointer = navi_helper.chartModule.chartPointer[setNum].max; navi_helper.chartModule.pause(setNum); return true; } var translateI = navi_helper.chartModule.chartPointer[setNum].currentPointer - navi_helper.chartModule.chartPointer[setNum].min; navi_helper.chartModule.chart.series[0].setData( navi_helper.chartModule.seriesSets[navi_helper.chartModule.chartPointer[setNum].useChart].slice(0, translateI+1) ); jQuery(navi_helper.chartModule.chartPointer[setNum].sliderID).val(navi_helper.chartModule.chartPointer[setNum].currentPointer); if( navi_helper.chartModule.chartPointer[setNum].syncToPic ) { navi_helper.chartModule.synchronizePicture(setNum); } if( navi_helper.chartModule.chartPointer[setNum].syncToSubchart ) { navi_helper.chartModule.synchronizeSubchart(setNum); } }, (1000 / this.myFPS)); //Let's now refresh }, pause: function (setNum) { console.log('[Set: '+ setNum +'] Pause'); if( !this.chartTimer[setNum] ) { console.log('Already paused or stopped...'); } clearInterval(this.chartTimer[setNum]); this.chartTimer[setNum]=null; }, sliderGoTo: function (setNum, value) { console.log('[Set: '+ setNum +'] Slider Value: {'+value+'}'); navi_helper.chartModule.pause(setNum); navi_helper.chartModule.chartPointer[setNum].currentPointer = value; if ( navi_helper.chartModule.chartPointer[setNum].currentPointer > navi_helper.chartModule.chartPointer[setNum].max ) { navi_helper.chartModule.chartPointer[setNum].currentPointer = navi_helper.chartModule.chartPointer[setNum].max; return true; }else if ( navi_helper.chartModule.chartPointer[setNum].currentPointer < navi_helper.chartModule.chartPointer[setNum].min ) { navi_helper.chartModule.chartPointer[setNum].currentPointer = navi_helper.chartModule.chartPointer[setNum].min; return true; } var translateI = navi_helper.chartModule.chartPointer[setNum].currentPointer - navi_helper.chartModule.chartPointer[setNum].min; navi_helper.chartModule.chart.series[0].setData( navi_helper.chartModule.seriesSets[navi_helper.chartModule.chartPointer[setNum].useChart].slice(0, translateI+1) ); //jQuery().val(navi_helper.chartModule.chartPointer[setNum].currentPointer); if( navi_helper.chartModule.chartPointer[setNum].syncToPic ) { navi_helper.chartModule.synchronizePicture(setNum); } if( navi_helper.chartModule.chartPointer[setNum].syncToSubchart ) { navi_helper.chartModule.synchronizeSubchart(setNum); } }, step: function (setNum, stepUp) { console.log('[Set: '+ setNum +'] Step: {'+(stepUp ? 'Up' : 'Back')+'}'); this.pause(setNum); if( stepUp ){ //Next year navi_helper.chartModule.chartPointer[setNum].currentPointer++; if ( navi_helper.chartModule.chartPointer[setNum].currentPointer > navi_helper.chartModule.chartPointer[setNum].max ) { navi_helper.chartModule.chartPointer[setNum].currentPointer = navi_helper.chartModule.chartPointer[setNum].max; return true; } }else{ //previous year navi_helper.chartModule.chartPointer[setNum].currentPointer--; if ( navi_helper.chartModule.chartPointer[setNum].currentPointer < navi_helper.chartModule.chartPointer[setNum].min ) { navi_helper.chartModule.chartPointer[setNum].currentPointer = navi_helper.chartModule.chartPointer[setNum].min; return true; } } var translateI = navi_helper.chartModule.chartPointer[setNum].currentPointer - navi_helper.chartModule.chartPointer[setNum].min; navi_helper.chartModule.chart.series[0].setData( navi_helper.chartModule.seriesSets[navi_helper.chartModule.chartPointer[setNum].useChart].slice(0, translateI+1) ); jQuery(navi_helper.chartModule.chartPointer[setNum].sliderID).val(navi_helper.chartModule.chartPointer[setNum].currentPointer); if( navi_helper.chartModule.chartPointer[setNum].syncToPic ) { navi_helper.chartModule.synchronizePicture(setNum); } if( navi_helper.chartModule.chartPointer[setNum].syncToSubchart ) { navi_helper.chartModule.synchronizeSubchart(setNum); } return true; }, destroyAllCharts: function () { if(this.chart){ this.chart.destroy(); this.chart=null; } if(this.subcharts['1']){ this.subcharts['1'].destroy(); this.subcharts['1']=null; } if(this.subcharts['2']){ this.subcharts['2'].destroy(); this.subcharts['2']=null; } if(this.subcharts['3']){ this.subcharts['3'].destroy(); this.subcharts['3']=null; } return true; }, updateGraphState: function ( setNum ) { console.log('[Func(): navi_helper.chartModule.updateGraphState] `' + setNum + '` '); if( setNum == 1 || setNum == 5 ){ console.log('[updateGraphState] No graphs in this set ('+ navi_helper.contentSets[navi_helper.current_page] +').'); return true; }else if( setNum == 2 ){ this.destroyAllCharts(); console.log('[updateGraphState] Updating ('+ navi_helper.contentSets[navi_helper.current_page] +').'); console.log('[updateGraphState] Preparing Arctic Avg Surface Air Temp Graph.'); this.chart = Highcharts.chart('set-2-chart', { chart: { id:'set2', type: 'spline', spacingRight: 10, }, plotOptions:{}, title: { text: 'Average Surface Air Temperature in the Arctic (C)' }, tooltip:{ useHTML:true, enabled:false }, xAxis: { title: { text: "Year" }, type: 'linear', min:1979, max:2016, labels:{ }, //tickInterval:5, }, yAxis: { title: { text: 'Air Temperature (C)' }, labels:{ }, min:-13, max:-7, tickInterval:1, endOnTick:false, startOnTick:false, floor: -13, ceiling: -7, }, series: [{ name: 'Air Temperature (C)', data: navi_helper.chartModule.seriesSets['arctic-mean'].slice(0,1), //navi_helper.chartModule.seriesSets[3]['chart-1'] color:'red' }] }); navi_helper.chartModule.chartPointer[setNum].currentPointer = navi_helper.chartModule.chartPointer[setNum].min; jQuery(navi_helper.chartModule.chartPointer[setNum].sliderID).val(navi_helper.chartModule.chartPointer[setNum].min); navi_helper.chartModule.synchronizeSubchart(setNum); return true; } else if( setNum == 3 ){ this.destroyAllCharts(); console.log('[updateGraphState] Updating ('+ navi_helper.contentSets[navi_helper.current_page] +').'); console.log('[updateGraphState] Preparing Arctic Sea Ice Extent.'); this.chart = Highcharts.chart('set-3-chart', { chart: { id:'set3', type: 'spline', }, plotOptions:{}, title: { text: 'Arctic Sea Ice Extent' }, tooltip:{ useHTML:true, enabled:false }, xAxis: { title: { text: "Year" }, type: 'linear', min:1979, max:2016, labels:{ }, tickInterval:5, }, yAxis: { title: { text: 'Arctic Sea Ice Extent (Million Sq. km)' }, labels:{ }, min:3, max:8, tickInterval:1, plotLines: [{ // mark the weekend color: 'darkblue', width: 2, value: navi_helper.chartModule.seriesSets['arctic-sea-ice-extent'].slice(0,1)[0][1], dashStyle: 'dash' }] }, series: [{ name: 'Arctic Sea Ice Extent (Million Sq. km)', data: ( navi_helper.current_page == 6 ? navi_helper.chartModule.seriesSets['arctic-sea-ice-extent'] :navi_helper.chartModule.seriesSets['arctic-sea-ice-extent'].slice(0,1) ), //navi_helper.chartModule.seriesSets[3]['chart-1'] color:'blue' }] }); this.subcharts['1'] = Highcharts.chart('set-3-subchart-1', { chart: { id:'set3-1', type: 'spline', className: 'set3-1', height:300, }, plotOptions:{}, title: { text: 'Arctic Averages Surface Air Temperature (C)' }, tooltip:{ useHTML:true, enabled:false }, xAxis: { title: { text: "Year" }, type: 'linear', min:1979, max:2016, labels:{ }, tickInterval:5, }, yAxis: { title: { text: 'Air Temperature (C)' }, labels:{ }, min:-13, max:-7, endOnTick:false, startOnTick:false, floor: -13, ceiling: -7, tickInterval:1, plotLines: [{ // mark the weekend color: 'darkblue', width: 2, value: navi_helper.chartModule.seriesSets['arctic-sea-ice-extent'].slice(0,1)[0][1], dashStyle: 'dash' }] }, series: [{ name: 'Air Temperature (C)', data: ( navi_helper.current_page == 6 ? navi_helper.chartModule.seriesSets['arctic-mean'] :navi_helper.chartModule.seriesSets['arctic-mean'].slice(0,1) ), //navi_helper.chartModule.seriesSets[3]['chart-1'] color:'red' }] }); if ( navi_helper.current_page == 6 ) { navi_helper.chartModule.chartPointer[setNum].currentPointer = navi_helper.chartModule.chartPointer[setNum].max; jQuery(navi_helper.chartModule.chartPointer[setNum].sliderID).val(navi_helper.chartModule.chartPointer[setNum].max); navi_helper.chartModule.synchronizeSubchart(setNum); }else { navi_helper.chartModule.chartPointer[setNum].currentPointer = navi_helper.chartModule.chartPointer[setNum].min; jQuery(navi_helper.chartModule.chartPointer[setNum].sliderID).val(navi_helper.chartModule.chartPointer[setNum].min); navi_helper.chartModule.synchronizeSubchart(setNum); } return true; } else if( setNum == 4 ){ this.destroyAllCharts(); console.log('[updateGraphState] Updating ('+ navi_helper.contentSets[navi_helper.current_page] +').'); console.log('[updateGraphState] Preparing Sea Ice Volume.'); this.chart = Highcharts.chart('set-4-chart', { chart: { id:'set4', type: 'spline', className: 'set4', }, plotOptions:{}, title: { text: 'Sea Ice Volume' }, tooltip:{ useHTML:true, enabled:false }, xAxis: { title: { text: "Year" }, type: 'linear', min:1979, max:2016, labels:{ }, tickInterval:5, }, yAxis: { title: { text: 'Sea Ice Volume (thousand km^3)' }, labels:{ }, min:0, max:20, endOnTick:false, startOnTick:false, floor: 0, ceiling: 20, tickInterval:5, }, series: [{ name: 'Sea Ice Volume (thousand km^3)', data: ( navi_helper.current_page == 9 ? navi_helper.chartModule.seriesSets['sea-ice-vol'] :navi_helper.chartModule.seriesSets['sea-ice-vol'].slice(0,1) ), //navi_helper.chartModule.seriesSets[3]['chart-1'] color:'purple' }] }); this.subcharts['1'] = Highcharts.chart('set-4-subchart-1', { chart: { id:'set4-1', type: 'spline', className: 'set4-1', height:350 }, plotOptions:{}, title: { text: 'Arctic Sea Ice Extent' }, tooltip:{ useHTML:true, enabled:false }, xAxis: { title: { text: "Year" }, type: 'linear', min:1979, max:2016, labels:{ }, //tickInterval:5, }, yAxis: { title: { text: 'Ice Extent (Million Sq. Km)' }, labels:{ }, min:3, max:8, endOnTick:false, startOnTick:false, //floor: -13, //ceiling: -7, tickInterval:1, }, series: [{ name: 'Arctic Sea Ice Extent (Million Sq. km)', data: ( navi_helper.current_page == 9 ? navi_helper.chartModule.seriesSets['arctic-sea-ice-extent'] :navi_helper.chartModule.seriesSets['arctic-sea-ice-extent'].slice(0,1) ), color:'blue' }] }); /* this.subcharts['2'] = Highcharts.chart('set-4-subchart-2', { chart: { id:'set4-2', type: 'spline', className: 'set4-2', height:350 }, plotOptions:{}, title: { text: 'Arctic Avg. Surface Air Temp' }, tooltip:{ useHTML:true, enabled:false }, xAxis: { title: { text: "Year" }, type: 'linear', min:1979, max:2016, labels:{ }, //tickInterval:5, }, yAxis: { title: { text: 'Air Temperature (C)' }, labels:{ }, min:-13, max:-7, endOnTick:false, startOnTick:false, floor: -13, ceiling: -7, tickInterval:1, }, series: [{ name: 'Air Temperature (C)', data: ( navi_helper.current_page == 9 ? navi_helper.chartModule.seriesSets['arctic-mean'] :navi_helper.chartModule.seriesSets['arctic-mean'].slice(0,1) ), //navi_helper.chartModule.seriesSets[3]['chart-1'] color:'red' }] }); */ if ( navi_helper.current_page == 9 ) { navi_helper.chartModule.chartPointer[setNum].currentPointer = navi_helper.chartModule.chartPointer[setNum].max; jQuery(navi_helper.chartModule.chartPointer[setNum].sliderID).val(navi_helper.chartModule.chartPointer[setNum].max); navi_helper.chartModule.synchronizeSubchart(setNum); }else { navi_helper.chartModule.chartPointer[setNum].currentPointer = navi_helper.chartModule.chartPointer[setNum].min; jQuery(navi_helper.chartModule.chartPointer[setNum].sliderID).val(navi_helper.chartModule.chartPointer[setNum].min); navi_helper.chartModule.synchronizeSubchart(setNum); } /* navi_helper.chartModule.chartPointer[setNum].currentPointer = navi_helper.chartModule.chartPointer[setNum].min; jQuery(navi_helper.chartModule.chartPointer[setNum].sliderID).val(navi_helper.chartModule.chartPointer[setNum].min); navi_helper.chartModule.synchronizeSubchart(setNum); */ return true; } else if( setNum == 6 ){ this.destroyAllCharts(); console.log('[updateGraphState] Updating ('+ navi_helper.contentSets[navi_helper.current_page] +').'); console.log('[updateGraphState] Preparing Sea Ice Volume.'); this.chart = Highcharts.chart('set-6-chart', { chart: { id:'set6', type: 'spline', className: 'set6', }, plotOptions:{}, title: { text: 'Sea Ice Volume' }, tooltip:{ useHTML:true, enabled:false }, xAxis: { title: { text: "Year" }, type: 'linear', min:1979, max:2016, labels:{ }, //tickInterval:5, }, yAxis: { title: { text: 'Sea Ice Volume (thousand km^3)' }, labels:{ }, min:0, max:20, endOnTick:false, startOnTick:false, floor: 0, ceiling: 20, //tickInterval:5, }, series: [{ name: 'Sea Ice Volume (thousand km^3)', data: navi_helper.chartModule.seriesSets['sea-ice-vol'], //navi_helper.chartModule.seriesSets[3]['chart-1'] color:'purple' }] }); this.subcharts['1'] = Highcharts.chart('set-6-subchart-1', { chart: { id:'set6-1', type: 'spline', className: 'set6-1', height:350 }, plotOptions:{}, title: { text: 'Arctic Sea Ice Extent' }, tooltip:{ useHTML:true, enabled:false }, xAxis: { title: { text: "Year" }, type: 'linear', min:1979, max:2016, labels:{ }, //tickInterval:5, }, yAxis: { title: { text: 'Ice Extent (Million Sq. Km)' }, labels:{ }, min:3, max:8, endOnTick:false, startOnTick:false, //floor: -13, //ceiling: -7, tickInterval:1, }, series: [{ name: 'Arctic Sea Ice Extent (Million Sq. km)', data: ( navi_helper.chartModule.seriesSets['arctic-sea-ice-extent'] ), color:'blue' }] }); this.subcharts['2'] = Highcharts.chart('set-6-subchart-2', { chart: { id:'set6-2', type: 'spline', className: 'set6-2', height:350 }, plotOptions:{}, title: { text: 'Arctic Avg. Surface Air Temp' }, tooltip:{ useHTML:true, enabled:false }, xAxis: { title: { text: "Year" }, type: 'linear', min:1979, max:2016, labels:{ }, //tickInterval:5, }, yAxis: { title: { text: 'Air Temperature (C)' }, labels:{ }, min:-13, max:-7, endOnTick:false, startOnTick:false, floor: -13, ceiling: -7, tickInterval:1, }, series: [{ name: 'Air Temperature (C)', data: navi_helper.chartModule.seriesSets['arctic-mean'], //navi_helper.chartModule.seriesSets[3]['chart-1'] color:'red' }] }); navi_helper.chartModule.chartPointer[setNum].currentPointer = navi_helper.chartModule.chartPointer[setNum].max; jQuery(navi_helper.chartModule.chartPointer[setNum].sliderID).val(navi_helper.chartModule.chartPointer[setNum].max); navi_helper.chartModule.synchronizeSubchart(setNum); return true; } else if( setNum == 7 ){ this.destroyAllCharts(); console.log('[updateGraphState] Updating ('+ navi_helper.contentSets[navi_helper.current_page] +').'); console.log('[updateGraphState] Preparing Arctic Sea Ice Extent.'); this.chart = Highcharts.chart('set-7-chart', { chart: { id:'set7', type: 'spline', }, plotOptions:{}, title: { text: 'Arctic Sea Ice Extent' }, tooltip:{ useHTML:true, enabled:false }, xAxis: { title: { text: "Year" }, type: 'linear', min:1979, max:2016, labels:{ }, tickInterval:5, }, yAxis: { title: { text: 'Arctic Sea Ice Extent (Million Sq. km)' }, labels:{ }, min:3, max:8, tickInterval:1, plotLines: [{ // mark the weekend color: 'darkblue', width: 2, value: navi_helper.chartModule.seriesSets['arctic-sea-ice-extent'].slice(0,1)[0][1], dashStyle: 'dash' }] }, series: [{ name: 'Arctic Sea Ice Extent (Million Sq. km)', data: ( navi_helper.chartModule.seriesSets['arctic-sea-ice-extent'].slice(0,1) ), //navi_helper.chartModule.seriesSets[3]['chart-1'] color:'blue' }] }); navi_helper.chartModule.chartPointer[setNum].currentPointer = navi_helper.chartModule.chartPointer[setNum].min; jQuery(navi_helper.chartModule.chartPointer[setNum].sliderID).val(navi_helper.chartModule.chartPointer[setNum].min); navi_helper.chartModule.synchronizeSubchart(setNum); return true; } else if( setNum == 8 ){ this.destroyAllCharts(); console.log('[updateGraphState] Updating ('+ navi_helper.contentSets[navi_helper.current_page] +').'); console.log('[updateGraphState] Preparing Arctic Sea Ice Extent.'); this.chart = Highcharts.chart('set-8-chart', { chart: { id:'set8', type: 'spline', className: 'set8', }, plotOptions:{}, title: { text: 'Sea Ice Volume' }, tooltip:{ useHTML:true, enabled:false }, xAxis: { title: { text: "Year" }, type: 'linear', min:1979, max:2016, labels:{ }, tickInterval:5, }, yAxis: { title: { text: 'Sea Ice Volume (thousand km^3)' }, labels:{ }, min:0, max:20, endOnTick:false, startOnTick:false, floor: 0, ceiling: 20, tickInterval:5, }, series: [{ name: 'Sea Ice Volume (thousand km^3)', data: ( navi_helper.chartModule.seriesSets['sea-ice-vol'].slice(0,1) ), //navi_helper.chartModule.seriesSets[3]['chart-1'] color:'purple' }] }); navi_helper.chartModule.chartPointer[setNum].currentPointer = navi_helper.chartModule.chartPointer[setNum].min; jQuery(navi_helper.chartModule.chartPointer[setNum].sliderID).val(navi_helper.chartModule.chartPointer[setNum].min); navi_helper.chartModule.synchronizeSubchart(setNum); return true; } console.warn('[Func(): navi_helper.chartModule.updateGraphState] Returning Early. '); return true; } }, my_popups:{ 1:[], //None 2:[], //None 3:[], //None 4:[], 5:[], 6:[] }, go_to_page: function ( page_num ) { jQuery('span.hover-box,span.hover-box-img').slideUp(); jQuery('.standard-set').show(); jQuery('.ext-set').hide(); //console.info('[navi_helper]: Go to page `'+ page_num +'`.'); if( page_num == 'next' ) { this.current_page++; }else if( page_num == 'prev' ) { this.current_page--; if( this.current_page < this.min_page) { this.current_page = this.min_page; } }else{ this.current_page = parseInt(page_num); } if( this.current_page < this.min_page) { this.current_page = this.min_page; }else if ( this.max_page < this.current_page ) { this.current_page = this.max_page; } if( this.current_page == 11 ){ console.log('End!'); } //this.pictureModule.stopAll(); this.chartModule.stopAll(); this.chartModule.updateGraphState(navi_helper.contentSets[navi_helper.current_page]); this.chartModule.synchronizePicture(navi_helper.contentSets[navi_helper.current_page]); this.chartModule.synchronizeSubchart(navi_helper.contentSets[navi_helper.current_page]); /* this.chartModule.updateGraphState(navi_helper.contentSets[navi_helper.current_page]); this.chartModule.synchronizePicture(navi_helper.contentSets[navi_helper.current_page]); this.chartModule.synchronizeSubchart(navi_helper.contentSets[navi_helper.current_page]); this.pictureModule.synchronizeGraph(navi_helper.contentSets[navi_helper.current_page]); */ //Specials by Content set if( this.contentSets[this.current_page] == 1 ){ //If this page is 1, add hovers, and remove the background. if( this.current_page == 1 ) { jQuery('.is-clickable', '#mosaic-page-'+this.current_page+'-right' ) .on('click', function (event) { jQuery('span.hover-box-img').html( navi_helper.contentSetInfo[navi_helper.contentSets[navi_helper.current_page]][jQuery(this).data( 'text-set' )] ).slideDown(); console.log('Clicking'); }); //jQuery('span.display-page-1').show(); }/*else if( this.current_page == 2 ) { //jQuery('span.display-page-1').hide(); }*/ }else if( this.contentSets[this.current_page] == 2 ){ if( this.current_page == 2 ) { //jQuery('#set-2-right-pic').prop({src:'/polar_ice/images/story4/globe-90-60N.jpg'}); jQuery('.display-page-2').show(); jQuery('.display-page-3').hide(); }else if( this.current_page == 3 ) { //jQuery('#set-2-right-pic').prop({src:'/polar_ice/images/story4/AlaskaBodySpring.jpg'}); jQuery('.display-page-2').hide(); jQuery('.display-page-3').show(); } }else if( this.contentSets[this.current_page] == 3 ){ console.log('Content Set 3'); if( this.current_page == 4 ) { jQuery('.display-page-4').show(); jQuery('.display-page-5').hide(); }else if( this.current_page == 5 ) { jQuery('.display-page-4').hide(); jQuery('.display-page-5').show(); }/*else if( this.current_page == 6 ) { jQuery('.display-page-4').hide(); jQuery('.display-page-5').hide(); }*/ }else if ( this.contentSets[this.current_page] == 4 ) { }else if ( this.contentSets[this.current_page] == 5 ) { if( this.current_page == 10 ) { jQuery('.display-page-10').show(); jQuery('.display-page-11').hide(); }else if( this.current_page == 11 ) { jQuery('.display-page-10').hide(); jQuery('.display-page-11').show(); } }else if ( this.contentSets[this.current_page] == 6 ) { }else if ( this.contentSets[this.current_page] == 7 ) { jQuery('.display-page-6').show(); }else if ( this.contentSets[this.current_page] == 8 ) { jQuery('.display-page-9').show(); } this.update_info_bubbles(); jQuery('button','#mosaic-button-nav').removeClass('current-page'); jQuery('button[data-page-id="'+ this.current_page +'"]','#mosaic-button-nav').addClass('current-page'); jQuery('.switch-page','#mosaic-page-content').removeClass('view-page'); jQuery('#mosaic-page-' + this.current_page + '-left','#mosaic-page-content').addClass('view-page'); jQuery('#mosaic-right-content-set-' + this.contentSets[this.current_page], '#mosaic-page-content').addClass('view-page'); //jQuery('#play-controls-1').css({display: ( this.current_page > 3 ? 'block' : 'none' ) } ); //this.update_image_information(); return this.next_button_state() && this.prev_button_state(); }, update_info_bubbles: function () { jQuery('span.marker').remove(); var my_icons = navi_helper.my_popups[ this.current_page ]; //console.log('Updating info bubbles.'); for(var index in my_icons ) { var create_icon = my_icons[index]; //Only picture-frame-1 is currently getting icons var target = jQuery('#image-wrapper-1'); //console.log(create_icon); if( create_icon.icon == '' ) { // jQuery('') .css({ top: create_icon.position.top, left: create_icon.position.left }).html('    '+ create_icon.content +''). appendTo(target); }else if( create_icon.icon == 'info' ) { jQuery('') .css({ top: create_icon.position.top, left: create_icon.position.left }).html(' '+ create_icon.content +''). appendTo(target); }else if( create_icon.icon == 'penguin' ) { jQuery('') .css({ top: create_icon.position.top, left: create_icon.position.left }).html(' '+ create_icon.content +''). appendTo(target); for(var i in create_icon.icon_position){ var new_pos = create_icon.icon_position[i]; jQuery('') .css({ top: new_pos.top, left: new_pos.left }).html(''). appendTo(target); } }else if( create_icon.icon == 'whale' ) { jQuery('') .css({ top: create_icon.position.top, left: create_icon.position.left }).html(' '+ create_icon.content +''). appendTo(target); for(var i in create_icon.icon_position){ var new_pos = create_icon.icon_position[i]; jQuery('') .css({ top: new_pos.top, left: new_pos.left }).html(''). appendTo(target); } }else if( create_icon.icon == 'plankton' ) { //Are amoebas plankton? Probably. No longer questioning it. jQuery('') .css({ top: create_icon.position.top, left: create_icon.position.left }).html(' '+ create_icon.content +''). appendTo(target); for(var i in create_icon.icon_position){ var new_pos = create_icon.icon_position[i]; jQuery('') .css({ top: new_pos.top, left: new_pos.left }).html(''). appendTo(target); } } } jQuery('span.marker').on('click', function() { var $marker = jQuery(this), $caption = jQuery('span.caption', $marker); //console.log($caption); if( $caption.length < 1 ) { if( $marker.hasClass('penguin') ) { jQuery('span.marker.penguin.is-clickable').trigger('click'); }else if( $marker.hasClass('whale') ) { jQuery('span.marker.whale.is-clickable').trigger('click'); }else if( $marker.hasClass('plankton') ) { jQuery('span.marker.plankton.is-clickable').trigger('click'); } }else{ if ($caption.is(':hidden')) { $caption.slideDown(300); } else { $caption.slideUp(300); } } }); //Fix anchor links in the span marker click to avoid event propagation // and other bad behavior jQuery('span.marker a').on('click', function (event) { event.stopPropagation(); return true; }); return true; }, update_image_information: function () { return true; this.pause_images(1); this.pause_images(2); if( this.current_page < 4 ) { jQuery('#picture-frame-1').removeClass('dual-image'); jQuery('#picture-frame-2').removeClass('dual-image').hide(); jQuery('#image-changer-1').prop({src: this.static_image}); jQuery('#play-controls-1').hide(); return true; } jQuery('#play-controls-1').show(); jQuery('#picture-frame-1').removeClass('dual-image'); jQuery('#picture-frame-2').removeClass('dual-image').hide(); var my_rules = this.dynamic_images[ this.current_page ]; if( my_rules.num_images == 1 ) { this.dynamic_images[ this.current_page ].frames[1].show_picture = 0; jQuery('#play-slider-1').val(0).prop({max:this.dynamic_images[ this.current_page ].frames[1].pictures.length-1}); var pad = "00"; var str_day = '' + this.dynamic_images[ this.current_page ].frames[1].curr_day; var str_hr = '' + this.dynamic_images[ this.current_page ].frames[1].curr_hr; jQuery('#image-changer-1').prop({ src: this.dynamic_images[ this.current_page ].location + '201502' + pad.substring(0, pad.length - str_day.length) + str_day + 'T' + pad.substring(0, pad.length - str_hr.length) + str_hr + '00.png' });//.removeClass('dual-image'); jQuery('#picture-frame-2').css({display:'none'}); }else{ jQuery('#play-slider-1').val(0).prop({max:this.dynamic_images[ this.current_page ].frames[1].pictures.length-1}); jQuery('#play-slider-2').val(0).prop({max:this.dynamic_images[ this.current_page ].frames[2].pictures.length-1}); this.dynamic_images[ this.current_page ].frames[1].show_picture = 0; this.dynamic_images[ this.current_page ].frames[2].show_picture = 0; jQuery('#picture-frame-1').addClass('dual-image'); jQuery('#picture-frame-2').addClass('dual-image').css({display:'inline-block'}); var pad = "00"; var str_day = '' + this.dynamic_images[ this.current_page ].frames[1].curr_day; var str_hr = '' + this.dynamic_images[ this.current_page ].frames[1].curr_hr; var str_day2 = '' + this.dynamic_images[ this.current_page ].frames[2].curr_day; var str_hr2 = '' + this.dynamic_images[ this.current_page ].frames[2].curr_hr; jQuery('#image-changer-1').prop({ src: this.dynamic_images[ this.current_page ].location + '201502' + pad.substring(0, pad.length - str_day.length) + str_day + 'T' + pad.substring(0, pad.length - str_hr.length) + str_hr + '00.png' }); jQuery('#image-changer-2').prop({ src: this.dynamic_images[ this.current_page ].location + '201502' + pad.substring(0, pad.length - str_day2.length) + str_day2 + 'T' + pad.substring(0, pad.length - str_hr2.length) + str_hr2 + '00.png' }); } if( this.current_page == 4 || this.current_page == 6 ){ if( my_rules.num_images == 1 ) { this.play_images(1); }else{ this.play_images(1); this.play_images(2); } } return true; }, play_images: function (frame_id) { this.pause_images(frame_id); this.my_timer[frame_id] = setInterval( function () { //console.log('Image change.'); navi_helper.forward_image_source(frame_id); }, ( 1000 / this.fps ) ); }, pause_images: function (frame_id) { if( this.my_timer[frame_id] !== null ) { clearInterval( this.my_timer[frame_id] ); this.my_timer[frame_id] = null; } }, step_forward: function (frame_id) { this.pause_images(frame_id); this.forward_image_source(frame_id); }, step_back: function (frame_id) { this.pause_images(frame_id); this.previous_image_source(frame_id); }, go_to_picture: function (frame_id, picture_id){ this.dynamic_images[ this.current_page ].frames[frame_id].show_picture = picture_id; this.show_images(frame_id); }, forward_image_source: function (frame_id) { this.dynamic_images[ this.current_page ].frames[frame_id].show_picture++; if( this.dynamic_images[ this.current_page ].frames[frame_id].show_picture >= this.dynamic_images[ this.current_page ].frames[frame_id].pictures.length ) { this.dynamic_images[ this.current_page ].frames[frame_id].show_picture=0; } //console.log(this.dynamic_images[ this.current_page ]); jQuery('#play-slider-' + frame_id).val( this.dynamic_images[ this.current_page ].frames[frame_id].show_picture ) ; this.show_images(frame_id); return true; }, previous_image_source: function (frame_id) { this.dynamic_images[ this.current_page ].frames[frame_id].show_picture--; if( this.dynamic_images[ this.current_page ].frames[frame_id].show_picture < 0 ) { this.dynamic_images[ this.current_page ].frames[frame_id].show_picture=this.dynamic_images[ this.current_page ].frames[frame_id].pictures.length-1; } jQuery('#play-slider-' + frame_id).val( this.dynamic_images[ this.current_page ].frames[frame_id].show_picture ) ; this.show_images(frame_id); return true; }, show_images: function (frame_id) { var my_rules = this.dynamic_images[ this.current_page ].frames[frame_id]; var pad = "00"; var str_day = '' + this.dynamic_images[ this.current_page ].frames[frame_id].curr_day; var str_hr = '' + this.dynamic_images[ this.current_page ].frames[frame_id].curr_hr; jQuery('#image-changer-' + frame_id).prop({ src: this.dynamic_images[ this.current_page ].frames[frame_id].pictures[ this.dynamic_images[ this.current_page ].frames[frame_id].show_picture ] }); ///polar_ice/maps/justmap_new_160212/tidalcurrents_20150208T0100.png /* jQuery('#image-changer-' + frame_id).prop({ src: this.dynamic_images[ this.current_page ].location + '201502' + pad.substring(0, pad.length - str_day.length) + str_day + 'T' + pad.substring(0, pad.length - str_hr.length) + str_hr + '00.png' }); */ return true; }, prev_button_state: function () { jQuery('#mosaic-prev-button').prop({disabled: (this.current_page == this.min_page) }); return true; }, next_button_state: function () { jQuery('#mosaic-next-button').prop({disabled: (this.current_page == this.max_page) }); return true; }, preload_all_images: function() { return true; }, initialize_pictures: function () { var my_dynamic_images = this.dynamic_images; for(var page in my_dynamic_images){ var my_frames = this.dynamic_images[page].frames; for(var my_frame in my_frames){ //We'll need to calculate then push (in order) var total_time = (this.dynamic_images[ page ].frames[my_frame].curr_day * 100) + this.dynamic_images[ page ].frames[my_frame].curr_hr; var end_time = (this.dynamic_images[ page ].frames[my_frame].end_day * 100) + this.dynamic_images[ page ].frames[my_frame].end_hr; while( total_time < end_time ) { this.dynamic_images[ page ].frames[my_frame].curr_hr++; if( this.dynamic_images[ page ].frames[my_frame].curr_hr >= 24 ) { this.dynamic_images[ page ].frames[my_frame].curr_day++; this.dynamic_images[ page ].frames[my_frame].curr_hr=0; } //e.g. day = 8 (or '08') hour = 11 (or '11'), total time = 811 or ('0811') vs end time of 2200 for day 22, hour 00 total_time = (this.dynamic_images[ page ].frames[my_frame].curr_day * 100) + this.dynamic_images[ page ].frames[my_frame].curr_hr; var pad = "00"; var str_day = '' + this.dynamic_images[ page ].frames[my_frame].curr_day; var str_hr = '' + this.dynamic_images[ page ].frames[my_frame].curr_hr; this.dynamic_images[ page ].frames[my_frame].pictures.push( this.dynamic_images[ page ].location + '201502' + pad.substring(0, pad.length - str_day.length) + str_day + 'T' + pad.substring(0, pad.length - str_hr.length) + str_hr + '00.png' ); } console.info('Page: `'+ page +'`, Frame: `'+ my_frame +'` initialized'); } } return true; },loadStaticCharts: function () { //Loading static cahrts console.log('[Func(): loadStaticCharts]'); //static-chart-3-1 //static-chart-3-2 Highcharts.chart('static-chart-3-1', { chart: { id:'static-3-1', type: 'spline', className: 'static-3-1', }, plotOptions:{}, title: { text: 'Arctic / Global Average Surface Air Temperature (C)' }, tooltip:{ useHTML:true, enabled:false }, xAxis: { title: { text: "Year" }, type: 'linear', min:1979, max:2016, labels:{ }, tickInterval:5, }, yAxis: { title: { text: 'Air Temperature (C)' }, labels:{ }, min:-17, max:9, endOnTick:false, startOnTick:false, floor: -17, ceiling: 9, tickInterval: 4 }, series: [{ name: 'Arctic Mean Air Temperature (C)', data: ( navi_helper.chartModule.seriesSets['arctic-mean'] ), //navi_helper.chartModule.seriesSets[3]['chart-1'] color:'red' },{ name: 'Global Mean Air Temperature (C)', data: ( navi_helper.chartModule.seriesSets['global-mean'] ), //navi_helper.chartModule.seriesSets[3]['chart-1'] color:'blue' }] }); }, orig_loadStaticCharts: function () { //Loading static cahrts console.log('[Func(): loadStaticCharts]'); //static-chart-3-1 //static-chart-3-2 Highcharts.chart('static-chart-3-1', { chart: { id:'static-3-1', type: 'spline', className: 'static-3-1', }, plotOptions:{}, title: { text: 'Arctic Average Surface Air Temperature (C)' }, tooltip:{ useHTML:true, enabled:false }, xAxis: { title: { text: "Year" }, type: 'linear', min:1979, max:2016, labels:{ }, tickInterval:5, }, yAxis: { title: { text: 'Air Temperature (C)' }, labels:{ }, min:-13, max:-7, endOnTick:false, startOnTick:false, floor: -13, ceiling: -7, tickInterval:1, }, series: [{ name: 'Arctic Mean Air Temperature (C)', data: ( navi_helper.chartModule.seriesSets['arctic-mean'] ), //navi_helper.chartModule.seriesSets[3]['chart-1'] color:'red' }] }); Highcharts.chart('static-chart-3-2', { chart: { id:'static-3-2', type: 'spline', className: 'static-3-2' }, plotOptions:{}, title: { text: 'Global Averages Surface Air Temperature (C)' }, tooltip:{ useHTML:true, enabled:false }, xAxis: { title: { text: "Year" }, type: 'linear', min:1979, max:2016, labels:{ }, tickInterval:5, }, yAxis: { title: { text: 'Air Temperature (C)' }, labels:{ }, min:3, max:7, endOnTick:false, startOnTick:false, floor: 3, ceiling: 7, tickInterval:1, }, series: [{ name: 'Air Temperature (C)', data: ( navi_helper.chartModule.seriesSets['global-mean'] ), //navi_helper.chartModule.seriesSets[3]['chart-1'] color:'red' }] }); } }; //There might be a conflict with the shorthand Dollar sign ($), so we'll just use jQuery instead jQuery.get('https://polar-ice.org/wp-content/uploads/2020/08/story_4_eng.html.txt', function(data) { console.log('THE DATA: ', data); var myHTML = data.replace(/REPLACE_OPEN_ANGLE_BRACKET/g, '<'); myHTML = myHTML.replace(/REPLACE_CLOSE_ANGLE_BRACKET/g, '>'); jQuery('#story-4-div').html(myHTML); console.log('HTML Loaded. Loading other items.'); jQuery('#mosaic-prev-button').prop({disabled:true}); jQuery('#mosaic-next-button').prop({disabled:false}); jQuery('button','#mosaic-button-nav').on('click', function () { navi_helper.go_to_page( jQuery(this).data('page-id') ); }); //We're going to remove the #sidebar for now and make #main width 100% jQuery('#sidebar').hide(); jQuery('#main').css({width:'100%'}); jQuery('.ext-page').on('click', function () { console.log(jQuery(this).data('extpage') ); jQuery('.standard-set').hide(); jQuery('#' + jQuery(this).data('extpage') ).show(); }); navi_helper.chartModule.initializeGraphs(); navi_helper.initializeButtons(); navi_helper.loadStaticCharts(); navi_helper.go_to_page(0); jQuery('span.hover-box').on('click', function () { jQuery(this).slideUp(); }) jQuery('span.hover-box-img').on('click', function () { jQuery(this).slideUp(); }); }, 'text');