(5 intermediate revisions by the same user not shown)
Line 3: Line 3:
 
Plugins are written in JavaScript language. Read more about JavaScript from: http://fi.wikipedia.org/wiki/JavaScript
 
Plugins are written in JavaScript language. Read more about JavaScript from: http://fi.wikipedia.org/wiki/JavaScript
  
Some ready made plugins: https://github.com/enyone/chrono-plugins
+
Some ready made plugins: https://gitlab.com/enyone/plugins
  
 
==Examples==
 
==Examples==
Line 9: Line 9:
 
An example code of plugin creating HTML syntax print layouts.
 
An example code of plugin creating HTML syntax print layouts.
  
Example code: [https://github.com/enyone/chrono-plugins/blob/master/demoplugin_html.js demoplugin_html.js]
+
Example code: [https://gitlab.com/enyone/plugins/blob/master/demoplugin_html.js demoplugin_html.js]
  
 
====Example output====
 
====Example output====
Line 26: Line 26:
 
An example code of plugin creating result tables to J2Chrono reporting window.
 
An example code of plugin creating result tables to J2Chrono reporting window.
  
Example code: [https://github.com/enyone/chrono-plugins/blob/master/demoplugin_list.js demoplugin_list.js]
+
Example code: [https://gitlab.com/enyone/plugins/blob/master/demoplugin_list.js demoplugin_list.js]
  
 
====Example list====
 
====Example list====
Line 33: Line 33:
 
==Creating plugins==
 
==Creating plugins==
 
* Create an empty file of type <tt>.js</tt>
 
* Create an empty file of type <tt>.js</tt>
* Write your plugin using an empty plugin layout: [http://wiki.enymind.fi/demo/plugins/empty_plugin.js empty_plugin.js]
+
* Write your plugin using an empty plugin layout: [https://gitlab.com/enyone/plugins/blob/master/empty_plugin.js empty_plugin.js]
 
* Load your <tt>.js</tt> file to J2Chrono -menu <tt>File->Settings->Plugins</tt>
 
* Load your <tt>.js</tt> file to J2Chrono -menu <tt>File->Settings->Plugins</tt>
  
 
==JSON API==
 
==JSON API==
Käyttääksesi tätä APIa sinun tulee käynnistää http tulospalvelin sekä ottaa liitännäiset käyttöön J2Chrono ohjelman asetuksista.
 
 
 
API can be reached from: http://localhost:8080/api/json when J2Chrono is running and plugins are enabled.
 
API can be reached from: http://localhost:8080/api/json when J2Chrono is running and plugins are enabled.
  
Line 51: Line 49:
 
  ] ]
 
  ] ]
  
==APIn methods==
+
==API methods==
Käytössä olevat invoke ja invokeWith metodit. Nämä ovat käytettävissä sekä liitännäisissä että JSON APIssa.
+
Available HTTP GET methods. Methods are usable in both JSON API and plugin code.
 +
 
 
===getRounds===
 
===getRounds===
Palauttaa kaikki erät 2-uloitteisessa taulukossa.
+
Returns all rounds in a race.
  
Taulukon indeksit:
+
List indexes:
 
  0 id  1 name  2 time  3 sequence  4 start  5 stop  6 part
 
  0 id  1 name  2 time  3 sequence  4 start  5 stop  6 part
 +
 +
===getCurrentRound===
 +
Returns currently selected round.
 +
 +
List indexes:
 +
0 name
  
 
===getPassings===
 
===getPassings===
Palauttaa kaikki erän/kilpailun ohitukset 2-uloitteisessa taulukossa.
+
Returns all passings of a selected round.
  
Taulukon indeksit:
+
List indexes:
 
  0 id  1 transponder  2 name  3 time  4 strength  5 noise  6 hits  7 lap
 
  0 id  1 transponder  2 name  3 time  4 strength  5 noise  6 hits  7 lap
  
 
===getRoundLaptimes===
 
===getRoundLaptimes===
Palauttaa kilpailijoiden kierrosajat 2-uloitteisessa taulukossa.
+
Returns all laptimes of a selected round.
  
Taulukon indeksit:
+
List indexes:
 
  0 name  1 additional  2 number  3 competitorId  4 class  5 transponder  6 lap  7 gap
 
  0 name  1 additional  2 number  3 competitorId  4 class  5 transponder  6 lap  7 gap
  
 
===getEnduroGapTimes===
 
===getEnduroGapTimes===
Palauttaa kilpailijoiden reittiajat 2-uloitteisessa taulukossa.
+
Returns all route times of a selected round.
  
Taulukon indeksit:
+
List indexes:
 
  0 name  1 additional  2 number  3 competitorId  4 class  5 transponder  6 lap  7 gap
 
  0 name  1 additional  2 number  3 competitorId  4 class  5 transponder  6 lap  7 gap
  
 
===getCompetitionResults===
 
===getCompetitionResults===
Palauttaa reittikilpailun tulokset 2-uloitteisessa taulukossa.
+
Returns route type race results of a selected round.
  
Taulukon indeksit:
+
List indexes:
 
  0 name  1 additional  2 number  3 competitorId  4 class  5 transponder  6 total  7 laps
 
  0 name  1 additional  2 number  3 competitorId  4 class  5 transponder  6 total  7 laps
 
  8 penalties  9 penalties_time  10 dns_time  11 penalties_laps
 
  8 penalties  9 penalties_time  10 dns_time  11 penalties_laps
  
 
===getRoundResults===
 
===getRoundResults===
Palauttaa erän tulokset 2-uloitteisessa taulukossa.
+
Returns track type race results of a selected round.
  
Taulukon indeksit:
+
List indexes:
 
  0 name  1 additional  2 number  3 competitorId  4 class  5 transponder  6 total  7 laps
 
  0 name  1 additional  2 number  3 competitorId  4 class  5 transponder  6 total  7 laps
 
  8 penalties  9 penalties_time  10 dns_time  11 penalties_laps
 
  8 penalties  9 penalties_time  10 dns_time  11 penalties_laps
 +
 +
===getRoundResultsExtended===
 +
Returns track type extended race results of a selected round.
 +
 +
List indexes:
 +
0 number  1 name  2 class  3 additional  4 total  5 laps  6 diff  7 gap
 +
8 gap2  9 lastLap  10 bestLap  11 bestInLap  12 penalties
  
 
===getRoundsPoints===
 
===getRoundsPoints===
Palauttaa yhteenlasketut pisteet 2-uloitteisessa taulukossa.
+
Returns results points of a selected round.
  
Taulukon indeksit:
+
List indexes:
 
  0 name  1 additional  2 number  3 competitorId  4 class  5 transponder  6 penalties  7 total_time
 
  0 name  1 additional  2 number  3 competitorId  4 class  5 transponder  6 penalties  7 total_time
 
  8 parts  9 total  10 penalties_time  11 penalties_laps
 
  8 parts  9 total  10 penalties_time  11 penalties_laps
  
 
===getRoundsPointsAsTime===
 
===getRoundsPointsAsTime===
Palauttaa yhteenlasketut ajat 2-uloitteisessa taulukossa.
+
Returns results sum of times of a selected round.
  
Taulukon indeksit:
+
List indexes:
 
  0 name  1 additional  2 number  3 competitorId  4 class  5 transponder  6 penalties  7 total_time
 
  0 name  1 additional  2 number  3 competitorId  4 class  5 transponder  6 penalties  7 total_time
 
  8 parts  9 total  10 penalties_time  11 penalties_laps
 
  8 parts  9 total  10 penalties_time  11 penalties_laps
  
 
===getRoundsPointsAsLaps===
 
===getRoundsPointsAsLaps===
Palauttaa yhteenlasketut kierrokset 2-uloitteisessa taulukossa.
+
Returns results sum of laps of a selected round.
  
Taulukon indeksit:
+
List indexes:
 
  0 name  1 additional  2 number  3 competitorId  4 class  5 transponder  6 penalties  7 total_time
 
  0 name  1 additional  2 number  3 competitorId  4 class  5 transponder  6 penalties  7 total_time
 
  8 parts  9 total  10 penalties_time  11 penalties_laps
 
  8 parts  9 total  10 penalties_time  11 penalties_laps
 +
 +
===getLatestTimeForEveryGap===
 +
Returns latest route time for each route type round.
 +
 +
List indexes:
 +
0 name  1 additional  2 number  3 competitorId  4 class  5 transponder  6 lap  7 gap  8 roundName
 +
 +
===getRoundLaptimesWithSectorTimes===
 +
Returns all laptimes and sector times of a selected round. "sector" is number 1,2,3.. In normal laptimes it is empty.
 +
 +
List indexes:
 +
0 name  1 additional  2 number  3 competitorId  4 class  5 transponder  6 lap  7 gap  8 sector

Latest revision as of 18:43, 5 April 2017

This page tells you how to increase the functionality of J2Chrono application.

Plugins are written in JavaScript language. Read more about JavaScript from: http://fi.wikipedia.org/wiki/JavaScript

Some ready made plugins: https://gitlab.com/enyone/plugins

Examples

HTML plugin

An example code of plugin creating HTML syntax print layouts.

Example code: demoplugin_html.js

Example output

Passing times:

23:34:03.421
23:34:19.996
23:34:26.944
23:54:31.672
23:54:42.103
02:40:26.316

Selected option: -1 which does not exist 

LIST plugin

An example code of plugin creating result tables to J2Chrono reporting window.

Example code: demoplugin_list.js

Example list

Demolist.png

Creating plugins

  • Create an empty file of type .js
  • Write your plugin using an empty plugin layout: empty_plugin.js
  • Load your .js file to J2Chrono -menu File->Settings->Plugins

JSON API

API can be reached from: http://localhost:8080/api/json when J2Chrono is running and plugins are enabled.

Parameters

Example output

[ [
 [ "Mattinen, Matti","","1","2","SM","1","00:00:07.000","1.0","","00:00:00.000","00:00:00.000","0.0" ],
 [ "Tepponen, Teppo","","2","4","SM","2","00:00:04.000","0.0","","00:00:00.000","00:00:00.000","0.0" ]
] ]

API methods

Available HTTP GET methods. Methods are usable in both JSON API and plugin code.

getRounds

Returns all rounds in a race.

List indexes:

0 id   1 name   2 time   3 sequence   4 start   5 stop   6 part

getCurrentRound

Returns currently selected round.

List indexes:

0 name

getPassings

Returns all passings of a selected round.

List indexes:

0 id   1 transponder   2 name   3 time   4 strength   5 noise   6 hits   7 lap

getRoundLaptimes

Returns all laptimes of a selected round.

List indexes:

0 name   1 additional   2 number   3 competitorId   4 class   5 transponder   6 lap   7 gap

getEnduroGapTimes

Returns all route times of a selected round.

List indexes:

0 name   1 additional   2 number   3 competitorId   4 class   5 transponder   6 lap   7 gap

getCompetitionResults

Returns route type race results of a selected round.

List indexes:

0 name   1 additional   2 number   3 competitorId   4 class   5 transponder   6 total   7 laps
8 penalties   9 penalties_time   10 dns_time   11 penalties_laps

getRoundResults

Returns track type race results of a selected round.

List indexes:

0 name   1 additional   2 number   3 competitorId   4 class   5 transponder   6 total   7 laps
8 penalties   9 penalties_time   10 dns_time   11 penalties_laps

getRoundResultsExtended

Returns track type extended race results of a selected round.

List indexes:

0 number   1 name   2 class   3 additional   4 total   5 laps   6 diff   7 gap
8 gap2   9 lastLap   10 bestLap   11 bestInLap   12 penalties

getRoundsPoints

Returns results points of a selected round.

List indexes:

0 name   1 additional   2 number   3 competitorId   4 class   5 transponder   6 penalties   7 total_time
8 parts   9 total   10 penalties_time   11 penalties_laps

getRoundsPointsAsTime

Returns results sum of times of a selected round.

List indexes:

0 name   1 additional   2 number   3 competitorId   4 class   5 transponder   6 penalties   7 total_time
8 parts   9 total   10 penalties_time   11 penalties_laps

getRoundsPointsAsLaps

Returns results sum of laps of a selected round.

List indexes:

0 name   1 additional   2 number   3 competitorId   4 class   5 transponder   6 penalties   7 total_time
8 parts   9 total   10 penalties_time   11 penalties_laps

getLatestTimeForEveryGap

Returns latest route time for each route type round.

List indexes:

0 name   1 additional   2 number   3 competitorId   4 class   5 transponder   6 lap   7 gap   8 roundName

getRoundLaptimesWithSectorTimes

Returns all laptimes and sector times of a selected round. "sector" is number 1,2,3.. In normal laptimes it is empty.

List indexes:

0 name   1 additional   2 number   3 competitorId   4 class   5 transponder   6 lap   7 gap   8 sector