I attached some patches that
-Fix the negative value of the depth axis.
-Added temperature curve and events to profile.
-Update user manual.

About the (start and end pressures) null values bug, I found that these
values are missing in the cylinder structure when the divecomputer
structure contains pressure samples. I think I just need to take the first
and the last sample from divecomputer.
the other case is somehow weirder, there is no pressure samples in the
divecomputer structure and the start and end pressure are existing in the
cylinder pressure, anyway Subsurface plots the pressure curve and its not
linear, is it a default plot or something?

Also if there is more than one cylinder which cylinder pressure must be
plotted?

Regards,
Gehad



On Sun, Jun 29, 2014 at 1:20 PM, Miika Turkia <[email protected]>
wrote:

> Here are these patches with my SOB. There was still slight white space
> inconsistency that I fixed in the last in 0009. However, after this the
> continuation line still does not strictly follow the coding style. But I
> thought that double tab would be enough there to show this.
>
> I didn't get any complain about === from the script so it is quite clear
> that different version of clang-format provides different results. In any
> case '===' is correct for JavaScript. And I would grouped some of the
> embedded HTML or JSON even more than is currently there. But our
> CodingStyle is quite flexible for "weird" languages anyway.
>
> Time scale needs still fixing and I see it odd that depths are in negative
> values, what do others think?
>
> miika
>
> On Sat, Jun 28, 2014 at 6:26 PM, Gehad Elrobey <[email protected]>
> wrote:
>
>> I Fixed the last 6 patches and attached them again with two additional
>> patches.
>>
>> I fixed the whitespaces and code style. (the whitespace.pl script will
>> still show some erros, But we can't use for example '== =' instead of '==='
>>  also the JSON has its own format)
>>
>> I rotated the labels a little to adjust them.
>>
>> I replaced the undefined word in the equipment list with a friendly
>> dashes to be consistent with all the data fields. But I still need to debug
>> here, some of the data (start and end pressures) are sometimes equals to
>> zero in the cylinder structure though they exist in the dive log.
>>
>> I found that the bookmark internal value is not important to be added as
>> it is used in the internal structure only and it always hold the same value
>> as the event name. so it is redundant here.
>>
>> Regards,
>> Gehad
>>
>>
>>
>>
>> On Fri, Jun 27, 2014 at 12:50 PM, Miika Turkia <[email protected]>
>> wrote:
>>
>>> With a very brief skipping through the code, I started to wonder if
>>> there is a reason why only d1 is declared?
>>> +var d1;
>>> +function canvas_draw(){
>>> +    document.getElementById("chart1").innerHTML="";
>>> +    d1 = new Array();
>>> +    d2 = new Array();
>>>
>>> list_lib.js has some white space inconsistencies.
>>>
>>> Time scale needs some adjusting as shown in the attachment.
>>>
>>> Cylinder information has some undefined fields even though I they are
>>> available in the log (start and end pressures and O2).
>>>
>>> Bookmarks contains all the events, so it should probably be re-named to
>>> Events. And the event type (numeric value) is probably not interesting to
>>> users (internal enum value).
>>>
>>> miika
>>>
>>>
>>> On Fri, Jun 27, 2014 at 3:40 AM, Gehad Elrobey <[email protected]>
>>> wrote:
>>>
>>>> I attached another 3 patches on the top of those I sent yesterday.
>>>>
>>>> Now we use jqplot to draw the dive profile which is not as beautiful as
>>>> Highcharts, but we get a nice compatible license.
>>>> The 5th patch will add some whitespaces errors, This is the included
>>>> code from jqplot library.
>>>> I will work on adding some more curves to the plot and also fixing the
>>>> padding in the detailed view.
>>>>
>>>> Regards,
>>>> Gehad
>>>>
>>>>
>>>> On Wed, Jun 25, 2014 at 11:55 PM, Gehad Elrobey <[email protected]
>>>> > wrote:
>>>>
>>>>> This patches add the events to list to the detailed view.
>>>>> This events will be rendered later to the profile.
>>>>>
>>>>> Regards,
>>>>> Gehad
>>>>>
>>>>>
>>>>> On Wed, Jun 25, 2014 at 12:36 PM, Miika Turkia <[email protected]
>>>>> > wrote:
>>>>>
>>>>>> Libdivecomputer.c has events structure that shows meaning of the
>>>>>> events (function handle_event). Just check from a sample dive that I am
>>>>>> correct. Tablet is a poor tool to check code...
>>>>>>
>>>>>> I believe the deleted means that user has deleted the event and does
>>>>>> not want to see it anymore.
>>>>>>
>>>>>> miika
>>>>>> On Jun 24, 2014 10:04 PM, "Gehad Elrobey" <[email protected]>
>>>>>> wrote:
>>>>>>
>>>>>>> I was lately working on exporting event list, I will send some
>>>>>>> patches for that today.
>>>>>>>
>>>>>>> I don't understand well the event structure in dive.h , I don't know
>>>>>>> what is the 'deleted' flag, and the type what do these numbers mean ? is
>>>>>>> there a look-up table for there meaning or some enums? some help in this
>>>>>>> will be appreciated.
>>>>>>>
>>>>>>> My to do for this week:
>>>>>>>
>>>>>>> - prototype the dive profile with jqplot (which is under GPL
>>>>>>> license).
>>>>>>> - Fix the detailed view style (Tweak up the css)
>>>>>>> - fix any semantic errors in the dive profile or the events list and
>>>>>>> add missing values.
>>>>>>> - will have some clean documentation and polishing to the javascript
>>>>>>> code.
>>>>>>>
>>>>>>> Regards,
>>>>>>> Gehad
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> On Tue, Jun 24, 2014 at 4:41 PM, Dirk Hohndel <[email protected]>
>>>>>>> wrote:
>>>>>>>
>>>>>>>> On Tue, Jun 24, 2014 at 04:01:40PM +0300, Miika Turkia wrote:
>>>>>>>> >
>>>>>>>> > I will send Gehad's patch-set from the 17th with my signed-off as
>>>>>>>> a
>>>>>>>> > separate set of mail (using git e-mail), as poor Internet
>>>>>>>> connection
>>>>>>>> > over here forces me to use HTML-only gmail and that does not seem
>>>>>>>> to
>>>>>>>> > support attachments. I will skip the one from 19th that switches
>>>>>>>> to
>>>>>>>> > Highchart as the license is unfortunately not acceptable for
>>>>>>>> > Subsurface.
>>>>>>>>
>>>>>>>> Thanks - I just applied them and will push in a moment, internet
>>>>>>>> connection permitting :-)
>>>>>>>>
>>>>>>>> /D
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>
>>>>
>>>
>>
>
From c9e8d9966026de5b23e798e43adce4bda37765a5 Mon Sep 17 00:00:00 2001
From: Gehad elrobey <[email protected]>
Date: Thu, 3 Jul 2014 17:20:49 +0200
Subject: [PATCH 7/7] HTML: depth value must be positive

