diff options
author | luxagraf <sng@luxagraf.net> | 2018-12-29 08:37:39 -0600 |
---|---|---|
committer | luxagraf <sng@luxagraf.net> | 2018-12-29 08:37:39 -0600 |
commit | 4f7b84194b056b5d6d9acca4cceb2cabc04fd8a5 (patch) | |
tree | 7fe109e7aeaddab7aa5e7f46f99414064a248e52 /scripts | |
parent | 02f520038e3c6d5a01c9545e9b1c3eb91e4e016c (diff) |
cleaned up JS and made modal handler.
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/package.json | 17 | ||||
-rw-r--r-- | scripts/shrinkwrap.yaml | 1011 | ||||
-rw-r--r-- | scripts/src/color-picker.js | 0 | ||||
-rw-r--r-- | scripts/src/lib/overlay.js | 253 | ||||
-rw-r--r-- | scripts/src/main-nav.js | 12 | ||||
-rw-r--r-- | scripts/src/note-edit.js | 181 | ||||
-rw-r--r-- | scripts/src/note-list.js | 33 | ||||
-rw-r--r-- | scripts/src/note-new.js | 27 | ||||
-rw-r--r-- | scripts/src/notebook-edit.js | 74 | ||||
-rw-r--r-- | scripts/src/util.js | 114 |
10 files changed, 1386 insertions, 336 deletions
diff --git a/scripts/package.json b/scripts/package.json index 890274e..1ec659e 100644 --- a/scripts/package.json +++ b/scripts/package.json @@ -4,14 +4,17 @@ "author": "luxagraf", "description": "Compile JS for Notes app", "main": "src/js/index.js", + "browserslist": "> 0.25%, not dead", "scripts": { "eslint": "eslint src/*.js --fix", "babel": "mkdir -p tmp && babel src/*.js -d tmp", "include": "cp src/lib/*.js tmp/", - "uglify:local": "mkdir -p ../media/js && uglifyjs tmp/*.js -m -c -o ../media/js/main.min.js", + "concat": "mkdir -p ../media/js && uglifyjs tmp/*.js -m -b -o tmp/main.js", + "browserify": "cd tmp && browserify main.js -o main.pack.js", + "uglify:local": "uglifyjs tmp/main.pack.js -m -o ../media/js/main.min.js", "uglify:deploy": "mkdir -p ../media/js && uglifyjs tmp/*.js -m -c drop_console=true -o ../media/js/main.min.js", "cleanup": "rm -rf tmp", - "build": "pnpm run babel && pnpm run include && pnpm run uglify:local && pnpm run cleanup", + "build": "pnpm run babel && pnpm run include && pnpm run concat && pnpm run browserify && pnpm run uglify:local && pnpm run cleanup", "deploy": "pnpm run babel && pnpm run include && pnpm run uglify && pnpm run cleanup", "watch": "watch 'pnpm run build' ." }, @@ -19,6 +22,16 @@ "@babel/cli": "^7.1.5", "@babel/core": "^7.1.6", "@babel/preset-env": "^7.1.6", + "@babel/standalone": "^7.2.5", + "babel-plugin-transform-es2015-modules-commonjs": "^6.26.2", + "babel-plugin-transform-runtime": "^6.23.0", + "babelify": "^10.0.0", + "browserify": "^16.2.3", + "core-js": "^2.6.1", "eslint": "^5.9.0" + }, + "dependencies": { + "babel-polyfill": "^6.26.0", + "babel-runtime": "^6.26.0" } } diff --git a/scripts/shrinkwrap.yaml b/scripts/shrinkwrap.yaml index 8907a9d..7cf56fd 100644 --- a/scripts/shrinkwrap.yaml +++ b/scripts/shrinkwrap.yaml @@ -1,7 +1,16 @@ +dependencies: + babel-polyfill: 6.26.0 + babel-runtime: 6.26.0 devDependencies: '@babel/cli': 7.1.5 '@babel/core': 7.1.6 '@babel/preset-env': 7.1.6 + '@babel/standalone': 7.2.5 + babel-plugin-transform-es2015-modules-commonjs: 6.26.2 + babel-plugin-transform-runtime: 6.23.0 + babelify: 10.0.0 + browserify: 16.2.3 + core-js: 2.6.1 eslint: 5.9.0 packages: /@babel/cli/7.1.5: @@ -592,6 +601,10 @@ packages: '@babel/core': ^7.0.0-0 resolution: integrity: sha512-YIBfpJNQMBkb6MCkjz/A9J76SNCSuGVamOVBgoUkLzpJD/z8ghHi9I42LQ4pulVX68N/MmImz6ZTixt7Azgexw== + /@babel/standalone/7.2.5: + dev: true + resolution: + integrity: sha512-U00wHmbh0eCUCAsCN1cz/WS2aB/UXjQrALsUmVIcugiK3HiI4PEh93PeGsaJttBmj0+Zfp1SpUNxPl6s8KPHUQ== /@babel/template/7.1.2: dependencies: '@babel/code-frame': 7.0.0 @@ -622,6 +635,23 @@ packages: dev: true resolution: integrity: sha512-DMiUzlY9DSjVsOylJssxLHSgj6tWM9PRFJOGW/RaOglVOK9nzTxoOMfTfRQXGUCUQ/HmlG2efwC+XqUEJ5ay4w== + /JSONStream/1.3.5: + dependencies: + jsonparse: 1.3.1 + through: 2.3.8 + dev: true + hasBin: true + resolution: + integrity: sha512-E+iruNOY8VV9s4JEbe1aNEm6MiszPRr/UfcHMz0TQh1BXSxHK+ASV1R6W4HpjBhSeS+54PIsAMCBmwD06LLsqQ== + /acorn-dynamic-import/4.0.0/acorn@6.0.4: + dependencies: + acorn: 6.0.4 + dev: true + id: registry.npmjs.org/acorn-dynamic-import/4.0.0 + peerDependencies: + acorn: ^6.0.0 + resolution: + integrity: sha512-d3OEjQV4ROpoflsnUA8HozoIR504TFxNivYEUi6uwz0IYhBkTDXGuWlNdMtybRt3nqVx/L6XqMt0FxkXuWKZhw== /acorn-jsx/5.0.1/acorn@6.0.4: dependencies: acorn: 6.0.4 @@ -631,6 +661,21 @@ packages: acorn: ^6.0.0 resolution: integrity: sha512-HJ7CfNHrfJLlNTzIEUTj43LNWGkqpRLxm3YjAlcD0ACydk9XynzYsCBHxut+iqt+1aBXkx9UP/w/ZqMr13XIzg== + /acorn-node/1.6.2: + dependencies: + acorn: 6.0.4 + acorn-dynamic-import: /acorn-dynamic-import/4.0.0/acorn@6.0.4 + acorn-walk: 6.1.1 + xtend: 4.0.1 + dev: true + resolution: + integrity: sha512-rIhNEZuNI8ibQcL7ANm/mGyPukIaZsRNX9psFNQURyJW0nu6k8wjSDld20z6v2mDBWqX13pIEnk9gGZJHIlEXg== + /acorn-walk/6.1.1: + dev: true + engines: + node: '>=0.4.0' + resolution: + integrity: sha512-OtUw6JUTgxA2QoqqmrmQ7F2NYqiBPi/L2jqHyFtllhOUvXYQXf0Z1CYUinIfyT4bTCGmrA7gX9FvHA81uzCoVw== /acorn/6.0.4: dev: true engines: @@ -653,6 +698,12 @@ packages: node: '>=4' resolution: integrity: sha512-UgAb8H9D41AQnu/PbWlCofQVcnV4Gs2bBJi9eZPxfU/hgglFh3SMDMENRIqdr7H6XFnXdoknctFByVsCOotTVw== + /ansi-regex/2.1.1: + dev: true + engines: + node: '>=0.10.0' + resolution: + integrity: sha1-w7M6te42DYbg5ijwRorn7yfWVN8= /ansi-regex/3.0.0: dev: true engines: @@ -665,6 +716,12 @@ packages: node: '>=6' resolution: integrity: sha512-iB5Dda8t/UqpPI/IjsejXu5jOGDrzn41wJyljwPH65VCIbk6+1BzFIMJGFwTNrYXT1CrD+B4l19U7awiQ8rk7w== + /ansi-styles/2.2.1: + dev: true + engines: + node: '>=0.10.0' + resolution: + integrity: sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4= /ansi-styles/3.2.1: dependencies: color-convert: 1.9.3 @@ -708,6 +765,18 @@ packages: optional: true resolution: integrity: sha1-45sJrqne+Gao8gbiiK9jkZuuOcQ= + /array-filter/0.0.1: + dev: true + resolution: + integrity: sha1-fajPLiZijtcygDWB/SH2fKzS7uw= + /array-map/0.0.0: + dev: true + resolution: + integrity: sha1-iKK6tz0c97zVwbEYoAP2b2ZfpmI= + /array-reduce/0.0.0: + dev: true + resolution: + integrity: sha1-FziZ0//Rx9k4PkR5Ul2+J4yrXys= /array-unique/0.3.2: dev: true engines: @@ -715,6 +784,20 @@ packages: optional: true resolution: integrity: sha1-qJS3XUvE9s1nnvMkSp/Y9Gri1Cg= + /asn1.js/4.10.1: + dependencies: + bn.js: 4.11.8 + inherits: 2.0.3 + minimalistic-assert: 1.0.1 + dev: true + resolution: + integrity: sha512-p32cOF5q0Zqs9uBiONKYLm6BClCoBCM5O9JfeUSlnQLBTxYdTK+pW+nXflm8UkKd2UYlEbYz5qEi0JuZR9ckSw== + /assert/1.4.1: + dependencies: + util: 0.10.3 + dev: true + resolution: + integrity: sha1-mZEtWRg2tab1s0XA8H7vwI/GXZE= /assign-symbols/1.0.0: dev: true engines: @@ -741,6 +824,102 @@ packages: optional: true resolution: integrity: sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg== + /babel-code-frame/6.26.0: + dependencies: + chalk: 1.1.3 + esutils: 2.0.2 + js-tokens: 3.0.2 + dev: true + resolution: + integrity: sha1-Y/1D99weO7fONZR9uP42mj9Yx0s= + /babel-messages/6.23.0: + dependencies: + babel-runtime: 6.26.0 + dev: true + resolution: + integrity: sha1-8830cDhYA1sqKVHG7F7fbGLyYw4= + /babel-plugin-transform-es2015-modules-commonjs/6.26.2: + dependencies: + babel-plugin-transform-strict-mode: 6.24.1 + babel-runtime: 6.26.0 + babel-template: 6.26.0 + babel-types: 6.26.0 + dev: true + resolution: + integrity: sha512-CV9ROOHEdrjcwhIaJNBGMBCodN+1cfkwtM1SbUHmvyy35KGT7fohbpOxkE2uLz1o6odKK2Ck/tz47z+VqQfi9Q== + /babel-plugin-transform-runtime/6.23.0: + dependencies: + babel-runtime: 6.26.0 + dev: true + resolution: + integrity: sha1-iEkNRGUC6puOfvsP4J7E2ZR5se4= + /babel-plugin-transform-strict-mode/6.24.1: + dependencies: + babel-runtime: 6.26.0 + babel-types: 6.26.0 + dev: true + resolution: + integrity: sha1-1fr3qleKZbvlkc9e2uBKDGcCB1g= + /babel-polyfill/6.26.0: + dependencies: + babel-runtime: 6.26.0 + core-js: 2.6.1 + regenerator-runtime: 0.10.5 + dev: false + resolution: + integrity: sha1-N5k3q8Z9eJWXCtxiHyhM2WbPIVM= + /babel-runtime/6.26.0: + dependencies: + core-js: 2.6.1 + regenerator-runtime: 0.11.1 + resolution: + integrity: sha1-llxwWGaOgrVde/4E/yM3vItWR/4= + /babel-template/6.26.0: + dependencies: + babel-runtime: 6.26.0 + babel-traverse: 6.26.0 + babel-types: 6.26.0 + babylon: 6.18.0 + lodash: 4.17.11 + dev: true + resolution: + integrity: sha1-3gPi0WOWsGn0bdn/+FIfsaDjXgI= + /babel-traverse/6.26.0: + dependencies: + babel-code-frame: 6.26.0 + babel-messages: 6.23.0 + babel-runtime: 6.26.0 + babel-types: 6.26.0 + babylon: 6.18.0 + debug: 2.6.9 + globals: 9.18.0 + invariant: 2.2.4 + lodash: 4.17.11 + dev: true + resolution: + integrity: sha1-RqnL1+3MYsjlwGTi0tjQ9ANXZu4= + /babel-types/6.26.0: + dependencies: + babel-runtime: 6.26.0 + esutils: 2.0.2 + lodash: 4.17.11 + to-fast-properties: 1.0.3 + dev: true + resolution: + integrity: sha1-o7Bz+Uq0nrb6Vc1lInozQ4BjJJc= + /babelify/10.0.0: + dev: true + engines: + node: '>=6.9.0' + peerDependencies: + '@babel/core': ^7.0.0 + resolution: + integrity: sha512-X40FaxyH7t3X+JFAKvb1H9wooWKLRCi8pg3m8poqtdZaIng+bjzp9RvKQCvRjF9isHiPkXspbbXT/zwXLtwgwg== + /babylon/6.18.0: + dev: true + hasBin: true + resolution: + integrity: sha512-q/UEjfGJ2Cm3oKV71DJz9d25TPnq5rhBVL2Q4fA5wcC3jcrdn7+SssEybFIxwAvvP+YCsCYNKughoF33GxgycQ== /balanced-match/1.0.0: dev: true resolution: @@ -760,6 +939,10 @@ packages: optional: true resolution: integrity: sha512-5T6P4xPgpp0YDFvSWwEZ4NoE3aM4QBQXDzmVbraCkFj8zHM+mba8SyqB5DbZWyR7mYHo6Y7BdQo3MoA4m0TeQg== + /base64-js/1.3.0: + dev: true + resolution: + integrity: sha512-ccav/yGvoa80BQDljCxsmmQ3Xvx60/UpBIij5QN21W3wBi/hhIC9OoO+KLpu9IJTS9j4DRVJ3aDDF9cMSoa2lw== /binary-extensions/1.12.0: dev: true engines: @@ -767,6 +950,10 @@ packages: optional: true resolution: integrity: sha512-DYWGk01lDcxeS/K9IHPGWfT8PsJmbXRtRd2Sx72Tnb8pcYZQFF1oSDb8hJtS1vhp212q1Rzi5dUf9+nq0o9UIg== + /bn.js/4.11.8: + dev: true + resolution: + integrity: sha512-ItfYfPLkWHUjckQCk8xC+LwxgK8NYcXywGigJgSwOP8Y2iyWT4f2vsZnoOXTTbo+o5yXmIUJ4gn5538SO5S3gA== /brace-expansion/1.1.11: dependencies: balanced-match: 1.0.0 @@ -792,6 +979,137 @@ packages: optional: true resolution: integrity: sha512-aNdbnj9P8PjdXU4ybaWLK2IF3jc/EoDYbC7AazW6to3TRsfXxscC9UXOB5iDiEQrkyIbWp2SLQda4+QAa7nc3w== + /brorand/1.1.0: + dev: true + resolution: + integrity: sha1-EsJe/kCkXjwyPrhnWgoM5XsiNx8= + /browser-pack/6.1.0: + dependencies: + JSONStream: 1.3.5 + combine-source-map: 0.8.0 + defined: 1.0.0 + safe-buffer: 5.1.2 + through2: 2.0.5 + umd: 3.0.3 + dev: true + hasBin: true + resolution: + integrity: sha512-erYug8XoqzU3IfcU8fUgyHqyOXqIE4tUTTQ+7mqUjQlvnXkOO6OlT9c/ZoJVHYoAaqGxr09CN53G7XIsO4KtWA== + /browser-resolve/1.11.3: + dependencies: + resolve: 1.1.7 + dev: true + resolution: + integrity: sha512-exDi1BYWB/6raKHmDTCicQfTkqwN5fioMFV4j8BsfMU4R2DK/QfZfK7kOVkmWCNANf0snkBzqGqAJBao9gZMdQ== + /browserify-aes/1.2.0: + dependencies: + buffer-xor: 1.0.3 + cipher-base: 1.0.4 + create-hash: 1.2.0 + evp_bytestokey: 1.0.3 + inherits: 2.0.3 + safe-buffer: 5.1.2 + dev: true + resolution: + integrity: sha512-+7CHXqGuspUn/Sl5aO7Ea0xWGAtETPXNSAjHo48JfLdPWcMng33Xe4znFvQweqc/uzk5zSOI3H52CYnjCfb5hA== + /browserify-cipher/1.0.1: + dependencies: + browserify-aes: 1.2.0 + browserify-des: 1.0.2 + evp_bytestokey: 1.0.3 + dev: true + resolution: + integrity: sha512-sPhkz0ARKbf4rRQt2hTpAHqn47X3llLkUGn+xEJzLjwY8LRs2p0v7ljvI5EyoRO/mexrNunNECisZs+gw2zz1w== + /browserify-des/1.0.2: + dependencies: + cipher-base: 1.0.4 + des.js: 1.0.0 + inherits: 2.0.3 + safe-buffer: 5.1.2 + dev: true + resolution: + integrity: sha512-BioO1xf3hFwz4kc6iBhI3ieDFompMhrMlnDFC4/0/vd5MokpuAc3R+LYbwTA9A5Yc9pq9UYPqffKpW2ObuwX5A== + /browserify-rsa/4.0.1: + dependencies: + bn.js: 4.11.8 + randombytes: 2.0.6 + dev: true + resolution: + integrity: sha1-IeCr+vbyApzy+vsTNWenAdQTVSQ= + /browserify-sign/4.0.4: + dependencies: + bn.js: 4.11.8 + browserify-rsa: 4.0.1 + create-hash: 1.2.0 + create-hmac: 1.1.7 + elliptic: 6.4.1 + inherits: 2.0.3 + parse-asn1: 5.1.1 + dev: true + resolution: + integrity: sha1-qk62jl17ZYuqa/alfmMMvXqT0pg= + /browserify-zlib/0.2.0: + dependencies: + pako: 1.0.7 + dev: true + resolution: + integrity: sha512-Z942RysHXmJrhqk88FmKBVq/v5tqmSkDz7p54G/MGyjMnCFFnC79XWNbg+Vta8W6Wb2qtSZTSxIGkJrRpCFEiA== + /browserify/16.2.3: + dependencies: + JSONStream: 1.3.5 + assert: 1.4.1 + browser-pack: 6.1.0 + browser-resolve: 1.11.3 + browserify-zlib: 0.2.0 + buffer: 5.2.1 + cached-path-relative: 1.0.2 + concat-stream: 1.6.2 + console-browserify: 1.1.0 + constants-browserify: 1.0.0 + crypto-browserify: 3.12.0 + defined: 1.0.0 + deps-sort: 2.0.0 + domain-browser: 1.2.0 + duplexer2: 0.1.4 + events: 2.1.0 + glob: 7.1.3 + has: 1.0.3 + htmlescape: 1.1.1 + https-browserify: 1.0.0 + inherits: 2.0.3 + insert-module-globals: 7.2.0 + labeled-stream-splicer: 2.0.1 + mkdirp: 0.5.1 + module-deps: 6.2.0 + os-browserify: 0.3.0 + parents: 1.0.1 + path-browserify: 0.0.1 + process: 0.11.10 + punycode: 1.4.1 + querystring-es3: 0.2.1 + read-only-stream: 2.0.0 + readable-stream: 2.3.6 + resolve: 1.9.0 + shasum: 1.0.2 + shell-quote: 1.6.1 + stream-browserify: 2.0.1 + stream-http: 2.8.3 + string_decoder: 1.2.0 + subarg: 1.0.0 + syntax-error: 1.4.0 + through2: 2.0.5 + timers-browserify: 1.4.2 + tty-browserify: 0.0.1 + url: 0.11.0 + util: 0.10.4 + vm-browserify: 1.1.0 + xtend: 4.0.1 + dev: true + engines: + node: '>= 0.8' + hasBin: true + resolution: + integrity: sha512-zQt/Gd1+W+IY+h/xX2NYMW4orQWhqSwyV+xsblycTtpOuB27h1fZhhNQuipJ4t79ohw4P4mMem0jp/ZkISQtjQ== /browserslist/4.3.5: dependencies: caniuse-lite: 1.0.30000912 @@ -801,6 +1119,25 @@ packages: hasBin: true resolution: integrity: sha512-z9ZhGc3d9e/sJ9dIx5NFXkKoaiQTnrvrMsN3R1fGb1tkWWNSz12UewJn9TNxGo1l7J23h0MRaPmk7jfeTZYs1w== + /buffer-from/1.1.1: + dev: true + resolution: + integrity: sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A== + /buffer-xor/1.0.3: + dev: true + resolution: + integrity: sha1-JuYe0UIvtw3ULm42cp7VHYVf6Nk= + /buffer/5.2.1: + dependencies: + base64-js: 1.3.0 + ieee754: 1.1.12 + dev: true + resolution: + integrity: sha512-c+Ko0loDaFfuPWiL02ls9Xd3GO3cPVmUobQ6t3rXNUk304u6hGq+8N/kFi+QEIKhzK3uwolVhLzszmfLmMLnqg== + /builtin-status-codes/3.0.0: + dev: true + resolution: + integrity: sha1-hZgoeOIbmOHGZCXgPQF0eI9Wnug= /cache-base/1.0.1: dependencies: collection-visit: 1.0.0 @@ -818,6 +1155,10 @@ packages: optional: true resolution: integrity: sha512-AKcdTnFSWATd5/GCPRxr2ChwIJ85CeyrEyjRHlKxQ56d4XJMGym0uAiKn0xbLOGOl3+yRpOTi484dVCEc5AUzQ== + /cached-path-relative/1.0.2: + dev: true + resolution: + integrity: sha512-5r2GqsoEb4qMTTN9J+WzXfjov+hjxT+j3u5K+kIVNIwAd99DLCJE9pBIMP1qVeybV6JiijL385Oz0DcYxfbOIg== /caller-path/0.1.0: dependencies: callsites: 0.2.0 @@ -836,6 +1177,18 @@ packages: dev: true resolution: integrity: sha512-M3zAtV36U+xw5mMROlTXpAHClmPAor6GPKAMD5Yi7glCB5sbMPFtnQ3rGpk4XqPdUrrTIaVYSJZxREZWNy8QJg== + /chalk/1.1.3: + dependencies: + ansi-styles: 2.2.1 + escape-string-regexp: 1.0.5 + has-ansi: 2.0.0 + strip-ansi: 3.0.1 + supports-color: 2.0.0 + dev: true + engines: + node: '>=0.10.0' + resolution: + integrity: sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg= /chalk/2.4.1: dependencies: ansi-styles: 3.2.1 @@ -870,6 +1223,13 @@ packages: fsevents: 1.2.4 resolution: integrity: sha512-z9n7yt9rOvIJrMhvDtDictKrkFHeihkNl6uWMmZlmL6tJtX9Cs+87oK+teBx+JIgzvbX3yZHT3eF8vpbDxHJXQ== + /cipher-base/1.0.4: + dependencies: + inherits: 2.0.3 + safe-buffer: 5.1.2 + dev: true + resolution: + integrity: sha512-Kkht5ye6ZGmwv40uUDZztayT2ThLQGfnj/T71N/XzeZeo3nf8foyW7zGTsPYkEya3m5f3cAypH+qe7YOrM1U2Q== /circular-json/0.3.3: deprecated: 'CircularJSON is in maintenance only, flatted is its successor.' dev: true @@ -919,6 +1279,15 @@ packages: dev: true resolution: integrity: sha1-p9BVi9icQveV3UIyj3QIMcpTvCU= + /combine-source-map/0.8.0: + dependencies: + convert-source-map: 1.1.3 + inline-source-map: 0.6.2 + lodash.memoize: 3.0.4 + source-map: 0.5.7 + dev: true + resolution: + integrity: sha1-pY0N8ELBhvz4IqjoAV9UUNLXmos= /commander/2.19.0: dev: true resolution: @@ -932,6 +1301,31 @@ packages: dev: true resolution: integrity: sha1-2Klr13/Wjfd5OnMDajug1UBdR3s= + /concat-stream/1.6.2: + dependencies: + buffer-from: 1.1.1 + inherits: 2.0.3 + readable-stream: 2.3.6 + typedarray: 0.0.6 + dev: true + engines: + '0': node >= 0.8 + resolution: + integrity: sha512-27HBghJxjiZtIk3Ycvn/4kbJk/1uZuJFfuPEns6LaEvpvG1f0hTea8lilrouyo9mVc2GWdcEZ8OLoGmSADlrCw== + /console-browserify/1.1.0: + dependencies: + date-now: 0.1.4 + dev: true + resolution: + integrity: sha1-8CQcRXMKn8YyOyBtvzjtx0HQuxA= + /constants-browserify/1.0.0: + dev: true + resolution: + integrity: sha1-wguW2MYXdIqvHBYCF2DNJ/y4y3U= + /convert-source-map/1.1.3: + dev: true + resolution: + integrity: sha1-SCnId+n+SbMWHzvzZziI4gRpmGA= /convert-source-map/1.6.0: dependencies: safe-buffer: 5.1.2 @@ -945,11 +1339,41 @@ packages: optional: true resolution: integrity: sha1-Z29us8OZl8LuGsOpJP1hJHSPV40= + /core-js/2.6.1: + resolution: + integrity: sha512-L72mmmEayPJBejKIWe2pYtGis5r0tQ5NaJekdhyXgeMQTpJoBsH0NL4ElY2LfSoV15xeQWKQ+XTTOZdyero5Xg== /core-util-is/1.0.2: dev: true - optional: true resolution: integrity: sha1-tf1UIgqivFq1eqtxQMlAdUUDwac= + /create-ecdh/4.0.3: + dependencies: + bn.js: 4.11.8 + elliptic: 6.4.1 + dev: true + resolution: + integrity: sha512-GbEHQPMOswGpKXM9kCWVrremUcBmjteUaQ01T9rkKCPDXfUHX0IoP9LpHYo2NPFampa4e+/pFDc3jQdxrxQLaw== + /create-hash/1.2.0: + dependencies: + cipher-base: 1.0.4 + inherits: 2.0.3 + md5.js: 1.3.5 + ripemd160: 2.0.2 + sha.js: 2.4.11 + dev: true + resolution: + integrity: sha512-z00bCGNHDG8mHAkP7CtT1qVu+bFQUPjYq/4Iv3C3kWjTFV10zIjfSoeqXo9Asws8gwSHDGj/hl2u4OGIjapeCg== + /create-hmac/1.1.7: + dependencies: + cipher-base: 1.0.4 + create-hash: 1.2.0 + inherits: 2.0.3 + ripemd160: 2.0.2 + safe-buffer: 5.1.2 + sha.js: 2.4.11 + dev: true + resolution: + integrity: sha512-MJG9liiZ+ogc4TzUwuvbER1JRdgvUFSB5+VR/g5h82fGaIRWMWddtKBHi7/sVhfjQZ6SehlyhvQYrcYkaUIpLg== /cross-spawn/6.0.5: dependencies: nice-try: 1.0.5 @@ -962,11 +1386,30 @@ packages: node: '>=4.8' resolution: integrity: sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ== + /crypto-browserify/3.12.0: + dependencies: + browserify-cipher: 1.0.1 + browserify-sign: 4.0.4 + create-ecdh: 4.0.3 + create-hash: 1.2.0 + create-hmac: 1.1.7 + diffie-hellman: 5.0.3 + inherits: 2.0.3 + pbkdf2: 3.0.17 + public-encrypt: 4.0.3 + randombytes: 2.0.6 + randomfill: 1.0.4 + dev: true + resolution: + integrity: sha512-fz4spIh+znjO2VjL+IdhEpRJ3YN6sMzITSBijk6FK2UvTqruSQW+/cCZTSNsMiZNvUeq0CqurF+dAbyiGOY6Wg== + /date-now/0.1.4: + dev: true + resolution: + integrity: sha1-6vQ5/U1ISK105cx9vvIAZyueNFs= /debug/2.6.9: dependencies: ms: 2.0.0 dev: true - optional: true resolution: integrity: sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA== /debug/4.1.0: @@ -1014,6 +1457,46 @@ packages: optional: true resolution: integrity: sha512-jwK2UV4cnPpbcG7+VRARKTZPUWowwXA8bzH5NP6ud0oeAxyYPuGZUAC7hMugpCdz4BeSZl2Dl9k66CHJ/46ZYQ== + /defined/1.0.0: + dev: true + resolution: + integrity: sha1-yY2bzvdWdBiOEQlpFRGZ45sfppM= + /deps-sort/2.0.0: + dependencies: + JSONStream: 1.3.5 + shasum: 1.0.2 + subarg: 1.0.0 + through2: 2.0.5 + dev: true + hasBin: true + resolution: + integrity: sha1-CRckkC6EZYJg65EHSMzNGvbiH7U= + /des.js/1.0.0: + dependencies: + inherits: 2.0.3 + minimalistic-assert: 1.0.1 + dev: true + resolution: + integrity: sha1-wHTS4qpqipoH29YfmhXCzYPsjsw= + /detective/5.1.0: + dependencies: + acorn-node: 1.6.2 + defined: 1.0.0 + minimist: 1.2.0 + dev: true + engines: + node: '>=0.8.0' + hasBin: true + resolution: + integrity: sha512-TFHMqfOvxlgrfVzTEkNBSh9SvSNX/HfF4OFI2QFGCyPm02EsyILqnUeb5P6q7JZ3SFNTBL5t2sePRgrN4epUWQ== + /diffie-hellman/5.0.3: + dependencies: + bn.js: 4.11.8 + miller-rabin: 4.0.1 + randombytes: 2.0.6 + dev: true + resolution: + integrity: sha512-kqag/Nl+f3GwyK25fhUMYj81BUOrZ9IuJsjIcDE5icNM9FJHAVm3VcUDxdLPoQtTuUylWm6ZIknYJwwaPxsUzg== /doctrine/2.1.0: dependencies: esutils: 2.0.2 @@ -1022,10 +1505,35 @@ packages: node: '>=0.10.0' resolution: integrity: sha512-35mSku4ZXK0vfCuHEDAwt55dg2jNajHZ1odvF+8SSr82EsZY4QmXfuWso8oEd8zRhVObSN18aM0CjSdoBX7zIw== + /domain-browser/1.2.0: + dev: true + engines: + node: '>=0.4' + npm: '>=1.2' + resolution: + integrity: sha512-jnjyiM6eRyZl2H+W8Q/zLMA481hzi0eszAaBUzIVnmYVDBbnLxVNnfu1HgEBvCbL+71FrxMl3E6lpKH7Ge3OXA== + /duplexer2/0.1.4: + dependencies: + readable-stream: 2.3.6 + dev: true + resolution: + integrity: sha1-ixLauHjA1p4+eJEFFmKjL8a93ME= /electron-to-chromium/1.3.86: dev: true resolution: integrity: sha512-BcmXOu37FCPxrrh0wyKgKi5dAjIu2ohxN5ptapkLPKRC3IBK2NeIwh9n1x/8HzSRQiEKamJkDce1ZgOGgEX9iw== + /elliptic/6.4.1: + dependencies: + bn.js: 4.11.8 + brorand: 1.1.0 + hash.js: 1.1.7 + hmac-drbg: 1.0.1 + inherits: 2.0.3 + minimalistic-assert: 1.0.1 + minimalistic-crypto-utils: 1.0.1 + dev: true + resolution: + integrity: sha512-BsXLz5sqX8OHcsh7CqBMztyXARmGQ3LWPtGjJi6DiJHq5C/qvi9P3OqgswKSDftbu8+IoI/QDTAm2fFnQ9SZSQ== /escape-string-regexp/1.0.5: dev: true engines: @@ -1144,6 +1652,19 @@ packages: node: '>=0.10.0' resolution: integrity: sha1-Cr9PHKpbyx96nYrMbepPqqBLrJs= + /events/2.1.0: + dev: true + engines: + node: '>=0.4.x' + resolution: + integrity: sha512-3Zmiobend8P9DjmKAty0Era4jV8oJ0yGYe2nJJAxgymF9+N8F2m0hhZiMoWtcfepExzNKZumFU3ksdQbInGWCg== + /evp_bytestokey/1.0.3: + dependencies: + md5.js: 1.3.5 + safe-buffer: 5.1.2 + dev: true + resolution: + integrity: sha512-/f2Go4TognH/KvCISP7OUsHn85hT9nUkxxA9BEWxFn+Oj9o8ZNLm/40hdlgSLyuOimsrTKLUMEorQexp/aPQeA== /expand-brackets/2.1.4: dependencies: debug: 2.6.9 @@ -1292,10 +1813,18 @@ packages: requiresBuild: true resolution: integrity: sha512-z8H8/diyk76B7q5wg+Ud0+CqzcAF3mBBI/bA5ne5zrRUUIvNkJY//D3BqyH571KuAC4Nr7Rw7CjWX4r0y9DvNg== + /function-bind/1.1.1: + dev: true + resolution: + integrity: sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A== /functional-red-black-tree/1.0.1: dev: true resolution: integrity: sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc= + /get-assigned-identifiers/1.2.0: + dev: true + resolution: + integrity: sha512-mBBwmeGTrxEMO4pMaaf/uUEFHnYtwr8FTe8Y/mer4rcV/bye0qGm6pw1bGZFGStxC5O76c5ZAVBGnqHmOaJpdQ== /get-value/2.0.6: dev: true engines: @@ -1328,10 +1857,24 @@ packages: node: '>=4' resolution: integrity: sha512-5cJVtyXWH8PiJPVLZzzoIizXx944O4OmRro5MWKx5fT4MgcN7OfaMutPeaTdJCCURwbWdhhcCWcKIffPnmTzBg== + /globals/9.18.0: + dev: true + engines: + node: '>=0.10.0' + resolution: + integrity: sha512-S0nG3CLEQiY/ILxqtztTWH/3iRRdyBLw6KMDxnKMchrtbj2OFmehVh0WUCfW3DUrIgx/qFrJPICrq4Z4sTR9UQ== /graceful-fs/4.1.15: dev: true resolution: integrity: sha512-6uHUhOPEBgQ24HM+r6b/QwWfZq+yiFcipKFrOFiBEnWdy5sdzYoi+pJeQaPI5qOLRFqWmAXUPQNsielzdLoecA== + /has-ansi/2.0.0: + dependencies: + ansi-regex: 2.1.1 + dev: true + engines: + node: '>=0.10.0' + resolution: + integrity: sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE= /has-flag/3.0.0: dev: true engines: @@ -1377,6 +1920,48 @@ packages: optional: true resolution: integrity: sha1-lbC2P+whRmGab+V/51Yo1aOe/k8= + /has/1.0.3: + dependencies: + function-bind: 1.1.1 + dev: true + engines: + node: '>= 0.4.0' + resolution: + integrity: sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw== + /hash-base/3.0.4: + dependencies: + inherits: 2.0.3 + safe-buffer: 5.1.2 + dev: true + engines: + node: '>=4' + resolution: + integrity: sha1-X8hoaEfs1zSZQDMZprCj8/auSRg= + /hash.js/1.1.7: + dependencies: + inherits: 2.0.3 + minimalistic-assert: 1.0.1 + dev: true + resolution: + integrity: sha512-taOaskGt4z4SOANNseOviYDvjEJinIkRgmp7LbKP2YTTmVxWBl87s/uzK9r+44BclBSp2X7K1hqeNfz9JbBeXA== + /hmac-drbg/1.0.1: + dependencies: + hash.js: 1.1.7 + minimalistic-assert: 1.0.1 + minimalistic-crypto-utils: 1.0.1 + dev: true + resolution: + integrity: sha1-0nRXAQJabHdabFRXk+1QL8DGSaE= + /htmlescape/1.1.1: + dev: true + engines: + node: '>=0.10' + resolution: + integrity: sha1-OgPtwiFLyjtmQko+eVk0lQnLA1E= + /https-browserify/1.0.0: + dev: true + resolution: + integrity: sha1-7AbBDgo0wPL68Zn3/X/Hj//QPHM= /iconv-lite/0.4.24: dependencies: safer-buffer: 2.1.2 @@ -1385,6 +1970,10 @@ packages: node: '>=0.10.0' resolution: integrity: sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA== + /ieee754/1.1.12: + dev: true + resolution: + integrity: sha512-GguP+DRY+pJ3soyIiGPTvdiVXjZ+DbXOxGpXn3eMvNW4x4irjqXm4wHKscC+TfxSJ0yw/S1F24tqdMNsMZTiLA== /ignore/4.0.6: dev: true engines: @@ -1404,10 +1993,20 @@ packages: dev: true resolution: integrity: sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk= + /inherits/2.0.1: + dev: true + resolution: + integrity: sha1-sX0I0ya0Qj5Wjv9xn5GwscvfafE= /inherits/2.0.3: dev: true resolution: integrity: sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4= + /inline-source-map/0.6.2: + dependencies: + source-map: 0.5.7 + dev: true + resolution: + integrity: sha1-+Tk0ccGKedFyT4Y/o4tYY3Ct4qU= /inquirer/6.2.1: dependencies: ansi-escapes: 3.1.0 @@ -1428,6 +2027,22 @@ packages: node: '>=6.0.0' resolution: integrity: sha512-088kl3DRT2dLU5riVMKKr1DlImd6X7smDhpXUCkJDCKvTEJeRiXh0G132HG9u5a+6Ylw9plFRY7RuTnwohYSpg== + /insert-module-globals/7.2.0: + dependencies: + JSONStream: 1.3.5 + acorn-node: 1.6.2 + combine-source-map: 0.8.0 + concat-stream: 1.6.2 + is-buffer: 1.1.6 + path-is-absolute: 1.0.1 + process: 0.11.10 + through2: 2.0.5 + undeclared-identifiers: 1.1.2 + xtend: 4.0.1 + dev: true + hasBin: true + resolution: + integrity: sha512-VE6NlW+WGn2/AeOMd496AHFYmE7eLKkUY6Ty31k4og5vmA3Fjuwe9v6ifH6Xx/Hz27QvdoMoviw1/pqWRB09Sw== /invariant/2.2.4: dependencies: loose-envify: 1.4.0 @@ -1463,7 +2078,6 @@ packages: integrity: sha1-dfFmQrSA8YenEcgUFh/TpKdlWJg= /is-buffer/1.1.6: dev: true - optional: true resolution: integrity: sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w== /is-data-descriptor/0.1.4: @@ -1594,9 +2208,12 @@ packages: integrity: sha512-eXK1UInq2bPmjyX6e3VHIzMLobc4J94i4AWn+Hpq3OU5KkrRC96OAcR3PRJ/pGu6m8TRnBHP9dkXQVsT/COVIA== /isarray/1.0.0: dev: true - optional: true resolution: integrity: sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE= + /isarray/2.0.4: + dev: true + resolution: + integrity: sha512-GMxXOiUirWg1xTKRipM0Ek07rX+ubx4nNVElTJdNLYmNO/2YrDkgJGw9CljXn+r4EWiDQg/8lsRdHyg2PJuUaA== /isexe/2.0.0: dev: true resolution: @@ -1623,6 +2240,10 @@ packages: node: '>=0.10.0' resolution: integrity: sha512-PxfGzSs0ztShKrUYPIn5r0MtyAhYcCwmndozzpz8YObbPnD1jFxzlBGbRnX2mIu6Z13xN6+PTu05TQFnZFlzow== + /js-tokens/3.0.2: + dev: true + resolution: + integrity: sha1-mGbfOVECEw449/mWvOtlRDIJwls= /js-tokens/4.0.0: dev: true resolution: @@ -1655,6 +2276,12 @@ packages: dev: true resolution: integrity: sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE= + /json-stable-stringify/0.0.1: + dependencies: + jsonify: 0.0.0 + dev: true + resolution: + integrity: sha1-YRwj6BTbN1Un34URk9tZ3Sryf0U= /json5/2.1.0: dependencies: minimist: 1.2.0 @@ -1664,6 +2291,16 @@ packages: hasBin: true resolution: integrity: sha512-8Mh9h6xViijj36g7Dxi+Y4S6hNGV96vcJZr/SrlHh1LR/pEn/8j/+qIBbs44YKl69Lrfctp4QD+AdWLTMqEZAQ== + /jsonify/0.0.0: + dev: true + resolution: + integrity: sha1-LHS27kHZPKUbe1qu6PUDYx0lKnM= + /jsonparse/1.3.1: + dev: true + engines: + '0': node >= 0.2.0 + resolution: + integrity: sha1-P02uSpH6wxX3EGL4UhzCOfE2YoA= /kind-of/3.2.2: dependencies: is-buffer: 1.1.6 @@ -1696,6 +2333,14 @@ packages: optional: true resolution: integrity: sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA== + /labeled-stream-splicer/2.0.1: + dependencies: + inherits: 2.0.3 + isarray: 2.0.4 + stream-splicer: 2.0.0 + dev: true + resolution: + integrity: sha512-MC94mHZRvJ3LfykJlTUipBqenZz1pacOZEMhhQ8dMGcDHs0SBE5GbsavUXV7YtP3icBW17W0Zy1I0lfASmo9Pg== /levn/0.3.0: dependencies: prelude-ls: 1.1.2 @@ -1710,6 +2355,10 @@ packages: optional: true resolution: integrity: sha1-gteb/zCmfEAF/9XiUVMArZyk168= + /lodash.memoize/3.0.4: + dev: true + resolution: + integrity: sha1-LcvSwofLwKVcxCMovQxzYVDVPj8= /lodash/4.17.11: dev: true resolution: @@ -1737,6 +2386,14 @@ packages: optional: true resolution: integrity: sha1-7Nyo8TFE5mDxtb1B8S80edmN+48= + /md5.js/1.3.5: + dependencies: + hash-base: 3.0.4 + inherits: 2.0.3 + safe-buffer: 5.1.2 + dev: true + resolution: + integrity: sha512-xitP+WxNPcTTOgnTJcrhM0xvdPepipPSf3I8EIpGKeFLjt3PlJLIDG3u8EX53ZIubkb+5U2+3rELYpEhHhzdkg== /micromatch/3.1.10: dependencies: arr-diff: 4.0.0 @@ -1758,12 +2415,28 @@ packages: optional: true resolution: integrity: sha512-MWikgl9n9M3w+bpsY3He8L+w9eF9338xRl8IAO5viDizwSzziFEyUzo2xrrloB64ADbTf8uA8vRqqttDTOmccg== + /miller-rabin/4.0.1: + dependencies: + bn.js: 4.11.8 + brorand: 1.1.0 + dev: true + hasBin: true + resolution: + integrity: sha512-115fLhvZVqWwHPbClyntxEVfVDfl9DLLTuJvq3g2O/Oxi8AiNouAHvDSzHS0viUJc+V5vm3eq91Xwqn9dp4jRA== /mimic-fn/1.2.0: dev: true engines: node: '>=4' resolution: integrity: sha512-jf84uxzwiuiIVKiOLpfYk7N46TSy8ubTonmneY9vrpHNAnp0QBt2BxWV9dO3/j+BoVAb+a5G6YDPW3M5HOdMWQ== + /minimalistic-assert/1.0.1: + dev: true + resolution: + integrity: sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A== + /minimalistic-crypto-utils/1.0.1: + dev: true + resolution: + integrity: sha1-9sAMHAsIIkblxNmd+4x8CDsrWCo= /minimatch/3.0.4: dependencies: brace-expansion: 1.1.11 @@ -1795,9 +2468,31 @@ packages: hasBin: true resolution: integrity: sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM= + /module-deps/6.2.0: + dependencies: + JSONStream: 1.3.5 + browser-resolve: 1.11.3 + cached-path-relative: 1.0.2 + concat-stream: 1.6.2 + defined: 1.0.0 + detective: 5.1.0 + duplexer2: 0.1.4 + inherits: 2.0.3 + parents: 1.0.1 + readable-stream: 2.3.6 + resolve: 1.9.0 + stream-combiner2: 1.1.1 + subarg: 1.0.0 + through2: 2.0.5 + xtend: 4.0.1 + dev: true + engines: + node: '>= 0.8.0' + hasBin: true + resolution: + integrity: sha512-hKPmO06so6bL/ZvqVNVqdTVO8UAYsi3tQWlCa+z9KuWhoN4KDQtb5hcqQQv58qYiDE21wIvnttZEPiDgEbpwbA== /ms/2.0.0: dev: true - optional: true resolution: integrity: sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g= /ms/2.1.1: @@ -1917,6 +2612,10 @@ packages: node: '>= 0.8.0' resolution: integrity: sha1-NkxeQJ0/TWMB1sC0wFu6UBgK62Q= + /os-browserify/0.3.0: + dev: true + resolution: + integrity: sha1-hUNzx/XCMVkU/Jv8a9gjj92h7Cc= /os-tmpdir/1.0.2: dev: true engines: @@ -1931,6 +2630,26 @@ packages: dev: true resolution: integrity: sha512-mDho4qm7WgIXIGf4eYU1RHN2UU5tPfVYVSRwDJw0uTmj35DQUt/eNp19N7v6T3SrR0ESTEf2up2CGO73qI35zQ== + /pako/1.0.7: + dev: true + resolution: + integrity: sha512-3HNK5tW4x8o5mO8RuHZp3Ydw9icZXx0RANAOMzlMzx7LVXhMJ4mo3MOBpzyd7r/+RUu8BmndP47LXT+vzjtWcQ== + /parents/1.0.1: + dependencies: + path-platform: 0.11.15 + dev: true + resolution: + integrity: sha1-/t1NK/GTp3dF/nHjcdc8MwfZx1E= + /parse-asn1/5.1.1: + dependencies: + asn1.js: 4.10.1 + browserify-aes: 1.2.0 + create-hash: 1.2.0 + evp_bytestokey: 1.0.3 + pbkdf2: 3.0.17 + dev: true + resolution: + integrity: sha512-KPx7flKXg775zZpnp9SxJlz00gTd4BmJ2yJufSc44gMCRrRQ7NSzAcSJQfifuOLgW6bEi+ftrALtsgALeB2Adw== /pascalcase/0.1.1: dev: true engines: @@ -1938,6 +2657,10 @@ packages: optional: true resolution: integrity: sha1-s2PlXoAGym/iF4TS2yK9FdeRfxQ= + /path-browserify/0.0.1: + dev: true + resolution: + integrity: sha512-BapA40NHICOS+USX9SN4tyhq+A2RrN/Ws5F0Z5aMHDp98Fl86lX8Oti8B7uN93L4Ifv4fHOEA+pQw87gmMO/lQ== /path-dirname/1.0.2: dev: true optional: true @@ -1963,6 +2686,24 @@ packages: dev: true resolution: integrity: sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw== + /path-platform/0.11.15: + dev: true + engines: + node: '>= 0.8.0' + resolution: + integrity: sha1-6GQhf3TDaFDwhSt43Hv31KVyG/I= + /pbkdf2/3.0.17: + dependencies: + create-hash: 1.2.0 + create-hmac: 1.1.7 + ripemd160: 2.0.2 + safe-buffer: 5.1.2 + sha.js: 2.4.11 + dev: true + engines: + node: '>=0.12' + resolution: + integrity: sha512-U/il5MsrZp7mGg3mSQfn742na2T+1/vHDCG5/iTI3X9MKUuYUZVLQhyRsg06mCgDBTd57TxzgZt7P+fYfjRLtA== /pluralize/7.0.0: dev: true engines: @@ -1990,21 +2731,76 @@ packages: integrity: sha512-VvivMrbvd2nKkiG38qjULzlc+4Vx4wm/whI9pQD35YrARNnhxeiRktSOhSukRLFNlzg6Br/cJPet5J/u19r/mg== /process-nextick-args/2.0.0: dev: true - optional: true resolution: integrity: sha512-MtEC1TqN0EU5nephaJ4rAtThHtC86dNN9qCuEhtshvpVBkAW5ZO7BASN9REnF9eoXGcRub+pFuKEpOHE+HbEMw== + /process/0.11.10: + dev: true + engines: + node: '>= 0.6.0' + resolution: + integrity: sha1-czIwDoQBYb2j5podHZGn1LwW8YI= /progress/2.0.1: dev: true engines: node: '>=0.4.0' resolution: integrity: sha512-OE+a6vzqazc+K6LxJrX5UPyKFvGnL5CYmq2jFGNIBWHpc4QyE49/YOumcrpQFJpfejmvRtbJzgO1zPmMCqlbBg== + /public-encrypt/4.0.3: + dependencies: + bn.js: 4.11.8 + browserify-rsa: 4.0.1 + create-hash: 1.2.0 + parse-asn1: 5.1.1 + randombytes: 2.0.6 + safe-buffer: 5.1.2 + dev: true + resolution: + integrity: sha512-zVpa8oKZSz5bTMTFClc1fQOnyyEzpl5ozpi1B5YcvBrdohMjH2rfsBtyXcuNuwjsDIXmBYlF2N5FlJYhR29t8Q== + /punycode/1.3.2: + dev: true + resolution: + integrity: sha1-llOgNvt8HuQjQvIyXM7v6jkmxI0= + /punycode/1.4.1: + dev: true + resolution: + integrity: sha1-wNWmOycYgArY4esPpSachN1BhF4= /punycode/2.1.1: dev: true engines: node: '>=6' resolution: integrity: sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A== + /querystring-es3/0.2.1: + dev: true + engines: + node: '>=0.4.x' + resolution: + integrity: sha1-nsYfeQSYdXB9aUFFlv2Qek1xHnM= + /querystring/0.2.0: + dev: true + engines: + node: '>=0.4.x' + resolution: + integrity: sha1-sgmEkgO7Jd+CDadW50cAWHhSFiA= + /randombytes/2.0.6: + dependencies: + safe-buffer: 5.1.2 + dev: true + resolution: + integrity: sha512-CIQ5OFxf4Jou6uOKe9t1AOgqpeU5fd70A8NPdHSGeYXqXsPe6peOwI0cUl88RWZ6sP1vPMV3avd/R6cZ5/sP1A== + /randomfill/1.0.4: + dependencies: + randombytes: 2.0.6 + safe-buffer: 5.1.2 + dev: true + resolution: + integrity: sha512-87lcbR8+MhcWcUiQ+9e+Rwx8MyR2P7qnt15ynUlbm3TU/fjbgz4GsvfSUDTemtCCtVCqb4ZcEFlyPNTh9bBTLw== + /read-only-stream/2.0.0: + dependencies: + readable-stream: 2.3.6 + dev: true + resolution: + integrity: sha1-JyT9aoET1zdkrCiNQ4YnDB2/F/A= /readable-stream/2.3.6: dependencies: core-util-is: 1.0.2 @@ -2015,7 +2811,6 @@ packages: string_decoder: 1.1.1 util-deprecate: 1.0.2 dev: true - optional: true resolution: integrity: sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw== /readdirp/2.2.1: @@ -2041,6 +2836,13 @@ packages: dev: true resolution: integrity: sha512-1G6jJVDWrt0rK99kBjvEtziZNCICAuvIPkSiUFIQxVP06RCVpq3dmDo2oi6ABpYaDYaTRr67BEhL8r1wgEZZKg== + /regenerator-runtime/0.10.5: + dev: false + resolution: + integrity: sha1-M2w+/BIgrc7dosn6tntaeVWjNlg= + /regenerator-runtime/0.11.1: + resolution: + integrity: sha512-MguG95oij0fC3QV3URf4V2SDYGJhJnJGqvIIgdECeODCT98wSWDAJ94SSuVpYQUoTcGUIL6L4yNB7j1DFFHSBg== /regenerator-transform/0.13.3: dependencies: private: 0.1.8 @@ -2126,12 +2928,22 @@ packages: optional: true resolution: integrity: sha1-LGN/53yJOv0qZj/iGqkIAGjiBSo= + /resolve/1.1.7: + dev: true + resolution: + integrity: sha1-IDEU2CrSxe2ejgQRs5ModeiJ6Xs= /resolve/1.8.1: dependencies: path-parse: 1.0.6 dev: true resolution: integrity: sha512-AicPrAC7Qu1JxPCZ9ZgCZlY35QgFnNqc+0LtbRNxnVw4TXvjQ72wnuL9JQcEBgXkI9JM8MsT9kaQoHcpCRJOYA== + /resolve/1.9.0: + dependencies: + path-parse: 1.0.6 + dev: true + resolution: + integrity: sha512-TZNye00tI67lwYvzxCxHGjwTNlUV70io54/Ed4j6PscB8xVfuBJpRenI/o6dVk0cY0PYTY27AgCoGGxRnYuItQ== /restore-cursor/2.0.0: dependencies: onetime: 2.0.1 @@ -2155,6 +2967,13 @@ packages: hasBin: true resolution: integrity: sha512-lreewLK/BlghmxtfH36YYVg1i8IAce4TI7oao75I1g245+6BctqTVQiBP3YUJ9C6DQOXJmkYR9X9fCLtCOJc5w== + /ripemd160/2.0.2: + dependencies: + hash-base: 3.0.4 + inherits: 2.0.3 + dev: true + resolution: + integrity: sha512-ii4iagi25WusVoiC4B4lq7pbXfAp3D9v5CwfkY33vffw2+pkDjY1D8GaN7spsxvCSx8dkPqOZCEZyfxcmJG2IA== /run-async/2.3.0: dependencies: is-promise: 2.1.0 @@ -2215,6 +3034,21 @@ packages: optional: true resolution: integrity: sha512-hw0yxk9GT/Hr5yJEYnHNKYXkIA8mVJgd9ditYZCe16ZczcaELYYcfvaXesNACk2O8O0nTiPQcQhGUQj8JLzeeg== + /sha.js/2.4.11: + dependencies: + inherits: 2.0.3 + safe-buffer: 5.1.2 + dev: true + hasBin: true + resolution: + integrity: sha512-QMEp5B7cftE7APOjk5Y6xgrbWu+WkLVQwk8JNjZ8nKRciZaByEW6MubieAiToS7+dwvrjGhH8jRXz3MVd0AYqQ== + /shasum/1.0.2: + dependencies: + json-stable-stringify: 0.0.1 + sha.js: 2.4.11 + dev: true + resolution: + integrity: sha1-5wEjENj0F/TetXEhUOVni4euVl8= /shebang-command/1.2.0: dependencies: shebang-regex: 1.0.0 @@ -2229,10 +3063,23 @@ packages: node: '>=0.10.0' resolution: integrity: sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM= + /shell-quote/1.6.1: + dependencies: + array-filter: 0.0.1 + array-map: 0.0.0 + array-reduce: 0.0.0 + jsonify: 0.0.0 + dev: true + resolution: + integrity: sha1-9HgZSczkAmlxJ0MOo7PFR29IF2c= /signal-exit/3.0.2: dev: true resolution: integrity: sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0= + /simple-concat/1.0.0: + dev: true + resolution: + integrity: sha1-c0TLuLbib7J9ZrL8hvn21Zl1IcY= /slash/2.0.0: dev: true engines: @@ -2330,6 +3177,37 @@ packages: optional: true resolution: integrity: sha1-YICcOcv/VTNyJv1eC1IPNB8ftcY= + /stream-browserify/2.0.1: + dependencies: + inherits: 2.0.3 + readable-stream: 2.3.6 + dev: true + resolution: + integrity: sha1-ZiZu5fm9uZQKTkUUyvtDu3Hlyds= + /stream-combiner2/1.1.1: + dependencies: + duplexer2: 0.1.4 + readable-stream: 2.3.6 + dev: true + resolution: + integrity: sha1-+02KFCDqNidk4hrUeAOXvry0HL4= + /stream-http/2.8.3: + dependencies: + builtin-status-codes: 3.0.0 + inherits: 2.0.3 + readable-stream: 2.3.6 + to-arraybuffer: 1.0.1 + xtend: 4.0.1 + dev: true + resolution: + integrity: sha512-+TSkfINHDo4J+ZobQLWiMouQYB+UVYFttRA94FpEzzJ7ZdqcL4uUUQ7WkdkI4DSozGmgBUE/a47L+38PenXhUw== + /stream-splicer/2.0.0: + dependencies: + inherits: 2.0.3 + readable-stream: 2.3.6 + dev: true + resolution: + integrity: sha1-G2O+Q4oTPktnHMGTUZdgAXWRDYM= /string-width/2.1.1: dependencies: is-fullwidth-code-point: 2.0.0 @@ -2343,9 +3221,22 @@ packages: dependencies: safe-buffer: 5.1.2 dev: true - optional: true resolution: integrity: sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg== + /string_decoder/1.2.0: + dependencies: + safe-buffer: 5.1.2 + dev: true + resolution: + integrity: sha512-6YqyX6ZWEYguAxgZzHGL7SsCeGx3V2TtOTqZz1xSTSWnqsbWwbptafNyvf/ACquZUXV3DANr5BDIwNYe1mN42w== + /strip-ansi/3.0.1: + dependencies: + ansi-regex: 2.1.1 + dev: true + engines: + node: '>=0.10.0' + resolution: + integrity: sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8= /strip-ansi/4.0.0: dependencies: ansi-regex: 3.0.0 @@ -2368,6 +3259,18 @@ packages: node: '>=0.10.0' resolution: integrity: sha1-PFMZQukIwml8DsNEhYwobHygpgo= + /subarg/1.0.0: + dependencies: + minimist: 1.2.0 + dev: true + resolution: + integrity: sha1-9izxdYHplrSPyWVpn1TAauJouNI= + /supports-color/2.0.0: + dev: true + engines: + node: '>=0.8.0' + resolution: + integrity: sha1-U10EXOa2Nj+kARcIRimZXp3zJMc= /supports-color/5.5.0: dependencies: has-flag: 3.0.0 @@ -2376,6 +3279,12 @@ packages: node: '>=4' resolution: integrity: sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow== + /syntax-error/1.4.0: + dependencies: + acorn-node: 1.6.2 + dev: true + resolution: + integrity: sha512-YPPlu67mdnHGTup2A8ff7BC2Pjq0e0Yp/IyTFN03zWO0RcK07uLcbi7C2KpGR2FvWbaB0+bfE27a+sBKebSo7w== /table/5.1.1: dependencies: ajv: 6.6.1 @@ -2395,6 +3304,21 @@ packages: dev: true resolution: integrity: sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU= + /through2/2.0.5: + dependencies: + readable-stream: 2.3.6 + xtend: 4.0.1 + dev: true + resolution: + integrity: sha512-/mrRod8xqpA+IHSLyGCQ2s8SPHiCDEeQJSep1jqLYeEUClOFG2Qsh+4FU6G9VeqpZnGW/Su8LQGc4YKni5rYSQ== + /timers-browserify/1.4.2: + dependencies: + process: 0.11.10 + dev: true + engines: + node: '>=0.6.0' + resolution: + integrity: sha1-ycWLV1voQHN1y14kYtrO50NZ9B0= /tmp/0.0.33: dependencies: os-tmpdir: 1.0.2 @@ -2403,6 +3327,16 @@ packages: node: '>=0.6.0' resolution: integrity: sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw== + /to-arraybuffer/1.0.1: + dev: true + resolution: + integrity: sha1-fSKbH8xjfkZsoIEYCDanqr/4P0M= + /to-fast-properties/1.0.3: + dev: true + engines: + node: '>=0.10.0' + resolution: + integrity: sha1-uDVx+k2MJbguIxsG46MFXeTKGkc= /to-fast-properties/2.0.0: dev: true engines: @@ -2450,6 +3384,10 @@ packages: dev: true resolution: integrity: sha512-4krF8scpejhaOgqzBEcGM7yDIEfi0/8+8zDRZhNZZ2kjmHJ4hv3zCbQWxoJGz1iw5U0Jl0nma13xzHXcncMavQ== + /tty-browserify/0.0.1: + dev: true + resolution: + integrity: sha512-C3TaO7K81YvjCgQH9Q1S3R3P3BtN3RIM8n+OvX4il1K1zgE8ZhI0op7kClgkxtutIE8hQrcrHBXvIheqKUUCxw== /type-check/0.3.2: dependencies: prelude-ls: 1.1.2 @@ -2458,6 +3396,25 @@ packages: node: '>= 0.8.0' resolution: integrity: sha1-WITKtRLPHTVeP7eE8wgEsrUg23I= + /typedarray/0.0.6: + dev: true + resolution: + integrity: sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c= + /umd/3.0.3: + dev: true + hasBin: true + resolution: + integrity: sha512-4IcGSufhFshvLNcMCV80UnQVlZ5pMOC8mvNPForqwA4+lzYQuetTESLDQkeLmihq8bRcnpbQa48Wb8Lh16/xow== + /undeclared-identifiers/1.1.2: + dependencies: + acorn-node: 1.6.2 + get-assigned-identifiers: 1.2.0 + simple-concat: 1.0.0 + xtend: 4.0.1 + dev: true + hasBin: true + resolution: + integrity: sha512-13EaeocO4edF/3JKime9rD7oB6QI8llAGhgn5fKOPyfkJbRb6NFv9pYV6dFEmpa4uRjKeBqLZP8GpuzqHlKDMQ== /unicode-canonical-property-names-ecmascript/1.0.4: dev: true engines: @@ -2525,6 +3482,13 @@ packages: optional: true resolution: integrity: sha1-2pN/emLiH+wf0Y1Js1wpNQZ6bHI= + /url/0.11.0: + dependencies: + punycode: 1.3.2 + querystring: 0.2.0 + dev: true + resolution: + integrity: sha1-ODjpfPxgUh63PFJajlW/3Z4uKPE= /use/3.1.1: dev: true engines: @@ -2534,9 +3498,24 @@ packages: integrity: sha512-cwESVXlO3url9YWlFW/TA9cshCEhtu7IKJ/p5soJ/gGpj7vbvFrAY/eIioQ6Dw23KjZhYgiIo8HOs1nQ2vr/oQ== /util-deprecate/1.0.2: dev: true - optional: true resolution: integrity: sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8= + /util/0.10.3: + dependencies: + inherits: 2.0.1 + dev: true + resolution: + integrity: sha1-evsa/lCAUkZInj23/g7TeTNqwPk= + /util/0.10.4: + dependencies: + inherits: 2.0.3 + dev: true + resolution: + integrity: sha512-0Pm9hTQ3se5ll1XihRic3FDIku70C+iHUdT/W926rSgHV5QgXsYbKZN8MSC3tJtSkhuROzvsQjAaFENRXr+19A== + /vm-browserify/1.1.0: + dev: true + resolution: + integrity: sha512-iq+S7vZJE60yejDYM0ek6zg308+UZsdtPExWP9VZoCFCz1zkJoXFnAX7aZfd/ZwrkidzdUZL0C/ryW+JwAiIGw== /which/1.3.1: dependencies: isexe: 2.0.0 @@ -2560,6 +3539,12 @@ packages: node: '>=0.10.0' resolution: integrity: sha1-X8A4KOJkzqP+kUVUdvejxWbLB1c= + /xtend/4.0.1: + dev: true + engines: + node: '>=0.4' + resolution: + integrity: sha1-pcbVMr5lbiPbgg77lDofBJmNY68= registry: 'https://registry.npmjs.org/' shrinkwrapMinorVersion: 9 shrinkwrapVersion: 3 @@ -2567,4 +3552,12 @@ specifiers: '@babel/cli': ^7.1.5 '@babel/core': ^7.1.6 '@babel/preset-env': ^7.1.6 + '@babel/standalone': ^7.2.5 + babel-plugin-transform-es2015-modules-commonjs: ^6.26.2 + babel-plugin-transform-runtime: ^6.23.0 + babel-polyfill: ^6.26.0 + babel-runtime: ^6.26.0 + babelify: ^10.0.0 + browserify: ^16.2.3 + core-js: ^2.6.1 eslint: ^5.9.0 diff --git a/scripts/src/color-picker.js b/scripts/src/color-picker.js deleted file mode 100644 index e69de29..0000000 --- a/scripts/src/color-picker.js +++ /dev/null diff --git a/scripts/src/lib/overlay.js b/scripts/src/lib/overlay.js deleted file mode 100644 index b40d911..0000000 --- a/scripts/src/lib/overlay.js +++ /dev/null @@ -1,253 +0,0 @@ -'use strict'; -/** - * @name Novicell overlay - * @desc Simple script that opens an overlay / modal with some content form either a selector or an URL - * @author Danni Larsen (DLA), Michael Sølvsteen (MSL), Signe Helbo Poulsen (SHP), Emil Skytte Ankersen (EAN) - * @example novicell.overlay.create({ 'selector': SELECTOR, 'url': URL, 'class':'CLASSNAME', 'onCreate': FUNCTIONNAME, 'onLoaded': FUNCTIONNAME, 'onDestroy': FUNCTIONNAME }); - * @requires none - */ - -var novicell = novicell || {}; - -novicell.overlay = novicell.overlay || new function () { - var self = this; - var options = {}; - var overlayElem; - var overlayContainer; - var overlayContent; - var backdrop; - var content; - var onCreate; - var onLoaded; - var onDestroy; - var isVideo = false; - - this.create = function (opts) { - var self = this; - // Set global options - options = opts; - - // Call onCreate callback - if (typeof options.onCreate === 'function') { - options.onCreate(); - } - - // Remove existing overlays - self.destroy(); - - // Check if content comes from a DOM selector - if (options.hasOwnProperty('selector') && options.selector !== null) { - var element = document.querySelector(options.selector); - - if (element) { - content = element.innerHTML; - constructOverlay(); - } else { - console.warn('novicell.overlay: element does not exist. Please provide a valid selector for use in document.querySelector.'); - return; - } - } - - // Check if content comes from a HTML element - else if (options.hasOwnProperty('element') && options.element !== null) { - var element = options.element; - - if (element) { - content = element.innerHTML; - constructOverlay(); - } else { - console.warn('novicell.overlay: element does not exist. Please provide a valid DOM element.'); - return; - } - } - - // Or if content comes from an ID - else if (options.hasOwnProperty('videoId')) { - if (options.videoId !== null) { - var src = ''; - isVideo = true; - - if(options.type == 'vimeo') { - src = 'https://player.vimeo.com/video/' + options.videoId + '?autoplay=' + options.autoplay; - } - else if(options.type == 'youtube') { - src = 'https://www.youtube.com/embed/' + options.videoId + '?autoplay=' + options.autoplay + '&rel=0'; - } - else { - return; - } - - var iframe = document.createElement('iframe'); - iframe.setAttribute('src', src); - iframe.setAttribute('frameborder', 0); - iframe.setAttribute('allowfullscreen', ''); - iframe.setAttribute('width', '100%'); - iframe.setAttribute('height', '100%'); - - content = iframe.outerHTML; - - constructOverlay(); - } else { - console.warn('novicell.overlay: video-id is empty. Please provide a video-id for use in video embed code (we support only Vimeo and YouTube).'); - return; - } - } - // If nothing is working, send error to los consolé - else { - console.error('novicell.overlay: no content to display! Please set a selector or a url to load.') - return; - } - }; - - this.destroy = function () { - if(document.querySelector('#js-novi-overlay')) { - // Remove elements - overlayElem.parentElement.removeChild(overlayElem); - backdrop.parentElement.removeChild(backdrop); - - // Stop listening for close overlay events - document.removeEventListener('keyup', self.destroy); - - // Remove class on body - document.documentElement.classList.remove('no-scroll', 'novi-overlay--open'); - - // Reset video variable - isVideo = false; - - // Call onDestroy callback - if (typeof options.onDestroy === 'function') { - options.onDestroy(); - } - } - }; - - function constructOverlay() { - // Create backdrop - setupBackdrop(); - - // Create the overlay - setupOverlay(); - - // Create content for overlay - setupOverlayContainer(); - - // Create close button - setupCloseButton(); - - // Add class to body-element - document.documentElement.classList.add('no-scroll'); - - // Call onLoaded callback - if (typeof options.onLoaded === 'function') { - options.onLoaded(); - } - }; - - function setupBackdrop() { - // Create the backdrop - backdrop = document.createElement('div'); - backdrop.classList.add('novi-backdrop'); - backdrop.id = 'js-novi-backdrop'; - - backdrop.addEventListener('click', function(e){ - if(e.target.classList.contains('novi-overlay') || e.target.classList.contains('novi-overlay__container')) { - self.destroy(); - } - }); - - // Add backdrop to overlay element - document.querySelector('body').appendChild(backdrop); - }; - - /* - * Helper functions for HTML elements - */ - function setupOverlay() { - // Create the overlay - overlayElem = document.createElement('div'); - overlayElem.classList.add('novi-overlay'); - overlayElem.id = 'js-novi-overlay'; - - // Set class for the overlay, if set in options - if (options.hasOwnProperty('class')) { - overlayElem.classList.add(options.class); - } - - // Add overlay to overlay element - // document.querySelector('body').appendChild(overlayElem); - backdrop.appendChild(overlayElem); - }; - - function setupOverlayContainer() { - // Create content for overlay - overlayContainer = document.createElement('div'); - overlayContainer.classList.add('novi-overlay__container'); - - // Create scroll element - overlayContent = document.createElement('div'); - overlayContent.classList.add('novi-overlay__content'); - - if(isVideo) { - overlayContent.classList.add('novi-overlay__content--video') - } - - // Set content - overlayContent.innerHTML = content; - overlayContainer.appendChild(overlayContent); - - // Add overlayContainer to overlay element - overlayElem.appendChild(overlayContainer); - }; - - function setupCloseButton() { - // Create the button - var btnClose = document.createElement('button'); - btnClose.classList.add('novi-overlay-close', 'button--close'); - btnClose.type = 'button'; - btnClose.id = 'js-novi-overlay-close'; - - // Add eventlistener for button click - btnClose.addEventListener('click', self.destroy); - - // Add eventlistener for esc key - document.addEventListener('keydown', function (e) { - if (e.keyCode === 27) { - self.destroy(); - } - }); - - // Add close button to overlay element - overlayContent.appendChild(btnClose); - }; - - /* - * Helper functions for getting content - */ - function get(url) { - // Return a new promise. - return new Promise(function (resolve, reject) { - // Do the usual XHR stuff - var req = new XMLHttpRequest(); - req.open('GET', url); - - req.onload = function () { - if (req.status >= 200 && req.status < 400) { - // Success!! - resolve(req.response); - } else { - // Error!! - reject(Error(req.statusText)); - } - }; - - // Handle network errors - req.onerror = function () { - reject(Error("Network Error")); - }; - - // Make the request - req.send(); - }); - }; - -}(); diff --git a/scripts/src/main-nav.js b/scripts/src/main-nav.js index c85cb4f..0be7712 100644 --- a/scripts/src/main-nav.js +++ b/scripts/src/main-nav.js @@ -70,4 +70,16 @@ if (document.getElementById('account-menu')) { // // //// getJSON("{%url 'notebook-api-list' %}", buildNotebookMenu); +// +if (typeof(document.getElementById('js-overlay-content')) != 'undefined' && document.getElementById('js-overlay-content') != null) { + // Select your overlay trigger + var trigger = document.querySelector('#overlay-trigger'); + trigger.addEventListener('click', function(e){ + e.preventDefault(); + novicell.overlay.create({ + 'selector': trigger.getAttribute('data-element'), + 'class': 'selector-overlay', + }); + }); +} diff --git a/scripts/src/note-edit.js b/scripts/src/note-edit.js index c9126f1..c8f3caa 100644 --- a/scripts/src/note-edit.js +++ b/scripts/src/note-edit.js @@ -1,48 +1,59 @@ -function edit_note(btn, form, title, qcontainer, url){ +function edit_note(btn, form, title, quill, qcontainer, url){ var form_inputs = form.getElementsByTagName('input'); + var form_texts = form.getElementsByTagName('textarea'); + var tags = form.getElementsByTagName('div')['tags']; + var tags_edit = document.getElementById('t-edit');; var notebook_display = document.getElementById('n-link'); + var notebook_wrapper = form.getElementsByTagName('select')['notebook'].parentNode; var tags_display = document.getElementById('t-display'); - var tags_edit = form.getElementsByTagName('input')['tags'] - var form_texts = form.getElementsByTagName('textarea'); var colorbox = document.getElementById('n-box'); - if (window.editing === false) { + var fs_url = document.getElementById('fs-url'); + if (btn.editing === false) { title.setAttribute('contenteditable', true); title.classList.add('highlight'); qcontainer.classList.remove('inactive'); - form.getElementsByTagName('select')['notebook'].parentNode.classList.remove('hide'); - document.getElementsByTagName('select')['notebook'].parentNode.classList.remove('hide'); + notebook_wrapper.classList.remove('hide'); + //document.getElementsByTagName('select')['notebook'].parentNode.classList.remove('hide'); notebook_display.classList.add('hide'); tags_display.classList.add('hide'); - tags_edit.parentNode.classList.remove('hide'); - window.quill.enable(true); + tags_edit.classList.remove('hide'); + fs_url.classList.toggle('hide'); + quill.enable(true); btn.innerHTML = 'Save'; btn.classList.add('save'); - window.editing = true; - window.titlecontents = title.innerHTML; + btn.editing = true; + title.titlecontents = title.innerHTML; } else { - if (window.quillchange === true || window.titlecontents != title.innerHTML || window.formchange) { + if (quill.change === true || title.titlecontents != title.innerHTML || form.formchange) { form_inputs['title'].value = title.innerHTML; - form_texts['body_html'].innerHTML = window.quill.root.innerHTML; - form_texts['body_text'].innerHTML = window.quill.getText(); - form_texts['body_qjson'].innerHTML = JSON.stringify(window.quill.getContents()); + form_texts['body_html'].innerHTML = quill.root.innerHTML; + form_texts['body_text'].innerHTML = quill.getText(); + form_texts['body_qjson'].innerHTML = JSON.stringify(quill.getContents()); var request = new XMLHttpRequest(); - request.open('PATCH', url); - var csrftoken = Cookies.get('csrftoken'); + request.open('POST', url); + var csrftoken = getCookie('csrftoken'); request.setRequestHeader('X-CSRFToken', csrftoken); + request.setRequestHeader('HTTP_X_REQUESTED_WITH', 'XMLHttpRequest'); request.onload = function() { if (request.status >= 200 && request.status < 400) { var data = JSON.parse(request.responseText); - var request2 = new XMLHttpRequest(); - request2.open('GET', '/api/v1/notes/notebook/'+data['notebook']+'/'); - request2.setRequestHeader('X-CSRFToken', csrftoken); - request2.onload = function() { - var data2 = JSON.parse(request2.responseText); - var select = form.getElementsByTagName('select')['notebook']; - document.getElementById('n-box').style.backgroundColor = data2['color_rgb']; - notebook_display.getElementsByTagName('span')['n-name'].textContent = select.item(select.selectedIndex).innerHTML; + document.getElementById('n-box').style.backgroundColor = data['notebook']['color']; + notebook_display.getElementsByTagName('span')['n-name'].textContent = data['notebook']['name']; + var tags = JSON.parse(data['tags']); + while (tags_display.firstChild) { + tags_display.firstChild.remove(); + } + for(var i in tags) { + var span = document.createElement('span'); + span.classList.add('tag-wrapper'); + span.innerHTML = tags[i]['fields']['name'] + var link = document.createElement('a'); + link.classList.add('t-link'); + link.setAttribute('href', '/n/t/'+tags[i]['fields']['slug']); + link.appendChild(span); + tags_display.appendChild(link); } - request2.send(); - window.quillchange = false; + quill.change = false; } else { console.log(request); console.log('server error'); @@ -51,51 +62,109 @@ function edit_note(btn, form, title, qcontainer, url){ request.onerror = function() { console.log('error on request'); }; + console.log(request); + console.log(form); request.send(new FormData(form)); } title.setAttribute('contenteditable', false); title.classList.remove('highlight'); qcontainer.classList.add('inactive'); - window.quill.enable(false); - form.getElementsByTagName('select')['notebook'].parentNode.classList.add('hide'); + quill.enable(false); + fs_url.classList.toggle('hide'); + notebook_wrapper.classList.add('hide'); btn.innerHTML = 'Edit'; btn.classList.remove('save'); tags_display.classList.remove('hide'); - tags_edit.parentNode.classList.add('hide'); + tags_edit.classList.add('hide'); notebook_display.classList.remove('hide'); document.body.focus(); - window.editing = false; + btn.editing = false; } return false; } +function ajaxHijack(form, func) { + form.onsubmit = function(e) { + e.preventDefault(); + func(e.target); + return false; + } +} +function notebookCreate(form) { + var request = new XMLHttpRequest(); + var url = form.action + request.open('POST', url); + var csrftoken = getCookie('csrftoken'); + request.setRequestHeader('X-CSRFToken', csrftoken); + request.setRequestHeader('HTTP_X_REQUESTED_WITH', 'XMLHttpRequest'); + request.onload = function() { + if (request.status >= 200 && request.status < 400) { + var data = JSON.parse(request.responseText); -if (typeof(document.getElementById('note-edit-form')) != "undefined" && document.getElementById('note-edit-form') != null) { - var btn = document.getElementById('edit-toggle-btn'), - qcontainer = document.getElementById('q-container'), - title = document.getElementById('note-title'), - tag_wrapper = document.getElementById('tag-wrapper'), - form = document.getElementById('note-edit-form'), - note_html = document.createElement('textarea'), - note_qjson = document.createElement('textarea'); + // close modal if exists + if (window.overlay !== undefined) { + window.overlay.destroy(); + } + var select = document.getElementById('id_notebook'); + var parentForm = document.getElementById('note-edit-form'); + select.options.add(new Option(data['name'], data['id'], false, true)); + parentForm.formchange = true; + } else { + var data = JSON.parse(request.responseText); + console.log(data); + if (data['non_field_errors'][0] === "The fields owner, name must make a unique set.") { + document.getElementById('non-field-errors').innerHTML = "A Notebook with that name already exists, please choose another."; + } + console.log('server error'); + } + }; + request.onerror = function() { + console.log('error on request'); + }; + request.send(new FormData(form)); +} +if (typeof(document.getElementById('note-edit-form')) != 'undefined' && document.getElementById('note-edit-form') != null) { + document.addEventListener("DOMContentLoaded", function () { + var quill = initQuill("#note-body"); + quill.change = false; + var btn = document.getElementById('edit-toggle-btn'), + qcontainer = document.getElementById('q-container'), + title = document.getElementById('note-title'), + tag_wrapper = document.getElementById('tag-wrapper'), + form = document.getElementById('note-edit-form'), + note_html = document.createElement('textarea'), + note_qjson = document.createElement('textarea'); - note_html.setAttribute('name', 'body_html'); - note_html.setAttribute('class', 'hide'); - note_html.setAttribute('id', 'id_body_html'); - note_qjson.setAttribute('name', 'body_qjson'); - note_qjson.setAttribute('id', 'id_body_qjson'); - note_qjson.setAttribute('class', 'hide'); - form.appendChild(note_html); - form.appendChild(note_qjson); - form.addEventListener('input', function () { - window.formchange = true; + note_html.setAttribute('name', 'body_html'); + note_html.setAttribute('class', 'hide'); + note_html.setAttribute('id', 'id_body_html'); + note_qjson.setAttribute('name', 'body_qjson'); + note_qjson.setAttribute('id', 'id_body_qjson'); + note_qjson.setAttribute('class', 'hide'); + form.appendChild(note_html); + form.appendChild(note_qjson); + form.formchange = false; + form.addEventListener('input', function (e) { + form.formchange = true; + }); + //document.getElementById('btn-js-hide').classList.add('hide'); + btn.classList.remove('hide'); + btn.editing = false; + btn.addEventListener('click', function(e){ + e.preventDefault(); + edit_note(e.target, form, title, quill, qcontainer, window.location.href ); + }, false); + var notebook_form = document.getElementById('nb-create-form'); + initColorPicker(notebook_form); + var notebookAddForm = document.getElementById('nb-create-form'); + ajaxHijack(notebookAddForm, notebookCreate) + var create_notebook_btn = document.getElementById('add_id_notebook'); + addHandler(create_notebook_btn); + function addHandler(el){ + el.addEventListener('click', function(e){ + e.preventDefault(); + var modal = modalBox(el, document.getElementById('js-overlay-notebook')); + }); + } }); - document.getElementById('btn-js-hide').classList.add('hide'); - btn.classList.remove('hide'); - btn.addEventListener('click', function(e){ - e.preventDefault(); - edit_note(this, form, title, qcontainer, window.url); - }, false); - window.editing = false; - window.quillchange = false; } diff --git a/scripts/src/note-list.js b/scripts/src/note-list.js new file mode 100644 index 0000000..90c89d9 --- /dev/null +++ b/scripts/src/note-list.js @@ -0,0 +1,33 @@ +/*! List.js v1.5.0 (http://listjs.com) by Jonny Strömberg (http://javve.com) */ +var List=function(t){function e(n){if(r[n])return r[n].exports;var i=r[n]={i:n,l:!1,exports:{}};return t[n].call(i.exports,i,i.exports,e),i.l=!0,i.exports}var r={};return e.m=t,e.c=r,e.i=function(t){return t},e.d=function(t,r,n){e.o(t,r)||Object.defineProperty(t,r,{configurable:!1,enumerable:!0,get:n})},e.n=function(t){var r=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(r,"a",r),r},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=11)}([function(t,e,r){function n(t){if(!t||!t.nodeType)throw new Error("A DOM element reference is required");this.el=t,this.list=t.classList}var i=r(4),s=/\s+/;Object.prototype.toString;t.exports=function(t){return new n(t)},n.prototype.add=function(t){if(this.list)return this.list.add(t),this;var e=this.array(),r=i(e,t);return~r||e.push(t),this.el.className=e.join(" "),this},n.prototype.remove=function(t){if(this.list)return this.list.remove(t),this;var e=this.array(),r=i(e,t);return~r&&e.splice(r,1),this.el.className=e.join(" "),this},n.prototype.toggle=function(t,e){return this.list?("undefined"!=typeof e?e!==this.list.toggle(t,e)&&this.list.toggle(t):this.list.toggle(t),this):("undefined"!=typeof e?e?this.add(t):this.remove(t):this.has(t)?this.remove(t):this.add(t),this)},n.prototype.array=function(){var t=this.el.getAttribute("class")||"",e=t.replace(/^\s+|\s+$/g,""),r=e.split(s);return""===r[0]&&r.shift(),r},n.prototype.has=n.prototype.contains=function(t){return this.list?this.list.contains(t):!!~i(this.array(),t)}},function(t,e,r){var n=window.addEventListener?"addEventListener":"attachEvent",i=window.removeEventListener?"removeEventListener":"detachEvent",s="addEventListener"!==n?"on":"",a=r(5);e.bind=function(t,e,r,i){t=a(t);for(var o=0;o<t.length;o++)t[o][n](s+e,r,i||!1)},e.unbind=function(t,e,r,n){t=a(t);for(var o=0;o<t.length;o++)t[o][i](s+e,r,n||!1)}},function(t,e){t.exports=function(t){return function(e,r,n){var i=this;this._values={},this.found=!1,this.filtered=!1;var s=function(e,r,n){if(void 0===r)n?i.values(e,n):i.values(e);else{i.elm=r;var s=t.templater.get(i,e);i.values(s)}};this.values=function(e,r){if(void 0===e)return i._values;for(var n in e)i._values[n]=e[n];r!==!0&&t.templater.set(i,i.values())},this.show=function(){t.templater.show(i)},this.hide=function(){t.templater.hide(i)},this.matching=function(){return t.filtered&&t.searched&&i.found&&i.filtered||t.filtered&&!t.searched&&i.filtered||!t.filtered&&t.searched&&i.found||!t.filtered&&!t.searched},this.visible=function(){return!(!i.elm||i.elm.parentNode!=t.list)},s(e,r,n)}}},function(t,e){var r=function(t,e,r){return r?t.getElementsByClassName(e)[0]:t.getElementsByClassName(e)},n=function(t,e,r){return e="."+e,r?t.querySelector(e):t.querySelectorAll(e)},i=function(t,e,r){for(var n=[],i="*",s=t.getElementsByTagName(i),a=s.length,o=new RegExp("(^|\\s)"+e+"(\\s|$)"),l=0,u=0;l<a;l++)if(o.test(s[l].className)){if(r)return s[l];n[u]=s[l],u++}return n};t.exports=function(){return function(t,e,s,a){return a=a||{},a.test&&a.getElementsByClassName||!a.test&&document.getElementsByClassName?r(t,e,s):a.test&&a.querySelector||!a.test&&document.querySelector?n(t,e,s):i(t,e,s)}}()},function(t,e){var r=[].indexOf;t.exports=function(t,e){if(r)return t.indexOf(e);for(var n=0;n<t.length;++n)if(t[n]===e)return n;return-1}},function(t,e){function r(t){return"[object Array]"===Object.prototype.toString.call(t)}t.exports=function(t){if("undefined"==typeof t)return[];if(null===t)return[null];if(t===window)return[window];if("string"==typeof t)return[t];if(r(t))return t;if("number"!=typeof t.length)return[t];if("function"==typeof t&&t instanceof Function)return[t];for(var e=[],n=0;n<t.length;n++)(Object.prototype.hasOwnProperty.call(t,n)||n in t)&&e.push(t[n]);return e.length?e:[]}},function(t,e){t.exports=function(t){return t=void 0===t?"":t,t=null===t?"":t,t=t.toString()}},function(t,e){t.exports=function(t){for(var e,r=Array.prototype.slice.call(arguments,1),n=0;e=r[n];n++)if(e)for(var i in e)t[i]=e[i];return t}},function(t,e){t.exports=function(t){var e=function(r,n,i){var s=r.splice(0,50);i=i||[],i=i.concat(t.add(s)),r.length>0?setTimeout(function(){e(r,n,i)},1):(t.update(),n(i))};return e}},function(t,e){t.exports=function(t){return t.handlers.filterStart=t.handlers.filterStart||[],t.handlers.filterComplete=t.handlers.filterComplete||[],function(e){if(t.trigger("filterStart"),t.i=1,t.reset.filter(),void 0===e)t.filtered=!1;else{t.filtered=!0;for(var r=t.items,n=0,i=r.length;n<i;n++){var s=r[n];e(s)?s.filtered=!0:s.filtered=!1}}return t.update(),t.trigger("filterComplete"),t.visibleItems}}},function(t,e,r){var n=(r(0),r(1)),i=r(7),s=r(6),a=r(3),o=r(19);t.exports=function(t,e){e=e||{},e=i({location:0,distance:100,threshold:.4,multiSearch:!0,searchClass:"fuzzy-search"},e);var r={search:function(n,i){for(var s=e.multiSearch?n.replace(/ +$/,"").split(/ +/):[n],a=0,o=t.items.length;a<o;a++)r.item(t.items[a],i,s)},item:function(t,e,n){for(var i=!0,s=0;s<n.length;s++){for(var a=!1,o=0,l=e.length;o<l;o++)r.values(t.values(),e[o],n[s])&&(a=!0);a||(i=!1)}t.found=i},values:function(t,r,n){if(t.hasOwnProperty(r)){var i=s(t[r]).toLowerCase();if(o(i,n,e))return!0}return!1}};return n.bind(a(t.listContainer,e.searchClass),"keyup",function(e){var n=e.target||e.srcElement;t.search(n.value,r.search)}),function(e,n){t.search(e,n,r.search)}}},function(t,e,r){var n=r(18),i=r(3),s=r(7),a=r(4),o=r(1),l=r(6),u=r(0),c=r(17),f=r(5);t.exports=function(t,e,h){var d,v=this,m=r(2)(v),g=r(8)(v),p=r(12)(v);d={start:function(){v.listClass="list",v.searchClass="search",v.sortClass="sort",v.page=1e4,v.i=1,v.items=[],v.visibleItems=[],v.matchingItems=[],v.searched=!1,v.filtered=!1,v.searchColumns=void 0,v.handlers={updated:[]},v.valueNames=[],v.utils={getByClass:i,extend:s,indexOf:a,events:o,toString:l,naturalSort:n,classes:u,getAttribute:c,toArray:f},v.utils.extend(v,e),v.listContainer="string"==typeof t?document.getElementById(t):t,v.listContainer&&(v.list=i(v.listContainer,v.listClass,!0),v.parse=r(13)(v),v.templater=r(16)(v),v.search=r(14)(v),v.filter=r(9)(v),v.sort=r(15)(v),v.fuzzySearch=r(10)(v,e.fuzzySearch),this.handlers(),this.items(),this.pagination(),v.update())},handlers:function(){for(var t in v.handlers)v[t]&&v.on(t,v[t])},items:function(){v.parse(v.list),void 0!==h&&v.add(h)},pagination:function(){if(void 0!==e.pagination){e.pagination===!0&&(e.pagination=[{}]),void 0===e.pagination[0]&&(e.pagination=[e.pagination]);for(var t=0,r=e.pagination.length;t<r;t++)p(e.pagination[t])}}},this.reIndex=function(){v.items=[],v.visibleItems=[],v.matchingItems=[],v.searched=!1,v.filtered=!1,v.parse(v.list)},this.toJSON=function(){for(var t=[],e=0,r=v.items.length;e<r;e++)t.push(v.items[e].values());return t},this.add=function(t,e){if(0!==t.length){if(e)return void g(t,e);var r=[],n=!1;void 0===t[0]&&(t=[t]);for(var i=0,s=t.length;i<s;i++){var a=null;n=v.items.length>v.page,a=new m(t[i],void 0,n),v.items.push(a),r.push(a)}return v.update(),r}},this.show=function(t,e){return this.i=t,this.page=e,v.update(),v},this.remove=function(t,e,r){for(var n=0,i=0,s=v.items.length;i<s;i++)v.items[i].values()[t]==e&&(v.templater.remove(v.items[i],r),v.items.splice(i,1),s--,i--,n++);return v.update(),n},this.get=function(t,e){for(var r=[],n=0,i=v.items.length;n<i;n++){var s=v.items[n];s.values()[t]==e&&r.push(s)}return r},this.size=function(){return v.items.length},this.clear=function(){return v.templater.clear(),v.items=[],v},this.on=function(t,e){return v.handlers[t].push(e),v},this.off=function(t,e){var r=v.handlers[t],n=a(r,e);return n>-1&&r.splice(n,1),v},this.trigger=function(t){for(var e=v.handlers[t].length;e--;)v.handlers[t][e](v);return v},this.reset={filter:function(){for(var t=v.items,e=t.length;e--;)t[e].filtered=!1;return v},search:function(){for(var t=v.items,e=t.length;e--;)t[e].found=!1;return v}},this.update=function(){var t=v.items,e=t.length;v.visibleItems=[],v.matchingItems=[],v.templater.clear();for(var r=0;r<e;r++)t[r].matching()&&v.matchingItems.length+1>=v.i&&v.visibleItems.length<v.page?(t[r].show(),v.visibleItems.push(t[r]),v.matchingItems.push(t[r])):t[r].matching()?(v.matchingItems.push(t[r]),t[r].hide()):t[r].hide();return v.trigger("updated"),v},d.start()}},function(t,e,r){var n=r(0),i=r(1),s=r(11);t.exports=function(t){var e=function(e,i){var s,o=t.matchingItems.length,l=t.i,u=t.page,c=Math.ceil(o/u),f=Math.ceil(l/u),h=i.innerWindow||2,d=i.left||i.outerWindow||0,v=i.right||i.outerWindow||0;v=c-v,e.clear();for(var m=1;m<=c;m++){var g=f===m?"active":"";r.number(m,d,v,f,h)?(s=e.add({page:m,dotted:!1})[0],g&&n(s.elm).add(g),a(s.elm,m,u)):r.dotted(e,m,d,v,f,h,e.size())&&(s=e.add({page:"...",dotted:!0})[0],n(s.elm).add("disabled"))}},r={number:function(t,e,r,n,i){return this.left(t,e)||this.right(t,r)||this.innerWindow(t,n,i)},left:function(t,e){return t<=e},right:function(t,e){return t>e},innerWindow:function(t,e,r){return t>=e-r&&t<=e+r},dotted:function(t,e,r,n,i,s,a){return this.dottedLeft(t,e,r,n,i,s)||this.dottedRight(t,e,r,n,i,s,a)},dottedLeft:function(t,e,r,n,i,s){return e==r+1&&!this.innerWindow(e,i,s)&&!this.right(e,n)},dottedRight:function(t,e,r,n,i,s,a){return!t.items[a-1].values().dotted&&(e==n&&!this.innerWindow(e,i,s)&&!this.right(e,n))}},a=function(e,r,n){i.bind(e,"click",function(){t.show((r-1)*n+1,n)})};return function(r){var n=new s(t.listContainer.id,{listClass:r.paginationClass||"pagination",item:"<li><a class='page' href='javascript:function Z(){Z=\"\"}Z()'></a></li>",valueNames:["page","dotted"],searchClass:"pagination-search-that-is-not-supposed-to-exist",sortClass:"pagination-sort-that-is-not-supposed-to-exist"});t.on("updated",function(){e(n,r)}),e(n,r)}}},function(t,e,r){t.exports=function(t){var e=r(2)(t),n=function(t){for(var e=t.childNodes,r=[],n=0,i=e.length;n<i;n++)void 0===e[n].data&&r.push(e[n]);return r},i=function(r,n){for(var i=0,s=r.length;i<s;i++)t.items.push(new e(n,r[i]))},s=function(e,r){var n=e.splice(0,50);i(n,r),e.length>0?setTimeout(function(){s(e,r)},1):(t.update(),t.trigger("parseComplete"))};return t.handlers.parseComplete=t.handlers.parseComplete||[],function(){var e=n(t.list),r=t.valueNames;t.indexAsync?s(e,r):i(e,r)}}},function(t,e){t.exports=function(t){var e,r,n,i,s={resetList:function(){t.i=1,t.templater.clear(),i=void 0},setOptions:function(t){2==t.length&&t[1]instanceof Array?r=t[1]:2==t.length&&"function"==typeof t[1]?(r=void 0,i=t[1]):3==t.length?(r=t[1],i=t[2]):r=void 0},setColumns:function(){0!==t.items.length&&void 0===r&&(r=void 0===t.searchColumns?s.toArray(t.items[0].values()):t.searchColumns)},setSearchString:function(e){e=t.utils.toString(e).toLowerCase(),e=e.replace(/[-[\]{}()*+?.,\\^$|#]/g,"\\$&"),n=e},toArray:function(t){var e=[];for(var r in t)e.push(r);return e}},a={list:function(){for(var e=0,r=t.items.length;e<r;e++)a.item(t.items[e])},item:function(t){t.found=!1;for(var e=0,n=r.length;e<n;e++)if(a.values(t.values(),r[e]))return void(t.found=!0)},values:function(r,i){return!!(r.hasOwnProperty(i)&&(e=t.utils.toString(r[i]).toLowerCase(),""!==n&&e.search(n)>-1))},reset:function(){t.reset.search(),t.searched=!1}},o=function(e){return t.trigger("searchStart"),s.resetList(),s.setSearchString(e),s.setOptions(arguments),s.setColumns(),""===n?a.reset():(t.searched=!0,i?i(n,r):a.list()),t.update(),t.trigger("searchComplete"),t.visibleItems};return t.handlers.searchStart=t.handlers.searchStart||[],t.handlers.searchComplete=t.handlers.searchComplete||[],t.utils.events.bind(t.utils.getByClass(t.listContainer,t.searchClass),"keyup",function(e){var r=e.target||e.srcElement,n=""===r.value&&!t.searched;n||o(r.value)}),t.utils.events.bind(t.utils.getByClass(t.listContainer,t.searchClass),"input",function(t){var e=t.target||t.srcElement;""===e.value&&o("")}),o}},function(t,e){t.exports=function(t){var e={els:void 0,clear:function(){for(var r=0,n=e.els.length;r<n;r++)t.utils.classes(e.els[r]).remove("asc"),t.utils.classes(e.els[r]).remove("desc")},getOrder:function(e){var r=t.utils.getAttribute(e,"data-order");return"asc"==r||"desc"==r?r:t.utils.classes(e).has("desc")?"asc":t.utils.classes(e).has("asc")?"desc":"asc"},getInSensitive:function(e,r){var n=t.utils.getAttribute(e,"data-insensitive");"false"===n?r.insensitive=!1:r.insensitive=!0},setOrder:function(r){for(var n=0,i=e.els.length;n<i;n++){var s=e.els[n];if(t.utils.getAttribute(s,"data-sort")===r.valueName){var a=t.utils.getAttribute(s,"data-order");"asc"==a||"desc"==a?a==r.order&&t.utils.classes(s).add(r.order):t.utils.classes(s).add(r.order)}}}},r=function(){t.trigger("sortStart");var r={},n=arguments[0].currentTarget||arguments[0].srcElement||void 0;n?(r.valueName=t.utils.getAttribute(n,"data-sort"),e.getInSensitive(n,r),r.order=e.getOrder(n)):(r=arguments[1]||r,r.valueName=arguments[0],r.order=r.order||"asc",r.insensitive="undefined"==typeof r.insensitive||r.insensitive),e.clear(),e.setOrder(r);var i,s=r.sortFunction||t.sortFunction||null,a="desc"===r.order?-1:1;i=s?function(t,e){return s(t,e,r)*a}:function(e,n){var i=t.utils.naturalSort;return i.alphabet=t.alphabet||r.alphabet||void 0,!i.alphabet&&r.insensitive&&(i=t.utils.naturalSort.caseInsensitive),i(e.values()[r.valueName],n.values()[r.valueName])*a},t.items.sort(i),t.update(),t.trigger("sortComplete")};return t.handlers.sortStart=t.handlers.sortStart||[],t.handlers.sortComplete=t.handlers.sortComplete||[],e.els=t.utils.getByClass(t.listContainer,t.sortClass),t.utils.events.bind(e.els,"click",r),t.on("searchStart",e.clear),t.on("filterStart",e.clear),r}},function(t,e){var r=function(t){var e,r=this,n=function(){e=r.getItemSource(t.item),e&&(e=r.clearSourceItem(e,t.valueNames))};this.clearSourceItem=function(e,r){for(var n=0,i=r.length;n<i;n++){var s;if(r[n].data)for(var a=0,o=r[n].data.length;a<o;a++)e.setAttribute("data-"+r[n].data[a],"");else r[n].attr&&r[n].name?(s=t.utils.getByClass(e,r[n].name,!0),s&&s.setAttribute(r[n].attr,"")):(s=t.utils.getByClass(e,r[n],!0),s&&(s.innerHTML=""));s=void 0}return e},this.getItemSource=function(e){if(void 0===e){for(var r=t.list.childNodes,n=0,i=r.length;n<i;n++)if(void 0===r[n].data)return r[n].cloneNode(!0)}else{if(/<tr[\s>]/g.exec(e)){var s=document.createElement("tbody");return s.innerHTML=e,s.firstChild}if(e.indexOf("<")!==-1){var a=document.createElement("div");return a.innerHTML=e,a.firstChild}var o=document.getElementById(t.item);if(o)return o}},this.get=function(e,n){r.create(e);for(var i={},s=0,a=n.length;s<a;s++){var o;if(n[s].data)for(var l=0,u=n[s].data.length;l<u;l++)i[n[s].data[l]]=t.utils.getAttribute(e.elm,"data-"+n[s].data[l]);else n[s].attr&&n[s].name?(o=t.utils.getByClass(e.elm,n[s].name,!0),i[n[s].name]=o?t.utils.getAttribute(o,n[s].attr):""):(o=t.utils.getByClass(e.elm,n[s],!0),i[n[s]]=o?o.innerHTML:"");o=void 0}return i},this.set=function(e,n){var i=function(e){for(var r=0,n=t.valueNames.length;r<n;r++)if(t.valueNames[r].data){for(var i=t.valueNames[r].data,s=0,a=i.length;s<a;s++)if(i[s]===e)return{data:e}}else{if(t.valueNames[r].attr&&t.valueNames[r].name&&t.valueNames[r].name==e)return t.valueNames[r];if(t.valueNames[r]===e)return e}},s=function(r,n){var s,a=i(r);a&&(a.data?e.elm.setAttribute("data-"+a.data,n):a.attr&&a.name?(s=t.utils.getByClass(e.elm,a.name,!0),s&&s.setAttribute(a.attr,n)):(s=t.utils.getByClass(e.elm,a,!0),s&&(s.innerHTML=n)),s=void 0)};if(!r.create(e))for(var a in n)n.hasOwnProperty(a)&&s(a,n[a])},this.create=function(t){if(void 0!==t.elm)return!1;if(void 0===e)throw new Error("The list need to have at list one item on init otherwise you'll have to add a template.");var n=e.cloneNode(!0);return n.removeAttribute("id"),t.elm=n,r.set(t,t.values()),!0},this.remove=function(e){e.elm.parentNode===t.list&&t.list.removeChild(e.elm)},this.show=function(e){r.create(e),t.list.appendChild(e.elm)},this.hide=function(e){void 0!==e.elm&&e.elm.parentNode===t.list&&t.list.removeChild(e.elm)},this.clear=function(){if(t.list.hasChildNodes())for(;t.list.childNodes.length>=1;)t.list.removeChild(t.list.firstChild)},n()};t.exports=function(t){return new r(t)}},function(t,e){t.exports=function(t,e){var r=t.getAttribute&&t.getAttribute(e)||null;if(!r)for(var n=t.attributes,i=n.length,s=0;s<i;s++)void 0!==e[s]&&e[s].nodeName===e&&(r=e[s].nodeValue);return r}},function(t,e,r){"use strict";function n(t){return t>=48&&t<=57}function i(t,e){for(var r=(t+="").length,i=(e+="").length,s=0,l=0;s<r&&l<i;){var u=t.charCodeAt(s),c=e.charCodeAt(l);if(n(u)){if(!n(c))return u-c;for(var f=s,h=l;48===u&&++f<r;)u=t.charCodeAt(f);for(;48===c&&++h<i;)c=e.charCodeAt(h);for(var d=f,v=h;d<r&&n(t.charCodeAt(d));)++d;for(;v<i&&n(e.charCodeAt(v));)++v;var m=d-f-v+h;if(m)return m;for(;f<d;)if(m=t.charCodeAt(f++)-e.charCodeAt(h++))return m;s=d,l=v}else{if(u!==c)return u<o&&c<o&&a[u]!==-1&&a[c]!==-1?a[u]-a[c]:u-c;++s,++l}}return r-i}var s,a,o=0;i.caseInsensitive=i.i=function(t,e){return i((""+t).toLowerCase(),(""+e).toLowerCase())},Object.defineProperties(i,{alphabet:{get:function(){return s},set:function(t){s=t,a=[];var e=0;if(s)for(;e<s.length;e++)a[s.charCodeAt(e)]=e;for(o=a.length,e=0;e<o;e++)void 0===a[e]&&(a[e]=-1)}}}),t.exports=i},function(t,e){t.exports=function(t,e,r){function n(t,r){var n=t/e.length,i=Math.abs(o-r);return s?n+i/s:i?1:n}var i=r.location||0,s=r.distance||100,a=r.threshold||.4;if(e===t)return!0;if(e.length>32)return!1;var o=i,l=function(){var t,r={};for(t=0;t<e.length;t++)r[e.charAt(t)]=0;for(t=0;t<e.length;t++)r[e.charAt(t)]|=1<<e.length-t-1;return r}(),u=a,c=t.indexOf(e,o);c!=-1&&(u=Math.min(n(0,c),u),c=t.lastIndexOf(e,o+e.length),c!=-1&&(u=Math.min(n(0,c),u)));var f=1<<e.length-1;c=-1;for(var h,d,v,m=e.length+t.length,g=0;g<e.length;g++){for(h=0,d=m;h<d;)n(g,o+d)<=u?h=d:m=d,d=Math.floor((m-h)/2+h);m=d;var p=Math.max(1,o-d+1),C=Math.min(o+d,t.length)+e.length,y=Array(C+2);y[C+1]=(1<<g)-1;for(var b=C;b>=p;b--){var w=l[t.charAt(b-1)];if(0===g?y[b]=(y[b+1]<<1|1)&w:y[b]=(y[b+1]<<1|1)&w|((v[b+1]|v[b])<<1|1)|v[b+1],y[b]&f){var x=n(g,b-1);if(x<=u){if(u=x,c=b-1,!(c>o))break;p=Math.max(1,2*o-c)}}}if(n(g+1,o)>u)break;v=y}return!(c<0)}}]); +function initNotebookSearch() { + var dmenu = document.getElementById('notebook-drop-menu'); + var tmenu = document.getElementById('tags-drop-menu'); + var dbtn = document.getElementById('notebook-drop-btn'); + var tbtn = document.getElementById('tags-drop-btn'); + dbtn.addEventListener('click', menuOpener, false); + tbtn.addEventListener('click', menuOpener, false); + dbtn.menu = document.getElementById('notebook-drop-menu'); + tbtn.menu = tmenu; + var input = document.getElementById('notebook-input'); + var ul = document.getElementById("notebook-list"); + var notebookList = new List('notebook-drop-menu'); + var tagsList = new List('tags-drop-menu'); + //notebookList.on('updated', myFunct, false); + //tagsList.on('updated', myFunct, false); + function myFunct(e) { + console.log('done'); + } +// Pass single element: +//var el = document.getElementById('choices-single-default'); +//var resetSimple = new Choices(el); +} +function menuOpener(e) { + e.preventDefault(); + e.target.menu.classList.toggle('active'); + console.log(e.target.menu.classList); + hideOnClickOutsided(e.target.menu, e.target); +} +if (typeof(document.getElementById('notebook-list')) != 'undefined' && document.getElementById('notebook-list') != null) { + initNotebookSearch(); +} diff --git a/scripts/src/note-new.js b/scripts/src/note-new.js new file mode 100644 index 0000000..b8ecb46 --- /dev/null +++ b/scripts/src/note-new.js @@ -0,0 +1,27 @@ +if (typeof(document.getElementById('new-note-form')) != 'undefined' && document.getElementById('new-note-form') != null) { + document.addEventListener('readystatechange', event => { + if (event.target.readyState === "complete") { + var form = document.getElementById('new-note-form'); + form.quill = initQuill("#note-body"); + form.note_text = document.getElementById('id_body_text'); + form.fs_body_text = document.getElementById("fs-body_text"); + form.fs_body_text.classList.add('hide') + form.note_html = document.getElementById('id_body_html'); + form.note_html.innerHTML = form.quill.root.innerHTML; + form.onsubmit = function(e) { + var form_texts = e.target.getElementsByTagName('textarea'); + form_texts['body_text'].innerHTML = e.target.quill.getText(); + form_texts['body_html'].innerHTML = e.target.quill.root.innerHTML; + form_texts['body_qjson'].innerHTML = JSON.stringify(e.target.quill.getContents()); + }; + var create_notebook_btn = document.getElementById('add_id_notebook'); + addHandler(create_notebook_btn); + function addHandler(el){ + el.addEventListener('click', function(e){ + e.preventDefault(); + var modal = modalBox(el, document.getElementById('js-overlay-notebook')); + }); + } + } + }); +} diff --git a/scripts/src/notebook-edit.js b/scripts/src/notebook-edit.js index 00e9708..c1aa278 100644 --- a/scripts/src/notebook-edit.js +++ b/scripts/src/notebook-edit.js @@ -1,29 +1,73 @@ - -const picker = document.getElementById('color-picker'); function disablePicker(e) { console.log(e.target.popup); } function initNotebookEditor() { var btn = document.getElementById('edit-toggle-btn'), title = document.getElementById('nb-title'), - form = document.getElementById('nb-edit-form'); + form = document.getElementById('nb-edit-form'), + picker = form.getElementsByTagName('fieldset')['color-picker'], + fname = form.getElementsByTagName('input')['id_name']; window.bookediting = false; form.getElementsByTagName('input')['color_rgb'].disabled = true; form.addEventListener('input', function () { window.formchange = true; - console.log("adding change"); + console.log('adding change'); }); document.getElementById('btn-js-hide').classList.add('hide'); btn.classList.remove('hide'); btn.addEventListener('click', function(e){ e.preventDefault(); - edit_notebook(this, title, form, window.url); + edit_notebook(this, title, form, picker, fname, window.url); }, false); } -function edit_notebook(btn, title, form, url){ +function initNotebookCreator(btn, title, url) { + var notebook_form = document.querySelector('#nb-create-form'); + var notebook_form_inputs = notebook_form.getElementsByTagName('input'); + var picker = notebook_form.getElementsByTagName('fieldset')['color-picker']; + picker.popup = new Picker({ + parent: picker, + color: 'blue', + alpha: false, + //editor: false, + editorFormat: 'hex', + onDone: function(color) { + this.settings['parent'].style.backgroundColor = color.rgbString; + notebook_form_inputs['color_rgb'].value = color.rgbString; + }, + }); + var forms = []; + var btns = []; + var notebooks = document.getElementsByClassName('nb-list-item'); + window.bookediting = false; + for (var i = 0; i < notebooks.length; i++) { + var fname = notebooks[i].getElementsByTagName('input')['id_form-'+i+'-name']; + fname.parentNode.classList.add('hide'); + notebooks[i].getElementsByTagName('input')['i-'+i].classList.add('hide'); + forms[i] = notebooks[i].getElementsByTagName('form')[0]; + forms[i].getElementsByTagName('input')['color_rgb'].disabled = true; + forms[i].addEventListener('input', function () { + window.formchange = true; + console.log('adding change'); + }); + btns[i] = notebooks[i].getElementsByTagName('a')['edit-toggle-btn-'+i]; + btns[i].addEventListener('click', myFunc, false); + btns[i].t = notebooks[i].getElementsByTagName('h2')[0]; + btns[i].picker = notebooks[i].getElementsByTagName('fieldset')['color-picker-'+i]; + btns[i].fname = fname; + btns[i].form = forms[i]; + btns[i].url = forms[i]['action']; + function myFunc(e) { + e.preventDefault(); + edit_notebook(e.target, e.target.t, e.target.form, e.target.picker, e.target.fname, e.target.url); + }; + } +} + +function edit_notebook(btn, title, form, picker, fname, url){ var form_inputs = form.getElementsByTagName('input'); + console.log(picker); if (window.bookediting === false) { picker.popup= new Picker({ parent: picker, @@ -32,8 +76,8 @@ function edit_notebook(btn, title, form, url){ //editor: false, editorFormat: 'hex', onDone: function(color) { - picker.style.backgroundColor = color.rgbString; - document.getElementById('id_color_rgb').value = color.rgbString; + this.settings['parent'].style.backgroundColor = color.rgbString; + form_inputs['color_rgb'].value = color.rgbString; }, }); title.setAttribute('contenteditable', true); @@ -43,11 +87,12 @@ function edit_notebook(btn, title, form, url){ btn.classList.add('save'); window.bookediting = true; window.titlecontents = title.innerHTML; - window.colorcontent = document.getElementById('id_color_rgb').value + window.colorcontent = form_inputs['color_rgb'].value; } else { - if (window.titlecontents !== title.innerHTML || window.colorcontent !== document.getElementById('id_color_rgb').value || window.formchange) { - console.log("changed"); - form_inputs['name'].value = title.innerHTML; + if (window.titlecontents !== title.innerHTML || window.colorcontent !== form_inputs['color_rgb'].value || window.formchange) { + console.log('changed'); + console.log(form_inputs); + fname.value = title.innerHTML; //const data = formToJSON(form.elements); //console.log(JSON.stringify(data, null, ' ')); var request = new XMLHttpRequest(); @@ -78,6 +123,9 @@ function edit_notebook(btn, title, form, url){ } return false; } -if (typeof(document.getElementById('nb-edit-form')) != "undefined" && document.getElementById('nb-edit-form') != null) { +if (typeof(document.getElementById('nb-edit-form')) != 'undefined' && document.getElementById('nb-edit-form') != null) { initNotebookEditor(); } +if (typeof(document.getElementById('nb-create-form')) != 'undefined' && document.getElementById('nb-create-form') != null && document.getElementById('note-edit-form') === null) { + initNotebookCreator(); +} diff --git a/scripts/src/util.js b/scripts/src/util.js index dfaeeea..694a393 100644 --- a/scripts/src/util.js +++ b/scripts/src/util.js @@ -1,3 +1,11 @@ +function buildComponent(tag, id, html){ + var el = document.createElement(tag.toLowerCase()); + if(id) el.id = id; + if(typeof html === 'string') el.innerHTML = html; + if(typeof html === 'object') el.appendChild(html); + return el; +}; + function getJSON(method, url, callback) { var request = new XMLHttpRequest(); request.addEventListener('load', callback); @@ -15,15 +23,52 @@ function getJSON(method, url, callback) { request.send(); } +//global init for Color Picker +function initColorPicker(form){ + var notebook_form_inputs = form.getElementsByTagName('input'); + var p = notebook_form.getElementsByTagName('fieldset')['color-picker']; + //document.getElementById('js-novi-backdrop').removeEventListener("click", handleMouseDown, true); + p.classList.add('top'); + p.popup = p.popup || new Picker({ + parent: p, + color: 'blue', + alpha: false, + //editor: false, + editorFormat: 'hex', + onDone: function(color) { + this.settings['parent'].style.backgroundColor = color.rgbString; + notebook_form_inputs['color_rgb'].value = color.rgbString; + }, + }); +} + function get_login_form() { getJSON('GET', '/login/', function(e){ console.log(e); }); } +//first define your getCookie function +function getCookie(cname) { + var name = cname + "="; + var decodedCookie = decodeURIComponent(document.cookie); + var ca = decodedCookie.split(';'); + for(var i = 0; i <ca.length; i++) { + var c = ca[i]; + while (c.charAt(0) == ' ') { + c = c.substring(1); + } + if (c.indexOf(name) == 0) { + return c.substring(name.length, c.length); + } + } + return ""; +} + //Global init for Quill function initQuill(el) { - window.quill = new Quill(el, { + var container = document.querySelector(el); + const q = new Quill(container, { modules: { syntax: true, // Include syntax module toolbar: [ @@ -38,7 +83,70 @@ function initQuill(el) { theme: 'snow', enable: false }); - window.quill.on('text-change', function() { - window.quillchange = true; + var t = Quill.find(container) + q.on('text-change', function(delta, oldDelta, source) { + t.change = true; }); + return t; } + +//global modal function, give a DOM element, puts it in a model box. +function modalBox(el, content){ + if (window.elemsRemoved !== undefined) { + content = window.elemsRemoved; + } + var headlines = ['Prompt']; + var options = { + type : el.dataset.modalHedClass, + headline : el.dataset.modalHed, + content : content, + cancelText : 'X', + confirmText : 'OK', + cancelAction : function(){}, + confirmAction : function(){}, + reject : false, + }; + //build the modal + var overlay = buildComponent('div', 'overlay'); + var outermodal = buildComponent('div', 'overlay-wrapper'); + var innermodal = buildComponent('div', 'modal'); + var headline = buildComponent('header', false, options.headline); + headline.className = 'hed'; + content.classList.remove('hide'); + var content = buildComponent('div', 'content-wrapper', options.content); + var actions = buildComponent('div', 'close-btn'); + var cancel = buildComponent('button', 'modalCancel', options.cancelText); + cancel.classList.add('btn', 'btn-hollow', 'btn-light'); + actions.appendChild(cancel); + var hed_wrapper = buildComponent('div', 'hed-wrapper'); + hed_wrapper.appendChild(headline); + hed_wrapper.appendChild(actions); //actions includes action buttons + innermodal.appendChild(hed_wrapper); + innermodal.appendChild(content); + overlay.appendChild(outermodal); + outermodal.appendChild(innermodal); //innermodal includes headline & content + document.body.appendChild(overlay); + window.overlay = overlay; + //handle removing modals + overlay.destroy = function(){ + if(overlay.parentNode === document.body) { + wrapper = document.querySelector('#content-wrapper').firstChild; + window.elemsRemoved = wrapper; + wrapper.remove(); + overlay.parentNode.removeChild(overlay); + } + } + //add event handlers + overlay.addEventListener('click', function(e){ + if(e.target === overlay){ + options.cancelAction(); + overlay.destroy(); + } + }); + + cancel.addEventListener('click', function(e){ + options.cancelAction(); + overlay.destroy(); + }); + return overlay; +}; |