(4 intermediate revisions by the same user not shown) | |||
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: [ | + | * 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> | ||
Line 49: | Line 49: | ||
] ] | ] ] | ||
− | == | + | ==API methods== |
− | + | Available HTTP GET methods. Methods are usable in both JSON API and plugin code. | |
+ | |||
===getRounds=== | ===getRounds=== | ||
Returns all rounds in a race. | Returns all rounds in a race. | ||
Line 56: | Line 57: | ||
List indexes: | 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=== | ||
Line 88: | Line 95: | ||
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=== | ||
Line 109: | Line 123: | ||
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 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
Contents
- 1 Examples
- 2 Creating plugins
- 3 JSON API
- 4 API methods
- 4.1 getRounds
- 4.2 getCurrentRound
- 4.3 getPassings
- 4.4 getRoundLaptimes
- 4.5 getEnduroGapTimes
- 4.6 getCompetitionResults
- 4.7 getRoundResults
- 4.8 getRoundResultsExtended
- 4.9 getRoundsPoints
- 4.10 getRoundsPointsAsTime
- 4.11 getRoundsPointsAsLaps
- 4.12 getLatestTimeForEveryGap
- 4.13 getRoundLaptimesWithSectorTimes
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
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