Remove negative sign from the inverted y-axis

Signed-off-by: Gehad elrobey <[email protected]>
---
 theme/list_lib.js | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/theme/list_lib.js b/theme/list_lib.js
index 23906b4..718ea4c 100644
--- a/theme/list_lib.js
+++ b/theme/list_lib.js
@@ -800,7 +800,6 @@ function canvas_draw()
 		}
 	}
 	for (var i = 0; i < items[dive_id].events.length; i++) {
-		//var x = get_sample(items[dive_id].events[i].time);
 		d3.push([
 			items[dive_id].events[i].time / 60,
 			0,
@@ -875,7 +874,8 @@ function canvas_draw()
 						 max : 0,
 						 tickRenderer : $.jqplot.CanvasAxisTickRenderer,
 						 tickOptions : {
-							 formatString : '%.2f'
+						 formatter: function(format, value) { return -1 * value + "m"; },
+							 formatString : '%.2fm'
 						 },
 						 pad : 2.05
 					 },
@@ -893,6 +893,7 @@ function canvas_draw()
 							showMark: false,
 							showLabel: false,
 							shadow: false,
+							formatString : '%i C',
 						},
 					 },
 				 }
-- 
1.9.1

From 3bfc639d1f400b1fd5ad70185d534993a8e82d2c Mon Sep 17 00:00:00 2001
From: Gehad elrobey <[email protected]>
Date: Thu, 3 Jul 2014 01:19:48 +0200
Subject: [PATCH 6/7] Clean list_lib and remove unused code from canvas
 profile.

