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 50: | Line 50: | ||
==APIn methods== | ==APIn 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. |
Revision as of 20:36, 17 February 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
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" ] ] ]
APIn 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
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
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