diff --git a/README.md b/README.md index 14d22c6..a5d53f1 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ sist2 (Simple incremental search tool) * Extracts text and metadata from common file types \* * Generates thumbnails \* * Incremental scanning -* Automatic tagging from file attributes via [user scripts](docs/scripting.md) +* Manual tagging from the UI and automatic tagging based on file attributes via [user scripts](docs/scripting.md) * Recursive scan inside archive files \*\* * OCR support with tesseract \*\*\* * Stats page & disk utilisation visualization diff --git a/docs/USAGE.md b/docs/USAGE.md index f0bbadd..64cb1a0 100644 --- a/docs/USAGE.md +++ b/docs/USAGE.md @@ -15,6 +15,7 @@ * [rewrite_url](#rewrite_url) * [link to specific indices](#link-to-specific-indices) * [exec-script](#exec-script) +* [tagging](#tagging) ``` Usage: sist2 scan [OPTION]... PATH @@ -57,6 +58,7 @@ Web options --es-url= Elasticsearch url. DEFAULT=http://localhost:9200 --bind= Listen on this address. DEFAULT=localhost:4090 --auth= Basic auth in user:password format + --tag-auth= Basic auth in user:password format for tagging Exec-script options --script-file= Path to user script. @@ -145,7 +147,10 @@ documents.idx/ ├── agg_mime.csv ├── agg_date.csv ├── add_size.csv -└── thumbs +├── thumbs +| ├── data.mdb +| └── lock.mdb +└── tags ├── data.mdb └── lock.mdb ``` @@ -270,6 +275,8 @@ sist2 index --print ./my_index/ | jq | less * `--es-url=` Elasticsearch url. * `--bind=` Listen on this address. * `--auth=` Basic auth in user:password format + * `--tag-auth=` Basic auth in user:password format. Works the same way as the + `--auth` argument, but authentication is only applied the `/tag/` endpoint. ### Web examples @@ -301,3 +308,31 @@ not displayed. ## exec-script The `exec-script` command is used to execute a user script for an index that has already been imported to Elasticsearch with the `index` command. Note that the documents will not be reset to their default state before each execution as the `index` command does: if you make undesired changes to the documents by accident, you will need to run `index` again to revert to the original state. + + +# Tagging + +### Manual tagging + +You can modify tags of individual documents directly from the + `web` interface. Note that you can setup authentication for this feature + with the `--tag-auth` option (See [web options](#web-options)) + +![manual_tag](manual_tag.png) + +Tags that are manually added are saved both in the + index folder (in `/tags/`) and in Elasticsearch*. When re-`index`ing, + they are read from the index and automatically applied. + +You can safely copy the `/tags/` database to another index. + +See [Automatic tagging](#automatic-tagging) for information about tag + hierarchies and tag colors. + +\* *It can take a few seconds to take effect in new search queries, and the page needs + to be reloaded for the tag tab to update* + + +### Automatic tagging + +See [scripting](docs/scripting.md) documentation. \ No newline at end of file diff --git a/docs/manual_tag.png b/docs/manual_tag.png new file mode 100644 index 0000000..3ddc78c Binary files /dev/null and b/docs/manual_tag.png differ diff --git a/schema/mappings.json b/schema/mappings.json index d43e5b0..c887484 100644 --- a/schema/mappings.json +++ b/schema/mappings.json @@ -126,7 +126,12 @@ } }, "tag": { - "type": "keyword" + "type": "keyword", + "copy_to": "suggest-tag" + }, + "suggest-tag": { + "type": "completion", + "analyzer": "case_insensitive_kw_analyzer" }, "exif_make": { "type": "text" diff --git a/src/cli.c b/src/cli.c index 7d0ff3c..2576054 100644 --- a/src/cli.c +++ b/src/cli.c @@ -326,7 +326,7 @@ int web_args_validate(web_args_t *args, int argc, const char **argv) { } strncpy(args->auth_user, args->credentials, (ptr - args->credentials)); - strncpy(args->auth_pass, ptr + 1, strlen(ptr + 1)); + strcpy(args->auth_pass, ptr + 1); if (strlen(args->auth_user) == 0) { fprintf(stderr, "--auth username must be at least one character long"); @@ -338,6 +338,31 @@ int web_args_validate(web_args_t *args, int argc, const char **argv) { args->auth_enabled = FALSE; } + if (args->tag_credentials != NULL && args->credentials != NULL) { + fprintf(stderr, "--auth and --tag-auth are mutually exclusive"); + return 1; + } + + if (args->tag_credentials != NULL) { + char *ptr = strstr(args->tag_credentials, ":"); + if (ptr == NULL) { + fprintf(stderr, "Invalid --tag-auth format, see usage\n"); + return 1; + } + + strncpy(args->auth_user, args->tag_credentials, (ptr - args->tag_credentials)); + strcpy(args->auth_pass, ptr + 1); + + if (strlen(args->auth_user) == 0) { + fprintf(stderr, "--tag-auth username must be at least one character long"); + return 1; + } + + args->tag_auth_enabled = TRUE; + } else { + args->tag_auth_enabled = FALSE; + } + args->index_count = argc - 1; args->indices = argv + 1; @@ -352,6 +377,7 @@ int web_args_validate(web_args_t *args, int argc, const char **argv) { LOG_DEBUGF("cli.c", "arg es_url=%s", args->es_url) LOG_DEBUGF("cli.c", "arg listen=%s", args->listen_address) LOG_DEBUGF("cli.c", "arg credentials=%s", args->credentials) + LOG_DEBUGF("cli.c", "arg tag_credentials=%s", args->tag_credentials) LOG_DEBUGF("cli.c", "arg auth_user=%s", args->auth_user) LOG_DEBUGF("cli.c", "arg auth_pass=%s", args->auth_pass) LOG_DEBUGF("cli.c", "arg index_count=%d", args->index_count) diff --git a/src/cli.h b/src/cli.h index c0f785d..ebd853d 100644 --- a/src/cli.h +++ b/src/cli.h @@ -48,9 +48,11 @@ typedef struct web_args { char *es_url; char *listen_address; char *credentials; + char *tag_credentials; char auth_user[256]; char auth_pass[256]; int auth_enabled; + int tag_auth_enabled; int index_count; const char **indices; } web_args_t; diff --git a/src/ctx.h b/src/ctx.h index a35cfb9..04ae8dd 100644 --- a/src/ctx.h +++ b/src/ctx.h @@ -13,6 +13,7 @@ #include "libscan/text/text.h" #include "libscan/mobi/scan_mobi.h" #include "libscan/raw/raw.h" +#include "src/io/store.h" #include #include @@ -59,6 +60,8 @@ typedef struct { char *es_url; int batch_size; tpool_t *pool; + store_t *tag_store; + GHashTable *tags; } IndexCtx_t; typedef struct { @@ -67,6 +70,7 @@ typedef struct { char *auth_user; char *auth_pass; int auth_enabled; + int tag_auth_enabled; struct index_t indices[64]; } WebCtx_t; diff --git a/src/index/elastic.c b/src/index/elastic.c index e3dcb9d..4364932 100644 --- a/src/index/elastic.c +++ b/src/index/elastic.c @@ -313,6 +313,11 @@ void finish_indexer(char *script, char *index_id) { r = web_post(url, ""); LOG_INFOF("elastic.c", "Merge index <%d>", r->status_code); free_response(r); + + snprintf(url, sizeof(url), "%s/sist2/_settings", IndexCtx.es_url); + r = web_put(url, "{\"index\":{\"refresh_interval\":\"1s\"}}"); + LOG_INFOF("elastic.c", "Set refresh interval <%d>", r->status_code); + free_response(r); } void elastic_init(int force_reset) { diff --git a/src/index/static_generated.c b/src/index/static_generated.c index a402d8c..79139df 100644 --- a/src/index/static_generated.c +++ b/src/index/static_generated.c @@ -1,3 +1,3 @@ -char mappings_json[1811] = {123,34,112,114,111,112,101,114,116,105,101,115,34,58,123,34,95,116,105,101,34,58,123,34,116,121,112,101,34,58,34,107,101,121,119,111,114,100,34,44,34,100,111,99,95,118,97,108,117,101,115,34,58,116,114,117,101,125,44,34,95,100,101,112,116,104,34,58,123,34,116,121,112,101,34,58,34,105,110,116,101,103,101,114,34,125,44,34,112,97,116,104,34,58,123,34,116,121,112,101,34,58,34,116,101,120,116,34,44,34,97,110,97,108,121,122,101,114,34,58,34,112,97,116,104,95,97,110,97,108,121,122,101,114,34,44,34,99,111,112,121,95,116,111,34,58,34,115,117,103,103,101,115,116,45,112,97,116,104,34,44,34,102,105,101,108,100,100,97,116,97,34,58,116,114,117,101,44,34,102,105,101,108,100,115,34,58,123,34,110,71,114,97,109,34,58,123,34,116,121,112,101,34,58,34,116,101,120,116,34,44,34,97,110,97,108,121,122,101,114,34,58,34,109,121,95,110,71,114,97,109,34,125,44,34,116,101,120,116,34,58,123,34,116,121,112,101,34,58,34,116,101,120,116,34,44,34,97,110,97,108,121,122,101,114,34,58,34,99,111,110,116,101,110,116,95,97,110,97,108,121,122,101,114,34,125,125,125,44,34,115,117,103,103,101,115,116,45,112,97,116,104,34,58,123,34,116,121,112,101,34,58,34,99,111,109,112,108,101,116,105,111,110,34,44,34,97,110,97,108,121,122,101,114,34,58,34,99,97,115,101,95,105,110,115,101,110,115,105,116,105,118,101,95,107,119,95,97,110,97,108,121,122,101,114,34,125,44,34,109,105,109,101,34,58,123,34,116,121,112,101,34,58,34,107,101,121,119,111,114,100,34,125,44,34,116,104,117,109,98,110,97,105,108,34,58,123,34,116,121,112,101,34,58,34,107,101,121,119,111,114,100,34,44,34,105,110,100,101,120,34,58,102,97,108,115,101,125,44,34,118,105,100,101,111,99,34,58,123,34,116,121,112,101,34,58,34,107,101,121,119,111,114,100,34,44,34,105,110,100,101,120,34,58,102,97,108,115,101,125,44,34,97,117,100,105,111,99,34,58,123,34,116,121,112,101,34,58,34,107,101,121,119,111,114,100,34,44,34,105,110,100,101,120,34,58,102,97,108,115,101,125,44,34,100,117,114,97,116,105,111,110,34,58,123,34,116,121,112,101,34,58,34,102,108,111,97,116,34,44,34,105,110,100,101,120,34,58,102,97,108,115,101,125,44,34,119,105,100,116,104,34,58,123,34,116,121,112,101,34,58,34,105,110,116,101,103,101,114,34,44,34,105,110,100,101,120,34,58,102,97,108,115,101,125,44,34,104,101,105,103,104,116,34,58,123,34,116,121,112,101,34,58,34,105,110,116,101,103,101,114,34,44,34,105,110,100,101,120,34,58,102,97,108,115,101,125,44,34,109,116,105,109,101,34,58,123,34,116,121,112,101,34,58,34,105,110,116,101,103,101,114,34,125,44,34,115,105,122,101,34,58,123,34,116,121,112,101,34,58,34,108,111,110,103,34,125,44,34,105,110,100,101,120,34,58,123,34,116,121,112,101,34,58,34,107,101,121,119,111,114,100,34,125,44,34,110,97,109,101,34,58,123,34,97,110,97,108,121,122,101,114,34,58,34,99,111,110,116,101,110,116,95,97,110,97,108,121,122,101,114,34,44,34,116,121,112,101,34,58,34,116,101,120,116,34,44,34,102,105,101,108,100,115,34,58,123,34,110,71,114,97,109,34,58,123,34,116,121,112,101,34,58,34,116,101,120,116,34,44,34,97,110,97,108,121,122,101,114,34,58,34,109,121,95,110,71,114,97,109,34,125,125,125,44,34,102,111,110,116,95,110,97,109,101,34,58,123,34,97,110,97,108,121,122,101,114,34,58,34,109,121,95,110,71,114,97,109,34,44,34,116,121,112,101,34,58,34,116,101,120,116,34,125,44,34,97,108,98,117,109,34,58,123,34,97,110,97,108,121,122,101,114,34,58,34,109,121,95,110,71,114,97,109,34,44,34,116,121,112,101,34,58,34,116,101,120,116,34,125,44,34,97,114,116,105,115,116,34,58,123,34,97,110,97,108,121,122,101,114,34,58,34,109,121,95,110,71,114,97,109,34,44,34,116,121,112,101,34,58,34,116,101,120,116,34,125,44,34,116,105,116,108,101,34,58,123,34,97,110,97,108,121,122,101,114,34,58,34,109,121,95,110,71,114,97,109,34,44,34,116,121,112,101,34,58,34,116,101,120,116,34,125,44,34,103,101,110,114,101,34,58,123,34,97,110,97,108,121,122,101,114,34,58,34,109,121,95,110,71,114,97,109,34,44,34,116,121,112,101,34,58,34,116,101,120,116,34,125,44,34,97,108,98,117,109,95,97,114,116,105,115,116,34,58,123,34,97,110,97,108,121,122,101,114,34,58,34,109,121,95,110,71,114,97,109,34,44,34,116,121,112,101,34,58,34,116,101,120,116,34,125,44,34,95,107,101,121,119,111,114,100,46,42,34,58,123,34,116,121,112,101,34,58,34,107,101,121,119,111,114,100,34,125,44,34,95,116,101,120,116,46,42,34,58,123,34,97,110,97,108,121,122,101,114,34,58,34,99,111,110,116,101,110,116,95,97,110,97,108,121,122,101,114,34,44,34,116,121,112,101,34,58,34,116,101,120,116,34,44,34,102,105,101,108,100,115,34,58,123,34,110,71,114,97,109,34,58,123,34,116,121,112,101,34,58,34,116,101,120,116,34,44,34,97,110,97,108,121,122,101,114,34,58,34,109,121,95,110,71,114,97,109,34,125,125,125,44,34,95,117,114,108,34,58,123,34,116,121,112,101,34,58,34,107,101,121,119,111,114,100,34,44,34,105,110,100,101,120,34,58,102,97,108,115,101,125,44,34,99,111,110,116,101,110,116,34,58,123,34,97,110,97,108,121,122,101,114,34,58,34,99,111,110,116,101,110,116,95,97,110,97,108,121,122,101,114,34,44,34,116,121,112,101,34,58,34,116,101,120,116,34,44,34,105,110,100,101,120,95,111,112,116,105,111,110,115,34,58,34,111,102,102,115,101,116,115,34,44,34,102,105,101,108,100,115,34,58,123,34,110,71,114,97,109,34,58,123,34,116,121,112,101,34,58,34,116,101,120,116,34,44,34,97,110,97,108,121,122,101,114,34,58,34,109,121,95,110,71,114,97,109,34,125,125,125,44,34,116,97,103,34,58,123,34,116,121,112,101,34,58,34,107,101,121,119,111,114,100,34,125,44,34,101,120,105,102,95,109,97,107,101,34,58,123,34,116,121,112,101,34,58,34,116,101,120,116,34,125,44,34,101,120,105,102,95,109,111,100,101,108,34,58,123,34,116,121,112,101,34,58,34,116,101,120,116,34,125,44,34,101,120,105,102,58,115,111,102,116,119,97,114,101,34,58,123,34,116,121,112,101,34,58,34,116,101,120,116,34,125,44,34,101,120,105,102,95,101,120,112,111,115,117,114,101,95,116,105,109,101,34,58,123,34,116,121,112,101,34,58,34,107,101,121,119,111,114,100,34,125,44,34,101,120,105,102,95,102,110,117,109,98,101,114,34,58,123,34,116,121,112,101,34,58,34,107,101,121,119,111,114,100,34,125,44,34,101,120,105,102,95,105,115,111,95,115,112,101,101,100,95,114,97,116,105,110,103,115,34,58,123,34,116,121,112,101,34,58,34,107,101,121,119,111,114,100,34,125,44,34,101,120,105,102,95,102,111,99,97,108,95,108,101,110,103,116,104,34,58,123,34,116,121,112,101,34,58,34,107,101,121,119,111,114,100,34,125,44,34,101,120,105,102,95,117,115,101,114,95,99,111,109,109,101,110,116,34,58,123,34,116,121,112,101,34,58,34,116,101,120,116,34,125,44,34,97,117,116,104,111,114,34,58,123,34,116,121,112,101,34,58,34,116,101,120,116,34,125,44,34,109,111,100,105,102,105,101,100,95,98,121,34,58,123,34,116,121,112,101,34,58,34,116,101,120,116,34,125,125,125,0}; +char mappings_json[1913] = {123,34,112,114,111,112,101,114,116,105,101,115,34,58,123,34,95,116,105,101,34,58,123,34,116,121,112,101,34,58,34,107,101,121,119,111,114,100,34,44,34,100,111,99,95,118,97,108,117,101,115,34,58,116,114,117,101,125,44,34,95,100,101,112,116,104,34,58,123,34,116,121,112,101,34,58,34,105,110,116,101,103,101,114,34,125,44,34,112,97,116,104,34,58,123,34,116,121,112,101,34,58,34,116,101,120,116,34,44,34,97,110,97,108,121,122,101,114,34,58,34,112,97,116,104,95,97,110,97,108,121,122,101,114,34,44,34,99,111,112,121,95,116,111,34,58,34,115,117,103,103,101,115,116,45,112,97,116,104,34,44,34,102,105,101,108,100,100,97,116,97,34,58,116,114,117,101,44,34,102,105,101,108,100,115,34,58,123,34,110,71,114,97,109,34,58,123,34,116,121,112,101,34,58,34,116,101,120,116,34,44,34,97,110,97,108,121,122,101,114,34,58,34,109,121,95,110,71,114,97,109,34,125,44,34,116,101,120,116,34,58,123,34,116,121,112,101,34,58,34,116,101,120,116,34,44,34,97,110,97,108,121,122,101,114,34,58,34,99,111,110,116,101,110,116,95,97,110,97,108,121,122,101,114,34,125,125,125,44,34,115,117,103,103,101,115,116,45,112,97,116,104,34,58,123,34,116,121,112,101,34,58,34,99,111,109,112,108,101,116,105,111,110,34,44,34,97,110,97,108,121,122,101,114,34,58,34,99,97,115,101,95,105,110,115,101,110,115,105,116,105,118,101,95,107,119,95,97,110,97,108,121,122,101,114,34,125,44,34,109,105,109,101,34,58,123,34,116,121,112,101,34,58,34,107,101,121,119,111,114,100,34,125,44,34,116,104,117,109,98,110,97,105,108,34,58,123,34,116,121,112,101,34,58,34,107,101,121,119,111,114,100,34,44,34,105,110,100,101,120,34,58,102,97,108,115,101,125,44,34,118,105,100,101,111,99,34,58,123,34,116,121,112,101,34,58,34,107,101,121,119,111,114,100,34,44,34,105,110,100,101,120,34,58,102,97,108,115,101,125,44,34,97,117,100,105,111,99,34,58,123,34,116,121,112,101,34,58,34,107,101,121,119,111,114,100,34,44,34,105,110,100,101,120,34,58,102,97,108,115,101,125,44,34,100,117,114,97,116,105,111,110,34,58,123,34,116,121,112,101,34,58,34,102,108,111,97,116,34,44,34,105,110,100,101,120,34,58,102,97,108,115,101,125,44,34,119,105,100,116,104,34,58,123,34,116,121,112,101,34,58,34,105,110,116,101,103,101,114,34,44,34,105,110,100,101,120,34,58,102,97,108,115,101,125,44,34,104,101,105,103,104,116,34,58,123,34,116,121,112,101,34,58,34,105,110,116,101,103,101,114,34,44,34,105,110,100,101,120,34,58,102,97,108,115,101,125,44,34,109,116,105,109,101,34,58,123,34,116,121,112,101,34,58,34,105,110,116,101,103,101,114,34,125,44,34,115,105,122,101,34,58,123,34,116,121,112,101,34,58,34,108,111,110,103,34,125,44,34,105,110,100,101,120,34,58,123,34,116,121,112,101,34,58,34,107,101,121,119,111,114,100,34,125,44,34,110,97,109,101,34,58,123,34,97,110,97,108,121,122,101,114,34,58,34,99,111,110,116,101,110,116,95,97,110,97,108,121,122,101,114,34,44,34,116,121,112,101,34,58,34,116,101,120,116,34,44,34,102,105,101,108,100,115,34,58,123,34,110,71,114,97,109,34,58,123,34,116,121,112,101,34,58,34,116,101,120,116,34,44,34,97,110,97,108,121,122,101,114,34,58,34,109,121,95,110,71,114,97,109,34,125,125,125,44,34,102,111,110,116,95,110,97,109,101,34,58,123,34,97,110,97,108,121,122,101,114,34,58,34,109,121,95,110,71,114,97,109,34,44,34,116,121,112,101,34,58,34,116,101,120,116,34,125,44,34,97,108,98,117,109,34,58,123,34,97,110,97,108,121,122,101,114,34,58,34,109,121,95,110,71,114,97,109,34,44,34,116,121,112,101,34,58,34,116,101,120,116,34,125,44,34,97,114,116,105,115,116,34,58,123,34,97,110,97,108,121,122,101,114,34,58,34,109,121,95,110,71,114,97,109,34,44,34,116,121,112,101,34,58,34,116,101,120,116,34,125,44,34,116,105,116,108,101,34,58,123,34,97,110,97,108,121,122,101,114,34,58,34,109,121,95,110,71,114,97,109,34,44,34,116,121,112,101,34,58,34,116,101,120,116,34,125,44,34,103,101,110,114,101,34,58,123,34,97,110,97,108,121,122,101,114,34,58,34,109,121,95,110,71,114,97,109,34,44,34,116,121,112,101,34,58,34,116,101,120,116,34,125,44,34,97,108,98,117,109,95,97,114,116,105,115,116,34,58,123,34,97,110,97,108,121,122,101,114,34,58,34,109,121,95,110,71,114,97,109,34,44,34,116,121,112,101,34,58,34,116,101,120,116,34,125,44,34,95,107,101,121,119,111,114,100,46,42,34,58,123,34,116,121,112,101,34,58,34,107,101,121,119,111,114,100,34,125,44,34,95,116,101,120,116,46,42,34,58,123,34,97,110,97,108,121,122,101,114,34,58,34,99,111,110,116,101,110,116,95,97,110,97,108,121,122,101,114,34,44,34,116,121,112,101,34,58,34,116,101,120,116,34,44,34,102,105,101,108,100,115,34,58,123,34,110,71,114,97,109,34,58,123,34,116,121,112,101,34,58,34,116,101,120,116,34,44,34,97,110,97,108,121,122,101,114,34,58,34,109,121,95,110,71,114,97,109,34,125,125,125,44,34,95,117,114,108,34,58,123,34,116,121,112,101,34,58,34,107,101,121,119,111,114,100,34,44,34,105,110,100,101,120,34,58,102,97,108,115,101,125,44,34,99,111,110,116,101,110,116,34,58,123,34,97,110,97,108,121,122,101,114,34,58,34,99,111,110,116,101,110,116,95,97,110,97,108,121,122,101,114,34,44,34,116,121,112,101,34,58,34,116,101,120,116,34,44,34,105,110,100,101,120,95,111,112,116,105,111,110,115,34,58,34,111,102,102,115,101,116,115,34,44,34,102,105,101,108,100,115,34,58,123,34,110,71,114,97,109,34,58,123,34,116,121,112,101,34,58,34,116,101,120,116,34,44,34,97,110,97,108,121,122,101,114,34,58,34,109,121,95,110,71,114,97,109,34,125,125,125,44,34,116,97,103,34,58,123,34,116,121,112,101,34,58,34,107,101,121,119,111,114,100,34,44,34,99,111,112,121,95,116,111,34,58,34,115,117,103,103,101,115,116,45,116,97,103,34,125,44,34,115,117,103,103,101,115,116,45,116,97,103,34,58,123,34,116,121,112,101,34,58,34,99,111,109,112,108,101,116,105,111,110,34,44,34,97,110,97,108,121,122,101,114,34,58,34,99,97,115,101,95,105,110,115,101,110,115,105,116,105,118,101,95,107,119,95,97,110,97,108,121,122,101,114,34,125,44,34,101,120,105,102,95,109,97,107,101,34,58,123,34,116,121,112,101,34,58,34,116,101,120,116,34,125,44,34,101,120,105,102,95,109,111,100,101,108,34,58,123,34,116,121,112,101,34,58,34,116,101,120,116,34,125,44,34,101,120,105,102,58,115,111,102,116,119,97,114,101,34,58,123,34,116,121,112,101,34,58,34,116,101,120,116,34,125,44,34,101,120,105,102,95,101,120,112,111,115,117,114,101,95,116,105,109,101,34,58,123,34,116,121,112,101,34,58,34,107,101,121,119,111,114,100,34,125,44,34,101,120,105,102,95,102,110,117,109,98,101,114,34,58,123,34,116,121,112,101,34,58,34,107,101,121,119,111,114,100,34,125,44,34,101,120,105,102,95,105,115,111,95,115,112,101,101,100,95,114,97,116,105,110,103,115,34,58,123,34,116,121,112,101,34,58,34,107,101,121,119,111,114,100,34,125,44,34,101,120,105,102,95,102,111,99,97,108,95,108,101,110,103,116,104,34,58,123,34,116,121,112,101,34,58,34,107,101,121,119,111,114,100,34,125,44,34,101,120,105,102,95,117,115,101,114,95,99,111,109,109,101,110,116,34,58,123,34,116,121,112,101,34,58,34,116,101,120,116,34,125,44,34,97,117,116,104,111,114,34,58,123,34,116,121,112,101,34,58,34,116,101,120,116,34,125,44,34,109,111,100,105,102,105,101,100,95,98,121,34,58,123,34,116,121,112,101,34,58,34,116,101,120,116,34,125,125,125,0}; char settings_json[548] = {123,34,105,110,100,101,120,34,58,123,34,114,101,102,114,101,115,104,95,105,110,116,101,114,118,97,108,34,58,34,51,48,115,34,44,34,99,111,100,101,99,34,58,34,98,101,115,116,95,99,111,109,112,114,101,115,115,105,111,110,34,44,34,110,117,109,98,101,114,95,111,102,95,114,101,112,108,105,99,97,115,34,58,48,125,44,34,97,110,97,108,121,115,105,115,34,58,123,34,116,111,107,101,110,105,122,101,114,34,58,123,34,112,97,116,104,95,116,111,107,101,110,105,122,101,114,34,58,123,34,116,121,112,101,34,58,34,112,97,116,104,95,104,105,101,114,97,114,99,104,121,34,125,44,34,109,121,95,110,71,114,97,109,95,116,111,107,101,110,105,122,101,114,34,58,123,34,116,121,112,101,34,58,34,110,71,114,97,109,34,44,34,109,105,110,95,103,114,97,109,34,58,51,44,34,109,97,120,95,103,114,97,109,34,58,51,125,125,44,34,97,110,97,108,121,122,101,114,34,58,123,34,112,97,116,104,95,97,110,97,108,121,122,101,114,34,58,123,34,116,111,107,101,110,105,122,101,114,34,58,34,112,97,116,104,95,116,111,107,101,110,105,122,101,114,34,44,34,102,105,108,116,101,114,34,58,91,34,108,111,119,101,114,99,97,115,101,34,93,125,44,34,99,97,115,101,95,105,110,115,101,110,115,105,116,105,118,101,95,107,119,95,97,110,97,108,121,122,101,114,34,58,123,34,116,111,107,101,110,105,122,101,114,34,58,34,107,101,121,119,111,114,100,34,44,34,102,105,108,116,101,114,34,58,91,34,108,111,119,101,114,99,97,115,101,34,93,125,44,34,109,121,95,110,71,114,97,109,34,58,123,34,116,111,107,101,110,105,122,101,114,34,58,34,109,121,95,110,71,114,97,109,95,116,111,107,101,110,105,122,101,114,34,44,34,102,105,108,116,101,114,34,58,91,34,108,111,119,101,114,99,97,115,101,34,44,34,97,115,99,105,105,102,111,108,100,105,110,103,34,93,125,44,34,99,111,110,116,101,110,116,95,97,110,97,108,121,122,101,114,34,58,123,34,116,111,107,101,110,105,122,101,114,34,58,34,115,116,97,110,100,97,114,100,34,44,34,102,105,108,116,101,114,34,58,91,34,108,111,119,101,114,99,97,115,101,34,44,34,97,115,99,105,105,102,111,108,100,105,110,103,34,93,125,125,125,125,0}; char pipeline_json[217] = {123,34,100,101,115,99,114,105,112,116,105,111,110,34,58,34,67,111,112,121,32,95,105,100,32,116,111,32,95,116,105,101,44,32,115,97,118,101,32,112,97,116,104,32,100,101,112,116,104,34,44,34,112,114,111,99,101,115,115,111,114,115,34,58,91,123,34,115,99,114,105,112,116,34,58,123,34,115,111,117,114,99,101,34,58,34,99,116,120,46,95,116,105,101,32,61,32,99,116,120,46,95,105,100,59,32,99,116,120,46,95,100,101,112,116,104,32,61,32,99,116,120,46,112,97,116,104,46,108,101,110,103,116,104,40,41,32,61,61,32,48,32,63,32,48,32,58,32,49,32,43,32,99,116,120,46,112,97,116,104,46,108,101,110,103,116,104,40,41,32,45,32,99,116,120,46,112,97,116,104,46,114,101,112,108,97,99,101,40,92,34,47,92,34,44,32,92,34,92,34,41,46,108,101,110,103,116,104,40,41,59,34,125,125,93,125,0}; diff --git a/src/io/serialize.c b/src/io/serialize.c index fde922e..ceecc66 100644 --- a/src/io/serialize.c +++ b/src/io/serialize.c @@ -62,7 +62,7 @@ index_descriptor_t read_index_descriptor(char *path) { int fd = open(path, O_RDONLY); if (fd == -1) { - LOG_FATALF("serialize.c", "Invalid/corrupt index (Could not find descriptor): %s: %s\n", path ,strerror(errno)) + LOG_FATALF("serialize.c", "Invalid/corrupt index (Could not find descriptor): %s: %s\n", path, strerror(errno)) } char *buf = malloc(info.st_size + 1); @@ -172,8 +172,8 @@ void write_document(document_t *doc) { dyn_buffer_t buf = dyn_buffer_create(); // Ignore root directory in the file path - doc->ext = doc->ext - ScanCtx.index.desc.root_len; - doc->base = doc->base - ScanCtx.index.desc.root_len; + doc->ext = (short) (doc->ext - ScanCtx.index.desc.root_len); + doc->base = (short) (doc->base - ScanCtx.index.desc.root_len); doc->filepath += ScanCtx.index.desc.root_len; dyn_buffer_write(&buf, doc, sizeof(line_t)); @@ -230,7 +230,7 @@ void read_index_bin(const char *path, const char *index_id, index_func func) { char uuid_str[UUID_STR_LEN]; uuid_unparse(line.uuid, uuid_str); - const char* mime_text = mime_get_mime_text(line.mime); + const char *mime_text = mime_get_mime_text(line.mime); if (mime_text == NULL) { cJSON_AddNullToObject(document, "mime"); } else { @@ -239,12 +239,18 @@ void read_index_bin(const char *path, const char *index_id, index_func func) { cJSON_AddNumberToObject(document, "size", (double) line.size); cJSON_AddNumberToObject(document, "mtime", line.mtime); - int c; + int c = 0; while ((c = getc(file)) != 0) { dyn_buffer_write_char(&buf, (char) c); } dyn_buffer_write_char(&buf, '\0'); + const char *tags_string = g_hash_table_lookup(IndexCtx.tags, buf.buf); + if (tags_string != NULL) { + cJSON *tags_arr = cJSON_Parse(tags_string); + cJSON_AddItemToObject(document, "tag", tags_arr); + } + cJSON_AddStringToObject(document, "extension", buf.buf + line.ext); if (*(buf.buf + line.ext - 1) == '.') { *(buf.buf + line.ext - 1) = '\0'; diff --git a/src/io/store.c b/src/io/store.c index 0c0e63d..9e08fac 100644 --- a/src/io/store.c +++ b/src/io/store.c @@ -1,9 +1,10 @@ #include "store.h" #include "src/ctx.h" -store_t *store_create(char *path) { +store_t *store_create(char *path, size_t chunk_size) { store_t *store = malloc(sizeof(struct store_t)); + store->chunk_size = chunk_size; pthread_rwlock_init(&store->lock, NULL); mdb_env_create(&store->env); @@ -18,7 +19,7 @@ store_t *store_create(char *path) { LOG_FATALF("store.c", "Error while opening store: %s (%s)\n", mdb_strerror(open_ret), path) } - store->size = (size_t) 1024 * 1024 * 5; + store->size = (size_t) store->chunk_size; ScanCtx.stat_tn_size = 0; mdb_env_set_mapsize(store->env, store->size); @@ -69,7 +70,7 @@ void store_write(store_t *store, char *key, size_t key_len, char *buf, size_t bu // Cannot resize when there is a opened transaction. // Resize take effect on the next commit. pthread_rwlock_wrlock(&store->lock); - store->size += 1024 * 1024 * 50; + store->size += store->chunk_size; mdb_env_set_mapsize(store->env, store->size); mdb_txn_begin(store->env, NULL, 0, &txn); put_ret = mdb_put(txn, store->dbi, &mdb_key, &mdb_value, 0); @@ -110,3 +111,35 @@ char *store_read(store_t *store, char *key, size_t key_len, size_t *ret_vallen) return buf; } +GHashTable *store_read_all(store_t *store) { + + int count = 0; + + GHashTable *table = g_hash_table_new_full(g_str_hash, g_str_equal, free, free); + + MDB_txn *txn = NULL; + mdb_txn_begin(store->env, NULL, MDB_RDONLY, &txn); + + MDB_cursor *cur = NULL; + mdb_cursor_open(txn, store->dbi, &cur); + + MDB_val key; + MDB_val value; + + while (mdb_cursor_get(cur, &key, &value, MDB_NEXT) == 0) { + char *key_str = malloc(key.mv_size); + memcpy(key_str, key.mv_data, key.mv_size); + char *val_str = malloc(value.mv_size); + memcpy(val_str, value.mv_data, value.mv_size); + + g_hash_table_insert(table, key_str, val_str); + count += 1; + } + + LOG_DEBUGF("store.c", "Read tags for %d documents", count); + + mdb_cursor_close(cur); + mdb_txn_abort(txn); + return table; +} + diff --git a/src/io/store.h b/src/io/store.h index f2db3a9..5a8f04e 100644 --- a/src/io/store.h +++ b/src/io/store.h @@ -4,14 +4,20 @@ #include #include +#include + +#define STORE_SIZE_TN 1024 * 1024 * 5 +#define STORE_SIZE_TAG 1024 * 16 + typedef struct store_t { MDB_dbi dbi; MDB_env *env; size_t size; + size_t chunk_size; pthread_rwlock_t lock; } store_t; -store_t *store_create(char *path); +store_t *store_create(char *path, size_t chunk_size); void store_destroy(store_t *store); @@ -19,4 +25,6 @@ void store_write(store_t *store, char *key, size_t key_len, char *buf, size_t bu char *store_read(store_t *store, char *key, size_t key_len, size_t *ret_vallen); +GHashTable *store_read_all(store_t *store); + #endif diff --git a/src/main.c b/src/main.c index 393ed6f..01fd557 100644 --- a/src/main.c +++ b/src/main.c @@ -21,7 +21,7 @@ #define EPILOG "Made by simon987 . Released under GPL-3.0" -static const char *const Version = "2.5.2"; +static const char *const Version = "2.6.0"; static const char *const usage[] = { "sist2 scan [OPTION]... PATH", "sist2 index [OPTION]... INDEX", @@ -176,7 +176,7 @@ void sist2_scan(scan_args_t *args) { char store_path[PATH_MAX]; snprintf(store_path, PATH_MAX, "%sthumbs", ScanCtx.index.path); mkdir(store_path, S_IWUSR | S_IRUSR | S_IXUSR); - ScanCtx.index.store = store_create(store_path); + ScanCtx.index.store = store_create(store_path, STORE_SIZE_TN); scan_print_header(); @@ -223,7 +223,7 @@ void sist2_scan(scan_args_t *args) { char dst_path[PATH_MAX]; snprintf(store_path, PATH_MAX, "%sthumbs", args->incremental); snprintf(dst_path, PATH_MAX, "%s_index_original", ScanCtx.index.path); - store_t *source = store_create(store_path); + store_t *source = store_create(store_path, STORE_SIZE_TN); DIR *dir = opendir(args->incremental); if (dir == NULL) { @@ -271,6 +271,12 @@ void sist2_index(index_args_t *args) { LOG_FATALF("main.c", "Could not open index %s: %s", args->index_path, strerror(errno)) } + char path_tmp[PATH_MAX]; + snprintf(path_tmp, sizeof(path_tmp), "%s/tags", args->index_path); + mkdir(path_tmp, S_IWUSR | S_IRUSR | S_IXUSR); + IndexCtx.tag_store = store_create(path_tmp, STORE_SIZE_TAG); + IndexCtx.tags = store_read_all(IndexCtx.tag_store); + index_func f; if (args->print) { f = print_json; @@ -303,8 +309,11 @@ void sist2_index(index_args_t *args) { if (!args->print) { finish_indexer(args->script, desc.uuid); } - tpool_destroy(IndexCtx.pool); + + store_destroy(IndexCtx.tag_store); + g_hash_table_remove_all(IndexCtx.tags); + g_hash_table_destroy(IndexCtx.tags); } void sist2_exec_script(exec_args_t *args) { @@ -330,6 +339,7 @@ void sist2_web(web_args_t *args) { WebCtx.auth_user = args->auth_user; WebCtx.auth_pass = args->auth_pass; WebCtx.auth_enabled = args->auth_enabled; + WebCtx.tag_auth_enabled = args->tag_auth_enabled; for (int i = 0; i < args->index_count; i++) { char *abs_path = abspath(args->indices[i]); @@ -339,7 +349,11 @@ void sist2_web(web_args_t *args) { char path_tmp[PATH_MAX]; snprintf(path_tmp, PATH_MAX, "%sthumbs", abs_path); - WebCtx.indices[i].store = store_create(path_tmp); + WebCtx.indices[i].store = store_create(path_tmp, STORE_SIZE_TN); + + snprintf(path_tmp, PATH_MAX, "%stags", abs_path); + mkdir(path_tmp, S_IWUSR | S_IRUSR | S_IXUSR); + WebCtx.indices[i].tag_store = store_create(path_tmp, STORE_SIZE_TAG); snprintf(path_tmp, PATH_MAX, "%sdescriptor.json", abs_path); WebCtx.indices[i].desc = read_index_descriptor(path_tmp); @@ -415,6 +429,7 @@ int main(int argc, const char *argv[]) { OPT_STRING(0, "es-url", &common_es_url, "Elasticsearch url. DEFAULT=http://localhost:9200"), OPT_STRING(0, "bind", &web_args->listen_address, "Listen on this address. DEFAULT=localhost:4090"), OPT_STRING(0, "auth", &web_args->credentials, "Basic auth in user:password format"), + OPT_STRING(0, "tag-auth", &web_args->tag_credentials, "Basic auth in user:password format for tagging"), OPT_GROUP("Exec-script options"), OPT_STRING(0, "script-file", &common_script_path, "Path to user script."), diff --git a/src/static/css/bootstrap-colorpicker.min.css b/src/static/css/bootstrap-colorpicker.min.css new file mode 100644 index 0000000..b1ed362 --- /dev/null +++ b/src/static/css/bootstrap-colorpicker.min.css @@ -0,0 +1,9 @@ +/*! + * Bootstrap Colorpicker - Bootstrap Colorpicker is a modular color picker plugin for Bootstrap 4. + * @package bootstrap-colorpicker + * @version v3.1.2 + * @license MIT + * @link https://farbelous.github.io/bootstrap-colorpicker/ + * @link https://github.com/farbelous/bootstrap-colorpicker.git + */ +.colorpicker{position:relative;display:none;font-size:inherit;color:inherit;text-align:left;list-style:none;background-color:#fff;background-clip:padding-box;border:1px solid rgba(0,0,0,.2);padding:.75rem .75rem;width:148px;border-radius:4px;-webkit-box-sizing:content-box;box-sizing:content-box}.colorpicker.colorpicker-disabled,.colorpicker.colorpicker-disabled *{cursor:default!important}.colorpicker div{position:relative}.colorpicker-popup{position:absolute;top:100%;left:0;float:left;margin-top:1px;z-index:1060}.colorpicker-popup.colorpicker-bs-popover-content{position:relative;top:auto;left:auto;float:none;margin:0;z-index:initial;border:none;padding:.25rem 0;border-radius:0;background:0 0;-webkit-box-shadow:none;box-shadow:none}.colorpicker:after,.colorpicker:before{content:"";display:table;clear:both;line-height:0}.colorpicker-clear{clear:both;display:block}.colorpicker:before{content:'';display:inline-block;border-left:7px solid transparent;border-right:7px solid transparent;border-bottom:7px solid #ccc;border-bottom-color:rgba(0,0,0,.2);position:absolute;top:-7px;left:auto;right:6px}.colorpicker:after{content:'';display:inline-block;border-left:6px solid transparent;border-right:6px solid transparent;border-bottom:6px solid #fff;position:absolute;top:-6px;left:auto;right:7px}.colorpicker.colorpicker-with-alpha{width:170px}.colorpicker.colorpicker-with-alpha .colorpicker-alpha{display:block}.colorpicker-saturation{position:relative;width:126px;height:126px;background:-webkit-gradient(linear,left top,left bottom,from(transparent),to(black)),-webkit-gradient(linear,left top,right top,from(white),to(rgba(255,255,255,0)));background:linear-gradient(to bottom,transparent 0,#000 100%),linear-gradient(to right,#fff 0,rgba(255,255,255,0) 100%);cursor:crosshair;float:left;-webkit-box-shadow:0 0 0 1px rgba(0,0,0,.2);box-shadow:0 0 0 1px rgba(0,0,0,.2);margin-bottom:6px}.colorpicker-saturation .colorpicker-guide{display:block;height:6px;width:6px;border-radius:6px;border:1px solid #000;-webkit-box-shadow:0 0 0 1px rgba(255,255,255,.8);box-shadow:0 0 0 1px rgba(255,255,255,.8);position:absolute;top:0;left:0;margin:-3px 0 0 -3px}.colorpicker-alpha,.colorpicker-hue{position:relative;width:16px;height:126px;float:left;cursor:row-resize;margin-left:6px;margin-bottom:6px}.colorpicker-alpha-color{position:absolute;top:0;left:0;width:100%;height:100%}.colorpicker-alpha-color,.colorpicker-hue{-webkit-box-shadow:0 0 0 1px rgba(0,0,0,.2);box-shadow:0 0 0 1px rgba(0,0,0,.2)}.colorpicker-alpha .colorpicker-guide,.colorpicker-hue .colorpicker-guide{display:block;height:4px;background:rgba(255,255,255,.8);border:1px solid rgba(0,0,0,.4);position:absolute;top:0;left:0;margin-left:-2px;margin-top:-2px;right:-2px;z-index:1}.colorpicker-hue{background:-webkit-gradient(linear,left bottom,left top,from(red),color-stop(8%,#ff8000),color-stop(17%,#ff0),color-stop(25%,#80ff00),color-stop(33%,#0f0),color-stop(42%,#00ff80),color-stop(50%,#0ff),color-stop(58%,#0080ff),color-stop(67%,#00f),color-stop(75%,#8000ff),color-stop(83%,#ff00ff),color-stop(92%,#ff0080),to(red));background:linear-gradient(to top,red 0,#ff8000 8%,#ff0 17%,#80ff00 25%,#0f0 33%,#00ff80 42%,#0ff 50%,#0080ff 58%,#00f 67%,#8000ff 75%,#ff00ff 83%,#ff0080 92%,red 100%)}.colorpicker-alpha{background:linear-gradient(45deg,rgba(0,0,0,.1) 25%,transparent 25%,transparent 75%,rgba(0,0,0,.1) 75%,rgba(0,0,0,.1) 0),linear-gradient(45deg,rgba(0,0,0,.1) 25%,transparent 25%,transparent 75%,rgba(0,0,0,.1) 75%,rgba(0,0,0,.1) 0),#fff;background-size:10px 10px;background-position:0 0,5px 5px;display:none}.colorpicker-bar{min-height:16px;margin:6px 0 0 0;clear:both;text-align:center;font-size:10px;line-height:normal;max-width:100%;-webkit-box-shadow:0 0 0 1px rgba(0,0,0,.2);box-shadow:0 0 0 1px rgba(0,0,0,.2)}.colorpicker-bar:before{content:"";display:table;clear:both}.colorpicker-bar.colorpicker-bar-horizontal{height:126px;width:16px;margin:0 0 6px 0;float:left}.colorpicker-input-addon{position:relative}.colorpicker-input-addon i{display:inline-block;cursor:pointer;vertical-align:text-top;height:16px;width:16px;position:relative}.colorpicker-input-addon:before{content:"";position:absolute;width:16px;height:16px;display:inline-block;vertical-align:text-top;background:linear-gradient(45deg,rgba(0,0,0,.1) 25%,transparent 25%,transparent 75%,rgba(0,0,0,.1) 75%,rgba(0,0,0,.1) 0),linear-gradient(45deg,rgba(0,0,0,.1) 25%,transparent 25%,transparent 75%,rgba(0,0,0,.1) 75%,rgba(0,0,0,.1) 0),#fff;background-size:10px 10px;background-position:0 0,5px 5px}.colorpicker.colorpicker-inline{position:relative;display:inline-block;float:none;z-index:auto;vertical-align:text-bottom}.colorpicker.colorpicker-horizontal{width:126px;height:auto}.colorpicker.colorpicker-horizontal .colorpicker-bar{width:126px}.colorpicker.colorpicker-horizontal .colorpicker-saturation{float:none;margin-bottom:0}.colorpicker.colorpicker-horizontal .colorpicker-alpha,.colorpicker.colorpicker-horizontal .colorpicker-hue{float:none;width:126px;height:16px;cursor:col-resize;margin-left:0;margin-top:6px;margin-bottom:0}.colorpicker.colorpicker-horizontal .colorpicker-alpha .colorpicker-guide,.colorpicker.colorpicker-horizontal .colorpicker-hue .colorpicker-guide{position:absolute;display:block;bottom:-2px;left:0;right:auto;height:auto;width:4px}.colorpicker.colorpicker-horizontal .colorpicker-hue{background:-webkit-gradient(linear,right top,left top,from(red),color-stop(8%,#ff8000),color-stop(17%,#ff0),color-stop(25%,#80ff00),color-stop(33%,#0f0),color-stop(42%,#00ff80),color-stop(50%,#0ff),color-stop(58%,#0080ff),color-stop(67%,#00f),color-stop(75%,#8000ff),color-stop(83%,#ff00ff),color-stop(92%,#ff0080),to(red));background:linear-gradient(to left,red 0,#ff8000 8%,#ff0 17%,#80ff00 25%,#0f0 33%,#00ff80 42%,#0ff 50%,#0080ff 58%,#00f 67%,#8000ff 75%,#ff00ff 83%,#ff0080 92%,red 100%)}.colorpicker.colorpicker-horizontal .colorpicker-alpha{background:linear-gradient(45deg,rgba(0,0,0,.1) 25%,transparent 25%,transparent 75%,rgba(0,0,0,.1) 75%,rgba(0,0,0,.1) 0),linear-gradient(45deg,rgba(0,0,0,.1) 25%,transparent 25%,transparent 75%,rgba(0,0,0,.1) 75%,rgba(0,0,0,.1) 0),#fff;background-size:10px 10px;background-position:0 0,5px 5px}.colorpicker-inline:before,.colorpicker-no-arrow:before,.colorpicker-popup.colorpicker-bs-popover-content:before{content:none;display:none}.colorpicker-inline:after,.colorpicker-no-arrow:after,.colorpicker-popup.colorpicker-bs-popover-content:after{content:none;display:none}.colorpicker-alpha,.colorpicker-hue,.colorpicker-saturation{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.colorpicker-alpha.colorpicker-visible,.colorpicker-bar.colorpicker-visible,.colorpicker-hue.colorpicker-visible,.colorpicker-saturation.colorpicker-visible,.colorpicker.colorpicker-visible{display:block}.colorpicker-alpha.colorpicker-hidden,.colorpicker-bar.colorpicker-hidden,.colorpicker-hue.colorpicker-hidden,.colorpicker-saturation.colorpicker-hidden,.colorpicker.colorpicker-hidden{display:none}.colorpicker-inline.colorpicker-visible{display:inline-block}.colorpicker.colorpicker-disabled:after{border:none;content:'';display:block;width:100%;height:100%;background:rgba(233,236,239,.33);top:0;left:0;right:auto;z-index:2;position:absolute}.colorpicker.colorpicker-disabled .colorpicker-guide{display:none}.colorpicker-preview{background:linear-gradient(45deg,rgba(0,0,0,.1) 25%,transparent 25%,transparent 75%,rgba(0,0,0,.1) 75%,rgba(0,0,0,.1) 0),linear-gradient(45deg,rgba(0,0,0,.1) 25%,transparent 25%,transparent 75%,rgba(0,0,0,.1) 75%,rgba(0,0,0,.1) 0),#fff;background-size:10px 10px;background-position:0 0,5px 5px}.colorpicker-preview>div{position:absolute;left:0;top:0;width:100%;height:100%}.colorpicker-bar.colorpicker-swatches{-webkit-box-shadow:none;box-shadow:none;height:auto}.colorpicker-swatches--inner{clear:both;margin-top:-6px}.colorpicker-swatch{position:relative;cursor:pointer;float:left;height:16px;width:16px;margin-right:6px;margin-top:6px;margin-left:0;display:block;-webkit-box-shadow:0 0 0 1px rgba(0,0,0,.2);box-shadow:0 0 0 1px rgba(0,0,0,.2);background:linear-gradient(45deg,rgba(0,0,0,.1) 25%,transparent 25%,transparent 75%,rgba(0,0,0,.1) 75%,rgba(0,0,0,.1) 0),linear-gradient(45deg,rgba(0,0,0,.1) 25%,transparent 25%,transparent 75%,rgba(0,0,0,.1) 75%,rgba(0,0,0,.1) 0),#fff;background-size:10px 10px;background-position:0 0,5px 5px}.colorpicker-swatch--inner{position:absolute;top:0;left:0;width:100%;height:100%}.colorpicker-swatch:nth-of-type(7n+0){margin-right:0}.colorpicker-with-alpha .colorpicker-swatch:nth-of-type(7n+0){margin-right:6px}.colorpicker-with-alpha .colorpicker-swatch:nth-of-type(8n+0){margin-right:0}.colorpicker-horizontal .colorpicker-swatch:nth-of-type(6n+0){margin-right:0}.colorpicker-horizontal .colorpicker-swatch:nth-of-type(7n+0){margin-right:6px}.colorpicker-horizontal .colorpicker-swatch:nth-of-type(8n+0){margin-right:6px}.colorpicker-swatch:last-of-type:after{content:"";display:table;clear:both}.colorpicker-element input[dir=rtl],.colorpicker-element[dir=rtl] input,[dir=rtl] .colorpicker-element input{direction:ltr;text-align:right} diff --git a/src/static/css/dark.css b/src/static/css/dark.css index 301e135..71d2b2d 100644 --- a/src/static/css/dark.css +++ b/src/static/css/dark.css @@ -166,6 +166,12 @@ a:hover,.btn:hover { background-color: #FAAB3C; } +.add-tag-button { + cursor: pointer; + color: #212529; + background-color: #e0e0e0; +} + .card-img-overlay { pointer-events: none; padding: 0.75rem; @@ -191,6 +197,18 @@ a:hover,.btn:hover { margin-right: 3px; } +.badge-delete { + margin-right: -2px; + margin-left: 2px; + margin-top: -1px; + font-family: monospace; + font-size: 90%; + background: rgba(0,0,0,0.2); + padding: 0.1em 0.4em; + color: white; + cursor: pointer; +} + .badge-user { color: #212529; background-color: #e0e0e0; @@ -516,3 +534,7 @@ svg { .wholerow { outline: none !important; } + +.stat > .card-body { + padding: 0.7em 1.25em; +} diff --git a/src/static/css/light.css b/src/static/css/light.css index 68a3dbf..18249ff 100644 --- a/src/static/css/light.css +++ b/src/static/css/light.css @@ -106,11 +106,33 @@ body { background-color: #e0e0e0; } +.badge { + margin-right: 3px; +} + +.badge-delete { + margin-right: -2px; + margin-left: 2px; + margin-top: -1px; + font-family: monospace; + font-size: 90%; + background: rgba(0,0,0,0.2); + padding: 0.1em 0.4em; + color: white; + cursor: pointer; +} + .badge-text { color: #FFFFFF; background-color: #FAAB3C; } +.add-tag-button { + cursor: pointer; + color: #212529; + background-color: #e0e0e0; +} + .card-img-overlay { pointer-events: none; padding: 0.75rem; @@ -131,9 +153,6 @@ body { overflow: hidden; } -.badge { - margin-right: 3px; -} .fit { display: block; @@ -379,3 +398,7 @@ mark { .wholerow { outline: none !important; } + +.stat > .card-body { + padding: 0.7em 1.25em; +} \ No newline at end of file diff --git a/src/static/js/bootstrap-colorpicker.min.js b/src/static/js/bootstrap-colorpicker.min.js new file mode 100644 index 0000000..23d91a7 --- /dev/null +++ b/src/static/js/bootstrap-colorpicker.min.js @@ -0,0 +1,9 @@ +/*! + * Bootstrap Colorpicker - Bootstrap Colorpicker is a modular color picker plugin for Bootstrap 4. + * @package bootstrap-colorpicker + * @version v3.1.2 + * @license MIT + * @link https://farbelous.github.io/bootstrap-colorpicker/ + * @link https://github.com/farbelous/bootstrap-colorpicker.git + */ +!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("jquery")):"function"==typeof define&&define.amd?define("bootstrap-colorpicker",["jquery"],t):"object"==typeof exports?exports["bootstrap-colorpicker"]=t(require("jquery")):e["bootstrap-colorpicker"]=t(e.jQuery)}("undefined"!=typeof self?self:this,function(e){return function(e){function t(r){if(o[r])return o[r].exports;var n=o[r]={i:r,l:!1,exports:{}};return e[r].call(n.exports,n,n.exports,t),n.l=!0,n.exports}var o={};return t.m=e,t.c=o,t.d=function(e,o,r){t.o(e,o)||Object.defineProperty(e,o,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var o=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(o,"a",o),o},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=7)}([function(t,o){t.exports=e},function(e,t,o){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(e,t){for(var o=0;o1&&void 0!==arguments[1]?arguments[1]:{};if(r(this,e),this.colorpicker=t,this.options=o,!this.colorpicker.element||!this.colorpicker.element.length)throw new Error("Extension: this.colorpicker.element is not valid");this.colorpicker.element.on("colorpickerCreate.colorpicker-ext",a.default.proxy(this.onCreate,this)),this.colorpicker.element.on("colorpickerDestroy.colorpicker-ext",a.default.proxy(this.onDestroy,this)),this.colorpicker.element.on("colorpickerUpdate.colorpicker-ext",a.default.proxy(this.onUpdate,this)),this.colorpicker.element.on("colorpickerChange.colorpicker-ext",a.default.proxy(this.onChange,this)),this.colorpicker.element.on("colorpickerInvalid.colorpicker-ext",a.default.proxy(this.onInvalid,this)),this.colorpicker.element.on("colorpickerShow.colorpicker-ext",a.default.proxy(this.onShow,this)),this.colorpicker.element.on("colorpickerHide.colorpicker-ext",a.default.proxy(this.onHide,this)),this.colorpicker.element.on("colorpickerEnable.colorpicker-ext",a.default.proxy(this.onEnable,this)),this.colorpicker.element.on("colorpickerDisable.colorpicker-ext",a.default.proxy(this.onDisable,this))}return n(e,[{key:"resolveColor",value:function(e){!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return!1}},{key:"onCreate",value:function(e){}},{key:"onDestroy",value:function(e){this.colorpicker.element.off(".colorpicker-ext")}},{key:"onUpdate",value:function(e){}},{key:"onChange",value:function(e){}},{key:"onInvalid",value:function(e){}},{key:"onHide",value:function(e){}},{key:"onShow",value:function(e){}},{key:"onDisable",value:function(e){}},{key:"onEnable",value:function(e){}}]),e}();t.default=l},function(e,t,o){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0}),t.ColorItem=t.HSVAColor=void 0;var n=function(){function e(e,t){for(var o=0;o0&&void 0!==arguments[0]?arguments[0]:null,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;r(this,e),this.replace(t,o)}return n(e,[{key:"api",value:function(t){for(var o=arguments.length,r=Array(o>1?o-1:0),n=1;n1&&void 0!==arguments[1]?arguments[1]:null;if(o=e.sanitizeFormat(o),this._original={color:t,format:o,valid:!0},this._color=e.parse(t),null===this._color)return this._color=(0,a.default)(),void(this._original.valid=!1);this._format=o||(e.isHex(t)?"hex":this._color.model)}},{key:"isValid",value:function(){return!0===this._original.valid}},{key:"setHueRatio",value:function(e){this.hue=360*(1-e)}},{key:"setSaturationRatio",value:function(e){this.saturation=100*e}},{key:"setValueRatio",value:function(e){this.value=100*(1-e)}},{key:"setAlphaRatio",value:function(e){this.alpha=1-e}},{key:"isDesaturated",value:function(){return 0===this.saturation}},{key:"isTransparent",value:function(){return 0===this.alpha}},{key:"hasTransparency",value:function(){return this.hasAlpha()&&this.alpha<1}},{key:"hasAlpha",value:function(){return!isNaN(this.alpha)}},{key:"toObject",value:function(){return new l(this.hue,this.saturation,this.value,this.alpha)}},{key:"toHsva",value:function(){return this.toObject()}},{key:"toHsvaRatio",value:function(){return new l(this.hue/360,this.saturation/100,this.value/100,this.alpha)}},{key:"toString",value:function(){return this.string()}},{key:"string",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;if(!(t=e.sanitizeFormat(t||this.format)))return this._color.round().string();if(void 0===this._color[t])throw new Error("Unsupported color format: '"+t+"'");var o=this._color[t]();return o.round?o.round().string():o}},{key:"equals",value:function(t){return t=t instanceof e?t:new e(t),!(!t.isValid()||!this.isValid())&&(this.hue===t.hue&&this.saturation===t.saturation&&this.value===t.value&&this.alpha===t.alpha)}},{key:"getClone",value:function(){return new e(this._color,this.format)}},{key:"getCloneHueOnly",value:function(){return new e([this.hue,100,100,1],this.format)}},{key:"getCloneOpaque",value:function(){return new e(this._color.alpha(1),this.format)}},{key:"toRgbString",value:function(){return this.string("rgb")}},{key:"toHexString",value:function(){return this.string("hex")}},{key:"toHslString",value:function(){return this.string("hsl")}},{key:"isDark",value:function(){return this._color.isDark()}},{key:"isLight",value:function(){return this._color.isLight()}},{key:"generate",value:function(t){var o=[];if(Array.isArray(t))o=t;else{if(!e.colorFormulas.hasOwnProperty(t))throw new Error("No color formula found with the name '"+t+"'.");o=e.colorFormulas[t]}var r=[],n=this._color,i=this.format;return o.forEach(function(t){var o=[t?(n.hue()+t)%360:n.hue(),n.saturationv(),n.value(),n.alpha()];r.push(new e(o,i))}),r}},{key:"hue",get:function(){return this._color.hue()},set:function(e){this._color=this._color.hue(e)}},{key:"saturation",get:function(){return this._color.saturationv()},set:function(e){this._color=this._color.saturationv(e)}},{key:"value",get:function(){return this._color.value()},set:function(e){this._color=this._color.value(e)}},{key:"alpha",get:function(){var e=this._color.alpha();return isNaN(e)?1:e},set:function(e){this._color=this._color.alpha(Math.round(100*e)/100)}},{key:"format",get:function(){return this._format?this._format:this._color.model},set:function(t){this._format=e.sanitizeFormat(t)}}],[{key:"parse",value:function(t){if(t instanceof a.default)return t;if(t instanceof e)return t._color;var o=null;if(null===(t=t instanceof l?[t.h,t.s,t.v,isNaN(t.a)?1:t.a]:e.sanitizeString(t)))return null;Array.isArray(t)&&(o="hsv");try{return(0,a.default)(t,o)}catch(e){return null}}},{key:"sanitizeString",value:function(e){return"string"==typeof e||e instanceof String?e.match(/^[0-9a-f]{2,}$/i)?"#"+e:"transparent"===e.toLowerCase()?"#FFFFFF00":e:e}},{key:"isHex",value:function(e){return("string"==typeof e||e instanceof String)&&!!e.match(/^#?[0-9a-f]{2,}$/i)}},{key:"sanitizeFormat",value:function(e){switch(e){case"hex":case"hex3":case"hex4":case"hex6":case"hex8":return"hex";case"rgb":case"rgba":case"keyword":case"name":return"rgb";case"hsl":case"hsla":case"hsv":case"hsva":case"hwb":case"hwba":return"hsl";default:return""}}}]),e}();s.colorFormulas={complementary:[180],triad:[0,120,240],tetrad:[0,90,180,270],splitcomplement:[0,72,216]},t.default=s,t.HSVAColor=l,t.ColorItem=s},function(e,t,o){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r={bar_size_short:16,base_margin:6,columns:6},n=r.bar_size_short*r.columns+r.base_margin*(r.columns-1);t.default={customClass:null,color:!1,fallbackColor:!1,format:"auto",horizontal:!1,inline:!1,container:!1,popover:{animation:!0,placement:"bottom",fallbackPlacement:"flip"},debug:!1,input:"input",addon:".colorpicker-input-addon",autoInputFallback:!0,useHashPrefix:!0,useAlpha:!0,template:'
\n
\n
\n
\n
\n \n
\n
',extensions:[{name:"preview",options:{showText:!0}}],sliders:{saturation:{selector:".colorpicker-saturation",maxLeft:n,maxTop:n,callLeft:"setSaturationRatio",callTop:"setValueRatio"},hue:{selector:".colorpicker-hue",maxLeft:0,maxTop:n,callLeft:!1,callTop:"setHueRatio"},alpha:{selector:".colorpicker-alpha",childSelector:".colorpicker-alpha-color",maxLeft:0,maxTop:n,callLeft:!1,callTop:"setAlphaRatio"}},slidersHorz:{saturation:{selector:".colorpicker-saturation",maxLeft:n,maxTop:n,callLeft:"setSaturationRatio",callTop:"setValueRatio"},hue:{selector:".colorpicker-hue",maxLeft:n,maxTop:0,callLeft:"setHueRatio",callTop:!1},alpha:{selector:".colorpicker-alpha",childSelector:".colorpicker-alpha-color",maxLeft:n,maxTop:0,callLeft:"setAlphaRatio",callTop:!1}}}},function(e,t,o){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},s=function(){function e(e,t){for(var o=0;o1&&void 0!==arguments[1]?arguments[1]:{};n(this,t);var r=i(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,p.default.extend(!0,{},f,o)));return Array.isArray(r.options.colors)||"object"===l(r.options.colors)||(r.options.colors=null),r}return a(t,e),s(t,[{key:"colors",get:function(){return this.options.colors}}]),s(t,[{key:"getLength",value:function(){return this.options.colors?Array.isArray(this.options.colors)?this.options.colors.length:"object"===l(this.options.colors)?Object.keys(this.options.colors).length:0:0}},{key:"resolveColor",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return!(this.getLength()<=0)&&(Array.isArray(this.options.colors)?this.options.colors.indexOf(e)>=0?e:this.options.colors.indexOf(e.toUpperCase())>=0?e.toUpperCase():this.options.colors.indexOf(e.toLowerCase())>=0&&e.toLowerCase():"object"===l(this.options.colors)&&(!this.options.namesAsValues||t?this.getValue(e,!1):this.getName(e,this.getName("#"+e))))}},{key:"getName",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if("string"!=typeof e||!this.options.colors)return t;for(var o in this.options.colors)if(this.options.colors.hasOwnProperty(o)&&this.options.colors[o].toLowerCase()===e.toLowerCase())return o;return t}},{key:"getValue",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return"string"==typeof e&&this.options.colors&&this.options.colors.hasOwnProperty(e)?this.options.colors[e]:t}}]),t}(u.default);t.default=d},function(e,t,o){"use strict";e.exports={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]}},function(e,t,o){function r(e,t){return Math.pow(e[0]-t[0],2)+Math.pow(e[1]-t[1],2)+Math.pow(e[2]-t[2],2)}var n=o(5),i={};for(var a in n)n.hasOwnProperty(a)&&(i[n[a]]=a);var l=e.exports={rgb:{channels:3,labels:"rgb"},hsl:{channels:3,labels:"hsl"},hsv:{channels:3,labels:"hsv"},hwb:{channels:3,labels:"hwb"},cmyk:{channels:4,labels:"cmyk"},xyz:{channels:3,labels:"xyz"},lab:{channels:3,labels:"lab"},lch:{channels:3,labels:"lch"},hex:{channels:1,labels:["hex"]},keyword:{channels:1,labels:["keyword"]},ansi16:{channels:1,labels:["ansi16"]},ansi256:{channels:1,labels:["ansi256"]},hcg:{channels:3,labels:["h","c","g"]},apple:{channels:3,labels:["r16","g16","b16"]},gray:{channels:1,labels:["gray"]}};for(var s in l)if(l.hasOwnProperty(s)){if(!("channels"in l[s]))throw new Error("missing channels property: "+s);if(!("labels"in l[s]))throw new Error("missing channel labels property: "+s);if(l[s].labels.length!==l[s].channels)throw new Error("channel and label counts mismatch: "+s);var c=l[s].channels,u=l[s].labels;delete l[s].channels,delete l[s].labels,Object.defineProperty(l[s],"channels",{value:c}),Object.defineProperty(l[s],"labels",{value:u})}l.rgb.hsl=function(e){var t,o,r,n=e[0]/255,i=e[1]/255,a=e[2]/255,l=Math.min(n,i,a),s=Math.max(n,i,a),c=s-l;return s===l?t=0:n===s?t=(i-a)/c:i===s?t=2+(a-n)/c:a===s&&(t=4+(n-i)/c),t=Math.min(60*t,360),t<0&&(t+=360),r=(l+s)/2,o=s===l?0:r<=.5?c/(s+l):c/(2-s-l),[t,100*o,100*r]},l.rgb.hsv=function(e){var t,o,r,n,i,a=e[0]/255,l=e[1]/255,s=e[2]/255,c=Math.max(a,l,s),u=c-Math.min(a,l,s),h=function(e){return(c-e)/6/u+.5};return 0===u?n=i=0:(i=u/c,t=h(a),o=h(l),r=h(s),a===c?n=r-o:l===c?n=1/3+t-r:s===c&&(n=2/3+o-t),n<0?n+=1:n>1&&(n-=1)),[360*n,100*i,100*c]},l.rgb.hwb=function(e){var t=e[0],o=e[1],r=e[2],n=l.rgb.hsl(e)[0],i=1/255*Math.min(t,Math.min(o,r));return r=1-1/255*Math.max(t,Math.max(o,r)),[n,100*i,100*r]},l.rgb.cmyk=function(e){var t,o,r,n,i=e[0]/255,a=e[1]/255,l=e[2]/255;return n=Math.min(1-i,1-a,1-l),t=(1-i-n)/(1-n)||0,o=(1-a-n)/(1-n)||0,r=(1-l-n)/(1-n)||0,[100*t,100*o,100*r,100*n]},l.rgb.keyword=function(e){var t=i[e];if(t)return t;var o,a=1/0;for(var l in n)if(n.hasOwnProperty(l)){var s=n[l],c=r(e,s);c.04045?Math.pow((t+.055)/1.055,2.4):t/12.92,o=o>.04045?Math.pow((o+.055)/1.055,2.4):o/12.92,r=r>.04045?Math.pow((r+.055)/1.055,2.4):r/12.92,[100*(.4124*t+.3576*o+.1805*r),100*(.2126*t+.7152*o+.0722*r),100*(.0193*t+.1192*o+.9505*r)]},l.rgb.lab=function(e){var t,o,r,n=l.rgb.xyz(e),i=n[0],a=n[1],s=n[2];return i/=95.047,a/=100,s/=108.883,i=i>.008856?Math.pow(i,1/3):7.787*i+16/116,a=a>.008856?Math.pow(a,1/3):7.787*a+16/116,s=s>.008856?Math.pow(s,1/3):7.787*s+16/116,t=116*a-16,o=500*(i-a),r=200*(a-s),[t,o,r]},l.hsl.rgb=function(e){var t,o,r,n,i,a=e[0]/360,l=e[1]/100,s=e[2]/100;if(0===l)return i=255*s,[i,i,i];o=s<.5?s*(1+l):s+l-s*l,t=2*s-o,n=[0,0,0];for(var c=0;c<3;c++)r=a+1/3*-(c-1),r<0&&r++,r>1&&r--,i=6*r<1?t+6*(o-t)*r:2*r<1?o:3*r<2?t+(o-t)*(2/3-r)*6:t,n[c]=255*i;return n},l.hsl.hsv=function(e){var t,o,r=e[0],n=e[1]/100,i=e[2]/100,a=n,l=Math.max(i,.01);return i*=2,n*=i<=1?i:2-i,a*=l<=1?l:2-l,o=(i+n)/2,t=0===i?2*a/(l+a):2*n/(i+n),[r,100*t,100*o]},l.hsv.rgb=function(e){var t=e[0]/60,o=e[1]/100,r=e[2]/100,n=Math.floor(t)%6,i=t-Math.floor(t),a=255*r*(1-o),l=255*r*(1-o*i),s=255*r*(1-o*(1-i));switch(r*=255,n){case 0:return[r,s,a];case 1:return[l,r,a];case 2:return[a,r,s];case 3:return[a,l,r];case 4:return[s,a,r];case 5:return[r,a,l]}},l.hsv.hsl=function(e){var t,o,r,n=e[0],i=e[1]/100,a=e[2]/100,l=Math.max(a,.01);return r=(2-i)*a,t=(2-i)*l,o=i*l,o/=t<=1?t:2-t,o=o||0,r/=2,[n,100*o,100*r]},l.hwb.rgb=function(e){var t,o,r,n,i=e[0]/360,a=e[1]/100,l=e[2]/100,s=a+l;s>1&&(a/=s,l/=s),t=Math.floor(6*i),o=1-l,r=6*i-t,0!=(1&t)&&(r=1-r),n=a+r*(o-a);var c,u,h;switch(t){default:case 6:case 0:c=o,u=n,h=a;break;case 1:c=n,u=o,h=a;break;case 2:c=a,u=o,h=n;break;case 3:c=a,u=n,h=o;break;case 4:c=n,u=a,h=o;break;case 5:c=o,u=a,h=n}return[255*c,255*u,255*h]},l.cmyk.rgb=function(e){var t,o,r,n=e[0]/100,i=e[1]/100,a=e[2]/100,l=e[3]/100;return t=1-Math.min(1,n*(1-l)+l),o=1-Math.min(1,i*(1-l)+l),r=1-Math.min(1,a*(1-l)+l),[255*t,255*o,255*r]},l.xyz.rgb=function(e){var t,o,r,n=e[0]/100,i=e[1]/100,a=e[2]/100;return t=3.2406*n+-1.5372*i+-.4986*a,o=-.9689*n+1.8758*i+.0415*a,r=.0557*n+-.204*i+1.057*a,t=t>.0031308?1.055*Math.pow(t,1/2.4)-.055:12.92*t,o=o>.0031308?1.055*Math.pow(o,1/2.4)-.055:12.92*o,r=r>.0031308?1.055*Math.pow(r,1/2.4)-.055:12.92*r,t=Math.min(Math.max(0,t),1),o=Math.min(Math.max(0,o),1),r=Math.min(Math.max(0,r),1),[255*t,255*o,255*r]},l.xyz.lab=function(e){var t,o,r,n=e[0],i=e[1],a=e[2];return n/=95.047,i/=100,a/=108.883,n=n>.008856?Math.pow(n,1/3):7.787*n+16/116,i=i>.008856?Math.pow(i,1/3):7.787*i+16/116,a=a>.008856?Math.pow(a,1/3):7.787*a+16/116,t=116*i-16,o=500*(n-i),r=200*(i-a),[t,o,r]},l.lab.xyz=function(e){var t,o,r,n=e[0],i=e[1],a=e[2];o=(n+16)/116,t=i/500+o,r=o-a/200;var l=Math.pow(o,3),s=Math.pow(t,3),c=Math.pow(r,3);return o=l>.008856?l:(o-16/116)/7.787,t=s>.008856?s:(t-16/116)/7.787,r=c>.008856?c:(r-16/116)/7.787,t*=95.047,o*=100,r*=108.883,[t,o,r]},l.lab.lch=function(e){var t,o,r,n=e[0],i=e[1],a=e[2];return t=Math.atan2(a,i),o=360*t/2/Math.PI,o<0&&(o+=360),r=Math.sqrt(i*i+a*a),[n,r,o]},l.lch.lab=function(e){var t,o,r,n=e[0],i=e[1],a=e[2];return r=a/360*2*Math.PI,t=i*Math.cos(r),o=i*Math.sin(r),[n,t,o]},l.rgb.ansi16=function(e){var t=e[0],o=e[1],r=e[2],n=1 in arguments?arguments[1]:l.rgb.hsv(e)[2];if(0===(n=Math.round(n/50)))return 30;var i=30+(Math.round(r/255)<<2|Math.round(o/255)<<1|Math.round(t/255));return 2===n&&(i+=60),i},l.hsv.ansi16=function(e){return l.rgb.ansi16(l.hsv.rgb(e),e[2])},l.rgb.ansi256=function(e){var t=e[0],o=e[1],r=e[2];return t===o&&o===r?t<8?16:t>248?231:Math.round((t-8)/247*24)+232:16+36*Math.round(t/255*5)+6*Math.round(o/255*5)+Math.round(r/255*5)},l.ansi16.rgb=function(e){var t=e%10;if(0===t||7===t)return e>50&&(t+=3.5),t=t/10.5*255,[t,t,t];var o=.5*(1+~~(e>50));return[(1&t)*o*255,(t>>1&1)*o*255,(t>>2&1)*o*255]},l.ansi256.rgb=function(e){if(e>=232){var t=10*(e-232)+8;return[t,t,t]}e-=16;var o;return[Math.floor(e/36)/5*255,Math.floor((o=e%36)/6)/5*255,o%6/5*255]},l.rgb.hex=function(e){var t=((255&Math.round(e[0]))<<16)+((255&Math.round(e[1]))<<8)+(255&Math.round(e[2])),o=t.toString(16).toUpperCase();return"000000".substring(o.length)+o},l.hex.rgb=function(e){var t=e.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);if(!t)return[0,0,0];var o=t[0];3===t[0].length&&(o=o.split("").map(function(e){return e+e}).join(""));var r=parseInt(o,16);return[r>>16&255,r>>8&255,255&r]},l.rgb.hcg=function(e){var t,o,r=e[0]/255,n=e[1]/255,i=e[2]/255,a=Math.max(Math.max(r,n),i),l=Math.min(Math.min(r,n),i),s=a-l;return t=s<1?l/(1-s):0,o=s<=0?0:a===r?(n-i)/s%6:a===n?2+(i-r)/s:4+(r-n)/s+4,o/=6,o%=1,[360*o,100*s,100*t]},l.hsl.hcg=function(e){var t=e[1]/100,o=e[2]/100,r=1,n=0;return r=o<.5?2*t*o:2*t*(1-o),r<1&&(n=(o-.5*r)/(1-r)),[e[0],100*r,100*n]},l.hsv.hcg=function(e){var t=e[1]/100,o=e[2]/100,r=t*o,n=0;return r<1&&(n=(o-r)/(1-r)),[e[0],100*r,100*n]},l.hcg.rgb=function(e){var t=e[0]/360,o=e[1]/100,r=e[2]/100;if(0===o)return[255*r,255*r,255*r];var n=[0,0,0],i=t%1*6,a=i%1,l=1-a,s=0;switch(Math.floor(i)){case 0:n[0]=1,n[1]=a,n[2]=0;break;case 1:n[0]=l,n[1]=1,n[2]=0;break;case 2:n[0]=0,n[1]=1,n[2]=a;break;case 3:n[0]=0,n[1]=l,n[2]=1;break;case 4:n[0]=a,n[1]=0,n[2]=1;break;default:n[0]=1,n[1]=0,n[2]=l}return s=(1-o)*r,[255*(o*n[0]+s),255*(o*n[1]+s),255*(o*n[2]+s)]},l.hcg.hsv=function(e){var t=e[1]/100,o=e[2]/100,r=t+o*(1-t),n=0;return r>0&&(n=t/r),[e[0],100*n,100*r]},l.hcg.hsl=function(e){var t=e[1]/100,o=e[2]/100,r=o*(1-t)+.5*t,n=0;return r>0&&r<.5?n=t/(2*r):r>=.5&&r<1&&(n=t/(2*(1-r))),[e[0],100*n,100*r]},l.hcg.hwb=function(e){var t=e[1]/100,o=e[2]/100,r=t+o*(1-t);return[e[0],100*(r-t),100*(1-r)]},l.hwb.hcg=function(e){var t=e[1]/100,o=e[2]/100,r=1-o,n=r-t,i=0;return n<1&&(i=(r-n)/(1-n)),[e[0],100*n,100*i]},l.apple.rgb=function(e){return[e[0]/65535*255,e[1]/65535*255,e[2]/65535*255]},l.rgb.apple=function(e){return[e[0]/255*65535,e[1]/255*65535,e[2]/255*65535]},l.gray.rgb=function(e){return[e[0]/100*255,e[0]/100*255,e[0]/100*255]},l.gray.hsl=l.gray.hsv=function(e){return[0,0,e[0]]},l.gray.hwb=function(e){return[0,100,e[0]]},l.gray.cmyk=function(e){return[0,0,0,e[0]]},l.gray.lab=function(e){return[e[0],0,0]},l.gray.hex=function(e){var t=255&Math.round(e[0]/100*255),o=(t<<16)+(t<<8)+t,r=o.toString(16).toUpperCase();return"000000".substring(r.length)+r},l.rgb.gray=function(e){return[(e[0]+e[1]+e[2])/3/255*100]}},function(e,t,o){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i=o(8),a=r(i),l=o(0),s=r(l),c="colorpicker";s.default[c]=a.default,s.default.fn[c]=function(e){var t=Array.prototype.slice.call(arguments,1),o=1===this.length,r=null,i=this.each(function(){var i=(0,s.default)(this),l=i.data(c),u="object"===(void 0===e?"undefined":n(e))?e:{};l||(l=new a.default(this,u),i.data(c,l)),o&&(r=i,"string"==typeof e&&(r="colorpicker"===e?l:s.default.isFunction(l[e])?l[e].apply(l,t):l[e]))});return o?r:i},s.default.fn[c].constructor=a.default},function(e,t,o){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var o=0;o1&&void 0!==arguments[1]?arguments[1]:{},o=new e(this,t);return this.extensions.push(o),o}},{key:"destroy",value:function(){var e=this.color;this.sliderHandler.unbind(),this.inputHandler.unbind(),this.popupHandler.unbind(),this.colorHandler.unbind(),this.addonHandler.unbind(),this.pickerHandler.unbind(),this.element.removeClass("colorpicker-element").removeData("colorpicker","color").off(".colorpicker"),this.trigger("colorpickerDestroy",e)}},{key:"show",value:function(e){this.popupHandler.show(e)}},{key:"hide",value:function(e){this.popupHandler.hide(e)}},{key:"toggle",value:function(e){this.popupHandler.toggle(e)}},{key:"getValue",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=this.colorHandler.color;return t=t instanceof j.default?t:e,t instanceof j.default?t.string(this.format):t}},{key:"setValue",value:function(e){if(!this.isDisabled()){var t=this.colorHandler;t.hasColor()&&e&&t.color.equals(e)||!t.hasColor()&&!e||(t.color=e?t.createColor(e,this.options.autoInputFallback):null,this.trigger("colorpickerChange",t.color,e),this.update())}}},{key:"update",value:function(){this.colorHandler.hasColor()?this.inputHandler.update():this.colorHandler.assureColor(),this.addonHandler.update(),this.pickerHandler.update(),this.trigger("colorpickerUpdate")}},{key:"enable",value:function(){return this.inputHandler.enable(),this.disabled=!1,this.picker.removeClass("colorpicker-disabled"),this.trigger("colorpickerEnable"),!0}},{key:"disable",value:function(){return this.inputHandler.disable(),this.disabled=!0,this.picker.addClass("colorpicker-disabled"),this.trigger("colorpickerDisable"),!0}},{key:"isEnabled",value:function(){return!this.isDisabled()}},{key:"isDisabled",value:function(){return!0===this.disabled}},{key:"trigger",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;this.element.trigger({type:e,colorpicker:this,color:t||this.color,value:o||this.getValue()})}}]),e}();E.extensions=h.default,t.default=E},function(e,t,o){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.Palette=t.Swatches=t.Preview=t.Debugger=void 0;var n=o(10),i=r(n),a=o(11),l=r(a),s=o(12),c=r(s),u=o(4),h=r(u);t.Debugger=i.default,t.Preview=l.default,t.Swatches=c.default,t.Palette=h.default,t.default={debugger:i.default,preview:l.default,swatches:c.default,palette:h.default}},function(e,t,o){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var l=function(){function e(e,t){for(var o=0;o1&&void 0!==arguments[1]?arguments[1]:{};n(this,t);var r=i(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,o));return r.eventCounter=0,r.colorpicker.inputHandler.hasInput()&&r.colorpicker.inputHandler.input.on("change.colorpicker-ext",p.default.proxy(r.onChangeInput,r)),r}return a(t,e),l(t,[{key:"log",value:function(e){for(var t,o=arguments.length,r=Array(o>1?o-1:0),n=1;n1&&void 0!==arguments[1])||arguments[1];return this.log("resolveColor()",e,t),!1}},{key:"onCreate",value:function(e){return this.log("colorpickerCreate"),s(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"onCreate",this).call(this,e)}},{key:"onDestroy",value:function(e){return this.log("colorpickerDestroy"),this.eventCounter=0,this.colorpicker.inputHandler.hasInput()&&this.colorpicker.inputHandler.input.off(".colorpicker-ext"),s(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"onDestroy",this).call(this,e)}},{key:"onUpdate",value:function(e){this.log("colorpickerUpdate")}},{key:"onChangeInput",value:function(e){this.log("input:change.colorpicker",e.value,e.color)}},{key:"onChange",value:function(e){this.log("colorpickerChange",e.value,e.color)}},{key:"onInvalid",value:function(e){this.log("colorpickerInvalid",e.value,e.color)}},{key:"onHide",value:function(e){this.log("colorpickerHide"),this.eventCounter=0}},{key:"onShow",value:function(e){this.log("colorpickerShow")}},{key:"onDisable",value:function(e){this.log("colorpickerDisable")}},{key:"onEnable",value:function(e){this.log("colorpickerEnable")}}]),t}(u.default);t.default=f},function(e,t,o){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var l=function(){function e(e,t){for(var o=0;o1&&void 0!==arguments[1]?arguments[1]:{};n(this,t);var r=i(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,p.default.extend(!0,{},{template:'
',showText:!0,format:e.format},o)));return r.element=(0,p.default)(r.options.template),r.elementInner=r.element.find("div"),r}return a(t,e),l(t,[{key:"onCreate",value:function(e){s(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"onCreate",this).call(this,e),this.colorpicker.picker.append(this.element)}},{key:"onUpdate",value:function(e){if(s(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"onUpdate",this).call(this,e),!e.color)return void this.elementInner.css("backgroundColor",null).css("color",null).html("");this.elementInner.css("backgroundColor",e.color.toRgbString()),this.options.showText&&(this.elementInner.html(e.color.string(this.options.format||this.colorpicker.format)),e.color.isDark()&&e.color.alpha>.5?this.elementInner.css("color","white"):this.elementInner.css("color","black"))}}]),t}(u.default);t.default=f},function(e,t,o){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var l=function(){function e(e,t){for(var o=0;o\n
\n
',swatchTemplate:''},d=function(e){function t(e){var o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};n(this,t);var r=i(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,p.default.extend(!0,{},f,o)));return r.element=null,r}return a(t,e),l(t,[{key:"isEnabled",value:function(){return this.getLength()>0}},{key:"onCreate",value:function(e){s(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"onCreate",this).call(this,e),this.isEnabled()&&(this.element=(0,p.default)(this.options.barTemplate),this.load(),this.colorpicker.picker.append(this.element))}},{key:"load",value:function(){var e=this,t=this.colorpicker,o=this.element.find(".colorpicker-swatches--inner"),r=!0===this.options.namesAsValues&&!Array.isArray(this.colors);o.empty(),p.default.each(this.colors,function(n,i){var a=(0,p.default)(e.options.swatchTemplate).attr("data-name",n).attr("data-value",i).attr("title",r?n+": "+i:i).on("mousedown.colorpicker touchstart.colorpicker",function(e){var o=(0,p.default)(this);t.setValue(r?o.attr("data-name"):o.attr("data-value"))});a.find(".colorpicker-swatch--inner").css("background-color",i),o.append(a)}),o.append((0,p.default)(''))}}]),t}(u.default);t.default=d},function(e,t,o){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(e,t){for(var o=0;o0)}},{key:"onClickingInside",value:function(e){this.clicking=this.isClickingInside(e)}},{key:"createPopover",value:function(){var e=this.colorpicker;this.popoverTarget=this.hasAddon?this.addon:this.input,e.picker.addClass("colorpicker-bs-popover-content"),this.popoverTarget.popover(l.default.extend(!0,{},c.default.popover,e.options.popover,{trigger:"manual",content:e.picker,html:!0})),this.popoverTip=(0,l.default)(this.popoverTarget.popover("getTipElement").data("bs.popover").tip),this.popoverTip.addClass("colorpicker-bs-popover"),this.popoverTarget.on("shown.bs.popover",l.default.proxy(this.fireShow,this)),this.popoverTarget.on("hidden.bs.popover",l.default.proxy(this.fireHide,this))}},{key:"reposition",value:function(e){this.popoverTarget&&this.isVisible()&&this.popoverTarget.popover("update")}},{key:"toggle",value:function(e){this.isVisible()?this.hide(e):this.show(e)}},{key:"show",value:function(e){if(!(this.isVisible()||this.showing||this.hidding)){this.showing=!0,this.hidding=!1,this.clicking=!1;var t=this.colorpicker;t.lastEvent.alias="show",t.lastEvent.e=e,e&&(!this.hasInput||"color"===this.input.attr("type"))&&e&&e.preventDefault&&(e.stopPropagation(),e.preventDefault()),this.isPopover&&(0,l.default)(this.root).on("resize.colorpicker",l.default.proxy(this.reposition,this)),t.picker.addClass("colorpicker-visible").removeClass("colorpicker-hidden"),this.popoverTarget?this.popoverTarget.popover("show"):this.fireShow()}}},{key:"fireShow",value:function(){this.hidding=!1,this.showing=!1,this.isPopover&&((0,l.default)(this.root.document).on("mousedown.colorpicker touchstart.colorpicker",l.default.proxy(this.hide,this)),(0,l.default)(this.root.document).on("mousedown.colorpicker touchstart.colorpicker",l.default.proxy(this.onClickingInside,this))),this.colorpicker.trigger("colorpickerShow")}},{key:"hide",value:function(e){if(!(this.isHidden()||this.showing||this.hidding)){var t=this.colorpicker,o=this.clicking||this.isClickingInside(e);if(this.hidding=!0,this.showing=!1,this.clicking=!1,t.lastEvent.alias="hide",t.lastEvent.e=e,o)return void(this.hidding=!1);this.popoverTarget?this.popoverTarget.popover("hide"):this.fireHide()}}},{key:"fireHide",value:function(){this.hidding=!1,this.showing=!1;var e=this.colorpicker;e.picker.addClass("colorpicker-hidden").removeClass("colorpicker-visible"),(0,l.default)(this.root).off("resize.colorpicker",l.default.proxy(this.reposition,this)),(0,l.default)(this.root.document).off("mousedown.colorpicker touchstart.colorpicker",l.default.proxy(this.hide,this)),(0,l.default)(this.root.document).off("mousedown.colorpicker touchstart.colorpicker",l.default.proxy(this.onClickingInside,this)),e.trigger("colorpickerHide")}},{key:"focus",value:function(){return this.hasAddon?this.addon.focus():!!this.hasInput&&this.input.focus()}},{key:"isVisible",value:function(){return this.colorpicker.picker.hasClass("colorpicker-visible")&&!this.colorpicker.picker.hasClass("colorpicker-hidden")}},{key:"isHidden",value:function(){return this.colorpicker.picker.hasClass("colorpicker-hidden")&&!this.colorpicker.picker.hasClass("colorpicker-visible")}},{key:"input",get:function(){return this.colorpicker.inputHandler.input}},{key:"hasInput",get:function(){return this.colorpicker.inputHandler.hasInput()}},{key:"addon",get:function(){return this.colorpicker.addonHandler.addon}},{key:"hasAddon",get:function(){return this.colorpicker.addonHandler.hasAddon()}},{key:"isPopover",get:function(){return!this.colorpicker.options.inline&&!!this.popoverTip}}]),e}();t.default=u},function(e,t,o){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var o=0;o0&&void 0!==arguments[0]?arguments[0]:null;return(e=e||this.colorpicker.colorHandler.getColorString())?(e=this.colorpicker.colorHandler.resolveColorDelegate(e,!1),!1===this.colorpicker.options.useHashPrefix&&(e=e.replace(/^#/g,"")),e):""}},{key:"hasInput",value:function(){return!1!==this.input}},{key:"isEnabled",value:function(){return this.hasInput()&&!this.isDisabled()}},{key:"isDisabled",value:function(){return this.hasInput()&&!0===this.input.prop("disabled")}},{key:"disable",value:function(){this.hasInput()&&this.input.prop("disabled",!0)}},{key:"enable",value:function(){this.hasInput()&&this.input.prop("disabled",!1)}},{key:"update",value:function(){this.hasInput()&&(!1===this.colorpicker.options.autoInputFallback&&this.colorpicker.colorHandler.isInvalidColor()||this.setValue(this.getFormattedColor()))}},{key:"onchange",value:function(e){this.colorpicker.lastEvent.alias="input.change",this.colorpicker.lastEvent.e=e;var t=this.getValue();t!==e.value&&this.colorpicker.setValue(t)}},{key:"onkeyup",value:function(e){this.colorpicker.lastEvent.alias="input.keyup",this.colorpicker.lastEvent.e=e;var t=this.getValue();t!==e.value&&this.colorpicker.setValue(t)}}]),e}();t.default=u},function(e,t,o){"use strict";function r(e,t){if(!(this instanceof r))return new r(e,t);if(t&&t in f&&(t=null),t&&!(t in h))throw new Error("Unknown model: "+t);var o,n;if(void 0===e)this.model="rgb",this.color=[0,0,0],this.valpha=1;else if(e instanceof r)this.model=e.model,this.color=e.color.slice(),this.valpha=e.valpha;else if("string"==typeof e){var i=u.get(e);if(null===i)throw new Error("Unable to parse color from string: "+e);this.model=i.model,n=h[this.model].channels,this.color=i.value.slice(0,n),this.valpha="number"==typeof i.value[n]?i.value[n]:1}else if(e.length){this.model=t||"rgb",n=h[this.model].channels;var a=p.call(e,0,n);this.color=c(a,n),this.valpha="number"==typeof e[n]?e[n]:1}else if("number"==typeof e)e&=16777215,this.model="rgb",this.color=[e>>16&255,e>>8&255,255&e],this.valpha=1;else{this.valpha=1;var l=Object.keys(e);"alpha"in e&&(l.splice(l.indexOf("alpha"),1),this.valpha="number"==typeof e.alpha?e.alpha:0);var s=l.sort().join("");if(!(s in d))throw new Error("Unable to parse color from object: "+JSON.stringify(e));this.model=d[s];var k=h[this.model].labels,g=[];for(o=0;oo?(t+.05)/(o+.05):(o+.05)/(t+.05)},level:function(e){var t=this.contrast(e);return t>=7.1?"AAA":t>=4.5?"AA":""},isDark:function(){var e=this.rgb().color;return(299*e[0]+587*e[1]+114*e[2])/1e3<128},isLight:function(){return!this.isDark()},negate:function(){for(var e=this.rgb(),t=0;t<3;t++)e.color[t]=255-e.color[t];return e},lighten:function(e){var t=this.hsl();return t.color[2]+=t.color[2]*e,t},darken:function(e){var t=this.hsl();return t.color[2]-=t.color[2]*e,t},saturate:function(e){var t=this.hsl();return t.color[1]+=t.color[1]*e,t},desaturate:function(e){var t=this.hsl();return t.color[1]-=t.color[1]*e,t},whiten:function(e){var t=this.hwb();return t.color[1]+=t.color[1]*e,t},blacken:function(e){var t=this.hwb();return t.color[2]+=t.color[2]*e,t},grayscale:function(){var e=this.rgb().color,t=.3*e[0]+.59*e[1]+.11*e[2];return r.rgb(t,t,t)},fade:function(e){return this.alpha(this.valpha-this.valpha*e)},opaquer:function(e){return this.alpha(this.valpha+this.valpha*e)},rotate:function(e){var t=this.hsl(),o=t.color[0];return o=(o+e)%360,o=o<0?360+o:o,t.color[0]=o,t},mix:function(e,t){if(!e||!e.rgb)throw new Error('Argument to "mix" was not a Color instance, but rather an instance of '+typeof e);var o=e.rgb(),n=this.rgb(),i=void 0===t?.5:t,a=2*i-1,l=o.alpha()-n.alpha(),s=((a*l==-1?a:(a+l)/(1+a*l))+1)/2,c=1-s;return r.rgb(s*o.red()+c*n.red(),s*o.green()+c*n.green(),s*o.blue()+c*n.blue(),o.alpha()*i+n.alpha()*(1-i))}},Object.keys(h).forEach(function(e){if(-1===f.indexOf(e)){var t=h[e].channels;r.prototype[e]=function(){if(this.model===e)return new r(this);if(arguments.length)return new r(arguments,e);var o="number"==typeof arguments[t]?t:this.valpha;return new r(s(h[this.model][e].raw(this.color)).concat(o),e)},r[e]=function(o){return"number"==typeof o&&(o=c(p.call(arguments),t)),new r(o,e)}}}),e.exports=r},function(e,t,o){function r(e,t,o){return Math.min(Math.max(t,e),o)}function n(e){var t=e.toString(16).toUpperCase();return t.length<2?"0"+t:t}var i=o(5),a=o(18),l={};for(var s in i)i.hasOwnProperty(s)&&(l[i[s]]=s);var c=e.exports={to:{},get:{}};c.get=function(e){var t,o,r=e.substring(0,3).toLowerCase();switch(r){case"hsl":t=c.get.hsl(e),o="hsl";break;case"hwb":t=c.get.hwb(e),o="hwb";break;default:t=c.get.rgb(e),o="rgb"}return t?{model:o,value:t}:null},c.get.rgb=function(e){if(!e)return null;var t,o,n,a=/^#([a-f0-9]{3,4})$/i,l=/^#([a-f0-9]{6})([a-f0-9]{2})?$/i,s=/^rgba?\(\s*([+-]?\d+)\s*,\s*([+-]?\d+)\s*,\s*([+-]?\d+)\s*(?:,\s*([+-]?[\d\.]+)\s*)?\)$/,c=/^rgba?\(\s*([+-]?[\d\.]+)\%\s*,\s*([+-]?[\d\.]+)\%\s*,\s*([+-]?[\d\.]+)\%\s*(?:,\s*([+-]?[\d\.]+)\s*)?\)$/,u=/(\D+)/,h=[0,0,0,1];if(t=e.match(l)){for(n=t[2],t=t[1],o=0;o<3;o++){var p=2*o;h[o]=parseInt(t.slice(p,p+2),16)}n&&(h[3]=Math.round(parseInt(n,16)/255*100)/100)}else if(t=e.match(a)){for(t=t[1],n=t[3],o=0;o<3;o++)h[o]=parseInt(t[o]+t[o],16);n&&(h[3]=Math.round(parseInt(n+n,16)/255*100)/100)}else if(t=e.match(s)){for(o=0;o<3;o++)h[o]=parseInt(t[o+1],0);t[4]&&(h[3]=parseFloat(t[4]))}else{if(!(t=e.match(c)))return(t=e.match(u))?"transparent"===t[1]?[0,0,0,0]:(h=i[t[1]])?(h[3]=1,h):null:null;for(o=0;o<3;o++)h[o]=Math.round(2.55*parseFloat(t[o+1]));t[4]&&(h[3]=parseFloat(t[4]))}for(o=0;o<3;o++)h[o]=r(h[o],0,255);return h[3]=r(h[3],0,1),h},c.get.hsl=function(e){if(!e)return null;var t=/^hsla?\(\s*([+-]?(?:\d*\.)?\d+)(?:deg)?\s*,\s*([+-]?[\d\.]+)%\s*,\s*([+-]?[\d\.]+)%\s*(?:,\s*([+-]?[\d\.]+)\s*)?\)$/,o=e.match(t);if(o){var n=parseFloat(o[4]);return[(parseFloat(o[1])+360)%360,r(parseFloat(o[2]),0,100),r(parseFloat(o[3]),0,100),r(isNaN(n)?1:n,0,1)]}return null},c.get.hwb=function(e){if(!e)return null;var t=/^hwb\(\s*([+-]?\d*[\.]?\d+)(?:deg)?\s*,\s*([+-]?[\d\.]+)%\s*,\s*([+-]?[\d\.]+)%\s*(?:,\s*([+-]?[\d\.]+)\s*)?\)$/,o=e.match(t);if(o){var n=parseFloat(o[4]);return[(parseFloat(o[1])%360+360)%360,r(parseFloat(o[2]),0,100),r(parseFloat(o[3]),0,100),r(isNaN(n)?1:n,0,1)]}return null},c.to.hex=function(){var e=a(arguments);return"#"+n(e[0])+n(e[1])+n(e[2])+(e[3]<1?n(Math.round(255*e[3])):"")},c.to.rgb=function(){var e=a(arguments);return e.length<4||1===e[3]?"rgb("+Math.round(e[0])+", "+Math.round(e[1])+", "+Math.round(e[2])+")":"rgba("+Math.round(e[0])+", "+Math.round(e[1])+", "+Math.round(e[2])+", "+e[3]+")"},c.to.rgb.percent=function(){var e=a(arguments),t=Math.round(e[0]/255*100),o=Math.round(e[1]/255*100),r=Math.round(e[2]/255*100);return e.length<4||1===e[3]?"rgb("+t+"%, "+o+"%, "+r+"%)":"rgba("+t+"%, "+o+"%, "+r+"%, "+e[3]+")"},c.to.hsl=function(){var e=a(arguments);return e.length<4||1===e[3]?"hsl("+e[0]+", "+e[1]+"%, "+e[2]+"%)":"hsla("+e[0]+", "+e[1]+"%, "+e[2]+"%, "+e[3]+")"},c.to.hwb=function(){var e=a(arguments),t="";return e.length>=4&&1!==e[3]&&(t=", "+e[3]),"hwb("+e[0]+", "+e[1]+"%, "+e[2]+"%"+t+")"},c.to.keyword=function(e){return l[e.slice(0,3)]}},function(e,t,o){"use strict";var r=o(19),n=Array.prototype.concat,i=Array.prototype.slice,a=e.exports=function(e){for(var t=[],o=0,a=e.length;o=0&&e.splice instanceof Function)}},function(e,t,o){function r(e){var t=function(t){return void 0===t||null===t?t:(arguments.length>1&&(t=Array.prototype.slice.call(arguments)),e(t))};return"conversion"in e&&(t.conversion=e.conversion),t}function n(e){var t=function(t){if(void 0===t||null===t)return t;arguments.length>1&&(t=Array.prototype.slice.call(arguments));var o=e(t);if("object"==typeof o)for(var r=o.length,n=0;n1&&void 0!==arguments[1])||arguments[1],o=new c.default(this.resolveColorDelegate(e),this.format);return o.isValid()||(t&&(o=this.getFallbackColor()),this.colorpicker.trigger("colorpickerInvalid",o,e)),this.isAlphaEnabled()||(o.alpha=1),o}},{key:"getFallbackColor",value:function(){if(this.fallback&&this.fallback===this.color)return this.color;var e=this.resolveColorDelegate(this.fallback),t=new c.default(e,this.format);return t.isValid()?t:(console.warn("The fallback color is invalid. Falling back to the previous color or black if any."),this.color?this.color:new c.default("#000000",this.format))}},{key:"assureColor",value:function(){return this.hasColor()||(this.color=this.getFallbackColor()),this.color}},{key:"resolveColorDelegate",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],o=!1;return l.default.each(this.colorpicker.extensions,function(r,n){!1===o&&(o=n.resolveColor(e,t))}),o||e}},{key:"isInvalidColor",value:function(){return!this.hasColor()||!this.color.isValid()}},{key:"isAlphaEnabled",value:function(){return!1!==this.colorpicker.options.useAlpha}},{key:"hasColor",value:function(){return this.color instanceof c.default}},{key:"fallback",get:function(){return this.colorpicker.options.fallbackColor?this.colorpicker.options.fallbackColor:this.hasColor()?this.color:null}},{key:"format",get:function(){return this.colorpicker.options.format?this.colorpicker.options.format:this.hasColor()&&this.color.hasTransparency()&&this.color.format.match(/^hex/)?this.isAlphaEnabled()?"rgba":"hex":this.hasColor()?this.color.format:"rgb"}},{key:"color",get:function(){return this.colorpicker.element.data("color")},set:function(e){this.colorpicker.element.data("color",e),e instanceof c.default&&"auto"===this.colorpicker.options.format&&(this.colorpicker.options.format=this.color.format)}}]),e}();t.default=u},function(e,t,o){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(e,t){for(var o=0;o0?o.css(t):this.addon.css(t)}}}]),e}();t.default=i}])}); \ No newline at end of file diff --git a/src/static/js/dom.js b/src/static/js/dom.js index 9dcbc0a..0fd46b8 100644 --- a/src/static/js/dom.js +++ b/src/static/js/dom.js @@ -153,26 +153,43 @@ function getTags(hit, mimeCategory) { // User tags if (hit["_source"].hasOwnProperty("tag")) { hit["_source"]["tag"].forEach(tag => { - const userTag = document.createElement("span"); - userTag.setAttribute("class", "badge badge-pill badge-user"); - - const tokens = tag.split("#"); - - if (tokens.length > 1) { - const bg = "#" + tokens[1]; - const fg = lum(tokens[1]) > 50 ? "#000" : "#fff"; - userTag.setAttribute("style", `background-color: ${bg}; color: ${fg}`); - } - - const name = tokens[0].split(".")[tokens[0].split(".").length - 1]; - userTag.appendChild(document.createTextNode(name)); - tags.push(userTag); + tags.push(makeUserTag(tag, hit)); }) } return tags } +function makeUserTag(tag, hit) { + const userTag = document.createElement("span"); + userTag.setAttribute("class", "badge badge-pill badge-user"); + + const tokens = tag.split("#"); + + if (tokens.length > 1) { + const bg = "#" + tokens[1]; + const fg = lum(tokens[1]) > 50 ? "#000" : "#fff"; + userTag.setAttribute("style", `background-color: ${bg}; color: ${fg}`); + } + + const deleteButton = document.createElement("span"); + deleteButton.setAttribute("class", "badge badge-pill badge-delete") + deleteButton.setAttribute("title", "Delete tag") + deleteButton.appendChild(document.createTextNode("X")); + deleteButton.addEventListener("click", () => { + deleteTag(tag, hit).then(() => { + userTag.remove(); + }); + }); + userTag.addEventListener("mouseenter", () => userTag.appendChild(deleteButton)); + userTag.addEventListener("mouseleave", () => deleteButton.remove()); + + const name = tokens[0].split(".")[tokens[0].split(".").length - 1]; + userTag.appendChild(document.createTextNode(name)); + + return userTag; +} + function infoButtonCb(hit) { return () => { getDocumentInfo(hit["_id"]).then(doc => { @@ -338,9 +355,31 @@ function createDocCard(hit) { docCardBody.appendChild(tagContainer); + attachTagContainerEventListener(tagContainer, hit); return docCard; } +function attachTagContainerEventListener(tagContainer, hit) { + const sizeTag = Array.from(tagContainer.children).find(child => child.tagName === "SMALL"); + + const addTagButton = document.createElement("span"); + addTagButton.setAttribute("class", "badge badge-pill add-tag-button"); + addTagButton.appendChild(document.createTextNode("+Add")); + + tagContainer.addEventListener("mouseenter", () => tagContainer.insertBefore(addTagButton, sizeTag)); + tagContainer.addEventListener("mouseleave", () => addTagButton.remove()); + + addTagButton.addEventListener("click", () => { + tagBar.value = ""; + currentDocToTag = hit; + currentTagCallback = tag => { + tagContainer.insertBefore(makeUserTag(tag, hit), sizeTag); + } + $("#tagModal").modal("show"); + tagBar.focus(); + }); +} + function makeThumbnail(mimeCategory, hit, imgWrapper, small) { if (!hit["_source"].hasOwnProperty("thumbnail")) { @@ -413,7 +452,6 @@ function createDocLine(hit) { if (hit["_source"].hasOwnProperty("parent")) { line.classList.add("sub-document"); - isSubDocument = true; } const infoButton = makeInfoButton(hit); @@ -486,6 +524,8 @@ function createDocLine(hit) { pathLine.appendChild(path); pathLine.appendChild(tagContainer); + attachTagContainerEventListener(tagContainer, hit); + return line; } diff --git a/src/static/js/search.js b/src/static/js/search.js index 264e1a1..6b54db7 100644 --- a/src/static/js/search.js +++ b/src/static/js/search.js @@ -6,6 +6,9 @@ let tagTree; let searchBar = document.getElementById("searchBar"); let pathBar = document.getElementById("pathBar"); +let tagBar = document.getElementById("tagBar"); +let currentDocToTag = null; +let currentTagCallback = null; let lastDoc = null; let reachedEnd = false; let docCount = 0; @@ -109,13 +112,112 @@ window.onload = () => { searchDebounced(); } }); + new autoComplete({ + selector: '#tagBar', + minChars: 1, + delay: 200, + renderItem: function (item) { + return '
' + item.split("#")[0] + '
'; + }, + source: async function (term, suggest) { + term = term.toLowerCase(); + + const choices = await getTagChoices(); + + let matches = []; + for (let i = 0; i < choices.length; i++) { + if (~choices[i].toLowerCase().indexOf(term)) { + matches.push(choices[i]); + } + } + suggest(matches.sort()); + }, + onSelect: function (e, item) { + const name = item.split("#")[0]; + const color = "#" + item.split("#")[1]; + $("#tag-color").val(color); + $("#tag-color").trigger("keyup", color); + tagBar.value = name; + e.preventDefault(); + } + }); + [tagBar, document.getElementById("tag-color")].forEach(elem => { + elem.addEventListener("keyup", e => { + if (e.key === "Enter" && tagBar.value.length > 0) { + const tag = tagBar.value + document.getElementById("tag-color").value; + saveTag(tag, currentDocToTag).then(() => currentTagCallback(tag)); + } + }); + }) + $("#tag-color").colorpicker({ + format: "hex", + sliders: { + saturation: { + selector: '.colorpicker-saturation', + callLeft: 'setSaturationRatio', + callTop: 'setValueRatio' + }, + hue: { + selector: '.colorpicker-hue', + maxLeft: 0, + callLeft: false, + callTop: 'setHueRatio' + } + } + }); }; +function saveTag(tag, hit) { + const relPath = hit["_source"]["path"] + "/" + hit["_source"]["name"] + ext(hit); + + return $.jsonPost("/tag/" + hit["_source"]["index"], { + delete: false, + name: tag, + doc_id: hit["_id"], + relpath: relPath + }).then(() => { + tagBar.blur(); + $("#tagModal").modal("hide"); + $.toast({ + heading: "Tag added", + text: "Tag saved to index storage and updated in ElasticSearch", + stack: 3, + bgColor: "#00a4bc", + textColor: "#fff", + position: 'bottom-right', + hideAfter: 3000, + loaderBg: "#08c7e8", + }); + }) +} + +function deleteTag(tag, hit) { + const relPath = hit["_source"]["path"] + "/" + hit["_source"]["name"] + ext(hit); + + return $.jsonPost("/tag/" + hit["_source"]["index"], { + delete: true, + name: tag, + doc_id: hit["_id"], + relpath: relPath + }).then(() => { + $.toast({ + heading: "Tag deleted", + text: "Tag deleted index storage and updated in ElasticSearch", + stack: 3, + bgColor: "#00a4bc", + textColor: "#fff", + position: 'bottom-right', + hideAfter: 3000, + loaderBg: "#08c7e8", + }); + }) +} + function toggleFuzzy() { searchDebounced(); } -$.jsonPost("i").then(resp => { +$.get("i").then(resp => { const urlIndices = (new URLSearchParams(location.search)).get("i"); resp["indices"].forEach(idx => { @@ -248,21 +350,25 @@ $.jsonPost("es", { }); function addTag(map, tag, id, count) { - let tags = tag.split("#")[0].split("."); + // let tags = tag.split("#")[0].split("."); + let tags = tag.split("."); let child = { id: id, - text: tags.length !== 1 ? tags[0] : `${tags[0]} (${count})`, + values: [id], + count: count, + text: tags.length !== 1 ? tags[0] : `${tags[0].split("#")[0]} (${count})`, name: tags[0], children: [], isLeaf: tags.length === 1, //Overwrite base functions - blur: function() {}, - select: function() { + blur: function () { + }, + select: function () { this.state("selected", true); return this.check() }, - deselect: function() { + deselect: function () { this.state("selected", false); return this.uncheck() }, @@ -299,10 +405,15 @@ function addTag(map, tag, id, count) { let found = false; map.forEach(node => { - if (node.name === child.name) { + if (node.name.split("#")[0] === child.name.split("#")[0]) { found = true; if (tags.length !== 1) { addTag(node.children, tags.slice(1).join("."), id, count); + } else { + // Same name, different color + node.count += count; + node.text = `${tags[0].split("#")[0]} (${node.count})`; + node.values.push(id); } } }); @@ -354,7 +465,11 @@ function getSelectedNodes(tree) { //Only get children if (selected[i].text.indexOf("(") !== -1) { - selectedNodes.push(selected[i].id); + if (selected[i].values) { + selectedNodes.push(selected[i].values); + } else { + selectedNodes.push(selected[i].id); + } } } @@ -417,7 +532,9 @@ function search(after = null) { let tags = getSelectedNodes(tagTree); if (!tags.includes("any")) { - tags.forEach(term => filters.push({term: {"tag": term}})) + tags.forEach(tagGroup => { + filters.push({terms: {"tag": tagGroup}}) + }) } if (date_min && date_max) { @@ -661,6 +778,7 @@ function getNextDepth(node) { text: `${name}/ (${bucket.doc_count})`, depth: node.depth + 1, index: node.index, + values: [bucket.key], children: true, } }).filter(x => x !== null) @@ -691,6 +809,7 @@ function createPathTree(target) { selectedIndices.forEach(index => { pathTree.addNode({ id: "/" + index, + values: ["/" + index], text: `/[${indexMap[index]}]`, index: index, depth: 0, @@ -719,5 +838,34 @@ function getPathChoices() { } } }).then(resp => getPaths(resp["suggest"]["path"][0]["options"].map(opt => opt["_source"]["path"]))); - }) + }); +} + + +function getTagChoices() { + return new Promise(getPaths => { + $.jsonPost("es", { + suggest: { + tag: { + prefix: tagBar.value, + completion: { + field: "suggest-tag", + skip_duplicates: true, + size: 10000 + } + } + } + }).then(resp => { + const result = []; + resp["suggest"]["tag"][0]["options"].map(opt => opt["_source"]["tag"]).forEach(tags => { + tags.forEach(tag => { + const t = tag.split("#")[0]; + if (!result.find(x => x.split("#")[0] === t)) { + result.push(tag); + } + }); + }); + getPaths(result); + }); + }); } diff --git a/src/static/search.html b/src/static/search.html index 4923d81..b6621b2 100644 --- a/src/static/search.html +++ b/src/static/search.html @@ -11,10 +11,11 @@ @@ -48,8 +49,11 @@
-
@@ -156,7 +160,8 @@ fried eggs and either eggplant or potato, but will ignore results containing frittata.

-

When neither + or | is specified, the default operator is + (and).

+

When neither + or | is specified, the default operator is + + (and).

When the Fuzzy option is checked, partial matches are also returned.


For more information, see - +

- +

@@ -288,6 +295,32 @@
+ +
diff --git a/src/static/stats.html b/src/static/stats.html index 49dc56c..af91cde 100644 --- a/src/static/stats.html +++ b/src/static/stats.html @@ -10,7 +10,7 @@