Comment some functions.
remove leftover code from list_lib.
Some code organization.

Signed-off-by: Gehad elrobey <[email protected]>
---
 theme/list_lib.js | 228 ++++++++++++------------------------------------------
 1 file changed, 50 insertions(+), 178 deletions(-)

diff --git a/theme/list_lib.js b/theme/list_lib.js
index 92177dc..23906b4 100644
--- a/theme/list_lib.js
+++ b/theme/list_lib.js
@@ -86,7 +86,9 @@ function view_in_range(start, end)
 	view_pagging(start, end);
 }
 
-
+/**
+*Show the previous page, Will do nothing if no previous pages
+*/
 function prev_page()
 {
 	var end = start + sizeofpage - 1;
@@ -104,6 +106,9 @@ function prev_page()
 	updateView(start, end)
 }
 
+/**
+*Show the next page, Will do nothing if no next pages
+*/
 function next_page()
 {
 	var end = start + sizeofpage - 1;
@@ -118,14 +123,15 @@ function next_page()
 	updateView(start, end)
 }
 
-///////////////////////////////////////////////
-
 function view_pagging(start, end)
 {
 	var page = document.getElementById("pagging");
 	page.innerHTML = (start + 1) + ' to ' + (end + 1) + ' of ' + (itemsToShow.length) + ' dives';
 }
 
+/**
+*Expand all dives in the view.
+*/
 function expandAll()
 {
 	for (var i = start; i < start + sizeofpage; i++) {
@@ -136,6 +142,9 @@ function expandAll()
 	}
 }
 
+/**
+*Collapse all dives in the view.
+*/
 function collapseAll()
 {
 	for (var i = start; i < start + sizeofpage; i++) {
@@ -226,6 +235,10 @@ function putTags(tags)
 	return result;
 }
 
+/**
+*@param {integer} rate out of 5
+*return HTML string of stars
+*/
 function putRating(rating)
 {
 	var result;
@@ -315,6 +328,10 @@ function list_sort(sortOn)
 	}
 }
 
+/*
+*sorting interface for different coloumns
+*/
+
 function cmpLocationAsc(j, iSmaller)
 {
 	return items[j].location < items[iSmaller].location;
@@ -406,6 +423,7 @@ function sort_it(sortOn, function_)
 //		Searching
 //
 //////////////////////////////////////
+
 function Set()
 {
 	this.keys = new Array();
@@ -442,15 +460,13 @@ Set.prototype.Union = function(another_set)
 	};
 };
 
-////////////////////////////////////////
-
 function Node(value)
 {
 	this.children = new Array();
 	this.value = value;
 	this.key = new Set();
 }
