summaryrefslogtreecommitdiff
path: root/scraper/client
diff options
context:
space:
mode:
authorJules Laplace <julescarbon@gmail.com>2019-02-16 14:21:32 +0100
committerJules Laplace <julescarbon@gmail.com>2019-02-16 14:21:32 +0100
commitc1ce13b41b595847f18d2f7232850b10cd677e66 (patch)
tree7ce70a6899f49ac3633b6364bf26b9da762a89d8 /scraper/client
parent3a3a89f2c58eceee07b2cfcfb1700a61b34619e5 (diff)
get better pdf url
Diffstat (limited to 'scraper/client')
-rw-r--r--scraper/client/paper/paper.address.js44
-rw-r--r--scraper/client/paper/paper.css3
2 files changed, 45 insertions, 2 deletions
diff --git a/scraper/client/paper/paper.address.js b/scraper/client/paper/paper.address.js
index 09b20758..9256d4ad 100644
--- a/scraper/client/paper/paper.address.js
+++ b/scraper/client/paper/paper.address.js
@@ -19,6 +19,7 @@ const initialState = {
institution_3_vetting: '',
institution_4_vetting: '',
notes: '',
+ pdf_index: 0,
}
class PaperAddress extends Component {
state = {
@@ -111,7 +112,25 @@ class PaperAddress extends Component {
institution_4_vetting: this.state.institution_4_vetting,
notes: this.state.notes,
})
- history.push('/paper/' + this.props.api.paperInfo.dataset.key + '/random/')
+ this.next(false)
+ }
+
+ next() {
+ const { key } = this.props.api.paperInfo.dataset
+ const { unknownCitations } = this.props.api
+ let citationIndex = (unknownCitations.citations || [])
+ .findIndex(f => f.id === this.state.citation.id)
+ if (citationIndex === -1) {
+ history.push('/paper/' + key + '/info/')
+ } else {
+ citationIndex += 1
+ if (citationIndex >= unknownCitations.length) {
+ history.push('/paper/' + key + '/info/')
+ } else {
+ let nextId = unknownCitations.citations[citationIndex].id
+ history.push('/paper/' + key + '/address/' + nextId)
+ }
+ }
}
render() {
@@ -229,9 +248,30 @@ class PaperAddress extends Component {
onClick={this.save.bind(this)}
ref={ref => this.button = ref}
>Save Institutions</button>
+
+ <button
+ className='btn'
+ onClick={this.next.bind(this)}
+ >{'Next >'}</button>
+ </div>
+
+ <div className='param pdf_links'>
+ {citation.pdf.map((pdf,i) => {
+ const pdf_partz = pdf.replace('www.','').split('/').slice(2,3)[0] || 'unknown'
+ let domain = ''
+ return (
+ <a
+ key={i}
+ onClick={() => this.setState({ pdf_index: i })}
+ className={i === this.state.pdf_index ? 'selected' : ''}
+ >
+ {'[' + domain + ']'}
+ </a>
+ )
+ })}
</div>
- <iframe className='pdfViewer' src={citation.pdf} />
+ <iframe className='pdfViewer' src={citation.pdf[this.state.pdf_index]} />
</div>
)
}
diff --git a/scraper/client/paper/paper.css b/scraper/client/paper/paper.css
index 430face4..9d55c55c 100644
--- a/scraper/client/paper/paper.css
+++ b/scraper/client/paper/paper.css
@@ -38,6 +38,9 @@ input.notes { width: 400px; }
margin-right: 10px;
}
+.pdf_links a.selected {
+ font-weight: bold;
+}
iframe.pdfViewer {
margin: 10px 0;
width: 100%;