>>(32-b))};
--------------------------------------------------------------------------------
/build/assets/viewer.css:
--------------------------------------------------------------------------------
1 |
2 | body {
3 | font-family: Arial;
4 | }
5 |
6 | #pdfList {
7 | margin-top: 20px;
8 | width: 200px;
9 | min-height: 300px;
10 | border: 2px solid black;
11 | background-color: #ddd;
12 | }
13 |
14 | #annotationList {
15 | display: none;
16 | margin-top: 20px;
17 | margin-left: 20px;
18 | width: 200px;
19 | min-height: 300px;
20 | border: 2px solid black;
21 | background-color: #ddd;
22 | }
23 |
24 | div h3 {
25 | text-align: center;
26 | }
27 |
28 | .pdfCard {
29 | margin: 10px;
30 | width: 170px;
31 | padding: 5px;
32 | border: 1px solid black;
33 | background-color: #fff;
34 | word-wrap: break-word;
35 | }
36 |
37 | .annotationCard {
38 | margin: 10px;
39 | width: 170px;
40 | padding: 5px;
41 | border-radius: 5px;
42 | background-color: #f1c40f;
43 | word-wrap: break-word;
44 | color: white;
45 | box-shadow: 1px 1px 4px #000;
46 | }
47 |
48 | .annotationCard:hover, .pdfCard:hover {
49 | cursor: hand;
50 | }
--------------------------------------------------------------------------------
/build/assets/viewer.js:
--------------------------------------------------------------------------------
1 | /*global PDFJS:false, console:false, Promise:false */
2 |
3 | 'use strict';
4 |
5 | PDFJS.disableWorker = true;
6 | PDFJS.disableRange = true;
7 |
8 | // JSMind Configuration
9 | var options = {
10 | container:'jsmind_container',
11 | editable:true,
12 | theme:'orange'
13 | };
14 | var mind = {
15 | meta: {
16 | "name":"jsMind remote",
17 | "author":"hizzgdev@163.com",
18 | "version":"0.2"
19 | },
20 | format:"node_tree",
21 | data: {
22 | id: "root", topic: "PDF", children: []
23 | }
24 | }
25 | var jm = new jsMind(options);
26 |
27 | var sendData = function (data) {
28 | var xhr = new XMLHttpRequest();
29 | xhr.open("POST", '/sendData', false);
30 |
31 | // Send the proper header information along with the request
32 | xhr.setRequestHeader("Content-type", "application/json");
33 |
34 | xhr.send(JSON.stringify(data));
35 | }
36 |
37 | var getRandomString = function (num) {
38 | num = num || 6;
39 | return Math.random().toString(36).replace(/[^a-z]+/g, '').substr(0, num);
40 | };
41 |
42 | // to read pdfs and extract annottations
43 | var loadPDF = function (filePath, fileName) {
44 | PDFJS.getDocument(filePath).then(function (pdf) {
45 | var promises = [], promise;
46 |
47 | for (var i = 1; i < pdf.numPages; i++) {
48 | promise = pdf.getPage(i).then(function (page) {
49 | return page.getAnnotations();
50 | });
51 | promises.push(promise);
52 | }
53 |
54 | var ignoreList = ['Link'];
55 |
56 | Promise.all(promises).then(function (pages) {
57 | var items = [];
58 |
59 | pages.forEach(function(annotations) {
60 | annotations
61 | .filter(function (annotation) {
62 | return !ignoreList.includes(annotation.subtype)
63 | })
64 | .forEach(function(annotation) {
65 | if( (annotation.subtype == "Popup")){
66 | items.push({
67 | id: getRandomString(),
68 | subtype: annotation.subtype,
69 | title: annotation.title,
70 | topic: annotation.contents
71 | });
72 | }
73 | });
74 | });
75 |
76 | mindmap[fileName] = items;
77 |
78 | // Prepare MindMap Node
79 | var mindmapNode = { id: getRandomString(), topic: fileName };
80 | mindmapNode.children = items;
81 |
82 | // Add the Node to the Mindmap
83 | // mind.data.children.push(mindmapNode);
84 | pdfTree.push({ id: getRandomString(), fileName: fileName, annotations: items });
85 | sendData({ fileName: fileName, data: items });
86 | }).then(function () {
87 | // Re-render Mindmap after processing every PDF
88 | jm.show(mind);
89 | renderPDFList();
90 | });
91 | });
92 | }
93 |
94 | function renderPDFList() {
95 | var base = 'PDFs ';
96 | pdfTree.forEach(function (eachCard) {
97 | base += ' ' + eachCard.fileName + '
';
98 | });
99 |
100 | // 'base' variable contains the HTML for the pdfList inner data
101 | // Set the innerHTML with contents of 'base'
102 | document.getElementById('pdfList').innerHTML = base;
103 | }
104 |
105 | function renderAnnotations(fileId) {
106 | // Select the required file based on the fileId
107 | var selectedFile = pdfTree.filter(function (eachCard) {
108 | return eachCard.id === fileId;
109 | })[0];
110 |
111 | var base = 'Annotations ';
112 | selectedFile.annotations.forEach(function (eachCard) {
113 | base += '' + eachCard.topic + '
';
114 | });
115 |
116 | // 'base' variable contains the HTML for the annotationList inner data
117 | // Set the innerHTML with contents of 'base'
118 | document.getElementById('annotationList').innerHTML = base;
119 |
120 | // Make the annotationList box visible
121 | document.getElementById('annotationList').style.display = 'block';
122 | }
123 |
124 | function addToMindmap() {
125 | // To be implemented
126 | }
127 |
128 | var files,
129 | file,
130 | extension,
131 | input = document.getElementById("fileURL"),
132 | mindmap = {},
133 | pdfTree = [],
134 | selectedFile;
135 |
136 | window.pdfTree = pdfTree;
137 | window.mindmap = mindmap;
138 | input.addEventListener("change", function(e) {
139 | // Reset
140 | pdfTree = [];
141 | files = e.target.files;
142 | var len = files.length;
143 | var promises = [], promise;
144 |
145 | for (var i = 0; i < len; i++) {
146 | file = files[i];
147 | extension = file.name.split(".").pop();
148 | if (extension == 'pdf') {
149 | loadPDF(URL.createObjectURL(file), file.name);
150 | }
151 | }
152 | }, false);
153 |
--------------------------------------------------------------------------------
/build/img/pdf-small.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JabRef/scimappr/251a0f36410f4209dd0d059e42cfeb45aa87f15f/build/img/pdf-small.png
--------------------------------------------------------------------------------
/build/img/pdf.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JabRef/scimappr/251a0f36410f4209dd0d059e42cfeb45aa87f15f/build/img/pdf.png
--------------------------------------------------------------------------------
/build/pdf.js/web/batchviewer.html:
--------------------------------------------------------------------------------
1 |
2 |
23 |
24 |
25 |
26 |
27 |
28 |
29 | PDF.js viewer
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |