- Further work on openclipart (use qr-manipulation)

master
Brett Zamir 2018-09-26 12:38:00 +08:00
parent 8c0161361f
commit 526c87b61e
3 changed files with 23 additions and 9 deletions

View File

@ -1,4 +1,8 @@
import {jml, $, body} from '../../external/jamilih/jml-es.js';
import {jml, body} from '../../external/jamilih/jml-es.js';
import $ from '../../../node_modules/query-result/esm/index.js';
import {manipulation} from '../../../node_modules/qr-manipulation/dist/index-es.js';
manipulation($, jml);
jml('div', [
['style', [
@ -16,15 +20,11 @@ jml('div', [
$custom: {
async $submit () {
console.log('submit2');
const results = $('#results');
while (results.hasChildNodes()) {
results.firstChild.remove();
}
const url = new URL('https://openclipart.org/search/json/');
[
'query', 'sort', 'amount', 'page'
].forEach((prop) => {
const {value} = $('#' + prop);
const {value} = $('#' + prop)[0];
url.searchParams.set(prop, value);
});
const r = await fetch(url);
@ -41,8 +41,8 @@ jml('div', [
current_page: currentPage
}} = json;
// $('#page').value = currentPage;
// $('#page').max = pages;
// $('#page')[0].value = currentPage;
// $('#page')[0].max = pages;
function queryLink (uploader) {
return ['a', {
@ -64,7 +64,7 @@ jml('div', [
// }` object of relevance?
// - No need for `tags` with `tags_array`
// - `svg`'s: `png_thumb`, `png_full_lossy`, `png_2400px`
jml(results, [
$('#results').htmlJML([
['span', [
'Number of results: ',
numResults

12
package-lock.json generated
View File

@ -5586,12 +5586,24 @@
"integrity": "sha1-fjL3W0E4EpHQRhHxvxQQmsAGUdc=",
"dev": true
},
"qr-manipulation": {
"version": "0.6.1",
"resolved": "https://registry.npmjs.org/qr-manipulation/-/qr-manipulation-0.6.1.tgz",
"integrity": "sha512-H6xACEWInMrv7AiKSH5xqCEO7opn9WGBe14jAreHu3vqjJpgEcBOYfsR2H45sFlXuWcPMz1gphaHhax/6yMAVQ==",
"dev": true
},
"qs": {
"version": "6.5.2",
"resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz",
"integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==",
"dev": true
},
"query-result": {
"version": "0.2.0",
"resolved": "https://registry.npmjs.org/query-result/-/query-result-0.2.0.tgz",
"integrity": "sha512-IYS3H3bctALxk93tgZP7GOSRdsUr/o5rOzzFqZOohX5WNQ3XMQn+pkC7vyVA6bBwDOG0M1mKy8MVhIDkwBS67w==",
"dev": true
},
"qunit": {
"version": "2.6.2",
"resolved": "https://registry.npmjs.org/qunit/-/qunit-2.6.2.tgz",

View File

@ -73,6 +73,8 @@
"node-static": "^0.7.11",
"opn-cli": "^3.1.0",
"promise-fs": "^1.3.0",
"qr-manipulation": "^0.6.1",
"query-result": "^0.2.0",
"qunit": "^2.6.2",
"rollup": "0.66.2",
"rollup-plugin-babel": "^3.0.7",