Commit 1865d5a9 authored by Jerome Chauveau's avatar Jerome Chauveau
Browse files

Initial commit

parent 21578ecc
......@@ -9,6 +9,7 @@
},
"dependencies": {
"core-js": "^3.6.5",
"libzotero": "^0.1.13",
"vue": "^3.0.0"
},
"devDependencies": {
......
<template>
<img alt="Vue logo" src="./assets/logo.png">
<HelloWorld msg="Welcome to Your Vue.js App"/>
<zotero-query-component/>
</template>
<script>
import HelloWorld from './components/HelloWorld.vue'
import ZoteroQueryComponent from "./components/ZoteroQueryComponent";
export default {
export default {
name: 'App',
components: {
HelloWorld
ZoteroQueryComponent
}
}
}
</script>
<style>
#app {
#app {
font-family: Avenir, Helvetica, Arial, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
text-align: center;
color: #2c3e50;
margin-top: 60px;
}
}
.zotero-query-component {
width: 600px;
margin: auto;
}
</style>
<template>
<div class="hello">
<h1>{{ msg }}</h1>
<p>
For a guide and recipes on how to configure / customize this project,<br>
check out the
<a href="https://cli.vuejs.org" target="_blank" rel="noopener">vue-cli documentation</a>.
</p>
<h3>Installed CLI Plugins</h3>
<ul>
<li><a href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-babel" target="_blank" rel="noopener">babel</a></li>
<li><a href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-eslint" target="_blank" rel="noopener">eslint</a></li>
</ul>
<h3>Essential Links</h3>
<ul>
<li><a href="https://vuejs.org" target="_blank" rel="noopener">Core Docs</a></li>
<li><a href="https://forum.vuejs.org" target="_blank" rel="noopener">Forum</a></li>
<li><a href="https://chat.vuejs.org" target="_blank" rel="noopener">Community Chat</a></li>
<li><a href="https://twitter.com/vuejs" target="_blank" rel="noopener">Twitter</a></li>
<li><a href="https://news.vuejs.org" target="_blank" rel="noopener">News</a></li>
</ul>
<h3>Ecosystem</h3>
<ul>
<li><a href="https://router.vuejs.org" target="_blank" rel="noopener">vue-router</a></li>
<li><a href="https://vuex.vuejs.org" target="_blank" rel="noopener">vuex</a></li>
<li><a href="https://github.com/vuejs/vue-devtools#vue-devtools" target="_blank" rel="noopener">vue-devtools</a></li>
<li><a href="https://vue-loader.vuejs.org" target="_blank" rel="noopener">vue-loader</a></li>
<li><a href="https://github.com/vuejs/awesome-vue" target="_blank" rel="noopener">awesome-vue</a></li>
</ul>
</div>
</template>
<script>
export default {
name: 'HelloWorld',
props: {
msg: String
}
}
</script>
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
h3 {
margin: 40px 0 0;
}
ul {
list-style-type: none;
padding: 0;
}
li {
display: inline-block;
margin: 0 10px;
}
a {
color: #42b983;
}
</style>
<template>
<div class="zotero-query-component">
<h2>Zotero Client <a role="button" @click="isConfigVisible=!isConfigVisible"></a></h2>
<div class="zotero-config-pane" v-if="isConfigVisible">
<div>
<label>Type de collection</label>
<select v-model="type">
<option value="group">Group</option>
<option value="user">User</option>
</select>
</div>
<div>
<label>Identifiant de "{{type}}"</label>
<input v-model="groupOrUserID"/>
</div>
<div>
<label>Résultats par page</label>
<input type="number" v-model="pageLength"/>
</div>
</div>
<div>
<input v-model="textQuery"/>
<button class="zotero-query-btn" @click="doQuery()" :disabled="!canQuery">
<span>&#128269;</span>
</button>
</div>
<progress v-if="isFetching"/>
<template v-if="entries">
<h3>Résultats <span class="results-count">{{nbResults}}</span></h3>
<div class="zotero-pager">
<a role="button" class="next-prev-btn" @click="previousPage()">&#5176;</a>
<span>{{currentPage}}/{{getTotalPages}}</span>
<a role="button" class="next-prev-btn" @click="nextPage()">&#5171;</a>
</div>
<div class="zotero-entries">
<ul>
<li v-for="entry in entries" :key="'entry-' + entry.key">
{{entry.key}}
</li>
</ul>
</div>
</template>
</div>
</template>
<script>
const Zotero = require('libzotero');
export default {
name: 'ZoteroQueryComponent',
props: {},
data() {
return {
type: 'group',
groupOrUserID: '427575',
entries: null,
isFetching: false,
isConfigVisible: true,
start:0,
currentPage:1,
pageLength: 10,
nbResults: 0,
textQuery : ""
}
},
computed: {
getTotalPages : function(){
return Math.ceil(this.nbResults / this.pageLength)
},
canQuery : function(){
return this.textQuery && this.textQuery.trim() !== ''
}
},
methods: {
doQuery() {
this.isFetching = true;
this.entries = null;
let library = new Zotero.Library(this.type, this.groupOrUserID);
library.loadItems({start: this.start, limit: this.pageLength, q: this.textQuery}).then((response)=>{
this.entries = response.data;
this.nbResults = response.totalResults;
this.isFetching = false;
})
},
previousPage(){
this.start -= this.pageLength;
this.currentPage --;
this.doQuery();
},
nextPage(){
this.start += this.pageLength;
this.currentPage ++;
this.doQuery();
}
}
}
</script>
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
* {
--input-height: 34px;
}
input, button, select {
height: var(--input-height);
}
h1 {}
a[role=button], button{
cursor: pointer;
}
label{
display: inline-block;
width: 200px;
}
.next-prev-btn{
display: inline-block;
margin-left: 15px;
margin-right: 15px;
}
.zotero-entries ul{
list-style-type: square;
}
.results-count{
font-size: 0.8em;
}
.results-count:before{
content: ' (';
}
.results-count:after{
content: ') ';
}
.zotero-config-pane{
background-color: gainsboro;
padding:15px;
margin-bottom: 15px;
}
.zotero-query-btn{
margin-left: 15px;
}
</style>
......@@ -3371,6 +3371,13 @@ encodeurl@~1.0.2:
resolved "https://registry.yarnpkg.com/encodeurl/-/encodeurl-1.0.2.tgz#ad3ff4c86ec2d029322f5a02c3a9a606c95b3f59"
integrity sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k=
encoding@^0.1.11:
version "0.1.13"
resolved "https://registry.yarnpkg.com/encoding/-/encoding-0.1.13.tgz#56574afdd791f54a8e9b2785c0582a2d26210fa9"
integrity sha512-ETBauow1T35Y/WZMkio9jiM0Z5xjHHmJ4XmjZOq1l/dXz3lr2sRn87nJy20RupqSh1F2m3HHPSp8ShIPQJrJ3A==
dependencies:
iconv-lite "^0.6.2"
end-of-stream@^1.0.0, end-of-stream@^1.1.0:
version "1.4.4"
resolved "https://registry.yarnpkg.com/end-of-stream/-/end-of-stream-1.4.4.tgz#5ae64a5f45057baf3626ec14da0ca5e4b2431eb0"
......@@ -3462,6 +3469,11 @@ es-to-primitive@^1.2.1:
is-date-object "^1.0.1"
is-symbol "^1.0.2"
es6-promise@^3.1.2:
version "3.3.1"
resolved "https://registry.yarnpkg.com/es6-promise/-/es6-promise-3.3.1.tgz#a08cdde84ccdbf34d027a1451bc91d4bcd28a613"
integrity sha1-oIzd6EzNvzTQJ6FFG8kdS80ophM=
escalade@^3.1.1:
version "3.1.1"
resolved "https://registry.yarnpkg.com/escalade/-/escalade-3.1.1.tgz#d8cfdc7000965c5a0174b4a82eaa5c0552742e40"
......@@ -4541,6 +4553,13 @@ iconv-lite@0.4.24, iconv-lite@^0.4.24:
dependencies:
safer-buffer ">= 2.1.2 < 3"
iconv-lite@^0.6.2:
version "0.6.2"
resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.6.2.tgz#ce13d1875b0c3a674bd6a04b7f76b01b1b6ded01"
integrity sha512-2y91h5OpQlolefMPmUlivelittSWy0rP+oYVpn6A7GwVHNE8AWzoYOBNmlwks3LobaJxgHCYZAnyNo2GgpNRNQ==
dependencies:
safer-buffer ">= 2.1.2 < 3.0.0"
icss-replace-symbols@^1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/icss-replace-symbols/-/icss-replace-symbols-1.1.0.tgz#06ea6f83679a7749e386cfe1fe812ae5db223ded"
......@@ -4940,7 +4959,7 @@ is-resolvable@^1.0.0:
resolved "https://registry.yarnpkg.com/is-resolvable/-/is-resolvable-1.1.0.tgz#fb18f87ce1feb925169c9a407c19318a3206ed88"
integrity sha512-qgDYXFSR5WvEfuS5dMj6oTMEbrrSaM0CrFk2Yiq/gXnBvD9pMa2jGXxyhGLfvhZpuMZe18CJpFxAt3CRs42NMg==
is-stream@^1.1.0:
is-stream@^1.0.1, is-stream@^1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-1.1.0.tgz#12d4a3dd4e68e0b79ceb8dbc84173ae80d91ca44"
integrity sha1-EtSj3U5o4Lec6428hBc66A2RykQ=
......@@ -5189,6 +5208,17 @@ levn@^0.3.0, levn@~0.3.0:
prelude-ls "~1.1.2"
type-check "~0.3.2"
libzotero@^0.1.13:
version "0.1.13"
resolved "https://registry.yarnpkg.com/libzotero/-/libzotero-0.1.13.tgz#410845b6c1daf6399267021f9cbc34b7c481bb32"
integrity sha1-QQhFtsHa9jmSZwIfnLw0t8SBuzI=
dependencies:
es6-promise "^3.1.2"
node-fetch "^1.6.0"
spark-md5 "^2.0.2"
striptags "^2.1.1"
whatwg-fetch "^1.0.0"
lines-and-columns@^1.1.6:
version "1.1.6"
resolved "https://registry.yarnpkg.com/lines-and-columns/-/lines-and-columns-1.1.6.tgz#1c00c743b433cd0a4e80758f7b64a57440d9ff00"
......@@ -5693,6 +5723,14 @@ no-case@^2.2.0:
dependencies:
lower-case "^1.1.1"
node-fetch@^1.6.0:
version "1.7.3"
resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-1.7.3.tgz#980f6f72d85211a5347c6b2bc18c5b84c3eb47ef"
integrity sha512-NhZ4CsKx7cYm2vSrBAr2PvFOe6sWDf0UYLRqA6svUYg7+/TSfVAu49jYC4BvQ4Sms9SZgdqGBgroqfDhJdTyKQ==
dependencies:
encoding "^0.1.11"
is-stream "^1.0.1"
node-forge@^0.10.0:
version "0.10.0"
resolved "https://registry.yarnpkg.com/node-forge/-/node-forge-0.10.0.tgz#32dea2afb3e9926f02ee5ce8794902691a676bf3"
......@@ -7140,7 +7178,7 @@ safe-regex@^1.1.0:
dependencies:
ret "~0.1.10"
"safer-buffer@>= 2.1.2 < 3", safer-buffer@^2.0.2, safer-buffer@^2.1.0, safer-buffer@~2.1.0:
"safer-buffer@>= 2.1.2 < 3", "safer-buffer@>= 2.1.2 < 3.0.0", safer-buffer@^2.0.2, safer-buffer@^2.1.0, safer-buffer@~2.1.0:
version "2.1.2"
resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a"
integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==
......@@ -7456,6 +7494,11 @@ sourcemap-codec@^1.4.4:
resolved "https://registry.yarnpkg.com/sourcemap-codec/-/sourcemap-codec-1.4.8.tgz#ea804bd94857402e6992d05a38ef1ae35a9ab4c4"
integrity sha512-9NykojV5Uih4lgo5So5dtw+f0JgJX30KCNI8gwhz2J9A15wD0Ml6tjHKwf6fTSa6fAdVBdZeNOs9eJ71qCk8vA==
spark-md5@^2.0.2:
version "2.0.2"
resolved "https://registry.yarnpkg.com/spark-md5/-/spark-md5-2.0.2.tgz#37b763847763ae7e7acef2ca5233d01e649a78b7"
integrity sha1-N7djhHdjrn56zvLKUjPQHmSaeLc=
spdx-correct@^3.0.0:
version "3.1.1"
resolved "https://registry.yarnpkg.com/spdx-correct/-/spdx-correct-3.1.1.tgz#dece81ac9c1e6713e5f7d1b6f17d468fa53d89a9"
......@@ -7716,6 +7759,11 @@ strip-json-comments@^3.0.1:
resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-3.1.1.tgz#31f1281b3832630434831c310c01cccda8cbe006"
integrity sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==
striptags@^2.1.1:
version "2.2.1"
resolved "https://registry.yarnpkg.com/striptags/-/striptags-2.2.1.tgz#4c450b708d41b8bf39cf24c49ff234fc6aabfd32"
integrity sha1-TEULcI1BuL85zyTEn/I0/Gqr/TI=
stylehacks@^4.0.0:
version "4.0.3"
resolved "https://registry.yarnpkg.com/stylehacks/-/stylehacks-4.0.3.tgz#6718fcaf4d1e07d8a1318690881e8d96726a71d5"
......@@ -8491,6 +8539,11 @@ websocket-extensions@>=0.1.1:
resolved "https://registry.yarnpkg.com/websocket-extensions/-/websocket-extensions-0.1.4.tgz#7f8473bc839dfd87608adb95d7eb075211578a42"
integrity sha512-OqedPIGOfsDlo31UNwYbCFMSaO9m9G/0faIHj5/dZFDMFqPTcx6UwqyOy3COEaEOg/9VsGIpdqn62W5KhoKSpg==
whatwg-fetch@^1.0.0:
version "1.1.1"
resolved "https://registry.yarnpkg.com/whatwg-fetch/-/whatwg-fetch-1.1.1.tgz#ac3c9d39f320c6dce5339969d054ef43dd333319"
integrity sha1-rDydOfMgxtzlM5lp0FTvQ90zMxk=
which-module@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/which-module/-/which-module-2.0.0.tgz#d9ef07dce77b9902b8a3a8fa4b31c3e3f7e6e87a"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment