|
1 | 1 | <!DOCTYPE html>
|
2 | 2 | <html lang="en">
|
3 | 3 | <head>
|
| 4 | + <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" |
| 5 | + integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous"> |
4 | 6 | <meta charset="UTF-8">
|
5 | 7 | <title>Scpus Hack</title>
|
| 8 | + <script src="https://cdn.socket.io/socket.io-3.0.1.min.js"></script> |
6 | 9 |
|
7 | 10 | <script>
|
8 | 11 |
|
9 |
| - function onLoaded(evt){ |
10 | 12 |
|
11 |
| - document.getElementById("querybox").value = window.localStorage.getItem("query"); |
12 |
| - } |
| 13 | + var bag_of_doi = ""; |
| 14 | + var item_info = new Array(); |
13 | 15 |
|
| 16 | + function download(filename, text) { |
| 17 | + var element = document.createElement('a'); |
| 18 | + element.setAttribute('href', 'data:application/x-bibtex;charset=utf-8,' + encodeURIComponent(text)); |
| 19 | + element.setAttribute('download', filename); |
14 | 20 |
|
15 |
| - function textAreaChange(){ |
16 |
| - updateQueryStorage(document.getElementById("querybox").value); |
17 |
| - } |
| 21 | + element.style.display = 'none'; |
| 22 | + document.body.appendChild(element); |
18 | 23 |
|
19 |
| - function updateQueryStorage(str){ |
20 |
| - window.localStorage.setItem("query", str); |
21 |
| - } |
| 24 | + element.click(); |
22 | 25 |
|
| 26 | + document.body.removeChild(element); |
| 27 | + } |
23 | 28 |
|
24 |
| - window.onload = onLoaded; |
| 29 | + function onLoaded(evt) { |
25 | 30 |
|
| 31 | + document.getElementById("querybox").value = window.localStorage.getItem("query"); |
| 32 | + } |
26 | 33 |
|
27 |
| -</script> |
| 34 | + |
| 35 | + function textAreaChange() { |
| 36 | + updateQueryStorage(document.getElementById("querybox").value); |
| 37 | + } |
| 38 | + |
| 39 | + function updateQueryStorage(str) { |
| 40 | + window.localStorage.setItem("query", str); |
| 41 | + } |
| 42 | + |
| 43 | + |
| 44 | + window.onload = onLoaded; |
| 45 | + |
| 46 | + const socket = io(); |
| 47 | + |
| 48 | + socket.on('connect', function () { |
| 49 | + socket.emit('my event', {data: 'I\'m connected!'}); |
| 50 | + }); |
| 51 | + |
| 52 | + socket.on('count', (count) => { |
| 53 | + console.log(count); |
| 54 | + document.getElementById("main_button").value = "fetch " + count + " results "; |
| 55 | + handle_submit = sendDoisRequest; |
| 56 | + }); |
| 57 | + |
| 58 | + socket.on('dois', (data) => { |
| 59 | + console.log(data); |
| 60 | + |
| 61 | + }); |
| 62 | + |
| 63 | + socket.on('doi_export_done', (data) => { |
| 64 | + document.getElementById("dlresults").removeAttribute("hidden"); |
| 65 | + }) |
| 66 | + |
| 67 | + socket.on('doi_update', (data) => { |
| 68 | + |
| 69 | + document.getElementById("pb_success").setAttribute("max", data["total"]); |
| 70 | + document.getElementById("pb_success").setAttribute("value", data["done"]); |
| 71 | + document.getElementById("pb_success_count").innerHTML = data["done"] + "/" + data["total"]; |
| 72 | + document.getElementById("pb_failure").setAttribute("max", data["total"]); |
| 73 | + document.getElementById("pb_failure").setAttribute("value", data["failed"]); |
| 74 | + document.getElementById("pb_failure_count").innerHTML = data["failed"] + "/" + data["total"]; |
| 75 | + |
| 76 | + |
| 77 | + }); |
| 78 | + |
| 79 | + socket.on('doi_results', (data) => { |
| 80 | + for (let doi_item of data) { |
| 81 | + doi = doi_item["doi"]; |
| 82 | + item_info.push(doi_item); |
| 83 | + add_item_to_table(doi_item); |
| 84 | + bag_of_doi += "@article{article1, \n\tdoi = { " + doi + "}\n },\n" |
| 85 | + } |
| 86 | + |
| 87 | + |
| 88 | + }); |
| 89 | + |
| 90 | + function add_item_to_table(doi_item) { |
| 91 | + var row = document.getElementById("doi_table").insertRow() |
| 92 | + if (doi_item["doi"] != "") { |
| 93 | + row.innerHTML = "<th scope=\"row\"><a href=\"https://www.doi.org/" + doi_item["doi"] + "\">" + doi_item["doi"] + "</a></th><td>" + doi_item["title"] + "</td><td><a href=\"https://sci-hub.se/" + doi_item["doi"] + "\">Download</a></td>"; |
| 94 | + } |
| 95 | + |
| 96 | + |
| 97 | + } |
| 98 | + |
| 99 | + |
| 100 | + function sendCountRequest() { |
| 101 | + socket.emit('count', {query: document.getElementById("querybox").value}); |
| 102 | + } |
| 103 | + |
| 104 | + function sendDoisRequest() { |
| 105 | + socket.emit('get_dois', {query: document.getElementById("querybox").value}); |
| 106 | + document.getElementById("main_button").disabled = true; |
| 107 | + } |
| 108 | + |
| 109 | + |
| 110 | + handle_submit = sendCountRequest; |
| 111 | + |
| 112 | + function resetAll() { |
| 113 | + bag_of_doi = ""; |
| 114 | + handle_submit = sendCountRequest; |
| 115 | + document.getElementById("main_button").value = "Count Results"; |
| 116 | + document.getElementById("dlresults").setAttribute("hidden", "true"); |
| 117 | + document.getElementById("querybox").value = ""; |
| 118 | + document.getElementById("pb_success").setAttribute("max", 0); |
| 119 | + document.getElementById("pb_success").setAttribute("value", 0); |
| 120 | + document.getElementById("pb_failure").setAttribute("max", 0); |
| 121 | + document.getElementById("pb_failure").setAttribute("value", 0); |
| 122 | + document.getElementById("pb_failure_count").innerHTML = ""; |
| 123 | + document.getElementById("pb_success_count").innerHTML = ""; |
| 124 | + document.getElementById("doi_table").innerHTML = ""; |
| 125 | + document.getElementById("main_button").disabled = false; |
| 126 | + } |
| 127 | + |
| 128 | + function downloadResults() { |
| 129 | + download("results.bib", bag_of_doi) |
| 130 | + } |
| 131 | + |
| 132 | + </script> |
28 | 133 | </head>
|
29 | 134 | <body>
|
30 |
| -<h1>Scpus Hack: Get a list of DOIs that match your search queries</h1> |
31 |
| -<h2>How to</h2> |
32 |
| -<ol> |
33 |
| - <li>Type your query by following the <a |
34 |
| - href="http://schema.elsevier.com/dtds/document/bkapi/search/SCOPUSSearchTips.htm">doc</a> e.g. <i>TITLE-ABS-KEY(blockchain) AND TITLE-ABS-KEY(INDUSTRY 4.0) AND (TITLE-ABS-KEY(Security) OR TITLE-ABS-KEY(Privacy))</i></li> |
35 |
| - <li>Click "count results" to get the number of results</li> |
36 |
| - <li>Once you have a number, click Fetch to show the dois as bibtex</li> |
37 |
| - <li>save the content in a .bib file</li> |
38 |
| - <li>import it in mendeley Desktop</li> |
39 |
| - <li>Select all the (untitled) entries and right click > update details</li> |
40 |
| - <li>Wait for mendeley to populate each entry</li> |
41 |
| - <li>In mendeley, select all entires and export as a bib file</li> |
42 |
| - <li>Inport your results in <a href="parsif.al">parsif.al</a></li> |
43 |
| -</ol> |
| 135 | +<div class="jumbotron"> |
| 136 | + <h1 class="display-4">Scpus Hack</h1> |
| 137 | + <p class="lead">Get a list of DOIs that match your search queries</p> |
| 138 | + <hr class="my-4"> |
| 139 | + <ol> |
| 140 | + <li>Type your query by following the <a |
| 141 | + href="http://schema.elsevier.com/dtds/document/bkapi/search/SCOPUSSearchTips.htm">doc</a> e.g. <i>TITLE-ABS-KEY(blockchain) |
| 142 | + AND TITLE-ABS-KEY(INDUSTRY 4.0) AND (TITLE-ABS-KEY(Security) OR TITLE-ABS-KEY(Privacy))</i></li> |
| 143 | + <li>Click "count results" to get the number of results</li> |
| 144 | + <li>Once you have a number, click Fetch to resolve DOIs</li> |
| 145 | + <li>Once the resolving is down, a button allows you to download a bibtex file</li> |
| 146 | + <li>import it in <a href="mendeley.com/">mendeley Desktop</a></li> |
| 147 | + <li>Select all the (yet untitled) entries and right click > update details</li> |
| 148 | + <li>Wait for mendeley to populate each entry</li> |
| 149 | + <li>In mendeley, select all entires and export as a bib file</li> |
| 150 | + <li>Inport your results in <a href="https://parsif.al/">parsif.al</a></li> |
| 151 | + </ol> |
| 152 | + |
| 153 | +</div> |
44 | 154 |
|
45 | 155 |
|
46 | 156 | <form action="query" method="POST">
|
47 | 157 | <p>Query:</p>
|
48 | 158 | <fieldset>
|
49 | 159 |
|
50 | 160 |
|
| 161 | + {% if count %} |
| 162 | + <textarea id="querybox" name="query" readonly>{{ query }}</textarea> |
51 | 163 |
|
52 | 164 |
|
53 |
| - {% if count %} |
54 |
| - <textarea id="querybox" name="query" readonly>{{ query }}</textarea> |
| 165 | + </fieldset> |
| 166 | + <input type="submit" value="Fetch {{ count }} results (up to 1000)"> |
| 167 | + {% else %} |
| 168 | + <textarea id="querybox" name="query" onkeyup="textAreaChange()" style="width:100%"></textarea> |
55 | 169 |
|
56 | 170 |
|
57 |
| - </fieldset> |
58 |
| - <input type="submit" value="Fetch {{ count }} results (up to 1000)"> |
59 |
| - {% else %} |
60 |
| - <textarea id="querybox" name="query" onkeyup="textAreaChange()"></textarea> |
61 |
| - <input type="hidden" name="count" value="true"> |
62 | 171 |
|
63 | 172 | </fieldset>
|
64 |
| - <input type="submit" value="Count Results"> |
65 |
| - {% endif %} |
| 173 | + <input class="btn btn-primary" id="main_button" type="button" value="Count Results" |
| 174 | + onclick="handle_submit()"> |
| 175 | + {% endif %} |
66 | 176 |
|
67 | 177 |
|
| 178 | +</form> |
68 | 179 |
|
69 | 180 |
|
70 |
| -</form> |
71 |
| -<form action="/home" method="GET"> |
72 |
| - <input type="submit" value="Reset" /> |
73 |
| -</form> |
| 181 | +<input class="btn btn-secondary" type="button" value="Reset" onclick="resetAll()"/> |
| 182 | +<input class="btn btn-success" id="dlresults" type="button" value="Download dois as bibtex" onclick="downloadResults()" |
| 183 | + hidden/> |
| 184 | +<div> |
| 185 | + <div> |
| 186 | + <label for="file">Resolved DOIs:</label> |
| 187 | + <progress id="pb_success" max="0" value="0"></progress> |
| 188 | + <span id="pb_success_count"></span> |
| 189 | + </div> |
| 190 | + <div> |
| 191 | + <label for="file">Entry without DOIs:</label> |
| 192 | + <progress id="pb_failure" max="0" value="0"></progress> |
| 193 | + <span id="pb_failure_count"></span> |
| 194 | + </div> |
| 195 | +</div> |
| 196 | +</div> |
| 197 | +<table class="table"> |
| 198 | + <thead> |
| 199 | + <td>DOI</td> |
| 200 | + <td>Title</td> |
| 201 | + <td>Sci-Hb link</td> |
| 202 | + |
| 203 | + </thead> |
| 204 | + <tbody id="doi_table"> |
| 205 | + |
| 206 | + |
| 207 | + </tbody> |
| 208 | + |
| 209 | +</table> |
74 | 210 |
|
75 | 211 | </body>
|
76 | 212 |
|
|
0 commit comments