(2 intermediate revisions by the same user not shown)
Line 100: Line 100:
  
 
List indexes:
 
List indexes:
  0 name   1 additional   2 number   3 competitorId   4 class   5 transponder   6 total   7 laps
+
  0 number   1 name   2 class   3 additional   4 total   5 laps   6 diff   7 gap
  8 penalties   9 penalties_time   10 dns_time   11 penalties_laps
+
  8 gap2   9 lastLap   10 bestLap   11 bestInLap  12 penalties
 
+
  
 
===getRoundsPoints===
 
===getRoundsPoints===
Line 130: Line 129:
 
List indexes:
 
List indexes:
 
  0 name  1 additional  2 number  3 competitorId  4 class  5 transponder  6 lap  7 gap  8 roundName
 
  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 17: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