-///////////////////////////////////////
+
 function Search_list_Modules(searchfor)
 {
 	document.getElementById("search_input").value = searchfor;
@@ -576,6 +592,10 @@ function searchin(value, node)
 
 var tripsShown;
 
+
+/**
+*This is the main function called to show/hide trips
+*/
 function toggleTrips()
 {
 	var trip_button = document.getElementById('trip_button');
@@ -642,157 +662,12 @@ function getItems()
 ////////////////////////canvas///////////////////
 
 /*
-Canvas Colors Constants
-*/
-var CAMARONE1 = rgb(0, 0.4, 0);
-var LIMENADE1 = rgb(0.4, 0.8, 0);
-var RIOGRANDE1 = rgb(0.8, 0.8, 0);
-var PIRATEGOLD1 = rgb(0.8, 0.5, 0);
-var RED1 = rgb(1, 0, 0);
-
-/*
 Some Global variables that hold the current shown dive data.
 */
-var dive_id;    //current shown ID
-var points;     //reference to the samples array of the shown dive.
-var MAX_HEIGHT; //Maximum depth, then its the maximum height for canvas
-var MAX_WIDTH;  //dive duration, then its the maximum width for canvas
-
-/**
-*Return RGB css color string.
-*/
-function rgb(r, g, b)
-{
-	r = Math.floor(r * 255);
-	g = Math.floor(g * 255);
-	b = Math.floor(b * 255);
-	return["rgb(", r, ",", g, ",", b, ")"].join("");
-}
-
-/**
-*This function returns the value scaled to the size of canvas
-*new scale = (old scale * height of canvas) / max height in dive
-*to ensure that the dive profile is filling the whole area available
-*/
-function scaleHeight(vari)
-{
-	var height = document.getElementById("profileCanvas").height;
-	max = MAX_HEIGHT;
-	return (vari * height) / max;
-}
-
-/**
-*This function returns the value scaled to the size of canvas
-*new scale = (old scale * width of canvas) / max width in dive
-*to ensure that the dive profile is filling the whole area available
-*/
-function scaleWidth(vari)
-{
-	var width = document.getElementById("profileCanvas").width;
-	max = MAX_WIDTH;
-	return (vari * width) / max;
-}
-
-/**
-*Show Axis information(Numbers on scale)
-*put a Number every 300 second scaled to canvas width.
-*/
-function canvas_showAxisInfo()
-{
-	var c = document.getElementById("profileCanvas");
-	var ctx = c.getContext("2d");
-	ctx.font = "27px Georgia"; /*This is better be a variable scale*/
-	for (var i = 0; i < MAX_WIDTH / scaleWidth(5); i++)
-		ctx.fillText("" + i * 5 + "", scaleWidth(i * 5 * 60), scaleHeight(MAX_HEIGHT - 150));
-}
-
-/**
-*Draw the grid
-*with spacing = 5 * 60 = 300
-*draw line every 5 minutes
-*/
-function canvas_showGrid()
-{
-	var cnv = document.getElementById("profileCanvas");
-	var cnvWidth = cnv.width;
-	var cnvHeight = cnv.height;
-	var lineOptions = {
-		separation : scaleWidth(300),
-		color : '#AAAAAA'
-	};
-	var ctx = cnv.getContext('2d');
-
-	ctx.strokeStyle = lineOptions.color;
-	ctx.strokeWidth = 0.5;
-	ctx.beginPath();
-
-	var iCount = null;
-	var i = null;
-	var x = null;
-	var y = null;
-
-	//draw horizontal lines
-	iCount = Math.floor(cnvWidth / lineOptions.separation);
-	for (i = 1; i <= iCount; i++) {
-		x = (i * lineOptions.separation);
-		ctx.moveTo(x, 0);
-		ctx.lineTo(x, cnvHeight);
-		ctx.stroke();
-	}
-
-	//draw vertical lines
-	iCount = Math.floor(cnvHeight / lineOptions.separation);
-	for (i = 1; i <= iCount; i++) {
-		y = (i * lineOptions.separation);
-		ctx.moveTo(0, y);
-		ctx.lineTo(cnvWidth, y);
-		ctx.stroke();
-	}
-
-	ctx.closePath();
-}
-
-/**
-*The Main function used for drawing canvas lines
-*it automatically calcualte the slope of the line
-*and choose its color.
-*This is the function that should be used internally.
-*/
-function canvas_drawline(ctx, begin, end)
-{
-	drawline(ctx, begin, end, getcolor(begin, end));
-}
-
-/**
-*Draw a line in the canvas with the given
-*starting point, ending point, and color.
-*/
-function drawline(ctx, begin, end, col)
-{
-	ctx.strokeStyle = col;
-	ctx.beginPath();
-	ctx.moveTo(scaleWidth(begin[0]), scaleHeight(begin[1]));
-	ctx.lineTo(scaleWidth(end[0]), scaleHeight(end[1]));
-	ctx.stroke();
-}
-
-/**
-*Choose Color for different speeds.
-*this need to be fixed to go with subsurface conversion.
-*/
-function getcolor(begin, end)
-{
-	var slope = (end[1] - begin[1]) / (end[0] - begin[0]);
-	if (Math.abs(slope) > 300)
-		return RED1;
-	if (Math.abs(slope) > 180)
-		return PIRATEGOLD1;
-	if (Math.abs(slope) > 110)
-		return RIOGRANDE1;
-	if (Math.abs(slope) > 70)
-		return LIMENADE1;
-	return CAMARONE1;
-}
+var dive_id; //current shown ID
+var points;  //reference to the samples array of the shown dive.
+var ZERO_C_IN_MKELVIN = 273150;
+var plot1;
 
 /**
 *Return the HTML string for a dive cylinder entry in the table.
@@ -861,8 +736,6 @@ function get_dive_HTML(dive)
 	       '</td></tr></table><div style="margin:10px;"><p class="words">Notes: </p>' + dive.notes + '</div>';
 };
 
-var ZERO_C_IN_MKELVIN = 273150;
-
 function mkelvin_to_C(mkelvin)
 {
 	return (mkelvin - ZERO_C_IN_MKELVIN) / 1000.0;
@@ -878,16 +751,16 @@ function mm_to_meter(mm)
 	return mm / (1000);
 }
 
-function format_two_digit(n){
-    return n > 9 ? "" + n: "0" + n;
+function format_two_digit(n)
+{
+	return n > 9 ? "" + n : "0" + n;
 }
 
-function int_to_time (n){
-	return  Math.floor((n) /60) +":"+ format_two_digit((n) % (60))+" min";
+function int_to_time(n)
+{
+	return Math.floor((n) / 60) + ":" + format_two_digit((n) % (60)) + " min";
 }
 
-var plot1;
-
 /**
 *Main canvas draw function
 *this calls the axis and grid initialization functions.
@@ -895,11 +768,11 @@ var plot1;
 function canvas_draw()
 {
 	document.getElementById("chart1").innerHTML = "";
-	var d1 = new Array();
-	var d2 = new Array();
-	var d3 = new Array();
-	var d4 = new Array();
-	var last = 0 ;
+	var d1 = new Array(); //depth
+	var d2 = new Array(); //pressure
+	var d3 = new Array(); //events
+	var d4 = new Array(); //temperature
+	var last = 0;
 	for (var i = 0; i < items[dive_id].samples.length; i++) {
 		d1.push([
 			items[dive_id].samples[i][0] / 60,
@@ -917,9 +790,8 @@ function canvas_draw()
 				mkelvin_to_C(items[dive_id].samples[i][3]),
 			]);
 			last = items[dive_id].samples[i][3];
-		}
-		else {
-			if(last != 0) {
+		} else {
+			if (last != 0) {
 				d4.push([
 					items[dive_id].samples[i][0] / 60,
 					mkelvin_to_C(last),
@@ -932,8 +804,7 @@ function canvas_draw()
 		d3.push([
 			items[dive_id].events[i].time / 60,
 			0,
-			//-1 * mm_to_meter(items[dive_id].samples[x][1])
-			]);
+		]);
 	}
 	plot1 = $.jqplot('chart1', [
 					   d1,
@@ -1040,8 +911,6 @@ function showDiveDetails(dive)
 	//set global variables
 	dive_id = dive;
 	points = items[dive_id].samples;
-	MAX_HEIGHT = items[dive_id].maxdepth * 1.1;
-	MAX_WIDTH = items[dive_id].duration;
 
 	//draw the canvas and initialize the view
 	document.getElementById("diveinfo").innerHTML = get_dive_HTML(items[dive_id]);
@@ -1089,14 +958,17 @@ function prevDetailedDive()
 	}
 }
 
+/**
+*This function handles keyboard events
+*shift to next/prev dives by keyboard arrows.
+*/
 function switchDives(e)
 {
-	if(document.getElementById("divePanel").style.display == 'block'){
+	if (document.getElementById("divePanel").style.display == 'block') {
 		e = e || window.event;
 		if (e.keyCode == '37') {
 			prevDetailedDive();
-		}
-		else if (e.keyCode == '39') {
+		} else if (e.keyCode == '39') {
 			nextDetailedDive();
 		}
 	}
-- 
1.9.1

From 5dd360593a2a9e6f61bb0ebe17ce5605479e2a92 Mon Sep 17 00:00:00 2001
From: Gehad elrobey <[email protected]>
Date: Wed, 2 Jul 2014 14:47:00 +0200
Subject: [PATCH 5/7] HTML: add temperature curve to profile.

Add temperature curve to profile view, The curve is tracable by mouse.
The temperature has a hidden axis that doesn't appear in the detailed
view.

Signed-off-by: Gehad elrobey <[email protected]>
---
 theme/list_lib.js | 35 ++++++++++++++++++++++++++++++++++-
 1 file changed, 34 insertions(+), 1 deletion(-)

diff --git a/theme/list_lib.js b/theme/list_lib.js
index 67e80e4..92177dc 100644
--- a/theme/list_lib.js
+++ b/theme/list_lib.js
@@ -898,6 +898,8 @@ function canvas_draw()
 	var d1 = new Array();
 	var d2 = new Array();
 	var d3 = new Array();
+	var d4 = new Array();
+	var last = 0 ;
 	for (var i = 0; i < items[dive_id].samples.length; i++) {
 		d1.push([
 			items[dive_id].samples[i][0] / 60,
@@ -909,6 +911,21 @@ function canvas_draw()
 				mbar_to_bar(items[dive_id].samples[i][2])
 			]);
 		}
+		if (items[dive_id].samples[i][3] != 0) {
+			d4.push([
+				items[dive_id].samples[i][0] / 60,
+				mkelvin_to_C(items[dive_id].samples[i][3]),
+			]);
+			last = items[dive_id].samples[i][3];
+		}
+		else {
+			if(last != 0) {
+				d4.push([
+					items[dive_id].samples[i][0] / 60,
+					mkelvin_to_C(last),
+				]);
+			}
+		}
 	}
 	for (var i = 0; i < items[dive_id].events.length; i++) {
 		//var x = get_sample(items[dive_id].events[i].time);
@@ -921,7 +938,8 @@ function canvas_draw()
 	plot1 = $.jqplot('chart1', [
 					   d1,
 					   d2,
-					   d3
+					   d3,
+					   d4,
 				   ],
 			 {
 				 grid : {
@@ -965,6 +983,12 @@ function canvas_draw()
 						  markerOptions: { size: 10, style:"o" },
 						  pointLabels: { show:false, } ,
 					 },
+					 {
+						  showLine:true,
+						  showMarker : false,
+						  pointLabels: { show:false, } ,
+						  yaxis : 'y3axis',
+					 },
 				 ],
 				 axes : {
 					 xaxis : {
@@ -991,6 +1015,15 @@ function canvas_draw()
 						 },
 						 pad : 3.05
 					 },
+					 y3axis : {
+						padMax : 3.05,
+						tickOptions: {
+							showGridline: false,
+							showMark: false,
+							showLabel: false,
+							shadow: false,
+						},
+					 },
 				 }
 			 });
 }
-- 
1.9.1

From fa820d63ebc22413e04d03a8de52cf1f73959b0a Mon Sep 17 00:00:00 2001
From: Gehad elrobey <[email protected]>
Date: Tue, 1 Jul 2014 18:15:40 +0200
Subject: [PATCH 4/7] User manual: HTML export update

This patch updated the export section in the user manual.

Some changes to the description of the HTML export options.

Signed-off-by: Gehad elrobey <[email protected]>
---
 Documentation/user-manual.txt | 23 +++++++++++++++++------
 1 file changed, 17 insertions(+), 6 deletions(-)

diff --git a/Documentation/user-manual.txt b/Documentation/user-manual.txt
index 6bdc7f5..563c593 100644
--- a/Documentation/user-manual.txt
+++ b/Documentation/user-manual.txt
@@ -1753,12 +1753,23 @@ duration, depth, temperature and pressure.
 some information about it are indicated. This map is not editable.
 
 * _HTML_ format, in which the dive(s) are stored in an HTML format, readable
-with an Internet browser. This file is not editable. HTML export is specified
-on the second tab of the Export dialog (image *B* above). If the _Export List
-only_ option is checked,
-the dive profile information is not exported. This dialog also has some
-style-related options. The HTML dive log contains most of the information
-and aslo contains a search option to search the dive log.
+with an Internet browser (Most modern web browsers are supported, Javascript
+must be enabled) This HTML file is not editable.
+The HTML dive log contains most of the information and aslo contains a search
+option to search the dive log. HTML export is specified on the second tab of the
+Export dialog (image *B* above).
+
+From _General Settings_ Subsurface provides the following options:
+
+- Subsurface Numbers: if this option is checked, the dive(s) are exported with the
+numbers associated with them in subsurface, Otherwise the dive(s) will be numbered
+starting from 1.
+- Minimum Javascript: This will minimize the Javascript produced with the file,
+some functionality will be lost.
+- Export List only: a list of dives will only be exported and the detailed dive
+information will not be exported.
+
+Under _Style Options_ some style-related options are available.
 
 Export to other formats can be achieved through third party facilities, for
 instance _www.divelogs.de_.
-- 
1.9.1

From 1b4031b8bd1c9a4771f085e87b4dc081e31926b1 Mon Sep 17 00:00:00 2001
From: Gehad elrobey <[email protected]>
Date: Tue, 1 Jul 2014 17:55:54 +0200
Subject: [PATCH 3/7] HTML: dive numbering starts from one instead of zero

since the practise is that the first dive is number 1.
so change the first dive number to 1 instead of 0.

Signed-off-by: Gehad elrobey <[email protected]>
---
 theme/list_lib.js | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/theme/list_lib.js b/theme/list_lib.js
index da63f0c..67e80e4 100644
--- a/theme/list_lib.js
+++ b/theme/list_lib.js
@@ -185,7 +185,7 @@ function unexpand(ul)
 
 function getlimited(dive)
 {
-	return '<div style="height:20px"><div class="item">' + (settings.subsurfaceNumbers === '0' ? dive.number : dive.subsurface_number) + '</div>' +
+	return '<div style="height:20px"><div class="item">' + (settings.subsurfaceNumbers === '0' ? dive.number + 1 : dive.subsurface_number) + '</div>' +
 	       '<div class="item">' + dive.date + '</div>' +
 	       '<div class="item">' + dive.time + '</div>' +
 	       '<div class="item_large">' + dive.location + '</div>' +
@@ -1025,7 +1025,7 @@ function showDiveDetails(dive)
 function setDiveTitle(dive)
 {
 	document.getElementById("dive_no").innerHTML = "Dive No. " + (settings.subsurfaceNumbers === '0' ?
-		dive.number : dive.subsurface_number);
+		dive.number + 1 : dive.subsurface_number);
 	document.getElementById("dive_location").innerHTML = dive.location;
 }
 
-- 
1.9.1

From f614f5348e00ecbbf65f30ec984df7d547dc3ee3 Mon Sep 17 00:00:00 2001
From: Gehad elrobey <[email protected]>
Date: Mon, 30 Jun 2014 17:05:23 +0200
Subject: [PATCH 2/7] HTML: add events to detailed profile view

Export events to detailed dive view and add events to the profile.
Events names must appear on mouse hover.

Signed-off-by: Gehad elrobey <[email protected]>
---
 save-html.c       |  2 +-
 theme/list_lib.js | 35 ++++++++++++++++++++++++++++++++---
 2 files changed, 33 insertions(+), 4 deletions(-)

diff --git a/save-html.c b/save-html.c
index d459b0e..e1116aa 100644
--- a/save-html.c
+++ b/save-html.c
@@ -17,7 +17,7 @@ void put_HTML_bookmarks(struct membuffer *b, struct dive *dive)
 	put_string(b, "\"events\":[");
 	while (ev) {
 		put_format(b, "{\"name\":\"%s\",", ev->name);
-		put_format(b, "\"time\":\"%d:%02d min\",},", FRACTION(ev->time.seconds, 60));
+		put_format(b, "\"time\":\"%d\",},", ev->time.seconds);
 		ev = ev->next;
 	}
 	put_string(b, "],");
diff --git a/theme/list_lib.js b/theme/list_lib.js
index 4347475..da63f0c 100644
--- a/theme/list_lib.js
+++ b/theme/list_lib.js
@@ -822,7 +822,7 @@ Return the HTML string for a bookmark entry in the table.
 */
 function get_bookmark_HTML(event)
 {
-	return '<tr><td class="Cyl">' + event.name + '</td><td class="Cyl">' + event.time + '</td></tr>';
+	return '<tr><td class="Cyl">' + event.name + '</td><td class="Cyl">' + int_to_time(event.time) + '</td></tr>';
 }
 
 /**
@@ -878,6 +878,14 @@ function mm_to_meter(mm)
 	return mm / (1000);
 }
 
+function format_two_digit(n){
+    return n > 9 ? "" + n: "0" + n;
+}
+
+function int_to_time (n){
+	return  Math.floor((n) /60) +":"+ format_two_digit((n) % (60))+" min";
+}
+
 var plot1;
 
 /**
@@ -889,6 +897,7 @@ function canvas_draw()
 	document.getElementById("chart1").innerHTML = "";
 	var d1 = new Array();
 	var d2 = new Array();
+	var d3 = new Array();
 	for (var i = 0; i < items[dive_id].samples.length; i++) {
 		d1.push([
 			items[dive_id].samples[i][0] / 60,
@@ -901,9 +910,18 @@ function canvas_draw()
 			]);
 		}
 	}
+	for (var i = 0; i < items[dive_id].events.length; i++) {
+		//var x = get_sample(items[dive_id].events[i].time);
+		d3.push([
+			items[dive_id].events[i].time / 60,
+			0,
+			//-1 * mm_to_meter(items[dive_id].samples[x][1])
+			]);
+	}
 	plot1 = $.jqplot('chart1', [
 					   d1,
-					   d2
+					   d2,
+					   d3
 				   ],
 			 {
 				 grid : {
@@ -912,7 +930,13 @@ function canvas_draw()
 					 background : 'rgba(0,0,0,0)'
 				 },
 				 highlighter : {
-					 show : true
+					 show : true,
+					 tooltipContentEditor: function(str, seriesIndex, pointIndex, jqPlot) {
+						if(seriesIndex===2)
+						return items[dive_id].events[pointIndex].name;
+						else
+						return str;
+					 }
 				 },
 				 seriesDefaults : {
 					 shadowAlpha : 0.1,
@@ -936,6 +960,11 @@ function canvas_draw()
 						 },
 						 yaxis : 'y2axis',
 					 },
+					 {
+						  showLine:false,
+						  markerOptions: { size: 10, style:"o" },
+						  pointLabels: { show:false, } ,
+					 },
 				 ],
 				 axes : {
 					 xaxis : {
-- 
1.9.1

From 6d32aea08e101d36ee308e9a37c5ddc4386b1ed2 Mon Sep 17 00:00:00 2001
From: Gehad elrobey <[email protected]>
Date: Thu, 26 Jun 2014 16:47:48 +0300
Subject: [PATCH 1/7] HTML: use Right/Left arrows to switch between dives

Use arrows to switch between dives in dive detailed view.

Signed-off-by: Gehad elrobey <[email protected]>
---
 theme/dive_export.html |  2 ++
 theme/list_lib.js      | 13 +++++++++++++
 2 files changed, 15 insertions(+)

diff --git a/theme/dive_export.html b/theme/dive_export.html
index 91c47db..e1d89f4 100644
--- a/theme/dive_export.html
+++ b/theme/dive_export.html
@@ -111,6 +111,8 @@ window.onload=function(){
 	showAllDives();
 	document.getElementById("divePanel").style.display='none';
 	document.body.style.visibility='visible';
+
+	document.onkeydown = switchDives;
 }
 
 function changeAdvSearch(e){
diff --git a/theme/list_lib.js b/theme/list_lib.js
index 0d84516..4347475 100644
--- a/theme/list_lib.js
+++ b/theme/list_lib.js
@@ -1026,3 +1026,16 @@ function prevDetailedDive()
 		showDiveDetails(--dive_id);
 	}
 }
+
+function switchDives(e)
+{
+	if(document.getElementById("divePanel").style.display == 'block'){
+		e = e || window.event;
+		if (e.keyCode == '37') {
+			prevDetailedDive();
+		}
+		else if (e.keyCode == '39') {
+			nextDetailedDive();
+		}
+	}
+}
-- 
1.9.1

_______________________________________________
subsurface mailing list
[email protected]
http://lists.hohndel.org/cgi-bin/mailman/listinfo/subsurface

Reply via email to