-
Notifications
You must be signed in to change notification settings - Fork 12
/
my-lens.js
62 lines (49 loc) · 1.56 KB
/
my-lens.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
"use strict";
var Lens = require("lens/reader");
var panels = Lens.getDefaultPanels();
// All available converters
var LensConverter = require("lens/converter");
var CustomConverter = require("./custom_converter");
var ElifeConverter = require("lens/converter/elife_converter");
// Custom Panels
// -------------------
//
// The following lines enable the altmetrics panel
// which can be considered a demo implementation for a custom
// panel in Lens
//
// Find the code in panels/altmetrics and use it as an inspiration
// to build your own Lens panel
var altmetricsPanel = require('./panels/altmetrics');
// Insert altmetrics panel at next to last position
panels.splice(-1, 0, altmetricsPanel);
var LensApp = function(config) {
Lens.call(this, config);
};
LensApp.Prototype = function() {
// Custom converters
// --------------
//
// Provides a sequence of converter instances
// Converter.match will be called on each instance with the
// XML document to processed. The one that returns true first
// will be chosen. You can change the order prioritize
// converters over others
this.getConverters = function(converterOptions) {
return [
new CustomConverter(converterOptions),
new ElifeConverter(converterOptions),
new LensConverter(converterOptions)
]
};
// Custom panels
// --------------
//
this.getPanels = function() {
return panels.slice(0);
};
};
LensApp.Prototype.prototype = Lens.prototype;
LensApp.prototype = new LensApp.Prototype();
LensApp.prototype.constructor = LensApp;
module.exports = LensApp;