-
Notifications
You must be signed in to change notification settings - Fork 0
/
boot.js
48 lines (38 loc) · 1.1 KB
/
boot.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
window.Lens = require("./src/my-lens");
// Little helper used to parse query strings from urls
// --------
//
var qs = function () {
var query_string = {};
var query = window.location.search.substring(1);
var vars = query.split("&");
for (var i=0;i<vars.length;i++) {
var pair = vars[i].split("=");
// If first entry with this name
if (typeof query_string[pair[0]] === "undefined") {
query_string[pair[0]] = pair[1];
// If second entry with this name
} else if (typeof query_string[pair[0]] === "string") {
var arr = [ query_string[pair[0]], pair[1] ];
query_string[pair[0]] = arr;
// If third or later entry with this name
} else {
query_string[pair[0]].push(pair[1]);
}
}
return query_string;
} ();
// This document gets loaded by default
// --------
var documentURL = "data/PMC4467057/fulltext.xml";
$(function() {
// Create a new Lens app instance
// --------
//
// Injects itself into body
var app = new window.Lens({
document_url: qs.url ? decodeURIComponent(qs.url) : documentURL
});
app.start();
window.app = app;
});