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 37: Line 37:
  
 
==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 54: Line 52:
 
Käytössä olevat invoke ja invokeWith metodit. Nämä ovat käytettävissä sekä liitännäisissä että JSON APIssa.
 
Käytössä olevat invoke ja invokeWith metodit. Nämä ovat käytettävissä sekä liitännäisissä että JSON APIssa.
 
===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
  
 
===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
  
 
===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

Revision as of 19:35, 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

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" ]
] ]

APIn methods

Käytössä olevat invoke ja invokeWith metodit. Nämä ovat käytettävissä sekä liitännäisissä että JSON APIssa.

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