diff --git a/.babelrc b/.babelrc new file mode 100644 index 0000000..389310f --- /dev/null +++ b/.babelrc @@ -0,0 +1,7 @@ +{ + "exclude": "node_modules/**", + "presets": [ + "@babel/preset-flow" + ], + "sourceMap": false +} \ No newline at end of file diff --git a/.eslintrc.js b/.eslintrc.js new file mode 100644 index 0000000..638b134 --- /dev/null +++ b/.eslintrc.js @@ -0,0 +1,35 @@ +module.exports = { + "parser": "babel-eslint", + "plugins": [ + "flowtype" + ], + "env": { + "browser": true, + "es6": true + }, + "extends": "plugin:flowtype/recommended", + "parserOptions": { + "ecmaVersion": 2017, + "sourceType": "module" + }, + "rules": { + "indent": [ + "error", + "tab", + { "SwitchCase": 1 } + ], + "quotes": [ + "error", + "single" + ], + "semi": [ + "error", + "always" + ] + }, + "settings": { + "flowtype": { + "onlyFilesWithFlowAnnotation": false + } + } +}; \ No newline at end of file diff --git a/.flowconfig b/.flowconfig new file mode 100644 index 0000000..c57b832 --- /dev/null +++ b/.flowconfig @@ -0,0 +1,4 @@ +[include] + +[ignore] +.*/node_modules/flow-bin \ No newline at end of file diff --git a/.gitignore b/.gitignore index a9e3dfc..0485a72 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ /.sass-cache /assets/generated +/assets/removeFlow /dist /nbproject/private /node_modules diff --git a/.jscsrc b/.jscsrc deleted file mode 100644 index d5cba18..0000000 --- a/.jscsrc +++ /dev/null @@ -1,152 +0,0 @@ -{ - "disallowDanglingUnderscores": true, - "disallowEmptyBlocks": true, - "disallowIdenticalDestructuringNames": true, - "disallowImplicitTypeConversion": [ - "numeric", - "boolean", - "binary", - "string" - ], - "disallowKeywordsOnNewLine": [ - "else" - ], - "disallowMixedSpacesAndTabs": "smart", - "disallowMultipleLineBreaks": true, - "disallowMultipleLineStrings": true, - "disallowMultipleSpaces": { - "allowEOLComments": true - }, - "disallowMultipleVarDecl": true, - "disallowNamedUnassignedFunctions": true, - "disallowNestedTernaries": true, - "disallowNewlineBeforeBlockStatements": true, - "disallowQuotedKeysInObjects": true, - "disallowSpaceAfterObjectKeys": true, - "disallowSpaceAfterPrefixUnaryOperators": true, - "disallowSpaceBeforeComma": true, - "disallowSpaceBeforePostfixUnaryOperators": true, - "disallowSpacesInAnonymousFunctionExpression": { - "beforeOpeningRoundBrace": true - }, - "disallowSpacesInCallExpression": true, - "disallowSpacesInFunctionDeclaration": { - "beforeOpeningRoundBrace": true - }, - "disallowSpacesInFunctionExpression": { - "beforeOpeningRoundBrace": true - }, - "disallowSpacesInFunction": { - "beforeOpeningRoundBrace": true - }, - "disallowSpacesInGenerator": { - "afterStar": true - }, - "disallowSpacesInNamedFunctionExpression": { - "beforeOpeningRoundBrace": true - }, - "disallowSpacesInsideArrayBrackets": "all", - "disallowSpacesInsideBrackets": true, - "disallowSpacesInsideObjectBrackets": true, - "disallowSpacesInsideParentheses": true, - "disallowSpacesInsideParenthesizedExpression": true, - "disallowSpacesInsideTemplateStringPlaceholders": true, - "disallowTrailingComma": true, - "disallowTrailingWhitespace": "ignoreEmptyLines", - "disallowUnusedParams": true, - /*"jsDoc": { - "checkAnnotations": "jsdoc3", - "checkParamExistence": true, - "checkParamNames": true, - "requireParamTypes": true, - "checkRedundantParams": true, - "checkReturnTypes": true, - "checkRedundantReturns": true, - "requireReturnTypes": true, - "checkTypes": "strictNativeCase", - "checkRedundantAccess": "enforceLeadingUnderscore", - "leadingUnderscoreAccess": true, - "enforceExistence": true, - "requireNewlineAfterDescription": true, - "requireDescriptionCompleteSentence": true, - "requireParamDescription": true, - "requireReturnDescription": true - }, */ - /*"maximumLineLength": { - "value": 0, - "tabSize": 4, - "allExcept": [ - "regex" - ] - },*/ - "requireAlignedMultilineParams": 0, - "requireAnonymousFunctions": { - "allExcept": [ - "declarations" - ] - }, - "requireBlocksOnNewline": 1, - "requireCamelCaseOrUpperCaseIdentifiers": { - "allowedPrefixes": [ - "GM_" - ] - }, - "requireCapitalizedComments": true, - "requireCommaBeforeLineBreak": true, - "requireCurlyBraces": [ - "if", - "else", - "for", - "while", - "do", - "try", - "catch" - ], - "requireDotNotation": true, - "requireEarlyReturn": true, - "requireLineBreakAfterVariableAssignment": true, - "requireLineFeedAtFileEnd": true, - "requireNumericLiterals": true, - "requireObjectKeysOnNewLine": { - "allExcept": ["sameLine"] - }, - "requireOperatorBeforeLineBreak": true, - "requirePaddingNewLinesAfterUseStrict": true, - "requireParenthesesAroundIIFE": true, - "requireSemicolons": true, - "requireSpaceAfterBinaryOperators": true, - "requireSpaceAfterComma": true, - "requireSpaceAfterLineComment": true, - "requireSpaceBeforeBinaryOperators": true, - "requireSpaceBeforeBlockStatements": true, - "requireSpaceBeforeKeywords": [ - "else", - "while", - "catch", - "finally" - ], - "requireSpaceBeforeObjectValues": true, - "requireSpaceBetweenArguments": true, - "requireSpacesInConditionalExpression": true, - "requireSpacesInForStatement": true, - "requireSpacesInFunctionDeclaration": { - "beforeOpeningCurlyBrace": true - }, - "requireSpacesInFunctionExpression": { - "beforeOpeningCurlyBrace": true - }, - "requireSpacesInFunction": { - "beforeOpeningCurlyBrace": true - }, - "requireSpacesInGenerator": { - "beforeStar": true - }, - "requireSpacesInNamedFunctionExpression": { - "beforeOpeningCurlyBrace": true - }, - "safeContextKeyword": ["self"], - "validateIndentation": "\t", - "validateLineBreaks": null, - "validateParameterSeparator": ", ", - "validateQuoteMarks": "'" -} diff --git a/.jshintrc b/.jshintrc deleted file mode 100644 index f24af91..0000000 --- a/.jshintrc +++ /dev/null @@ -1,31 +0,0 @@ -{ - "bitwise": true, - "curly": true, - "eqeqeq": true, - "forin": true, - "freeze": true, - "futurehostile": true, - "globals": { - "angular": true, - "GM_info": true, - "GM_xmlhttpRequest": true, - "GM_getValue": true, - "GM_setValue": true, - "unsafeWindow": true, - "GM": true - }, - "latedef": true, - "nocomma": true, - "nonbsp": true, - "nonew": true, - "notypeof": true, - "quotmark": "single", - "shadow": "outer", - "singleGroups": true, - "strict": true, - "undef": true, - "unused": true, - - "browser": true, - "jquery": true -} diff --git a/.travis.yml b/.travis.yml index 53b5036..55df980 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,12 +1,26 @@ language: node_js node_js: - - "4.7.0" -before_install: - - npm install -g grunt-cli - - rvm install 2.4.1 - - gem install sass --version "=3.4.23" - - gem install compass --version "=1.0.3" +- 8.4.0 +before_install: +- npm install -g grunt-cli +- rvm install 2.4.2 +- gem install sass --version "=3.4.25" +- gem install compass --version "=1.0.3" install: - - npm update -g - - npm install -script: grunt build +- npm update -g +- npm install +script: +- grunt build +- npm run print-userscript-banner +deploy: + provider: releases + api_key: + secure: UfVMZo8geJjIw3p9p2Iw5LDXWXVcJKNBkAam8PDDWlqprPhRuHsvvvev5BGchjZ8mlr/3R2poYn+6KXWqiGNh/1/4vEx1GCeo9/Y7IdZw4Zk11Z0rZIsg0G8VyQidLwEJC/g3y5INV3RkHmg2ux5qHpgWXVaaVInyPgHEYxoVeYtGb1QRQfu45axLjxhT6PbGjSzQ9oa6kE5+mR+GZAfr4KdiVXYVfN+VFF75KMh8swoRUOtxX5ED+mblC83ar25BHUCSwDvkfMZgNJHziTI0KzIJHSoxAZnso14cx6/BWcRW3chsU/Eh5mXT3Z94iGIgrTTNKjq6nDC/HJuRMwVKfMGSkQBOpAtKEGpSusLOsluOw1XVRytnkIXEE5+CnQNS8J0GqKUU9Ea47EScH+VW4xUmWolyGDuYjZC0tH2GFhxcAXDUFMbCxTwVNIuoph7nokxbYAPgGc4g0WeI/fNJ0szHTw9mGFbWXFh4kWj0bCEcKwPBkgrN18n7l1EiM7uR221jUPjqJihS5hiyVyBsjzxefS/lY1+9C0Fb0tBRMWE/jEqgh1LVA5ir8LiRlV3FxHdT04ebR6y5aq5e1A8Xfu+z72aPi8ZmGz4hdU4VHIou6VzzzGuPp9lnQx5UEZ+nvBAPeoprcXG0HV9CwaJa3aStPdSm8WSJxNHdyMUQdQ= + file: + - dist/qc-ext.min.user.js + - dist/qc-ext.user.js + - dist/qc-ext.meta.js + skip_cleanup: true + on: + repo: Questionable-Content-Extensions/client + tags: true diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..fd1c8f3 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "javascript.validate.enable": false +} \ No newline at end of file diff --git a/Gruntfile.js b/Gruntfile.js index 7813203..9ebeabb 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016 Alexander Krivács Schrøder + * Copyright (C) 2016-2018 Alexander Krivács Schrøder * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -17,163 +17,193 @@ /* global module, require */ +const resolve = require('rollup-plugin-node-resolve'); +const commonJs = require('rollup-plugin-commonjs'); +const virtual = require('rollup-plugin-virtual'); +const babel = require('rollup-plugin-babel'); + +const licenseBanner = require('./licenseBanner'); +const userScriptBanner = require('./userScriptBanner'); + +const baseFileName = 'qc-ext'; + module.exports = function (grunt) { - 'use strict'; + 'use strict'; - // Project configuration. - grunt.initConfig({ - pkg: grunt.file.readJSON('package.json'), - watch: { - css: { - files: [ - '**/*.sass', - '**/*.scss' - ], - tasks: ['build'] - }, - js: { - files: [ - 'assets/js/*.js', - 'Gruntfile.js' - ], - tasks: ['build'] - }, - templates: { - files: [ - 'templates/*.*' - ], - tasks: ['build'] - } - }, - compass: { - dist: { - options: { - sassDir: 'assets/sass', - cssDir: 'assets/generated', - outputStyle: 'compressed' - } - } - }, - jshint: { - options: { - jshintrc: '.jshintrc', - verbose: true - }, - all: ['Gruntfile.js', 'assets/js/*.js'] - }, - jscs: { - src: 'assets/js/*.js', - options: { - config: '.jscsrc', - fix: false - } - }, - concat: { - options: { - separator: '', - stripBanners: true - }, - variables: { - src: [ - 'assets/generated/css.variables.pass1.js', - 'assets/generated/angular.variables.pass1.js', - 'assets/templates/variables.post.template' - ], - dest: 'assets/generated/variables.pass2.js' - }, - source: { - options: { - banner: '<%= pkg.licenseBanner %>\n<%= pkg.userscriptBanner %>' - }, - src: [ - 'assets/js/gm4-shim.js', - 'assets/js/constants.js', - 'assets/generated/variables.pass2.js', - 'assets/js/settings.js', - 'assets/js/module.js', - 'assets/js/module.*.js', - 'assets/js/dom-operations.js', - 'assets/js/config.js', - 'assets/js/qc-ext-*.js', - 'assets/js/bootstrap.js' - ], - dest: 'dist/qc-ext.user.js' - } - }, - uglify: { - options: { - mangle: { - except: ['jQuery', 'angular', 'GM_setValue', 'GM_getValue', 'GM_deleteValue', 'GM_xmlhttprequest', 'unsafeWindow'], - screwIE8: true - }, - banner: '<%= pkg.licenseBanner %>\n<%= pkg.userscriptBanner %>' - }, - target: { - files: { - 'dist/qc-ext.min.user.js': ['dist/qc-ext.user.js'] - } - } - }, - filesToJavascript: { - css: { - options: { - inputFilesFolder: 'assets/generated', - inputFileExtension: 'css', - outputBaseFile: 'assets/templates/variables.pre.template', - outputBaseFileVariable: 'qcExt.variables.css', - outputFile: 'assets/generated/css.variables.pass1.js' - } - }, - angularTemplates: { - options: { - inputFilesFolder: 'assets/generated', - inputFileExtension: 'html', - outputBaseFile: 'assets/templates/variables.empty.template', - outputBaseFileVariable: 'qcExt.variables.angularTemplates', - outputFile: 'assets/generated/angular.variables.pass1.js' - } - } - }, - htmlmin: { - dist: { - options: { - removeComments: true, - collapseWhitespace: true - }, - files: { - 'assets/generated/navigation.html': 'assets/templates/navigation.html', - 'assets/generated/extra.html': 'assets/templates/extra.html', - 'assets/generated/extraNav.html': 'assets/templates/extraNav.html', - 'assets/generated/settings.html': 'assets/templates/settings.html', - 'assets/generated/editComicData.html': 'assets/templates/editComicData.html', - 'assets/generated/addItem.html': 'assets/templates/addItem.html', - 'assets/generated/setTitle.html': 'assets/templates/setTitle.html', - 'assets/generated/setTagline.html': 'assets/templates/setTagline.html', - 'assets/generated/setPublishDate.html': 'assets/templates/setPublishDate.html', - 'assets/generated/donut.html': 'assets/templates/donut.html', - 'assets/generated/ribbon.html': 'assets/templates/ribbon.html', - 'assets/generated/itemDetails.html': 'assets/templates/itemDetails.html', - 'assets/generated/comicNav.html': 'assets/templates/comicNav.html', - 'assets/generated/changeLog.html': 'assets/templates/changeLog.html', - 'assets/generated/date.html': 'assets/templates/date.html' - } - } - } - }); + // Project configuration. + grunt.initConfig({ + pkg: grunt.file.readJSON('package.json'), + watch: { + css: { + files: [ + '**/*.sass', + '**/*.scss' + ], + tasks: ['build'] + }, + js: { + files: [ + 'assets/js/**/*.js', + 'Gruntfile.js' + ], + tasks: ['build'] + }, + templates: { + files: [ + 'templates/*.*' + ], + tasks: ['build'] + } + }, + compass: { + dist: { + options: { + sassDir: 'assets/sass', + cssDir: 'assets/generated', + outputStyle: 'compressed' + } + } + }, + eslint: { + target: [ + 'assets/js/**/*.js', + '*.js', + 'scripts/*.js' + ] + }, + concat: { + options: { + separator: '', + stripBanners: true + }, + variables: { + src: [ + 'assets/templates/variables.pre.template', + 'assets/generated/css.variables.pass1.js', + 'assets/generated/html.variables.pass1.js', + 'assets/templates/variables.post.template' + ], + dest: 'assets/generated/variables.pass2.js' + }, + source: { + options: { + banner: `${licenseBanner}\n${userScriptBanner}\n` + }, + src: [ + 'assets/generated/rollup.js' + ], + dest: `dist/${baseFileName}.user.js` + } + }, + uglify: { + options: { + banner: licenseBanner + '\n' + userScriptBanner + }, + target: { + files: { + [`dist/${baseFileName}.min.user.js`]: [`dist/${baseFileName}.user.js`] + } + } + }, + filesToJavascript: { + css: { + options: { + inputFilesFolder: 'assets/generated', + inputFileExtension: 'css', + outputBaseFile: 'assets/templates/variables.empty.template', + outputBaseFileVariable: 'variables.css', + outputFile: 'assets/generated/css.variables.pass1.js' + } + }, + htmlTemplates: { + options: { + inputFilesFolder: 'assets/generated', + inputFileExtension: 'html', + outputBaseFile: 'assets/templates/variables.empty.template', + outputBaseFileVariable: 'variables.html', + outputFile: 'assets/generated/html.variables.pass1.js' + } + } + }, + htmlmin: { + dist: { + options: { + removeComments: true, + collapseWhitespace: true + }, + files: { + 'assets/generated/navigation.html': 'assets/templates/navigation.html', + 'assets/generated/extra.html': 'assets/templates/extra.html', + 'assets/generated/extraNav.html': 'assets/templates/extraNav.html', + 'assets/generated/settings.html': 'assets/templates/settings.html', + 'assets/generated/editComicData.html': 'assets/templates/editComicData.html', + 'assets/generated/addItem.html': 'assets/templates/addItem.html', + 'assets/generated/setTitle.html': 'assets/templates/setTitle.html', + 'assets/generated/setTagline.html': 'assets/templates/setTagline.html', + 'assets/generated/setPublishDate.html': 'assets/templates/setPublishDate.html', + 'assets/generated/donut.html': 'assets/templates/donut.html', + 'assets/generated/ribbon.html': 'assets/templates/ribbon.html', + 'assets/generated/itemDetails.html': 'assets/templates/itemDetails.html', + 'assets/generated/comicNav.html': 'assets/templates/comicNav.html', + 'assets/generated/changeLog.html': 'assets/templates/changeLog.html', + 'assets/generated/date.html': 'assets/templates/date.html' + } + } + }, + rollup: { + options: { + pureExternalImports: true, + plugins: [ + babel(), + virtual({ + 'jquery': 'export default jQuery', + 'angular': 'export default angular', + 'greasemonkey': 'export default GM' + }), + resolve({ + browser: true + }), + commonJs() + ] + }, + main: { + files: { + 'assets/generated/rollup.js': 'assets/js/app.js' + } + } + }, + flow: { + options: { + server: false + }, + files: ['assets/js/**/*.js'] + }, + babel: { + options: { + sourceMap: true + }, + dist: { + files: { + 'assets/generated/babel.js': 'assets/js/app.js' + } + } + } + }); - // Load the Grunt tasks. - require('load-grunt-tasks')(grunt); + // Load the Grunt tasks. + require('load-grunt-tasks')(grunt); - // Register the tasks. - grunt.registerTask('default', ['build']); - grunt.registerTask('build', [ - 'jshint', // Check for lint - 'jscs', // Check code style - 'compass', // Compile CSS - 'htmlmin', // Minify HTML templates - 'filesToJavascript', // Convert HTML templates to JS variables - 'concat:variables', // Create finished variable.pass2.js file - 'concat:source', // Concatenate all the javascript files into one - 'uglify', // Minify the javascript - ]); + // Register the tasks. + grunt.registerTask('default', ['build']); + grunt.registerTask('build', [ + 'compass', // Compile CSS + 'htmlmin', // Minify HTML templates + 'filesToJavascript', // Convert HTML templates to JS variables + 'concat:variables', // Create finished variable.pass2.js file + 'flow', // Type-checking + 'eslint', // Check for lint + 'rollup:main', // Rollup all the javascript files into one + 'concat:source', // Add banner to rollup result + 'uglify', // Minify the javascript + ]); }; diff --git a/README.md b/README.md index 82a3861..dfeefea 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Questionable Content Extensions User Script [![Build Status](https://travis-ci.org/Questionable-Content-Extensions/client.svg?branch=master)](https://travis-ci.org/Questionable-Content-Extensions/client) [![Dependency Status](https://www.versioneye.com/user/projects/58da3f4f26a5bb0038e42095/badge.svg?style=flat)](https://www.versioneye.com/user/projects/58da3f4f26a5bb0038e42095) [![Built with Grunt](https://cdn.gruntjs.com/builtwith.svg)](http://gruntjs.com/) +# Questionable Content Extensions User Script [![Build Status](https://travis-ci.org/Questionable-Content-Extensions/client.svg?branch=master)](https://travis-ci.org/Questionable-Content-Extensions/client) [![Built with Grunt](https://cdn.gruntjs.com/builtwith.svg)](http://gruntjs.com/) ## Getting Started @@ -29,8 +29,6 @@ This project requires [Node.js®](https://nodejs.org/) and [Ruby](https://www.ru ```shell gem install compass # If you don't have compass installed already npm install -g grunt-cli # If you don't have grunt installed already -npm install -g jsonlint # If you don't have jsonlint installed already -npm install -g jshint # If you don't have jshint installed already npm install # To install all the grunt plugins we use grunt build # To build our script ``` diff --git a/assets/js/app.js b/assets/js/app.js new file mode 100644 index 0000000..b937b73 --- /dev/null +++ b/assets/js/app.js @@ -0,0 +1,38 @@ +// @flow +/* + * Copyright (C) 2016-2018 Alexander Krivács Schrøder + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +import $ from 'jquery'; +import angular from 'angular'; + +import './modules/jQuery.changeElementType'; + +import settings from './modules/settings'; +import DomModifier from './modules/dom-modifier'; +import { setup as setupAngular } from './modules/angular-app'; + +(async () => { + await settings.loadSettings(); + + const domModifier = new DomModifier(); + domModifier.modify(); + + setupAngular(); + + // Let's go! + angular.bootstrap($('html').get(0), ['qc-spa']); +})(); diff --git a/assets/js/constants.js b/assets/js/constants.js index 14b95aa..972d20c 100644 --- a/assets/js/constants.js +++ b/assets/js/constants.js @@ -1,5 +1,6 @@ +// @flow /* - * Copyright (C) 2016, 2017 Alexander Krivács Schrøder + * Copyright (C) 2016-2018 Alexander Krivács Schrøder * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -15,56 +16,68 @@ * along with this program. If not, see . */ -var constants; +// Set this to true when working against your local test server. +// NEVER CHECK THIS FILE IN WITH developmentMode = true! +const developmentMode = false; -(function(constants) { - 'use strict'; - - constants.settingsKey = 'settings'; - - // Comics after 3132 should have a tagline - constants.taglineThreshold = 3132; +function getSiteUrl() { + if (developmentMode) { + return 'http://localhost:3000/'; + } else { + return 'https://questionablextensions.net/'; + } +} - // Set this to true when working against your local test server. - // NEVER CHECK THIS FILE IN WITH developmentMode = true! - constants.developmentMode = false; - if (constants.developmentMode) { - constants.baseUrl = - 'http://localhost/questionablecontentextensions/web/'; - constants.webServiceBaseUrl = constants.baseUrl + 'app_dev.php/'; +function getWebserviceBaseUrl() { + if (developmentMode) { + return 'http://localhost:3000/api/'; } else { - constants.baseUrl = 'https://questionablextensions.net/'; - constants.webServiceBaseUrl = constants.baseUrl; + return 'https://questionablecontent.herokuapp.com/api/'; } +} + +const comicDataUrl = getWebserviceBaseUrl() + 'comicdata/'; +const itemDataUrl = getWebserviceBaseUrl() + 'itemdata/'; + +const constants = { + settingsKey: 'settings', + + developmentMode, + siteUrl: getSiteUrl(), + comicDataUrl, + itemDataUrl, - constants.comicDataUrl = constants.webServiceBaseUrl + 'comicdata/'; - constants.addItemToComicUrl = constants.comicDataUrl + 'additem'; - constants.removeItemFromComicUrl = constants.comicDataUrl + 'removeitem'; - constants.setComicTitleUrl = constants.comicDataUrl + 'settitle'; - constants.setComicTaglineUrl = constants.comicDataUrl + 'settagline'; - constants.setPublishDateUrl = constants.comicDataUrl + 'setpublishdate'; - constants.setGuestComicUrl = constants.comicDataUrl + 'setguest'; - constants.setNonCanonUrl = constants.comicDataUrl + 'setnoncanon'; - - constants.itemDataUrl = constants.webServiceBaseUrl + 'itemdata/'; - constants.itemFriendDataUrl = constants.itemDataUrl + 'friends/'; - constants.itemLocationDataUrl = constants.itemDataUrl + 'locations/'; - constants.setItemDataPropertyUrl = constants.itemDataUrl + 'setproperty'; - - constants.characterImageBaseUrl = constants.baseUrl + 'images/characters/'; - constants.characterImageExtension = 'png'; + // Comics after 3132 should have a tagline + taglineThreshold: 3132, + + addItemToComicUrl: comicDataUrl + 'additem', + removeItemFromComicUrl: comicDataUrl + 'removeitem', + setComicTitleUrl: comicDataUrl + 'settitle', + setComicTaglineUrl: comicDataUrl + 'settagline', + setPublishDateUrl: comicDataUrl + 'setpublishdate', + setGuestComicUrl: comicDataUrl + 'setguest', + setNonCanonUrl: comicDataUrl + 'setnoncanon', + + itemFriendDataUrl: itemDataUrl + 'friends/', + itemLocationDataUrl: itemDataUrl + 'locations/', + setItemDataPropertyUrl: itemDataUrl + 'setproperty', + + characterImageBaseUrl: getSiteUrl() + 'images/characters/', + characterImageExtension: 'png', - constants.comicExtensions = ['png', 'gif', 'jpg']; + comicExtensions: ['png', 'gif', 'jpg'], - constants.comicdataLoadingEvent = 'comicdata-loading'; - constants.comicdataLoadedEvent = 'comicdata-loaded'; - constants.comicdataErrorEvent = 'comicdata-error'; - constants.itemsChangedEvent = 'items-changed'; - - constants.messages = { + comicdataLoadingEvent: 'comicdata-loading', + comicdataLoadedEvent: 'comicdata-loaded', + comicdataErrorEvent: 'comicdata-error', + itemsChangedEvent: 'items-changed', + + messages: { maintenance: 'The Questionable Extensions' + ' server is currently undergoing maintenance.' + ' Normal operation should resume within a' + ' few minutes.' - }; -})(constants || (constants = {})); + } +}; + +export default constants; diff --git a/assets/js/dom-operations.js b/assets/js/dom-operations.js deleted file mode 100644 index f552f7b..0000000 --- a/assets/js/dom-operations.js +++ /dev/null @@ -1,142 +0,0 @@ -/* - * Copyright (C) 2016, 2017 Alexander Krivács Schrøder - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -/* global constants, console */ - -var qcExt; - -(function(qcExt) { - 'use strict'; - - // Add our modal windows - $('body').prepend(''); - $('body').prepend(''); - $('body').prepend(''); - $('body').prepend(''); - - // Take control over the page's title - $('title').replaceWith('' + - '{{t.title}}'); - - /** - * Adds a CSS element to the of the document. - * - * @param {string} href - URL to the CSS document - */ - function addCss(href) { - $('head').prepend( - '' - ); - } - - /** - * Adds an inline CSS ')); - } - - // Bootstrap - addCss(constants.baseUrl + 'style/bootstrap.min.css'); - - // Font Awesome - addCss('https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/' + - 'font-awesome.min.css'); - - // Style adder function - addStyle(qcExt.variables.css.style); - - // Take over the comic link - // For some reason, Jeph didn't use id="strip" on the comic on - // the front page. Whyyy???? - // (In other words, we have to use this method instead of just '#strip'.) - var comicImg = $('img[src*="/comics/"]'); - var comicAnchor = comicImg.parent('a'); - - if (comicAnchor.length !== 1) { - comicImg.wrap($('')); - comicAnchor = comicImg.parent('a'); - } - - $('body').append($('
')); - - // To avoid triggering a flash of the comic "reloading", do in-place DOM - // manipulation instead of replacing the whole thing with a template. - // Fixes issue #13 - var comicDirective = $(''); - comicAnchor.before(comicDirective); - comicAnchor.detach().appendTo(comicDirective); - comicAnchor.attr('ng-href', 'view.php?comic={{c.comicService.nextComic}}'); - comicImg.attr('ng-src', 'http://questionablecontent.net/comics/' + - '{{c.comicService.comic}}.{{c.comicService.comicExtension}}'); - comicImg.attr('ng-click', 'c.next($event)'); - comicImg.attr('on-error', 'c.comicService.canFallback() ' + - '&& c.comicService.tryFallback()'); - - // #comicDirective.attr('id', 'comic-anchor'); - comicDirective.append($('')); - - var comicImage = comicImg.get(0); - var comicLinkUrl = comicImage.src; - - comicLinkUrl = comicLinkUrl.split('/'); - var comic = parseInt(comicLinkUrl[comicLinkUrl.length - 1].split('.')[0]); - - qcExt.app.constant('startComic', comic); - - // Figure out what the latest comic # is based on the URL in the - // "Latest/Last" navigation button. - var latestUrl = $('#comicnav a').get(3).href; - var latestComic = parseInt(latestUrl.split('=')[1]); - if (isNaN(latestComic)) { - latestComic = comic; - } - - if (qcExt.settings.showDebugLogs) { - console.debug('Running QC Extensions v' + GM_info.script.version); - console.debug('Latest URL:', latestUrl, 'Latest Comic:', latestComic); - } - - qcExt.app.constant('latestComic', latestComic); - - $('body #comicnav') - .replaceWith(''); - - if ($('#news, #newspost').prev().prop('tagName') === 'QC-NAV') { - // There's no date section: Insert our own - $('#news, #newspost').before(''); - } else { - // There's a date section: Replace with our own - $('#news, #newspost').prev().replaceWith(''); - } - - $('#news, #newspost').replaceWith(''); - - comicDirective.parent().siblings('.small-2').prepend(''); - - // Set a base (required by Angular's html5Mode) - $('head').append(''); - - // Set up ng-controller for - $('body').attr('ng-controller', 'bodyController as b'); - - // Fixed positioned element covering the whole page used to show messages - // See the messageReportingService for details. - $('body').append('
'); -})(qcExt || (qcExt = {})); diff --git a/assets/js/gm4-shim.js b/assets/js/gm4-shim.js deleted file mode 100644 index 9226e0d..0000000 --- a/assets/js/gm4-shim.js +++ /dev/null @@ -1,61 +0,0 @@ -/* -Functions copied from https://gist.github.com/arantius/3123124 -The MIT License (MIT) - -Copyright (c) 2014 Anthony Lieuallen - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. -*/ - -/*jshint unused:false, esversion: 6, latedef: false*/ - -if (typeof GM !== 'undefined' && typeof GM_getValue === 'undefined') { - if (typeof GM_info === 'undefined') { const GM_info = GM.info; } - var GM_xmlhttpRequest = GM.xmlHttpRequest; - var storagePrefix = GM.info.script.name.replace(/[^A-Z]*/g, '') + '-'; - - // The following functions all use local storage, and thus could be accessed - // by the host. They are also restricted to a single domain. - - var GM_deleteValue = function(aKey) { - 'use strict'; - - localStorage.removeItem(storagePrefix + aKey); - }; - - var GM_getValue = function(aKey, aDefault) { - 'use strict'; - - var aValue = localStorage.getItem(storagePrefix + aKey); - if (null === aValue && 'undefined' !== typeof aDefault) { return aDefault; } - return aValue; - }; - - var GM_listValues = function() { - 'use strict'; - - var prefixLen = storagePrefix.length; - var values = []; - for (var i = 0; i < localStorage.length; i++) { - var k = localStorage.key(i); - if (k.substr(0, prefixLen) === storagePrefix) { - values.push(k.substr(prefixLen)); - } - } - return values; - }; - - var GM_setValue = function(aKey, aVal) { - 'use strict'; - - localStorage.setItem(storagePrefix + aKey, aVal); - }; -} diff --git a/assets/js/module.decorateHttpService.js b/assets/js/module.decorateHttpService.js deleted file mode 100644 index e8fcc0f..0000000 --- a/assets/js/module.decorateHttpService.js +++ /dev/null @@ -1,218 +0,0 @@ -/* - * Copyright (C) 2016 Alexander Krivács Schrøder - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -var qcExt; - -(function(qcExt) { - 'use strict'; - - (function(modules) { - // TODO: Since we're not using the original service at all, we might - // as well completely replace it rather than decorate it... - // http://www.bennadel.com/blog/ - // 2927-overriding-core-and-custom-services-in-angularjs.htm - modules.decorateHttpService = function($provide) { - - // Let's take over $http and make it use Greasemonkey's cross-domain - // XMLHTTPRequests instead of the browser's. - $provide.decorator('$http', function() { - - // START Code bits borrowed from angular - // (see angular's license for details) - var APPLICATION_JSON = 'application/json'; - var JSON_START = /^\[|^\{(?!\{)/; - var JSON_ENDS = { - '[': /]$/, - '{': /}$/ - }; - var JSON_PROTECTION_PREFIX = /^\)\]\}',?\n/; - - function isJsonLike(str) { - var jsonStart = str.match(JSON_START); - - return jsonStart && JSON_ENDS[jsonStart[0]].test(str); - } - - function isString(value) { - return typeof value === 'string'; - } - - function fromJson(json) { - return isString(json) ? JSON.parse(json) : json; - } - - function defaultHttpResponseTransform(data, headers) { - if (!isString(data)) { - return data; - } - - // Strip json vulnerability protection prefix - // and trim whitespace - var tempData = data.replace(JSON_PROTECTION_PREFIX, '') - .trim(); - - if (!tempData) { - return data; - } - - var contentType = headers('Content-Type'); - - if (contentType && - contentType.indexOf(APPLICATION_JSON) === 0 || - isJsonLike(tempData)) { - data = fromJson(tempData); - } - - return data; - } - - // END Code bits borrowed from angular - - function getHeaderFunction(headers) { - var keyedHeaders = {}; - - angular.forEach(headers, function(value) { - var splitValue = value.trim().split(':', 2); - - if (splitValue.length < 2) { - return; - } - - keyedHeaders[splitValue[0].trim()] = - splitValue[1].trim(); - }); - - return function(key) { - return keyedHeaders[key] || null; - }; - } - - var injector = angular.injector(['ng']); - var $q = injector.get('$q'); - var ourHttp = { - get: function(url, config) { - return $q(function(resolve, reject) { - GM_xmlhttpRequest({ - method: 'GET', - url: url, - headers: { - Accept: APPLICATION_JSON - }, - onload: function(gmResponse) { - var headers = getHeaderFunction( - gmResponse.responseHeaders - .split('\n')); - var responseData = gmResponse.response; - - responseData = defaultHttpResponseTransform( - responseData, headers); - var response = { - data: responseData, - status: gmResponse.status, - headers: headers, - config: config, - statusText: gmResponse.statusText - }; - - resolve(response); - }, - onerror: function(gmResponse) { - var headers = getHeaderFunction(gmResponse - .responseHeaders.split('\n')); - var responseData = gmResponse.response; - - responseData = defaultHttpResponseTransform( - responseData, headers); - var response = { - data: responseData, - status: gmResponse.status, - headers: headers, - config: config, - statusText: gmResponse.statusText - }; - - reject(response); - } - }); - }); - }, - post: function(url, data, config) { - return $q(function(resolve, reject) { - GM_xmlhttpRequest({ - method: 'POST', - url: url, - data: JSON.stringify(data), - headers: { - 'Content-Type': APPLICATION_JSON, - Accept: APPLICATION_JSON - }, - onload: function(gmResponse) { - var headers = getHeaderFunction( - gmResponse.responseHeaders - .split('\n')); - var responseData = gmResponse.response; - - responseData = defaultHttpResponseTransform( - responseData, headers); - var response = { - data: responseData, - status: gmResponse.status, - headers: headers, - config: config, - statusText: gmResponse.statusText - }; - - resolve(response); - }, - onerror: function(gmResponse) { - var headers = getHeaderFunction(gmResponse - .responseHeaders.split('\n')); - var responseData = gmResponse.response; - - responseData = defaultHttpResponseTransform( - responseData, headers); - var response = { - data: responseData, - status: gmResponse.status, - headers: headers, - config: config, - statusText: gmResponse.statusText - }; - - reject(response); - } - }); - }); - } - }; - - /* Methods/properties to implement for full compatibility: - * pendingRequests - * delete - * head - * jsonp - * post - * put - * patch - * defaults - */ - - return ourHttp; - }); - }; - })(qcExt.modules || (qcExt.modules = {})); -})(qcExt || (qcExt = {})); diff --git a/assets/js/module.jQuery.changeElementType.js b/assets/js/module.jQuery.changeElementType.js deleted file mode 100644 index dbb5084..0000000 --- a/assets/js/module.jQuery.changeElementType.js +++ /dev/null @@ -1,21 +0,0 @@ -// Found at: https://gist.github.com/etienned/2934516 -/*! License unknown */ -(function($) { - 'use strict'; - - $.fn.changeElementType = function(newType) { - var newElements = []; - this.each(function() { - var attrs = {}; - $.each(this.attributes, function(idx, attr) { - attrs[attr.nodeName] = attr.nodeValue; - }); - $(this).replaceWith(function() { - var newElement = $('<' + newType + '/>', attrs); - newElements.push(newElement.get()[0]); - return newElement.append($(this).contents()); - }); - }); - return $(newElements); - }; -})(jQuery); diff --git a/assets/js/modules/angular-app.js b/assets/js/modules/angular-app.js new file mode 100644 index 0000000..c137971 --- /dev/null +++ b/assets/js/modules/angular-app.js @@ -0,0 +1,28 @@ +// @flow +/* + * Copyright (C) 2016-2018 Alexander Krivács Schrøder + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +import angular from 'angular'; + +import assemble from './angular/assemble'; + +const angularApp = angular.module('qc-spa', ['ui.router']); +export function setup() { + assemble(angularApp); +} + +export default angularApp; diff --git a/assets/js/modules/angular/api/comicData.js b/assets/js/modules/angular/api/comicData.js new file mode 100644 index 0000000..9c24eee --- /dev/null +++ b/assets/js/modules/angular/api/comicData.js @@ -0,0 +1,75 @@ +// @flow +/* + * Copyright (C) 2016-2018 Alexander Krivács Schrøder + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +import type { ItemType } from './itemData'; + +export type ComicEditorDataMissing = { + first: ?number; + previous: ?number; + next: ?number; + last: ?number; + any: boolean; +} + +export type ComicEditorData = { + missing: { + cast: ComicEditorDataMissing; + location: ComicEditorDataMissing; + storyline: ComicEditorDataMissing; + title: ComicEditorDataMissing; + tagline: ComicEditorDataMissing; + any: boolean; + } +}; + +export type ComicItem = { + first: ?number; + previous: ?number; + first: ?number; + last: ?number; + id: number; + shortName: string; + name: string; + type: ItemType; + color: string; +}; + +export type ComicData = { + comic: number; + hasData: boolean; + publishDate: ?string; + isAccuratePublishDate: ?boolean; + title: ?string; + tagline: ?string; + isGuestComic: ?boolean; + isNonCanon: ?boolean; + news: ?string; + previous: ?number; + next: ?number; + editorData?: ComicEditorData; + items: Array; + allItems?: Array; +}; + +export type ComicItemRepository = { + [string]: ComicItem[]; + + cast?: ComicItem[]; + location?: ComicItem[]; + storyline?: ComicItem[]; +} diff --git a/assets/js/modules/angular/api/itemData.js b/assets/js/modules/angular/api/itemData.js new file mode 100644 index 0000000..95814e6 --- /dev/null +++ b/assets/js/modules/angular/api/itemData.js @@ -0,0 +1,50 @@ +// @flow +/* + * Copyright (C) 2016-2018 Alexander Krivács Schrøder + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +export type ItemType = 'cast' | 'location' | 'storyline'; + +export type ItemBaseData = { + id: number; + shortName: string; + name: string; + type: ItemType; +} + +export type ItemBaseDataWithColor = ItemBaseData & { + color: string; +} + +export type ItemData = ItemBaseDataWithColor & { + first: number; + last: number; + appearances: number; + totalComics: number; + presence: number; + hasImage: boolean; +}; + +export type ItemRelationData = ItemBaseDataWithColor & { + count: number; + percentage: number; +}; + +export type DecoratedItemData = ItemData & { + highlightColor: string; + locations: ItemRelationData[]; + friends: ItemRelationData[]; +}; diff --git a/assets/js/modules/angular/assemble.js b/assets/js/modules/angular/assemble.js new file mode 100644 index 0000000..a88a7e6 --- /dev/null +++ b/assets/js/modules/angular/assemble.js @@ -0,0 +1,87 @@ +// @flow +/* + * Copyright (C) 2016-2018 Alexander Krivács Schrøder + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +import type { AngularModule } from 'angular'; + +import config from './config'; +import run from './run'; + +import bodyController from './controllers/bodyController'; +import comicController from './controllers/comicController'; +import titleController from './controllers/titleController'; + +import colorService from './services/colorService'; +import comicService from './services/comicService'; +import eventFactory from './services/eventFactory'; +import eventService from './services/eventService'; +import messageReportingService from './services/messageReportingService'; +import styleService from './services/styleService'; + +import donutDirective from './directives/donutDirective'; +import onErrorDirective from './directives/onErrorDirective'; +import qcAddItemDirective from './directives/qcAddItemDirective'; +import qcChangeLogDirective from './directives/qcChangeLogDirective'; +import qcComicDirective from './directives/qcComicDirective'; +import qcComicNavDirective from './directives/qcComicNavDirective'; +import qcDateDirective from './directives/qcDateDirective'; +import qcEditComicDataDirective from './directives/qcEditComicDataDirective'; +import qcExtraDirective from './directives/qcExtraDirective'; +import qcExtraNavDirective from './directives/qcExtraNavDirective'; +import qcItemDetailsDirective from './directives/qcItemDetailsDirective'; +import qcNavDirective from './directives/qcNavDirective'; +import qcNewsDirective from './directives/qcNewsDirective'; +import qcRibbonDirective from './directives/qcRibbonDirective'; +import qcSetPublishDateDirective from './directives/qcSetPublishDateDirective'; +import qcSetTaglineDirective from './directives/qcSetTaglineDirective'; +import qcSettingsDirective from './directives/qcSettingsDirective'; +import qcSetTitleDirective from './directives/qcSetTitleDirective'; + +export default function (app: AngularModule) { + config(app); + run(app); + + bodyController(app); + comicController(app); + titleController(app); + + colorService(app); + comicService(app); + eventFactory(app); + eventService(app); + messageReportingService(app); + styleService(app); + + donutDirective(app); + onErrorDirective(app); + qcAddItemDirective(app); + qcChangeLogDirective(app); + qcComicDirective(app); + qcComicNavDirective(app); + qcDateDirective(app); + qcEditComicDataDirective(app); + qcExtraDirective(app); + qcExtraNavDirective(app); + qcItemDetailsDirective(app); + qcNavDirective(app); + qcNewsDirective(app); + qcRibbonDirective(app); + qcSetPublishDateDirective(app); + qcSetTaglineDirective(app); + qcSettingsDirective(app); + qcSetTitleDirective(app); +} diff --git a/assets/js/config.js b/assets/js/modules/angular/config.js similarity index 59% rename from assets/js/config.js rename to assets/js/modules/angular/config.js index dcd6e09..15da11d 100644 --- a/assets/js/config.js +++ b/assets/js/modules/angular/config.js @@ -1,5 +1,6 @@ +// @flow /* - * Copyright (C) 2016 Alexander Krivács Schrøder + * Copyright (C) 2016-2018 Alexander Krivács Schrøder * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -15,20 +16,26 @@ * along with this program. If not, see . */ -var qcExt; +import GM from 'greasemonkey'; +import angular from 'angular'; +import type { AngularModule } from 'angular'; -(function(qcExt) { - 'use strict'; +import settings from './../settings'; +import decorateHttpService from './decorateHttpService'; +import decorateScope from './decorateScope'; + +export default function (app: AngularModule) { // Set up routing and do other configuration - qcExt.app.config(['$stateProvider', '$urlRouterProvider', + app.config(['$stateProvider', '$urlRouterProvider', '$locationProvider', '$provide', '$logProvider', - function($stateProvider, $urlRouterProvider, $locationProvider, + function ($stateProvider, $urlRouterProvider, $locationProvider, $provide, $logProvider) { - qcExt.modules.decorateHttpService($provide); + decorateHttpService($provide); + decorateScope($provide); $stateProvider.state('homepage', { - url: '^/', + url: '^/$', controller: 'comicController', controllerAs: 'c', template: '
' @@ -38,12 +45,12 @@ var qcExt; controllerAs: 'c', template: '
' }); - $urlRouterProvider.otherwise(function() { - window.location.reload(); + $urlRouterProvider.otherwise(function ($injector, $location) { + GM.openInTab($location.$$absUrl, false); }); $locationProvider.html5Mode(true); - $logProvider.debugEnabled(qcExt.settings.showDebugLogs); + $logProvider.debugEnabled(settings.values.showDebugLogs); }]); -})(qcExt || (qcExt = {})); +} diff --git a/assets/js/modules/angular/controllers/ControllerBases.js b/assets/js/modules/angular/controllers/ControllerBases.js new file mode 100644 index 0000000..f3da709 --- /dev/null +++ b/assets/js/modules/angular/controllers/ControllerBases.js @@ -0,0 +1,103 @@ +// @flow +/* + * Copyright (C) 2016-2018 Alexander Krivács Schrøder + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +import type { $DecoratedScope } from '../decorateScope'; +import type { ComicService } from '../services/comicService'; +import type { EventService } from '../services/eventService'; +import type { ComicData } from '../api/comicData'; + +export class ComicDataControllerBase { + $scope: $DecoratedScope; + eventService: EventService; + + constructor( + $scope: $DecoratedScope, + eventService: EventService + ) { + this.$scope = $scope; + this.eventService = eventService; + + eventService.comicDataLoadingEvent.subscribe($scope, + (event, comic) => { + $scope.safeApply(() => { + this._comicDataLoading(comic); + }); + }); + + eventService.comicDataLoadedEvent.subscribe($scope, + (event, comicData) => { + $scope.safeApply(() => { + this._comicDataLoaded(comicData); + }); + }); + + eventService.comicDataErrorEvent.subscribe($scope, + (event, error) => { + $scope.safeApply(() => { + this._comicDataError(error); + }); + }); + + eventService.itemsChangedEvent.subscribe($scope, + (event, data) => { + $scope.safeApply(() => { + this._itemsChanged(); + }); + }); + } + + _comicDataLoading(comic: number) { + } + + _comicDataLoaded(comicData: ComicData) { + } + + _comicDataError(error: any) { + } + + _itemsChanged() { + } +} + +export class SetValueControllerBase extends ComicDataControllerBase { + comicService: ComicService; + + unique: string; + + constructor( + $scope: $DecoratedScope, + comicService: ComicService, + eventService: EventService + ) { + super($scope, eventService); + + this.comicService = comicService; + + this.unique = Math.random().toString(36).slice(-5); + } + + _updateValue() { + } + + keyPress(event: KeyboardEvent) { + if (event.keyCode === 13) { + // ENTER key + this._updateValue(); + } + } +} diff --git a/assets/js/qc-ext-bodyController.js b/assets/js/modules/angular/controllers/bodyController.js similarity index 70% rename from assets/js/qc-ext-bodyController.js rename to assets/js/modules/angular/controllers/bodyController.js index 523992f..ff705df 100644 --- a/assets/js/qc-ext-bodyController.js +++ b/assets/js/modules/angular/controllers/bodyController.js @@ -1,5 +1,6 @@ +// @flow /* - * Copyright (C) 2016 Alexander Krivács Schrøder + * Copyright (C) 2016-2018 Alexander Krivács Schrøder * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -15,56 +16,55 @@ * along with this program. If not, see . */ -var qcExt; +import type { AngularModule, $Log, $Scope } from 'angular'; -(function(qcExt) { - 'use strict'; +import settings from '../../settings'; - qcExt.app.controller('bodyController', ['$log', '$scope', 'comicService', - function($log, $scope, comicService) { +import type { $DecoratedScope } from '../decorateScope'; +import type { ComicService } from '../services/comicService'; + +export default function (app: AngularModule) { + app.controller('bodyController', ['$log', '$scope', 'comicService', + function ($log: $Log, $scope: $DecoratedScope, comicService: ComicService) { $log.debug('START bodyController()'); - var isStupidFox = + const isStupidFox = navigator.userAgent.toLowerCase().indexOf('firefox') > -1; function previous() { - $scope.$apply(function() { + $scope.$apply(function () { comicService.previous(); }); } function next() { - $scope.$apply(function() { + $scope.$apply(function () { comicService.next(); }); } - var shortcut = - /* jshint evil:true */ + const shortcut = window.eval('window.shortcut'); - /* jshint evil:false */ - + // Firefox balks at me trying to use the "shortcut" object from // my user script. Works just fine in Chrome. I can't be bothered // to cater to one browser's stupidity. if (isStupidFox) { - var shortcutRemove = - /* jshint evil:true */ + const shortcutRemove = window.eval('window.shortcut.remove').bind(shortcut); - /* jshint evil:false */ shortcutRemove('Left'); shortcutRemove('Right'); - + // This is a sort of replacement for "shortcut". Only supports // simple Left/Right navigation. Is missing the editor mode // shortcuts because Firefox is behaving like shit. - window.addEventListener('keydown', function(event) { + window.addEventListener('keydown', function (event) { // Only if no special keys are held down if (event.altKey || event.ctrlKey || event.metaKey || event.shiftKey) { return; } - + if (event.keyCode === 37) { // LEFT previous(); @@ -78,23 +78,21 @@ var qcExt; // actively try to sabotage you? shortcut.remove('Left'); shortcut.remove('Right'); - - // jscs:disable requireCamelCaseOrUpperCaseIdentifiers + shortcut.add('Left', previous, - {disable_in_input: true}); + { disable_in_input: true }); shortcut.add('Ctrl+Left', previous); shortcut.add('Right', next, - {disable_in_input: true}); + { disable_in_input: true }); shortcut.add('Ctrl+Right', next); - shortcut.add('Q', function() { - if (qcExt.settings.editMode) { + shortcut.add('Q', function () { + if (settings.values.editMode) { $('input[id^="addItem"]').focus(); } - }, {disable_in_input: true}); - // jscs:enable requireCamelCaseOrUpperCaseIdentifiers + }, { disable_in_input: true }); } $log.debug('END bodyController()'); }]); -})(qcExt || (qcExt = {})); +} diff --git a/assets/js/qc-ext-comicController.js b/assets/js/modules/angular/controllers/comicController.js similarity index 68% rename from assets/js/qc-ext-comicController.js rename to assets/js/modules/angular/controllers/comicController.js index 568be5a..22b51ce 100644 --- a/assets/js/qc-ext-comicController.js +++ b/assets/js/modules/angular/controllers/comicController.js @@ -1,5 +1,6 @@ +// @flow /* - * Copyright (C) 2016 Alexander Krivács Schrøder + * Copyright (C) 2016-2018 Alexander Krivács Schrøder * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -15,15 +16,14 @@ * along with this program. If not, see . */ -var qcExt; +import type { AngularModule, $Log } from 'angular'; +import type { ComicService } from '../services/comicService'; -(function(qcExt) { - 'use strict'; - - qcExt.app.controller('comicController', ['$log', 'comicService', - function($log, comicService) { +export default function (app: AngularModule) { + app.controller('comicController', ['$log', 'comicService', + function ($log: $Log, comicService: ComicService) { $log.debug('START comicController()'); this.comicService = comicService; $log.debug('END comicController()'); }]); -})(qcExt || (qcExt = {})); +} diff --git a/assets/js/modules/angular/controllers/titleController.js b/assets/js/modules/angular/controllers/titleController.js new file mode 100644 index 0000000..836a7be --- /dev/null +++ b/assets/js/modules/angular/controllers/titleController.js @@ -0,0 +1,69 @@ +// @flow +/* + * Copyright (C) 2016-2018 Alexander Krivács Schrøder + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +import type { AngularModule, $Log } from 'angular'; + +import constants from '../../../constants'; + +import { ComicDataControllerBase } from './ControllerBases'; + +import type { $DecoratedScope } from '../decorateScope'; +import type { EventService } from '../services/eventService'; +import type { ComicData } from '../api/comicData'; + +export class TitleController extends ComicDataControllerBase { + static $inject: string[]; + + $log: $Log; + + title: string; + + constructor( + $scope: $DecoratedScope, + $log: $Log, + eventService: EventService + ) { + $log.debug('START TitleController'); + + super($scope, eventService); + + this.$log = $log; + + this.title = 'Loading Questionable Content Extension...'; + + $log.debug('END TitleController'); + } + + _comicDataLoading(comic: number) { + this.title = `Loading #${comic} — Questionable Content`; + } + + _comicDataLoaded(comicData: ComicData) { + if (comicData.hasData && comicData.title) { + this.title = `#${comicData.comic}: ${comicData.title} — Questionable Content`; + } else { + this.title = `#${comicData.comic} — Questionable Content`; + } + } + +} +TitleController.$inject = ['$scope', '$log', 'eventService']; + +export default function (app: AngularModule) { + app.controller('titleController', TitleController); +} diff --git a/assets/js/modules/angular/decorateHttpService.js b/assets/js/modules/angular/decorateHttpService.js new file mode 100644 index 0000000..9bc5dac --- /dev/null +++ b/assets/js/modules/angular/decorateHttpService.js @@ -0,0 +1,214 @@ +// @flow +/* + * Copyright (C) 2016-2018 Alexander Krivács Schrøder + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +import GM from 'greasemonkey'; +import angular from 'angular'; + +// TODO: Since we're not using the original service at all, we might +// as well completely replace it rather than decorate it... +// http://www.bennadel.com/blog/ +// 2927-overriding-core-and-custom-services-in-angularjs.htm +export default function ($provide: any) { + + // Let's take over $http and make it use Greasemonkey's cross-domain + // XMLHTTPRequests instead of the browser's. + $provide.decorator('$http', function () { + + // START Code bits borrowed from angular + // (see angular's license for details) + const APPLICATION_JSON = 'application/json'; + const JSON_START = /^\[|^\{(?!\{)/; + const JSON_ENDS = { + '[': /]$/, + '{': /}$/ + }; + const JSON_PROTECTION_PREFIX = /^\)\]\}',?\n/; + + function isJsonLike(str) { + const jsonStart = str.match(JSON_START); + + return jsonStart && JSON_ENDS[jsonStart[0]].test(str); + } + + function isString(value) { + return typeof value === 'string'; + } + + function fromJson(json) { + return isString(json) ? JSON.parse(json) : json; + } + + function defaultHttpResponseTransform(data, headers) { + if (!isString(data)) { + return data; + } + + // Strip json vulnerability protection prefix + // and trim whitespace + const tempData = data.replace(JSON_PROTECTION_PREFIX, '') + .trim(); + + if (!tempData) { + return data; + } + + const contentType = headers('Content-Type'); + + if (contentType && + contentType.indexOf(APPLICATION_JSON) === 0 || + isJsonLike(tempData)) { + data = fromJson(tempData); + } + + return data; + } + + // END Code bits borrowed from angular + + function getHeaderFunction(headers) { + const keyedHeaders = {}; + + angular.forEach(headers, function (value) { + const splitValue = value.trim().split(':', 2); + + if (splitValue.length < 2) { + return; + } + + keyedHeaders[splitValue[0].trim()] = + splitValue[1].trim(); + }); + + return function (key) { + return keyedHeaders[key] || null; + }; + } + + const injector = (angular: any).injector(['ng']); + const $q = injector.get('$q'); + const ourHttp = { + get: function (url, config) { + return $q(function (resolve, reject) { + GM.xmlHttpRequest({ + method: 'GET', + url: url, + headers: { + Accept: APPLICATION_JSON + }, + onload: function (gmResponse) { + const headers = getHeaderFunction( + gmResponse.responseHeaders + .split('\n')); + let responseData = gmResponse.response; + + responseData = defaultHttpResponseTransform( + responseData, headers); + const response = { + data: responseData, + status: gmResponse.status, + headers: headers, + config: config, + statusText: gmResponse.statusText + }; + + resolve(response); + }, + onerror: function (gmResponse) { + const headers = getHeaderFunction(gmResponse + .responseHeaders.split('\n')); + let responseData = gmResponse.response; + + responseData = defaultHttpResponseTransform( + responseData, headers); + const response = { + data: responseData, + status: gmResponse.status, + headers: headers, + config: config, + statusText: gmResponse.statusText + }; + + reject(response); + } + }); + }); + }, + post: function (url, data, config) { + return $q(function (resolve, reject) { + GM.xmlHttpRequest({ + method: 'POST', + url: url, + data: JSON.stringify(data), + headers: { + 'Content-Type': APPLICATION_JSON, + Accept: APPLICATION_JSON + }, + onload: function (gmResponse) { + const headers = getHeaderFunction( + gmResponse.responseHeaders + .split('\n')); + let responseData = gmResponse.response; + + responseData = defaultHttpResponseTransform( + responseData, headers); + const response = { + data: responseData, + status: gmResponse.status, + headers: headers, + config: config, + statusText: gmResponse.statusText + }; + + resolve(response); + }, + onerror: function (gmResponse) { + const headers = getHeaderFunction(gmResponse + .responseHeaders.split('\n')); + let responseData = gmResponse.response; + + responseData = defaultHttpResponseTransform( + responseData, headers); + const response = { + data: responseData, + status: gmResponse.status, + headers: headers, + config: config, + statusText: gmResponse.statusText + }; + + reject(response); + } + }); + }); + } + }; + + /* Methods/properties to implement for full compatibility: + * pendingRequests + * delete + * head + * jsonp + * post + * put + * patch + * defaults + */ + + return ourHttp; + }); +} diff --git a/assets/js/modules/angular/decorateScope.js b/assets/js/modules/angular/decorateScope.js new file mode 100644 index 0000000..80f2dc3 --- /dev/null +++ b/assets/js/modules/angular/decorateScope.js @@ -0,0 +1,43 @@ +// @flow +/* + * Copyright (C) 2016-2018 Alexander Krivács Schrøder + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +import GM from 'greasemonkey'; + +import type { $Scope } from 'angular'; + +export type $DecoratedScope = $Scope & { + safeApply(fn: Function): void; +}; + +export default function ($provide: any) { + $provide.decorator('$rootScope', ['$delegate', function ($delegate) { + const $rootScopePrototype = Object.getPrototypeOf($delegate); + $rootScopePrototype.safeApply = function (fn) { + const phase = this.$root.$$phase; + if (phase === '$apply' || phase === '$digest') { + if (fn && typeof fn === 'function') { + fn(); + } + } else { + this.$apply(fn); + } + }; + + return $delegate; + }]); +} diff --git a/assets/js/qc-ext-donutDirective.js b/assets/js/modules/angular/directives/donutDirective.js similarity index 82% rename from assets/js/qc-ext-donutDirective.js rename to assets/js/modules/angular/directives/donutDirective.js index fcdada2..df47374 100644 --- a/assets/js/qc-ext-donutDirective.js +++ b/assets/js/modules/angular/directives/donutDirective.js @@ -1,5 +1,6 @@ +// @flow /* - * Copyright (C) 2016 Alexander Krivács Schrøder + * Copyright (C) 2016-2018 Alexander Krivács Schrøder * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -15,13 +16,13 @@ * along with this program. If not, see . */ -var qcExt; +import type { AngularModule } from 'angular'; -(function(qcExt) { - 'use strict'; +import variables from '../../../../generated/variables.pass2'; - qcExt.app.directive('donut', [ - function() { +export default function (app: AngularModule) { + app.directive('donut', + function () { return { restrict: 'E', scope: { @@ -33,7 +34,7 @@ var qcExt; borderSize: '@' }, controller: ['$scope', - function($scope) { + function ($scope) { function calculateRotationValues() { $scope.rotation = $scope.percent / 100 * 180; $scope.fixRotation = $scope.rotation * 2; @@ -56,13 +57,13 @@ var qcExt; } calculateRotationValues(); calculateSizeValues(); - + $scope.$watch('percent', calculateRotationValues); $scope.$watch('size', calculateSizeValues); $scope.$watch('borderSize', calculateSizeValues); } ], - template: qcExt.variables.angularTemplates.donut + template: variables.html.donut }; - }]); -})(qcExt || (qcExt = {})); + }); +} diff --git a/assets/js/qc-ext-onErrorDirective.js b/assets/js/modules/angular/directives/onErrorDirective.js similarity index 70% rename from assets/js/qc-ext-onErrorDirective.js rename to assets/js/modules/angular/directives/onErrorDirective.js index 722e13e..53d5de8 100644 --- a/assets/js/qc-ext-onErrorDirective.js +++ b/assets/js/modules/angular/directives/onErrorDirective.js @@ -1,5 +1,6 @@ +// @flow /* - * Copyright (C) 2016 Alexander Krivács Schrøder + * Copyright (C) 2016-2018 Alexander Krivács Schrøder * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -15,19 +16,17 @@ * along with this program. If not, see . */ -var qcExt; +import type { AngularModule } from 'angular'; -(function(qcExt) { - 'use strict'; - - qcExt.app.directive('onError', function() { +export default function (app: AngularModule) { + app.directive('onError', function () { return { restrict: 'A', - link: function(scope, element, attrs) { - element.bind('error', function() { + link: function (scope, element, attrs) { + element.bind('error', function () { scope.$apply(attrs.onError); }); } }; }); -})(qcExt || (qcExt = {})); +} diff --git a/assets/js/modules/angular/directives/qcAddItemDirective.js b/assets/js/modules/angular/directives/qcAddItemDirective.js new file mode 100644 index 0000000..23ec401 --- /dev/null +++ b/assets/js/modules/angular/directives/qcAddItemDirective.js @@ -0,0 +1,244 @@ +// @flow +/* + * Copyright (C) 2016-2018 Alexander Krivács Schrøder + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +import type { AngularModule, $Log, $Timeout, $Http, $Filter } from 'angular'; + +import constants from '../../../constants'; +import variables from '../../../../generated/variables.pass2'; + +import { SetValueControllerBase } from '../controllers/ControllerBases'; + +import type { $DecoratedScope } from '../decorateScope'; +import type { ComicService } from '../services/comicService'; +import type { EventService } from '../services/eventService'; +import type { ItemBaseData, ItemData } from '../api/itemData'; +import type { ComicItem } from '../api/comicData'; + +const addCastTemplate = 'Add new cast member'; +const addCastItem: ItemBaseData = { + id: -1, + type: 'cast', + shortName: `${addCastTemplate} ''`, + name: '' +}; +const addStorylineTemplate = 'Add new storyline'; +const addStorylineItem: ItemBaseData = { + id: -1, + type: 'storyline', + shortName: `${addStorylineTemplate} ''`, + name: '' +}; +const addLocationTemplate = 'Add new location'; +const addLocationItem: ItemBaseData = { + id: -1, + type: 'location', + shortName: `${addLocationTemplate} ''`, + name: '' +}; + +function escapeRegExp(s) { + return s.replace(/[-/\\^$*+?.()|[\]{}]/g, '\\$&'); +} + +let triggeredFocus = false; +let dropdownOpen = false; +let firstRun = true; + +export class AddItemController extends SetValueControllerBase { + static $inject: string[]; + + $log: $Log; + $http: $Http; + $timeout: $Timeout; + $filter: $Filter; + + searchFieldId: string; + dropdownId: string; + dropdownButtonId: string; + + itemFilterText: string; + items: ItemBaseData[]; + + constructor( + $scope: $DecoratedScope, + $log: $Log, + comicService: ComicService, + eventService: EventService, + $http: $Http, + $timeout: $Timeout, + $filter: $Filter + ) { + $log.debug('START AddItemController'); + + super($scope, comicService, eventService); + + this.$log = $log; + this.$http = $http; + this.$timeout = $timeout; + this.$filter = $filter; + + this.searchFieldId = `#addItem_${this.unique}_search`; + this.dropdownId = `#addItem_${this.unique}_dropdown`; + this.dropdownButtonId = `#addItem_${this.unique}_dropdownButton`; + + this.items = []; + this.itemFilterText = ''; + + (this: any).itemFilter = this.itemFilter.bind(this); + + this._loadItemData(); + + $log.debug('END AddItemController'); + } + + _loadItemData() { + this.$http.get(constants.itemDataUrl) + .then((response) => { + let itemData: ItemBaseData[] = []; + if (response.status === 200) { + itemData = response.data; + } + + itemData.push(addCastItem); + itemData.push(addStorylineItem); + itemData.push(addLocationItem); + + this.$scope.safeApply(() => { + this.items = itemData; + }); + }); + } + + _updateValue() { + // Add the top item in the list + const filteredList = this.$filter('filter')(this.items, + this.itemFilter); + const chosenItem = filteredList[0]; + this.addItem(chosenItem); + } + + _itemsChanged() { + this._loadItemData(); + } + + searchChanged() { + let filterText = this.itemFilterText; + + if (filterText.charAt(0) === '!') { + filterText = filterText.substr(1); + } else if (filterText.charAt(0) === '@') { + filterText = filterText.substr(1); + } else if (filterText.charAt(0) === '#') { + filterText = filterText.substr(1); + } + + addCastItem.shortName = `${addCastTemplate} '${filterText}'`; + addCastItem.name = filterText; + addStorylineItem.shortName = `${addStorylineTemplate} '${filterText}'`; + addStorylineItem.name = filterText; + addLocationItem.shortName = `${addLocationTemplate} '${filterText}'`; + addLocationItem.name = filterText; + } + + itemFilter(value: ItemBaseData) { + let filterText = this.itemFilterText; + + let result = true; + if (filterText.charAt(0) === '!') { + result = value.type === 'cast'; + filterText = filterText.substr(1); + } else if (filterText.charAt(0) === '@') { + result = value.type === 'location'; + filterText = filterText.substr(1); + } else if (filterText.charAt(0) === '#') { + result = value.type === 'storyline'; + filterText = filterText.substr(1); + } + + const searchRegex = new RegExp(escapeRegExp(filterText), 'i'); + result = result && + value.shortName.match(searchRegex) !== null; + + return result; + } + + focusSearch() { + this.$log.debug('AddItemController::focusSearch(): #1 Search focused'); + if (firstRun) { + $(this.dropdownId).on('shown.bs.dropdown', () => { + dropdownOpen = true; + this.$log.debug('AddItemController::focusSearch(): #4 Dropdown opened'); + + // Opening the dropdown makes the search field + // lose focus. So set it again. + $(this.searchFieldId).focus(); + triggeredFocus = false; + + $(this.dropdownId + ' .dropdown-menu').width($( + this.dropdownId).width()); + }); + $(this.dropdownId).on('hidden.bs.dropdown', () => { + this.$log.debug('AddItemController::focusSearch(): #5 Dropdown closed'); + dropdownOpen = false; + }); + + firstRun = false; + } + + if (!dropdownOpen && !triggeredFocus) { + this.$log.debug( + 'AddItemController::focusSearch(): #2 Focus was user-initiated'); + triggeredFocus = true; + this.$timeout(() => { + if (!dropdownOpen) { + this.$log.debug( + 'AddItemController::focusSearch(): #3 Toggle dropdown'); + ($(this.dropdownButtonId): any).dropdown('toggle'); + } + }, 150); + } + } + + addItem(item: ComicItem) { + this.comicService.addItem(item).then((response) => { + if (response.status === 200) { + this.eventService.itemsChangedEvent.publish(); + this.$scope.safeApply(() => { + this.itemFilterText = ''; + }); + } + }); + } +} +AddItemController.$inject = [ + '$scope', '$log', 'comicService', 'eventService', + '$http', '$timeout' +]; + +export default function (app: AngularModule) { + app.directive('qcAddItem', function () { + return { + restrict: 'E', + replace: true, + scope: {}, + controller: AddItemController, + controllerAs: 'a', + template: variables.html.addItem + }; + }); +} diff --git a/assets/js/modules/angular/directives/qcChangeLogDirective.js b/assets/js/modules/angular/directives/qcChangeLogDirective.js new file mode 100644 index 0000000..bfa2adf --- /dev/null +++ b/assets/js/modules/angular/directives/qcChangeLogDirective.js @@ -0,0 +1,102 @@ +// @flow +/* + * Copyright (C) 2016-2018 Alexander Krivács Schrøder + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +import type { AngularModule, $Log } from 'angular'; + +import GM from 'greasemonkey'; + +import constants from '../../../constants'; +import settings from '../../settings'; +import variables from '../../../../generated/variables.pass2'; + +import { ComicDataControllerBase } from '../controllers/ControllerBases'; + +import type { $DecoratedScope } from '../decorateScope'; +import type { EventService } from '../services/eventService'; +import type { ComicData } from '../api/comicData'; + +export class ChangeLogController extends ComicDataControllerBase { + static $inject: string[]; + + $log: $Log; + + versionUpdated: boolean; + currentVersion: string; + previousVersion: ?string; + + constructor( + $scope: $DecoratedScope, + $log: $Log, + eventService: EventService + ) { + $log.debug('START ChangeLogController'); + + super($scope, eventService); + + this.$log = $log; + + this.versionUpdated = false; + this.currentVersion = GM.info.script.version; + this.previousVersion = null; + + $('#changeLogDialog').on('hide.bs.modal', () => { + this.$log.debug('Saving settings...'); + settings.values.version = this.currentVersion; + settings.saveSettings().then(() => { + this.$log.debug('Settings saved.'); + }); + }); + + $log.debug('END ChangeLogController'); + } + + _comicDataLoaded(comicData: ComicData) { + if (!settings.values.version) { + // Version is undefined. We're a new user! + this.$log.debug('ChangeLogController::_comicDataLoaded(): Version undefined!'); + } else if (settings.values.version !== + this.currentVersion) { + // Version is changed. Script has been updated! + // Show the change log dialog. + this.previousVersion = settings.values.version; + this.$log.debug('ChangeLogController::_comicDataLoaded(): Version different!'); + } else { + return; + } + this.versionUpdated = true; + } + + close() { + ($('#changeLogDialog'): any).modal('hide'); + } + +} +ChangeLogController.$inject = ['$scope', '$log', 'eventService']; + +export default function (app: AngularModule) { + app.directive('qcChangeLog', function () { + return { + restrict: 'E', + replace: true, + scope: {}, + controller: ChangeLogController, + controllerAs: 'clvm', + template: variables.html.changeLog + }; + }); +} diff --git a/assets/js/qc-ext-qcComicDirective.js b/assets/js/modules/angular/directives/qcComicDirective.js similarity index 71% rename from assets/js/qc-ext-qcComicDirective.js rename to assets/js/modules/angular/directives/qcComicDirective.js index ed3dc66..ba33258 100644 --- a/assets/js/qc-ext-qcComicDirective.js +++ b/assets/js/modules/angular/directives/qcComicDirective.js @@ -1,5 +1,6 @@ +// @flow /* - * Copyright (C) 2016 Alexander Krivács Schrøder + * Copyright (C) 2016-2018 Alexander Krivács Schrøder * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -15,26 +16,25 @@ * along with this program. If not, see . */ -var qcExt; +import type { AngularModule } from 'angular'; -(function(qcExt) { - 'use strict'; - qcExt.app.directive('qcComic', function() { +export default function (app: AngularModule) { + app.directive('qcComic', function () { return { restrict: 'E', transclude: true, scope: {}, - link: function(scope, element, attrs, ctrl, transclude) { - transclude(scope, function(clone) { + link: function (scope, element, attrs, ctrl, transclude) { + transclude(scope, function (clone) { element.append(clone); }); }, controller: ['comicService', - function(comicService) { + function (comicService) { this.comicService = comicService; }], controllerAs: 'c' }; }); -})(qcExt || (qcExt = {})); +} diff --git a/assets/js/modules/angular/directives/qcComicNavDirective.js b/assets/js/modules/angular/directives/qcComicNavDirective.js new file mode 100644 index 0000000..66ab020 --- /dev/null +++ b/assets/js/modules/angular/directives/qcComicNavDirective.js @@ -0,0 +1,97 @@ +// @flow +/* + * Copyright (C) 2016-2018 Alexander Krivács Schrøder + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +import type { AngularModule, $Log } from 'angular'; + +import constants from '../../../constants'; +import variables from '../../../../generated/variables.pass2'; + +import { ComicDataControllerBase } from '../controllers/ControllerBases'; + +import type { $DecoratedScope } from '../decorateScope'; +import type { ComicService } from '../services/comicService'; +import type { EventService } from '../services/eventService'; +import type { ComicData } from '../api/comicData'; + +export class ComicNavController extends ComicDataControllerBase { + static $inject: string[]; + + $log: $Log; + comicService: ComicService; + latestComic: number; + + currentComic: ?number; + + constructor( + $scope: $DecoratedScope, + $log: $Log, + comicService: ComicService, + eventService: EventService, + latestComic: number + ) { + $log.debug('START ComicNavController'); + + super($scope, eventService); + + this.$log = $log; + this.comicService = comicService; + this.latestComic = latestComic; + + this.currentComic = null; + + $log.debug('END ComicNavController'); + } + + _comicDataLoaded(comicData: ComicData) { + this.currentComic = comicData.comic; + } + + go() { + this.$log.debug(`ComicNavController::go(): ${this.currentComic ? this.currentComic : 'NONE'}`); + if (!this.currentComic) { + this.currentComic = this.latestComic; + } else if (this.currentComic < 1) { + this.currentComic = 1; + } else if (this.currentComic > this.latestComic) { + this.currentComic = this.latestComic; + } + this.comicService.gotoComic(this.currentComic); + } + + keyPress(event: KeyboardEvent) { + if (event.keyCode === 13) { + // ENTER key + this.go(); + } + } + +} +ComicNavController.$inject = ['$scope', '$log', 'comicService', 'eventService', 'latestComic']; + +export default function (app: AngularModule) { + app.directive('qcComicNav', function () { + return { + restrict: 'E', + replace: true, + scope: {}, + controller: ComicNavController, + controllerAs: 'cn', + template: variables.html.comicNav + }; + }); +} diff --git a/assets/js/modules/angular/directives/qcDateDirective.js b/assets/js/modules/angular/directives/qcDateDirective.js new file mode 100644 index 0000000..6db425a --- /dev/null +++ b/assets/js/modules/angular/directives/qcDateDirective.js @@ -0,0 +1,91 @@ +// @flow +/* + * Copyright (C) 2016-2018 Alexander Krivács Schrøder + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +import type { AngularModule, $Log } from 'angular'; + +import constants from '../../../constants'; +import settings, { Settings } from '../../settings'; +import variables from '../../../../generated/variables.pass2'; + +import { ComicDataControllerBase } from '../controllers/ControllerBases'; + +import type { $DecoratedScope } from '../decorateScope'; +import type { EventService } from '../services/eventService'; +import type { ComicData } from '../api/comicData'; + +export class DateController extends ComicDataControllerBase { + static $inject: string[]; + + $log: $Log; + + settings: Settings; + + date: ?Date; + approximateDate: boolean; + + constructor( + $scope: $DecoratedScope, + $log: $Log, + eventService: EventService + ) { + $log.debug('START DateController'); + + super($scope, eventService); + + this.$log = $log; + + this.settings = settings; + this.date = null; + this.approximateDate = false; + + $log.debug('END DateController'); + } + + _comicDataLoading(comic: number) { + self.date = null; + self.approximateDate = false; + } + + _comicDataLoaded(comicData: ComicData) { + this.approximateDate = !comicData.isAccuratePublishDate; + const publishDate = comicData.publishDate; + this.$log.debug('DateController::_comicDataLoaded(): ', publishDate); + if (publishDate !== null && + publishDate !== undefined) { + const date = new Date(publishDate); + this.date = date; + } else { + this.date = null; + } + } + +} +DateController.$inject = ['$scope', '$log', 'eventService']; + +export default function (app: AngularModule) { + app.directive('qcDate', function () { + return { + restrict: 'E', + replace: true, + scope: {}, + controller: DateController, + controllerAs: 'd', + template: variables.html.date + }; + }); +} diff --git a/assets/js/modules/angular/directives/qcEditComicDataDirective.js b/assets/js/modules/angular/directives/qcEditComicDataDirective.js new file mode 100644 index 0000000..a2ed06d --- /dev/null +++ b/assets/js/modules/angular/directives/qcEditComicDataDirective.js @@ -0,0 +1,117 @@ +// @flow +/* + * Copyright (C) 2016-2018 Alexander Krivács Schrøder + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +import type { AngularModule, $Log } from 'angular'; + +import angular from 'angular'; + +import constants from '../../../constants'; +import variables from '../../../../generated/variables.pass2'; + +import { ComicDataControllerBase } from '../controllers/ControllerBases'; + +import type { $DecoratedScope } from '../decorateScope'; +import type { ComicService } from '../services/comicService'; +import type { EventService } from '../services/eventService'; +import type { ComicData, ComicItem } from '../api/comicData'; +import type { ItemType } from '../api/itemData'; + +export class EditComicDataController extends ComicDataControllerBase { + static $inject: string[]; + + $log: $Log; + comicService: ComicService; + + editData: any; // TODO: Make properly strongly typed + + constructor( + $scope: $DecoratedScope, + $log: $Log, + eventService: EventService, + comicService: ComicService + ) { + $log.debug('START EditComicDataController'); + + super($scope, eventService); + + this.$log = $log; + this.comicService = comicService; + + $('#editComicDataDialog').on('show.bs.modal', () => { + // If something needs to be done, do it here. + }); + + $log.debug('END EditComicDataController'); + } + + _comicDataLoaded(comicData: ComicData) { + const editData: { comicData: ComicData, [ItemType]: { [number]: ComicItem } } = { comicData: comicData }; + + if (comicData.hasData) { + angular.forEach(comicData.items, + (item) => { + let editDataType: { [number]: ComicItem }; + if (!editData[item.type]) { + editDataType = editData[item.type] = {}; + } else { + editDataType = editData[item.type]; + } + + editDataType[item.id] = item; + }); + } + + this.editData = editData; + } + + remove(item: ComicItem) { + this.comicService.removeItem(item).then((response) => { + if (response.status === 200) { + this.eventService.itemsChangedEvent.publish(); + } + }); + } + + changeGuestComic() { + this.comicService.setGuestComic( + this.editData.comicData.isGuestComic); + } + + changeNonCanon() { + this.comicService.setNonCanon( + this.editData.comicData.isNonCanon); + } + + close() { + ($('#editComicDataDialog'): any).modal('hide'); + } +} +EditComicDataController.$inject = ['$scope', '$log', 'eventService', 'comicService']; + +export default function (app: AngularModule) { + app.directive('qcEditComicData', function () { + return { + restrict: 'E', + replace: true, + scope: {}, + controller: EditComicDataController, + controllerAs: 'ecdvm', + template: variables.html.editComicData + }; + }); +} diff --git a/assets/js/modules/angular/directives/qcExtraDirective.js b/assets/js/modules/angular/directives/qcExtraDirective.js new file mode 100644 index 0000000..8c9586a --- /dev/null +++ b/assets/js/modules/angular/directives/qcExtraDirective.js @@ -0,0 +1,301 @@ +// @flow +/* + * Copyright (C) 2016-2018 Alexander Krivács Schrøder + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +import type { AngularModule, $Log, $Http, $Sce } from 'angular'; + +import GM from 'greasemonkey'; +import angular from 'angular'; + +import constants from '../../../constants'; +import settings, { Settings } from '../../settings'; +import variables from '../../../../generated/variables.pass2'; + +import { ComicDataControllerBase } from '../controllers/ControllerBases'; + +import type { $DecoratedScope } from '../decorateScope'; +import type { ColorService } from '../services/colorService'; +import type { ComicService } from '../services/comicService'; +import type { EventService } from '../services/eventService'; +import type { MessageReportingService } from '../services/messageReportingService'; +import type { StyleService } from '../services/styleService'; +import type { ItemData } from '../api/itemData'; +import type { ComicItemRepository, ComicData, ComicEditorData, ComicItem } from '../api/comicData'; + +export class ExtraController extends ComicDataControllerBase { + static $inject: string[]; + + $log: $Log; + $sce: $Sce; + comicService: ComicService; + + settings: Settings; + constants: *; + + messages: string[]; + missingDataInfo: string[]; + showWelcomeMessage: boolean; + showUpdateMessage: boolean; + isLoading: boolean; + hasError: boolean; + hasWarning: boolean; + + items: ComicItemRepository; + allItems: ComicItemRepository; + + editorData: ComicEditorData; + + constructor( + $scope: $DecoratedScope, + $log: $Log, + $sce: $Sce, + comicService: ComicService, + eventService: EventService, + latestComic: number + ) { + $log.debug('START ExtraController'); + + super($scope, eventService); + + this.$log = $log; + this.$sce = $sce; + this.comicService = comicService; + + this.settings = settings; + this.constants = constants; + this.items = {}; + this.allItems = {}; + this.editorData = (({}: any): ComicEditorData); + this.messages = []; + this.missingDataInfo = []; + + $log.debug('END ExtraController'); + } + + _comicDataLoading(comic: number) { + this._loading(); + } + + _comicDataLoaded(comicData: ComicData) { + this._reset(); + + if (this.settings.values.editMode && + comicData.editorData) { + this.editorData = comicData.editorData; + this.editorData.missing.cast.any = + this.editorData.missing.cast.first !== null; + this.editorData.missing.location.any = + this.editorData.missing.location.first !== null; + this.editorData.missing.storyline.any = + this.editorData.missing.storyline.first !== null; + this.editorData.missing.title.any = + this.editorData.missing.title.first !== null; + this.editorData.missing.tagline.any = + this.editorData.missing.tagline.first !== null; + this.editorData.missing.any = + this.editorData.missing.cast.any || + this.editorData.missing.location.any || + this.editorData.missing.storyline.any || + this.editorData.missing.title.any || + this.editorData.missing.tagline.any; + + if (this.editorData.missing.cast.first == this.comicService.comic) { + this.editorData.missing.cast.first = null; + } + if (this.editorData.missing.cast.last == this.comicService.comic) { + this.editorData.missing.cast.last = null; + } + + if (this.editorData.missing.location.first == this.comicService.comic) { + this.editorData.missing.location.first = null; + } + if (this.editorData.missing.location.last == this.comicService.comic) { + this.editorData.missing.location.last = null; + } + + if (this.editorData.missing.storyline.first == this.comicService.comic) { + this.editorData.missing.storyline.first = null; + } + if (this.editorData.missing.storyline.last == this.comicService.comic) { + this.editorData.missing.storyline.last = null; + } + } + + const self = this; + function processItem(item: ComicItem) { + let items: ComicItem[]; + if (!self.items[item.type]) { + items = self.items[item.type] = []; + } else { + items = self.items[item.type]; + } + items.push(item); + } + + function processAllItem(item: ComicItem) { + let items: ComicItem[]; + if (!self.allItems[item.type]) { + items = self.allItems[item.type] = []; + } else { + items = self.allItems[item.type]; + } + items.push(item); + } + + if (!comicData.hasData) { + this.messages.push( + 'This strip has no navigation data yet' + ); + this.hasWarning = true; + + if (settings.values.showAllMembers && comicData.allItems) { + angular.forEach(comicData.allItems, processAllItem); + } + return; + } + + let hasCast = false; + let hasLocation = false; + //let hasStoryline = false; + angular.forEach(comicData.items, + function (item) { + processItem(item); + + if (item.type === 'cast') { + hasCast = true; + } else if (item.type === 'location') { + hasLocation = true; + } else if (item.type === 'storyline') { + //hasStoryline = true; + } + } + ); + if (settings.values.showAllMembers && comicData.allItems) { + angular.forEach(comicData.allItems, processAllItem); + } + + if (!hasCast) { + this.missingDataInfo.push('cast members'); + } + if (!hasLocation) { + this.missingDataInfo.push('a location'); + } + /* #if (!hasStoryline) { + self.missingDataInfo.push('a storyline'); + }*/ + if (!comicData.title) { + this.missingDataInfo.push('a title'); + } + if (!comicData.tagline && + this.comicService.comic > constants.taglineThreshold) { + this.missingDataInfo.push('a tagline'); + } + + const currentVersion = GM.info.script.version; + if (!settings.values.version) { + // Version is undefined. We're a new user! + this.$log.debug('qcExtra(): Version undefined!'); + this.showWelcomeMessage = true; + } else if (settings.values.version !== + currentVersion) { + // Version is changed. Script has been updated! + this.$log.debug(`qcExtra(): Version is ${settings.values.version}!`); + this.showUpdateMessage = true; + } + } + + _comicDataError(error: any) { + this._reset(); + if (error.status !== 503) { + this.messages.push('Error communicating with server'); + this.hasError = true; + } else { + this.messages.push(constants.messages.maintenance); + } + } + + _reset() { + this.isLoading = false; + this.items = {}; + this.allItems = {}; + this.editorData = (({}: any): ComicEditorData); + this.messages.length = 0; + this.missingDataInfo.length = 0; + this.hasError = false; + this.hasWarning = false; + } + + _loading() { + this._reset(); + this.isLoading = true; + this.messages.push('Loading...'); + } + + getTypeDescription(type: string) { + switch (type) { + case 'cast': + return 'Cast Members'; + case 'storyline': + return 'Storylines'; + case 'location': + return 'Locations'; + + case 'all-cast': + return this.$sce.trustAsHtml('Cast Members
' + + '(Non-Present)'); + case 'all-storyline': + return this.$sce.trustAsHtml('Storylines
' + + '(Non-Present)'); + case 'all-location': + return this.$sce.trustAsHtml('Locations
' + + '(Non-Present)'); + } + } + + openSettings() { + ($('#settingsDialog'): any).modal('show'); + } + + editComicData() { + ($('#editComicDataDialog'): any).modal('show'); + } + + showDetailsFor(item: ItemData) { + $('#itemDetailsDialog').data('itemId', item.id); + ($('#itemDetailsDialog'): any).modal('show'); + } + + showChangeLog() { + this.showWelcomeMessage = false; + this.showUpdateMessage = false; + ($('#changeLogDialog'): any).modal('show'); + } +} +ExtraController.$inject = ['$scope', '$log', '$sce', 'comicService', 'eventService', 'latestComic']; + +export default function (app: AngularModule) { + app.directive('qcExtra', function () { + return { + restrict: 'E', + replace: true, + scope: {}, + controller: ExtraController, + controllerAs: 'e', + template: variables.html.extra + }; + }); +} diff --git a/assets/js/qc-ext-qcExtraNavDirective.js b/assets/js/modules/angular/directives/qcExtraNavDirective.js similarity index 74% rename from assets/js/qc-ext-qcExtraNavDirective.js rename to assets/js/modules/angular/directives/qcExtraNavDirective.js index a39cc4d..93c25aa 100644 --- a/assets/js/qc-ext-qcExtraNavDirective.js +++ b/assets/js/modules/angular/directives/qcExtraNavDirective.js @@ -1,5 +1,6 @@ +// @flow /* - * Copyright (C) 2016 Alexander Krivács Schrøder + * Copyright (C) 2016-2018 Alexander Krivács Schrøder * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -15,12 +16,12 @@ * along with this program. If not, see . */ -var qcExt; +import type { AngularModule } from 'angular'; -(function(qcExt) { - 'use strict'; - - qcExt.app.directive('qcExtraNav', function() { +import variables from '../../../../generated/variables.pass2'; + +export default function (app: AngularModule) { + app.directive('qcExtraNav', function () { return { restrict: 'E', scope: { @@ -36,7 +37,7 @@ var qcExt; nameTitle: '@', clickAction: '&' }, - template: qcExt.variables.angularTemplates.extraNav + template: variables.html.extraNav }; }); -})(qcExt || (qcExt = {})); +} diff --git a/assets/js/modules/angular/directives/qcItemDetailsDirective.js b/assets/js/modules/angular/directives/qcItemDetailsDirective.js new file mode 100644 index 0000000..4620141 --- /dev/null +++ b/assets/js/modules/angular/directives/qcItemDetailsDirective.js @@ -0,0 +1,230 @@ +// @flow +/* + * Copyright (C) 2016-2018 Alexander Krivács Schrøder + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +import type { AngularModule, $Log, $Http } from 'angular'; + +import constants from '../../../constants'; +import settings, { Settings } from '../../settings'; +import variables from '../../../../generated/variables.pass2'; + +import type { $DecoratedScope } from '../decorateScope'; +import type { ColorService } from '../services/colorService'; +import type { ComicService } from '../services/comicService'; +import type { MessageReportingService } from '../services/messageReportingService'; +import type { StyleService } from '../services/styleService'; +import type { DecoratedItemData, ItemRelationData } from '../api/itemData'; + +export class ItemDetailsController { + static $inject: string[]; + + $log: $Log; + $http: $Http; + $scope: $DecoratedScope; + colorService: ColorService; + comicService: ComicService; + messageReportingService: MessageReportingService; + styleService: StyleService; + + isLoading: boolean; + settings: Settings; + itemData: DecoratedItemData; + + constructor( + $log: $Log, + $http: $Http, + $scope: $DecoratedScope, + colorService: ColorService, + comicService: ComicService, + messageReportingService: MessageReportingService, + styleService: StyleService + ) { + $log.debug('START ItemDetailsController'); + + this.$log = $log; + this.$http = $http; + this.$scope = $scope; + this.colorService = colorService; + this.comicService = comicService; + this.messageReportingService = messageReportingService; + this.styleService = styleService; + + this.isLoading = true; + this.settings = settings; + + $('#itemDetailsDialog').on('show.bs.modal', () => this._getItemDetails()); + + $log.debug('END ItemDetailsController'); + } + + _getItemDetails() { + const self = this; + const itemId = $('#itemDetailsDialog').data('itemId'); + this.$log.debug('ItemDetailsController::showModal() - item id:', + itemId); + + function handleRelationData(response): ?ItemRelationData[] { + if (response.status === 200) { + const relationData = (response.data: ItemRelationData[]); + + $.each(relationData, (_: number, relation) => { + relation.percentage = relation.count / + self.itemData.appearances * 100; + }); + + return relationData; + } + return null; + } + + function handleItemFriendsData(response) { + let friends = handleRelationData(response); + self.$scope.safeApply(() => { + self.itemData.friends = friends || []; + }); + } + + function handleItemLocationsData(response) { + let locations = handleRelationData(response); + self.$scope.safeApply(() => { + self.itemData.locations = locations || []; + }); + } + + function handleItemData(response) { + if (response.status === 200) { + const itemData = response.data; + + itemData.highlightColor = self.colorService + .createTintOrShade(itemData.color); + + if (itemData.hasImage) { + itemData.imagePath = + constants.characterImageBaseUrl + + itemData.id + '.' + + constants.characterImageExtension; + } + + self.$log.debug('qcItemDetails::showModal() - ' + + 'item data:', itemData); + + // If the color changes, also update the + // highlight color + self.$scope.safeApply(() => { + self.itemData = itemData; + self.isLoading = false; + + self.$scope.$watch(() => { + return self.itemData.color; + }, function () { + self.itemData.highlightColor = + self.colorService + .createTintOrShade( + itemData.color); + }); + }); + + self.$http.get(constants.itemFriendDataUrl + itemId) + .then(handleItemFriendsData); + self.$http.get(constants.itemLocationDataUrl + + itemId).then(handleItemLocationsData); + } else { + self.messageReportingService.reportError( + response.data); + } + } + + this.itemData = (({}: any): DecoratedItemData); + this.isLoading = true; + this.$http.get(constants.itemDataUrl + itemId) + .then(response => handleItemData(response)); + } + + _onErrorLog(response: any) { + this.messageReportingService.reportError(response.data); + return response; + } + + _onSuccessRefreshElseErrorLog(response: any) { + if (response.status === 200) { + this.comicService.refreshComicData(); + } else { + this._onErrorLog(response); + } + return response; + } + + showInfoFor(id: number) { + $('#itemDetailsDialog').data('itemId', id); + this._getItemDetails(); + } + + keypress(event: KeyboardEvent, property: string) { + if (event.keyCode === 13) { + // ENTER key + this.update(property); + } + } + + update(property: string) { + const self = this; + function updateItemColor(response) { + if (response.status === 200) { + if (property === 'color') { + self.$log.debug('ItemDetailsController::update() - ' + + 'update item color'); + self.styleService.removeItemStyle( + self.itemData.id); + } + } + return self._onSuccessRefreshElseErrorLog(response); + } + + const data = { + token: settings.values.editModeToken, + item: this.itemData.id, + property: property, + value: this.itemData[property] + }; + this.$http.post(constants.setItemDataPropertyUrl, data) + .then(r => updateItemColor(r)).catch(r => this._onErrorLog(r)); + } + + goToComic(comic: number) { + this.comicService.gotoComic(comic); + this.close(); + } + + close() { + ($('#itemDetailsDialog'): any).modal('hide'); + } +} +ItemDetailsController.$inject = ['$log', '$http', '$scope', 'colorService', + 'comicService', 'messageReportingService', 'styleService']; + +export default function (app: AngularModule) { + app.directive('qcItemDetails', function () { + return { + restrict: 'E', + replace: true, + scope: {}, + controller: ItemDetailsController, + controllerAs: 'idvm', + template: variables.html.itemDetails + }; + }); +} diff --git a/assets/js/modules/angular/directives/qcNavDirective.js b/assets/js/modules/angular/directives/qcNavDirective.js new file mode 100644 index 0000000..92657c1 --- /dev/null +++ b/assets/js/modules/angular/directives/qcNavDirective.js @@ -0,0 +1,95 @@ +// @flow +/* + * Copyright (C) 2016-2018 Alexander Krivács Schrøder + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +import type { AngularModule, $Log } from 'angular'; + +import variables from '../../../../generated/variables.pass2'; + +import type { $DecoratedScope } from '../decorateScope'; +import type { ComicService } from '../services/comicService'; + +export class NavController { + static $inject: string[]; + + $scope: $DecoratedScope; + comicService: ComicService; + latestComic: number; + randomComic: number; + + constructor( + $scope: $DecoratedScope, + comicService: ComicService, + latestComic: number + ) { + this.$scope = $scope; + this.comicService = comicService; + this.latestComic = latestComic; + + this._updateRandomComic(); + } + + _updateRandomComic() { + this.$scope.randomComic = Math.floor(Math.random() * + (parseInt(this.latestComic) + 1)); + } + + first(event: UIEvent) { + event.preventDefault(); + event.stopPropagation(); + this.comicService.first(); + } + + previous(event: UIEvent) { + event.preventDefault(); + event.stopPropagation(); + this.comicService.previous(); + } + + next(event: UIEvent) { + event.preventDefault(); + event.stopPropagation(); + this.comicService.next(); + } + + last(event: UIEvent) { + event.preventDefault(); + event.stopPropagation(); + this.comicService.last(); + } + + random(event: UIEvent) { + event.preventDefault(); + event.stopPropagation(); + + this.comicService.gotoComic(this.$scope.randomComic); + this._updateRandomComic(); + } +} +NavController.$inject = ['$scope', 'comicService', 'latestComic']; + +export default function (app: AngularModule) { + app.directive('qcNav', function () { + return { + restrict: 'E', + scope: { randomComic: '=' }, + controller: NavController, + controllerAs: 'n', + template: variables.html.navigation + }; + }); +} diff --git a/assets/js/modules/angular/directives/qcNewsDirective.js b/assets/js/modules/angular/directives/qcNewsDirective.js new file mode 100644 index 0000000..5dddc95 --- /dev/null +++ b/assets/js/modules/angular/directives/qcNewsDirective.js @@ -0,0 +1,80 @@ +// @flow +/* + * Copyright (C) 2016-2018 Alexander Krivács Schrøder + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +import type { AngularModule, $Log, $Sce } from 'angular'; + +import constants from '../../../constants'; +import { nl2br, angularizeLinks } from '../util'; + +import { ComicDataControllerBase } from '../controllers/ControllerBases'; + +import type { $DecoratedScope } from '../decorateScope'; +import type { EventService } from '../services/eventService'; +import type { ComicData } from '../api/comicData'; + +export class NewsController extends ComicDataControllerBase { + static $inject: string[]; + + $sce: $Sce; + + news: string; + + constructor( + $scope: $DecoratedScope, + $log: $Log, + eventService: EventService, + $sce: $Sce + ) { + $log.debug('START NewsController'); + + super($scope, eventService); + this.$sce = $sce; + + this.news = $sce.trustAsHtml('Loading...'); + + $log.debug('END NewsController'); + } + + _comicDataLoading(comic: number) { + this.news = this.$sce.trustAsHtml('Loading...'); + } + + _comicDataLoaded(comicData: ComicData) { + const news = comicData.news; + if (news == null) { + this.news = ''; + } else { + this.news = this.$sce.trustAsHtml(nl2br(angularizeLinks(news), false)); + } + } + +} +NewsController.$inject = ['$scope', '$log', 'eventService', '$sce']; + +export default function (app: AngularModule) { + app.directive('qcNews', function () { + return { + restrict: 'E', + replace: true, + scope: {}, + controller: NewsController, + controllerAs: 'n', + template: '
' + }; + }); +} diff --git a/assets/js/modules/angular/directives/qcRibbonDirective.js b/assets/js/modules/angular/directives/qcRibbonDirective.js new file mode 100644 index 0000000..7e01036 --- /dev/null +++ b/assets/js/modules/angular/directives/qcRibbonDirective.js @@ -0,0 +1,75 @@ +// @flow +/* + * Copyright (C) 2016-2018 Alexander Krivács Schrøder + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +import type { AngularModule, $Log } from 'angular'; + +import constants from '../../../constants'; +import settings, { Settings } from '../../settings'; +import variables from '../../../../generated/variables.pass2'; + +import { ComicDataControllerBase } from '../controllers/ControllerBases'; + +import type { $DecoratedScope } from '../decorateScope'; +import type { EventService } from '../services/eventService'; +import type { ComicData } from '../api/comicData'; + +export class RibbonController extends ComicDataControllerBase { + static $inject: string[]; + + settings: Settings; + isNonCanon: ?boolean; + isGuestComic: ?boolean; + isSmall: boolean; + + constructor( + $scope: $DecoratedScope, + $log: $Log, + eventService: EventService + ) { + $log.debug('START RibbonController'); + + super($scope, eventService); + + this.settings = settings; + this.isNonCanon = false; + this.isGuestComic = false; + this.isSmall = settings.values.showSmallRibbonByDefault; + + $log.debug('END RibbonController'); + } + + _comicDataLoaded(comicData: ComicData) { + this.isNonCanon = comicData.isNonCanon; + this.isGuestComic = comicData.isGuestComic; + } + +} +RibbonController.$inject = ['$scope', '$log', 'eventService']; + +export default function (app: AngularModule) { + app.directive('qcRibbon', function () { + return { + restrict: 'E', + replace: true, + scope: {}, + controller: RibbonController, + controllerAs: 'r', + template: variables.html.ribbon + }; + }); +} diff --git a/assets/js/modules/angular/directives/qcSetPublishDateDirective.js b/assets/js/modules/angular/directives/qcSetPublishDateDirective.js new file mode 100644 index 0000000..6c93cc0 --- /dev/null +++ b/assets/js/modules/angular/directives/qcSetPublishDateDirective.js @@ -0,0 +1,99 @@ +// @flow + +/* + * Copyright (C) 2016-2018 Alexander Krivács Schrøder + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +import type { AngularModule, $Log } from 'angular'; + +import constants from '../../../constants'; +import variables from '../../../../generated/variables.pass2'; + +import { SetValueControllerBase } from '../controllers/ControllerBases'; + +import type { $DecoratedScope } from '../decorateScope'; +import type { ComicService } from '../services/comicService'; +import type { EventService } from '../services/eventService'; +import type { MessageReportingService } from '../services/messageReportingService'; +import type { ComicData } from '../api/comicData'; + +export class SetPublishDateController extends SetValueControllerBase { + static $inject: string[]; + + $log: $Log; + + messageReportingService: MessageReportingService; + + publishDate: ?Date; + isAccuratePublishDate: ?boolean; + + constructor( + $scope: $DecoratedScope, + $log: $Log, + comicService: ComicService, + eventService: EventService, + messageReportingService: MessageReportingService + ) { + $log.debug('START SetPublishDateController'); + + super($scope, comicService, eventService); + this.$log = $log; + this.messageReportingService = messageReportingService; + + this.publishDate = new Date(); + + $log.debug('END SetPublishDateController'); + } + + _comicDataLoaded(comicData: ComicData) { + if (comicData.publishDate != null) { + this.publishDate = new Date(comicData.publishDate); + } else { + this.publishDate = null; + } + this.isAccuratePublishDate = + comicData.isAccuratePublishDate; + } + + _updateValue() { + this.setPublishDate(); + } + + setPublishDate() { + if (this.publishDate == null) { + // Error + this.messageReportingService.reportWarning( + 'The date entered is not valid!'); + return; + } + this.comicService.setPublishDate(this.publishDate, + this.isAccuratePublishDate != null ? this.isAccuratePublishDate : false); + } +} +SetPublishDateController.$inject = ['$scope', '$log', 'comicService', 'eventService', 'messageReportingService']; + +export default function (app: AngularModule) { + app.directive('qcSetPublishDate', function () { + return { + restrict: 'E', + replace: true, + scope: {}, + controller: SetPublishDateController, + controllerAs: 's', + template: variables.html.setPublishDate + }; + }); +} diff --git a/assets/js/modules/angular/directives/qcSetTaglineDirective.js b/assets/js/modules/angular/directives/qcSetTaglineDirective.js new file mode 100644 index 0000000..e1d693e --- /dev/null +++ b/assets/js/modules/angular/directives/qcSetTaglineDirective.js @@ -0,0 +1,79 @@ +// @flow +/* + * Copyright (C) 2016-2018 Alexander Krivács Schrøder + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +import type { AngularModule, $Log } from 'angular'; + +import constants from '../../../constants'; +import variables from '../../../../generated/variables.pass2'; + +import { SetValueControllerBase } from '../controllers/ControllerBases'; + +import type { $DecoratedScope } from '../decorateScope'; +import type { ComicService } from '../services/comicService'; +import type { EventService } from '../services/eventService'; +import type { ComicData } from '../api/comicData'; + +export class SetTaglineController extends SetValueControllerBase { + static $inject: string[]; + + $log: $Log; + + tagline: ?string; + + constructor( + $scope: $DecoratedScope, + $log: $Log, + comicService: ComicService, + eventService: EventService + ) { + $log.debug('START SetTaglineController'); + + super($scope, comicService, eventService); + this.$log = $log; + + this.tagline = ''; + + $log.debug('END SetTaglineController'); + } + + _comicDataLoaded(comicData: ComicData) { + this.tagline = comicData.tagline; + } + + _updateValue() { + this.setTagline(); + } + + setTagline() { + this.comicService.setTagline(this.tagline ? this.tagline : ''); + } +} +SetTaglineController.$inject = ['$scope', '$log', 'comicService', 'eventService']; + +export default function (app: AngularModule) { + app.directive('qcSetTagline', function () { + return { + restrict: 'E', + replace: true, + scope: {}, + controller: SetTaglineController, + controllerAs: 's', + template: variables.html.setTagline + }; + }); +} diff --git a/assets/js/modules/angular/directives/qcSetTitleDirective.js b/assets/js/modules/angular/directives/qcSetTitleDirective.js new file mode 100644 index 0000000..1a0bca3 --- /dev/null +++ b/assets/js/modules/angular/directives/qcSetTitleDirective.js @@ -0,0 +1,79 @@ +// @flow +/* + * Copyright (C) 2016-2018 Alexander Krivács Schrøder + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +import type { AngularModule, $Log } from 'angular'; + +import constants from '../../../constants'; +import variables from '../../../../generated/variables.pass2'; + +import { SetValueControllerBase } from '../controllers/ControllerBases'; + +import type { $DecoratedScope } from '../decorateScope'; +import type { ComicService } from '../services/comicService'; +import type { EventService } from '../services/eventService'; +import type { ComicData } from '../api/comicData'; + +export class SetTitleController extends SetValueControllerBase { + static $inject: string[]; + + $log: $Log; + + title: ?string; + + constructor( + $scope: $DecoratedScope, + $log: $Log, + comicService: ComicService, + eventService: EventService + ) { + $log.debug('START SetTitleController'); + + super($scope, comicService, eventService); + this.$log = $log; + + this.title = ''; + + $log.debug('END SetTitleController'); + } + + _comicDataLoaded(comicData: ComicData) { + this.title = comicData.title; + } + + _updateValue() { + this.setTitle(); + } + + setTitle() { + this.comicService.setTitle(this.title ? this.title : ''); + }; +} +SetTitleController.$inject = ['$scope', '$log', 'comicService', 'eventService']; + +export default function (app: AngularModule) { + app.directive('qcSetTitle', function () { + return { + restrict: 'E', + replace: true, + scope: {}, + controller: SetTitleController, + controllerAs: 's', + template: variables.html.setTitle + }; + }); +} diff --git a/assets/js/modules/angular/directives/qcSettingsDirective.js b/assets/js/modules/angular/directives/qcSettingsDirective.js new file mode 100644 index 0000000..fd514dc --- /dev/null +++ b/assets/js/modules/angular/directives/qcSettingsDirective.js @@ -0,0 +1,79 @@ +// @flow +/* + * Copyright (C) 2016-2018 Alexander Krivács Schrøder + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +import type { AngularModule, $Log } from 'angular'; + +import settings, { Settings } from '../../settings'; +import variables from '../../../../generated/variables.pass2'; + +import type { $DecoratedScope } from '../decorateScope'; +import type { ComicService } from '../services/comicService'; + +export class SettingsController { + static $inject: string[]; + + $scope: $DecoratedScope; + $log: $Log; + comicService: ComicService; + + settings: Settings; + + constructor($scope: $DecoratedScope, $log: $Log, comicService: ComicService) { + $log.debug('START SettingsController'); + + this.$scope = $scope; + this.$log = $log; + this.comicService = comicService; + + this.settings = settings; + + $scope.$watchGroup([() => { + return this.settings.values.showAllMembers; + }, () => { + return this.settings.values.editMode; + }], () => { + this.comicService.refreshComicData(); + }); + + $('#settingsDialog').on('hide.bs.modal', () => { + $log.debug('Saving settings...'); + this.settings.saveSettings().then(() => { + $log.debug('Settings saved.'); + }); + }); + + $log.debug('END SettingsController'); + } + + close() { + ($('#settingsDialog'): any).modal('hide'); + } +} + +export default function (app: AngularModule) { + app.directive('qcSettings', function () { + return { + restrict: 'E', + replace: true, + scope: {}, + controller: SettingsController, + controllerAs: 'svm', + template: variables.html.settings + }; + }); +} diff --git a/assets/js/module.js b/assets/js/modules/angular/run.js similarity index 66% rename from assets/js/module.js rename to assets/js/modules/angular/run.js index 23bdf08..d1f6475 100644 --- a/assets/js/module.js +++ b/assets/js/modules/angular/run.js @@ -1,5 +1,6 @@ +// @flow /* - * Copyright (C) 2016 Alexander Krivács Schrøder + * Copyright (C) 2016-2018 Alexander Krivács Schrøder * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -15,15 +16,14 @@ * along with this program. If not, see . */ -var qcExt; +import type { AngularModule } from 'angular'; -(function(qcExt) { - 'use strict'; +import settings from './../settings'; - qcExt.app = angular.module('qc-spa', ['ui.router']); - qcExt.app.run(['$rootScope', 'comicService', 'startComic', - function($rootScope, comicService, startComic) { - $rootScope.settings = qcExt.settings; +export default function (app: AngularModule) { + app.run(['$rootScope', 'comicService', 'startComic', + function ($rootScope, comicService, startComic) { + $rootScope.settings = settings; comicService.gotoComic(startComic); }]); -})(qcExt || (qcExt = {})); +} diff --git a/assets/js/bootstrap.js b/assets/js/modules/angular/scopes/rootScope.js similarity index 80% rename from assets/js/bootstrap.js rename to assets/js/modules/angular/scopes/rootScope.js index e44e6ac..07e2b0b 100644 --- a/assets/js/bootstrap.js +++ b/assets/js/modules/angular/scopes/rootScope.js @@ -1,5 +1,6 @@ +// @flow /* - * Copyright (C) 2016 Alexander Krivács Schrøder + * Copyright (C) 2016-2018 Alexander Krivács Schrøder * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -15,8 +16,6 @@ * along with this program. If not, see . */ -(function() { - 'use strict'; +export type RootScope = { - angular.bootstrap($('html').get(0), ['qc-spa']); -})(); +}; diff --git a/assets/js/modules/angular/services/colorService.js b/assets/js/modules/angular/services/colorService.js new file mode 100644 index 0000000..e908ac0 --- /dev/null +++ b/assets/js/modules/angular/services/colorService.js @@ -0,0 +1,312 @@ +// @flow +/* + * Copyright (C) 2016-2018 Alexander Krivács Schrøder + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +import type { AngularModule, $Log } from 'angular'; + +// Parts based on code from: +// http://axonflux.com/handy-rgb-to-hsl-and-rgb-to-hsv-color-model-c + +function hue2rgb(p, q, t) { + if (t < 0) { + t += 1; + } + + if (t > 1) { + t -= 1; + } + + if (t < 1 / 6) { + return p + (q - p) * 6 * t; + } + + if (t < 1 / 2) { + return q; + } + + if (t < 2 / 3) { + return p + (q - p) * (2 / 3 - t) * 6; + } + + return p; +} + +type HSLValue = [number, number, number]; +type RGBValue = [number, number, number]; +type HSVValue = [number, number, number]; + +export class ColorService { + $log: $Log; + + constructor($log: $Log) { + this.$log = $log; + } + + /** + * Converts an RGB color value to HSL. Conversion formula + * adapted from http://en.wikipedia.org/wiki/HSL_color_space. + * Assumes r, g, and b are contained in the set [0, 255] and + * returns h, s, and l in the set [0, 1]. + * + * @param {number} r The red color value + * @param {number} g The green color value + * @param {number} b The blue color value + * @return {HSLValue} The HSL representation + */ + rgbToHsl(r: number, g: number, b: number): HSLValue { + r /= 255; + g /= 255; + b /= 255; + const max = Math.max(r, g, b); + const min = Math.min(r, g, b); + let h = 0; + let s; + const l = (max + min) / 2; + + if (max === min) { + h = s = 0; // Achromatic + } else { + const d = max - min; + + s = l > 0.5 ? d / (2 - max - min) : d / (max + min); + + switch (max) { + case r: + h = (g - b) / d + (g < b ? 6 : 0); + break; + + case g: + h = (b - r) / d + 2; + break; + + case b: + h = (r - g) / d + 4; + break; + } + h /= 6; + } + + return [h, s, l]; + } + + /** + * Converts an HSL color value to RGB. Conversion formula + * adapted from http://en.wikipedia.org/wiki/HSL_color_space. + * Assumes h, s, and l are contained in the set [0, 1] and + * returns r, g, and b in the set [0, 255]. + * + * @param {number} h The hue + * @param {number} s The saturation + * @param {number} l The lightness + * @return {RGBValue} The RGB representation + */ + hslToRgb(h: number, s: number, l: number): RGBValue { + let r; + let g; + let b; + + if (s === 0) { + r = g = b = l; // Achromatic + } else { + const q = l < 0.5 ? l * (1 + s) : l + s - l * s; + const p = 2 * l - q; + + r = hue2rgb(p, q, h + 1 / 3); + g = hue2rgb(p, q, h); + b = hue2rgb(p, q, h - 1 / 3); + } + + return [ + Math.round(r * 255), + Math.round(g * 255), + Math.round(b * 255) + ]; + } + + + /** + * Converts an RGB color value to HSV. Conversion formula + * adapted from http://en.wikipedia.org/wiki/HSV_color_space. + * Assumes r, g, and b are contained in the set [0, 255] and + * returns h, s, and v in the set [0, 1]. + * + * @param {number} r The red color value + * @param {number} g The green color value + * @param {number} b The blue color value + * @return {HSVValue} The HSV representation + */ + rgbToHsv(r: number, g: number, b: number): HSVValue { + r = r / 255; + g = g / 255; + b = b / 255; + const max = Math.max(r, g, b); + const min = Math.min(r, g, b); + let h = 0; + let s; + const v = max; + + const d = max - min; + + s = max === 0 ? 0 : d / max; + + if (max === min) { + h = 0; // Achromatic + } else { + switch (max) { + case r: + h = (g - b) / d + (g < b ? 6 : 0); + break; + + case g: + h = (b - r) / d + 2; + break; + + case b: + h = (r - g) / d + 4; + break; + } + h /= 6; + } + + return [h, s, v]; + } + + /** + * Converts an HSV color value to RGB. Conversion formula + * adapted from http://en.wikipedia.org/wiki/HSV_color_space. + * Assumes h, s, and v are contained in the set [0, 1] and + * returns r, g, and b in the set [0, 255]. + * + * @param {number} h The hue + * @param {number} s The saturation + * @param {number} v The value + * @return {RGBValue} The RGB representation + */ + hsvToRgb(h: number, s: number, v: number) { + let r = 0; + let g = 0; + let b = 0; + + const i = Math.floor(h * 6); + const f = h * 6 - i; + const p = v * (1 - s); + const q = v * (1 - f * s); + const t = v * (1 - (1 - f) * s); + + switch (i % 6) { + case 0: + r = v; + g = t; + b = p; + break; + + case 1: + r = q; + g = v; + b = p; + break; + + case 2: + r = p; + g = v; + b = t; + break; + + case 3: + r = p; + g = q; + b = v; + break; + + case 4: + r = t; + g = p; + b = v; + break; + + case 5: + r = v; + g = p; + b = q; + break; + } + + return [ + Math.round(r * 255), + Math.round(g * 255), + Math.round(b * 255) + ]; + } + + hexColorToRgb(hexColor: string): RGBValue { + if (hexColor.charAt(0) === '#') { + hexColor = hexColor.substring(1); // Strip # + } + const rgb = parseInt(hexColor, 16); // Convert rrggbb to decimal + const r = rgb >> 16 & 0xff; // Extract red + const g = rgb >> 8 & 0xff; // Extract green + const b = rgb & 0xff; // Extract blue + return [r, g, b]; + } + + rgbToHexColor(r: number, g: number, b: number): string { + return '#' + ((1 << 24) + (r << 16) + (g << 8) + b) + .toString(16).slice(1); + } + + getRgbRelativeLuminance(r: number, g: number, b: number): number { + return 0.2126 * r + 0.7152 * g + 0.0722 * b; // Per ITU-R BT.709 + } + + createTintOrShade(hexColor: string, iterations?: number): string { + if (typeof iterations === 'undefined') { + iterations = 1; + } + + let rgb = this.hexColorToRgb(hexColor); + const hsl = this.rgbToHsl(rgb[0], rgb[1], rgb[2]); + + const tint = hsl[2] < 0.5; + + for (let i = iterations; i > 0; i--) { + // If it's a dark color, make it lighter + // and vice versa. + if (tint) { + // Increase the lightness by + // 50% (tint) + hsl[2] = (hsl[2] + 1) / 2; + } else { + // Decrease the lightness by + // 50% (shade) + hsl[2] /= 2; + } + } + + rgb = this.hslToRgb(hsl[0], hsl[1], hsl[2]); + return this.rgbToHexColor(rgb[0], rgb[1], rgb[2]); + } +} + +export default function (app: AngularModule) { + app.service('colorService', ['$log', + function ($log: $Log) { + $log.debug('START colorService()'); + const colorService = new ColorService($log); + $log.debug('END colorService()'); + return colorService; + }]); +} diff --git a/assets/js/modules/angular/services/comicService.js b/assets/js/modules/angular/services/comicService.js new file mode 100644 index 0000000..3ff8c52 --- /dev/null +++ b/assets/js/modules/angular/services/comicService.js @@ -0,0 +1,329 @@ +// @flow +/* + * Copyright (C) 2016-2018 Alexander Krivács Schrøder + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +import $ from 'jquery'; +import angular from 'angular'; +import type { AngularModule, $Log, $Scope, AngularHttpService, $Location } from 'angular'; +import type { $StateParams } from 'angular-ui'; + +import constants from '../../../constants'; +import settings from '../../settings'; + +import type { EventService } from './eventService'; +import type { ColorService } from './colorService'; +import type { StyleService } from './styleService'; +import type { MessageReportingService } from './messageReportingService'; +import type { ComicData, ComicItem } from '../api/comicData.js'; + +export class ComicService { + $log: $Log; + $stateParams: $StateParams; + $location: $Location; + $scope: $Scope; + $http: AngularHttpService; + latestComic: number; + eventService: EventService; + colorService: ColorService; + styleService: StyleService; + messageReportingService: MessageReportingService; + + comic: number; + nextComic: number; + previousComic: number; + comicExtensionIndex: number; + comicExtension: string; + comicData: ComicData; + + constructor($log: $Log, $stateParams: $StateParams, $location: $Location, + $scope: $Scope, $http: AngularHttpService, latestComic: number, eventService: EventService, + colorService: ColorService, styleService: StyleService, + messageReportingService: MessageReportingService) { + this.$log = $log; + this.$stateParams = $stateParams; + this.$location = $location; + this.$scope = $scope; + this.$http = $http; + this.latestComic = latestComic; + this.eventService = eventService; + this.colorService = colorService; + this.styleService = styleService; + this.messageReportingService = messageReportingService; + + $scope.$on('$stateChangeSuccess', () => { + this._updateComic(); + this.refreshComicData(); + }); + } + + _updateComic() { + let comic; + if (typeof this.$stateParams.comic === 'string') { + comic = Number(this.$stateParams.comic); + } else { + comic = this.latestComic; + } + + this.$log.debug('ComicService:_updateComic(): Comic is', comic); + + this.comic = comic; + this.nextComic = this.comic + 1 > this.latestComic ? + this.latestComic : this.comic + 1; + this.previousComic = this.comic - 1 < 1 ? 1 : this.comic - 1; + this.comicExtensionIndex = 0; + this.comicExtension = + constants.comicExtensions[this.comicExtensionIndex]; + + if (settings.values.scrollToTop) { + $(window).scrollTop(0); + } + } + + // TODO: Add proper response type + _onErrorLog(response: any) { + if (response.status !== 503) { + this.messageReportingService.reportError(response.data); + } else { + this.messageReportingService.reportError( + constants.messages.maintenance); + } + return response; + } + + // TODO: Add proper response type + _onSuccessRefreshElseErrorLog(response: any) { + if (response.status === 200) { + this.refreshComicData(); + } else { + this._onErrorLog(response); + } + return response; + } + + _fixItem(item: ComicItem) { + if (item.first == this.comic) { + item.first = null; + } + + if (item.last == this.comic) { + item.last = null; + } + + this.styleService.addItemStyle(item.id, + item.color); + } + + refreshComicData() { + if (typeof this.comic === 'undefined') { + this.$log.debug('comicService::refreshComicData() called ' + + 'before the comicService was properly initialized. ' + + 'Ignored.'); + return; + } + + this.eventService.comicDataLoadingEvent.publish(this.comic); + + let comicDataUrl = constants.comicDataUrl + this.comic; + const urlParameters = {}; + if (settings.values.editMode) { + urlParameters.token = settings.values.editModeToken; + } + if (settings.values.skipGuest) { + urlParameters.exclude = 'guest'; + } else if (settings.values.skipNonCanon) { + urlParameters.exclude = 'non-canon'; + } + if (settings.values.showAllMembers) { + urlParameters.include = 'all'; + } + const urlQuery = $.param(urlParameters); + if (urlQuery) { + comicDataUrl += '?' + urlQuery; + } + + this.$log.debug('comicService:refreshComicData(): URL is', comicDataUrl); + this.$http.get(comicDataUrl) + .then((response) => { + if (response.status === 503) { + this.eventService.comicDataErrorEvent.publish(response); + return; + } + if (response.status !== 200) { + this._onErrorLog(response); + this.eventService.comicDataErrorEvent.publish(response); + return; + } + + const comicData = response.data; + if (comicData.hasData) { + if (comicData.next !== null) { + this.nextComic = comicData.next; + } else { + this.nextComic = this.comic + 1 > this.latestComic ? + this.latestComic : this.comic + 1; + } + if (comicData.previous !== null) { + this.previousComic = comicData.previous; + } else { + this.previousComic = this.comic - 1 < 1 ? 1 : + this.comic - 1; + } + + angular.forEach(comicData.items, item => this._fixItem(item)); + if (settings.values.showAllMembers) { + angular.forEach(comicData.allItems, item => this._fixItem(item)); + } + } else { + this.nextComic = this.comic + 1 > this.latestComic ? + this.latestComic : this.comic + 1; + this.previousComic = this.comic - 1 < 1 ? 1 : + this.comic - 1; + + if (settings.values.showAllMembers) { + angular.forEach(comicData.allItems, item => this._fixItem(item)); + } + } + + comicData.comic = this.comic; + this.comicData = comicData; + this.eventService.comicDataLoadedEvent.publish(this.comicData); + }).catch((errorResponse) => { + this._onErrorLog(errorResponse); + this.eventService.comicDataErrorEvent.publish(errorResponse); + }); + } + + addItem(item: ComicItem) { + const data = { + token: settings.values.editModeToken, + comic: this.comic, + item: item + }; + return this.$http.post(constants.addItemToComicUrl, data) + .then(r => this._onSuccessRefreshElseErrorLog(r)).catch(r => this._onErrorLog(r)); + } + + removeItem(item: ComicItem) { + const data = { + token: settings.values.editModeToken, + comic: this.comic, + item: item + }; + return this.$http.post(constants.removeItemFromComicUrl, data) + .then(r => this._onSuccessRefreshElseErrorLog(r)).catch(r => this._onErrorLog(r)); + } + + setTitle(title: string) { + const data = { + token: settings.values.editModeToken, + comic: this.comic, + title: title + }; + return this.$http.post(constants.setComicTitleUrl, data) + .then(r => this._onSuccessRefreshElseErrorLog(r)).catch(r => this._onErrorLog(r)); + } + + setTagline(tagline: string) { + const data = { + token: settings.values.editModeToken, + comic: this.comic, + tagline: tagline + }; + return this.$http.post(constants.setComicTaglineUrl, data) + .then(r => this._onSuccessRefreshElseErrorLog(r)).catch(r => this._onErrorLog(r)); + } + + setPublishDate(publishDate: Date, isAccurate: boolean) { + const data = { + token: settings.values.editModeToken, + comic: this.comic, + publishDate: publishDate, + isAccuratePublishDate: isAccurate + }; + return this.$http.post(constants.setPublishDateUrl, data) + .then(r => this._onSuccessRefreshElseErrorLog(r)).catch(r => this._onErrorLog(r)); + } + + setGuestComic(value: boolean) { + const data = { + token: settings.values.editModeToken, + comic: this.comic, + value: value + }; + return this.$http.post(constants.setGuestComicUrl, data) + .then(r => this._onSuccessRefreshElseErrorLog(r)).catch(r => this._onErrorLog(r)); + } + + setNonCanon(value: boolean) { + const data = { + token: settings.values.editModeToken, + comic: this.comic, + value: value + }; + return this.$http.post(constants.setNonCanonUrl, data) + .then(r => this._onSuccessRefreshElseErrorLog(r)).catch(r => this._onErrorLog(r)); + } + + gotoComic(comicNo: number) { + this.$location.url('/view.php?comic=' + comicNo); + } + + canFallback() { + return this.comicExtensionIndex < + constants.comicExtensions.length - 1; + } + + tryFallback() { + this.comicExtensionIndex++; + this.comicExtension = constants + .comicExtensions[this.comicExtensionIndex]; + } + + first() { + this.gotoComic(1); + }; + + previous() { + this.gotoComic(this.previousComic); + }; + + next() { + this.gotoComic(this.nextComic); + }; + + last() { + this.gotoComic(this.latestComic); + }; +} + +export default function (app: AngularModule) { + app.service('comicService', ['$log', '$stateParams', '$location', + '$rootScope', '$http', 'latestComic', 'eventService', 'colorService', + 'styleService', 'messageReportingService', + function ($log: $Log, $stateParams: $StateParams, $location: $Location, + $scope: $Scope, $http: AngularHttpService, latestComic: number, eventService: EventService, + colorService: ColorService, styleService: StyleService, + messageReportingService: MessageReportingService) { + + $log.debug('START comicService()'); + const comicService = new ComicService($log, $stateParams, $location, $scope, + $http, latestComic, eventService, colorService, styleService, + messageReportingService); + $log.debug('END comicService()'); + return comicService; + }]); +} diff --git a/assets/js/modules/angular/services/eventFactory.js b/assets/js/modules/angular/services/eventFactory.js new file mode 100644 index 0000000..86a8bdf --- /dev/null +++ b/assets/js/modules/angular/services/eventFactory.js @@ -0,0 +1,63 @@ +// @flow +/* + * Copyright (C) 2016-2018 Alexander Krivács Schrøder + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +import type { AngularModule, $Log, $Scope } from 'angular'; + +import type { RootScope } from '../scopes/rootScope'; + +export class Event { + static $log: $Log; + static $rootScope: $Scope; + + eventName: string; + + constructor(eventName: string) { + this.eventName = eventName; + } + + //$FlowFixMe when Flow properly supports generics + subscribe(scope: $Scope<*>, callback: (event: string, eventData?: T) => void) { + const handle = Event.$rootScope.$on(this.eventName, callback); + scope.$on('$destroy', handle); + } + + publish(data?: T) { + const eventData: [string, ?T] = [this.eventName, null]; + + if (data != null) { + eventData[1] = data; + } + + Event.$log.debug('Event data: ', eventData); + Event.$rootScope.$emit.apply(Event.$rootScope, eventData); + } +} + +export type EventFactory = (eventName: string) => Event; + +export default function (app: AngularModule) { + app.factory('eventFactory', ['$rootScope', '$log', + function ($rootScope: $Scope, $log: $Log) { + $log.debug('START eventFactory()'); + Event.$rootScope = $rootScope; + Event.$log = $log; + + $log.debug('END eventFactory()'); + return (eventName: string) => new Event(eventName); + }]); +} diff --git a/assets/js/modules/angular/services/eventService.js b/assets/js/modules/angular/services/eventService.js new file mode 100644 index 0000000..6e326fe --- /dev/null +++ b/assets/js/modules/angular/services/eventService.js @@ -0,0 +1,52 @@ +// @flow +/* + * Copyright (C) 2016-2018 Alexander Krivács Schrøder + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +import type { AngularModule, $Log } from 'angular'; + +import constants from '../../../constants'; + +import type { Event, EventFactory } from './eventFactory'; +import type { ComicData } from '../api/comicData'; + +export class EventService { + $log: $Log; + + comicDataLoadingEvent: Event; + comicDataLoadedEvent: Event; + comicDataErrorEvent: Event; + itemsChangedEvent: Event; + + constructor($log: $Log, eventFactory: EventFactory) { + this.$log = $log; + + this.comicDataLoadingEvent = eventFactory(constants.comicdataLoadingEvent); + this.comicDataLoadedEvent = eventFactory(constants.comicdataLoadedEvent); + this.comicDataErrorEvent = eventFactory(constants.comicdataErrorEvent); // TODO: Figure out this type + this.itemsChangedEvent = eventFactory(constants.itemsChangedEvent); + } +} + +export default function (app: AngularModule) { + app.service('eventService', ['$log', 'eventFactory', + function($log: $Log, eventFactory: EventFactory) { + $log.debug('START eventService()'); + const eventService = new EventService($log, eventFactory); + $log.debug('END eventService()'); + return eventService; + }]); +} diff --git a/assets/js/modules/angular/services/messageReportingService.js b/assets/js/modules/angular/services/messageReportingService.js new file mode 100644 index 0000000..2195c5c --- /dev/null +++ b/assets/js/modules/angular/services/messageReportingService.js @@ -0,0 +1,114 @@ +// @flow +/* + * Copyright (C) 2016-2018 Alexander Krivács Schrøder + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +import $ from 'jquery'; + +import type { AngularModule, $Log, $Timeout } from 'angular'; + +function escapeHtml(text: string): string { + return text.replace(/["&'/<>]/g, function (a) { + return { + '"': '"', + '&': '&', + '\'': ''', + '/': '/', + '<': '<', + '>': '>' + }[a]; + }); +} + +type MessageType = 'danger' | 'warning'; +type Message = { type: MessageType, message: string }; + +export class MessageReportingService { + $log: $Log; + $timeout: $Timeout; + + messageQueue: Message[]; + isProcessing: boolean; + + constructor($log: $Log, $timeout: $Timeout) { + this.$log = $log; + this.$timeout = $timeout; + + this.messageQueue = []; + this.isProcessing = false; + } + + processMessages() { + this.isProcessing = true; + + let nextMessage = this.messageQueue.shift(); + if (typeof nextMessage === 'undefined') { + this.isProcessing = false; + return; + } + + const unique = Math.random().toString(36).slice(-5); + + const messageHtml = '
' + + escapeHtml(nextMessage.message) + + '
'; + + $('#messageSeat').append(messageHtml); + const messageElement = $('#' + unique); + messageElement.slideDown(); + + function removeMessage() { + messageElement.slideUp( + function () { + messageElement.remove(); + this.processMessages(); + }); + } + + const timeoutHandle = this.$timeout(removeMessage, 5000, false); + + messageElement.click(function () { + this.$timeout.cancel(timeoutHandle); + removeMessage(); + }); + } + + reportMessage(type: MessageType, message: string) { + this.messageQueue.push({ type: type, message: message }); + if (!this.isProcessing) { this.processMessages(); } + } + + reportError(message: string) { + this.reportMessage('danger', message); + } + + reportWarning(message: string) { + this.reportMessage('warning', message); + } +} + +export default function (app: AngularModule) { + app.service('messageReportingService', ['$log', '$timeout', + function ($log: $Log, $timeout: $Timeout) { + $log.debug('START messageReportingService()'); + const messageReportingService = new MessageReportingService($log, $timeout); + $log.debug('END messageReportingService()'); + return messageReportingService; + }]); +} diff --git a/assets/js/modules/angular/services/styleService.js b/assets/js/modules/angular/services/styleService.js new file mode 100644 index 0000000..fb3d290 --- /dev/null +++ b/assets/js/modules/angular/services/styleService.js @@ -0,0 +1,120 @@ +// @flow +/* + * Copyright (C) 2016-2018 Alexander Krivács Schrøder + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +import $ from 'jquery'; +import type { AngularModule, $Log } from 'angular'; + +import type { ColorService } from './colorService'; + +function addStyle(style: string) { + const styleElement = + $(''); + $('head').append(styleElement); + return styleElement; +} + +export class StyleService { + $log: $Log; + colorService: ColorService; + + customStyles: {}; + customStyleElements: {}; + + constructor($log: $Log, colorService: ColorService) { + this.$log = $log; + this.colorService = colorService; + + this.customStyles = {}; + this.customStyleElements = {}; + } + + _hasCustomStyle(key: string) { + return key in this.customStyles; + } + + _addCustomStyle(key: string, style: string) { + if (this._hasCustomStyle(key)) { + return; + } + + const styleElement = addStyle(style); + this.customStyles[key] = style; + this.customStyleElements[key] = styleElement; + } + + _removeCustomStyle(key: string) { + delete this.customStyles[key]; + this.customStyleElements[key].remove(); + delete this.customStyleElements[key]; + } + + addItemStyle(id: number, color: string) { + const itemId = 'item_' + id; + if (!this._hasCustomStyle(itemId)) { + const qcNavItem = '#qcnav_item_' + id + ' > table'; + const qcNavItemWithColor = qcNavItem + '.with_color'; + + const backgroundColor = color; + const foregroundColor = this.colorService.createTintOrShade(color); + const hoverFocusColor = this.colorService.createTintOrShade(color, 2); + + const itemStyle = + qcNavItemWithColor + '{' + + 'background-color:' + backgroundColor + ';' + + '}' + + qcNavItemWithColor + ',' + + qcNavItemWithColor + ' a.qcnav_name_link,' + + qcNavItemWithColor + ' a:link,' + + qcNavItemWithColor + ' a:visited{' + + 'color:' + foregroundColor + ';' + + '}' + + qcNavItem + ' a.qcnav_name_link{' + + 'cursor: pointer;' + + 'text-decoration: none;' + + '}' + + qcNavItemWithColor + ' a:hover,' + + qcNavItemWithColor + ' a:focus{' + + 'color: ' + hoverFocusColor + ';' + + '}'; + + this._addCustomStyle(itemId, itemStyle); + } + } + + removeItemStyle(id: number) { + const itemId = 'item_' + id; + if (this._hasCustomStyle(itemId)) { + this._removeCustomStyle(itemId); + } + } + + hasItemStyle(id: number) { + const itemId = 'item_' + id; + return this._hasCustomStyle(itemId); + } +} + +export default function (app: AngularModule) { + app.service('styleService', ['$log', 'colorService', + function ($log: $Log, colorService: ColorService) { + $log.debug('START styleService()'); + const styleService = new StyleService($log, colorService); + $log.debug('END styleService()'); + return styleService; + }]); +} diff --git a/assets/js/modules/angular/util.js b/assets/js/modules/angular/util.js new file mode 100644 index 0000000..b245ce5 --- /dev/null +++ b/assets/js/modules/angular/util.js @@ -0,0 +1,33 @@ +// @flow +/* + * Copyright (C) 2016-2018 Alexander Krivács Schrøder + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +export function nl2br(str: string, isXhtml: boolean) { + const breakTag = isXhtml || + typeof isXhtml === 'undefined' ? + '
' : '
'; + + return String(str).replace(/([^>\r\n]?)(\r\n|\n\r|\r|\n)/g, + '$1' + breakTag + '$2'); +} + +const comicLinkRegexp = +/]*href=(?:"|')(?:http:\/\/(?:www\.)?questionablecontent.net\/)?view\.php\?comic=(\d+)(?:"|')[^>]*>/; +export function angularizeLinks(str: string) { + return String(str).replace(comicLinkRegexp, + ''); +} diff --git a/assets/js/modules/dom-modifier.js b/assets/js/modules/dom-modifier.js new file mode 100644 index 0000000..cc4b804 --- /dev/null +++ b/assets/js/modules/dom-modifier.js @@ -0,0 +1,147 @@ +// @flow +/* + * Copyright (C) 2016-2018 Alexander Krivács Schrøder + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +import GM from 'greasemonkey'; +import $ from 'jquery'; + +import constants from '../constants'; +import settings from './settings'; +import variables from '../../generated/variables.pass2'; +import angularApp from './angular-app'; + +/** + * Adds a CSS element to the of the document. + * + * @param {string} href - URL to the CSS document + */ +function addCss(href: string) { + $('head').prepend( + '' + ); +} + +/** + * Adds an inline CSS ')); +} + +export default class DomModifier { + modify() { + // Add our modal windows + $('body').prepend(''); + $('body').prepend(''); + $('body').prepend(''); + $('body').prepend(''); + + // Take control over the page's title + $('title').replaceWith('' + + '{{t.title}}'); + + // Bootstrap + addCss(constants.siteUrl + 'style/bootstrap.min.css'); + + // Font Awesome + addCss('https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/' + + 'font-awesome.min.css'); + + // Style adder function + addStyle(variables.css.style); + + // Take over the comic link + // For some reason, Jeph didn't use id="strip" on the comic on + // the front page. Whyyy???? + // (In other words, we have to use this method instead of just '#strip'.) + const comicImg = $('img[src*="/comics/"]'); + let comicAnchor = comicImg.parent('a'); + + if (comicAnchor.length !== 1) { + comicImg.wrap($('')); + comicAnchor = comicImg.parent('a'); + } + + $('body').append($('
')); + + // To avoid triggering a flash of the comic "reloading", do in-place DOM + // manipulation instead of replacing the whole thing with a template. + // Fixes issue #13 + const comicDirective = $(''); + comicAnchor.before(comicDirective); + comicAnchor.detach().appendTo(comicDirective); + comicAnchor.attr('ng-href', 'view.php?comic={{c.comicService.nextComic}}'); + comicImg.attr('ng-src', '//questionablecontent.net/comics/' + + '{{c.comicService.comic}}.{{c.comicService.comicExtension}}'); + comicImg.attr('ng-click', 'c.next($event)'); + comicImg.attr('on-error', 'c.comicService.canFallback() ' + + '&& c.comicService.tryFallback()'); + + // #comicDirective.attr('id', 'comic-anchor'); + comicDirective.append($('')); + + const comicImage = comicImg.get(0); + let comicLinkUrl = comicImage.src; + + comicLinkUrl = comicLinkUrl.split('/'); + const comic = parseInt(comicLinkUrl[comicLinkUrl.length - 1].split('.')[0]); + + angularApp.constant('startComic', comic); + + // Figure out what the latest comic # is based on the URL in the + // "Latest/Last" navigation button. + const latestUrl = $('#comicnav a').get(3).href; + let latestComic = parseInt(latestUrl.split('=')[1]); + if (isNaN(latestComic)) { + latestComic = comic; + } + + if (settings.values.showDebugLogs) { + console.debug('Running QC Extensions v' + GM.info.script.version); // eslint-disable-line no-console + console.debug('Latest URL:', latestUrl, 'Latest Comic:', latestComic); // eslint-disable-line no-console + } + + angularApp.constant('latestComic', latestComic); + + $('body #comicnav') + .replaceWith(''); + + if ($('#news, #newspost').prev().prop('tagName') === 'QC-NAV') { + // There's no date section: Insert our own + $('#news, #newspost').before(''); + } else { + // There's a date section: Replace with our own + $('#news, #newspost').prev().replaceWith(''); + } + + $('#news, #newspost').replaceWith(''); + + comicDirective.parent().siblings('.small-2').prepend(''); + + // Set a base (required by Angular's html5Mode) + $('head').append(''); + + // Set up ng-controller for + $('body').attr('ng-controller', 'bodyController as b'); + + // Fixed positioned element covering the whole page used to show messages + // See the messageReportingService for details. + $('body').append('
'); + } +} diff --git a/assets/js/modules/jQuery.changeElementType.js b/assets/js/modules/jQuery.changeElementType.js new file mode 100644 index 0000000..a9af7e2 --- /dev/null +++ b/assets/js/modules/jQuery.changeElementType.js @@ -0,0 +1,21 @@ +// @flow +// Found at: https://gist.github.com/etienned/2934516 +/*! License unknown */ + +import $ from 'jquery'; + +$.fn.changeElementType = function (newType) { + const newElements = []; + this.each(function () { + const attrs = {}; + $.each(this.attributes, function (idx, attr) { + attrs[attr.nodeName] = attr.nodeValue; + }); + $(this).replaceWith(function () { + const newElement = $('<' + newType + '/>', attrs); + newElements.push(newElement.get()[0]); + return newElement.append($(this).contents()); + }); + }); + return $(newElements); +}; diff --git a/assets/js/modules/settings.js b/assets/js/modules/settings.js new file mode 100644 index 0000000..9f10670 --- /dev/null +++ b/assets/js/modules/settings.js @@ -0,0 +1,144 @@ +// @flow +/* + * Copyright (C) 2016-2018 Alexander Krivács Schrøder + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +import GM from 'greasemonkey'; + +import constants from '../constants'; + +export type SettingValues = { + showDebugLogs: boolean, + scrollToTop: boolean, + + showAllMembers: boolean, + showCast: boolean, + showStorylines: boolean, + showLocations: boolean, + useColors: boolean, + + skipNonCanon: boolean, + skipGuest: boolean, + + editMode: boolean, + editModeToken: string, + + showIndicatorRibbon: boolean, + showSmallRibbonByDefault: boolean, + useCorrectTimeFormat: boolean, + + version: ?string +}; + +/** + * Because we used a shim for GM4 temporarily, we should + * load our shimmed settings when migrating, to give the + * user a better UX. + */ +function loadFromGM4Shim(): ?string { + const storagePrefix = GM.info.script.name.replace(/[^A-Z]*/g, '') + '-'; + function shimGetValue(aKey: string, aDefault?: string): ?string { + const aValue = localStorage.getItem(storagePrefix + aKey); + if (null === aValue && 'undefined' !== typeof aDefault) { return aDefault; } + return aValue; + } + function shimDeleteValue(aKey: string): void { + localStorage.removeItem(storagePrefix + aKey); + } + + const shimSettings = shimGetValue(constants.settingsKey); + if (shimSettings) { + shimDeleteValue(constants.settingsKey); + } + return shimSettings; +} + +export class Settings { + defaults: SettingValues; + values: SettingValues; + + constructor() { + this.defaults = { + showDebugLogs: false, + scrollToTop: true, + + showAllMembers: false, + showCast: true, + showStorylines: true, + showLocations: true, + useColors: true, + + skipNonCanon: false, + skipGuest: false, + + editMode: false, + editModeToken: '', + + showIndicatorRibbon: true, + showSmallRibbonByDefault: false, + useCorrectTimeFormat: true, + + version: null + }; + + // This proxy makes it so you can access properties within the settings object + // directly on the settings class object also. + const self = this; + return new Proxy(this, { + get(target, prop) { + if (!(prop in target)) { + return target.values[prop]; + } + return (target: any)[prop]; + }, + set(target, prop, value) { + if (!(prop in target) && target.values && (prop in target.values)) { + target.values[prop] = value; + } else { + (target: any)[prop] = value; + } + return true; + } + }); + } + + async loadSettings() { + const shimSettings = loadFromGM4Shim(); + const settingsValue = shimSettings + ? shimSettings + : await GM.getValue(constants.settingsKey, + JSON.stringify(this.defaults)); + + const settings = JSON.parse(settingsValue); + + // This makes sure that when new settings are added, users will + // automatically receive the default values for those new settings when + // they update. + $.each(this.defaults, (key, defaultValue) => { + if (!(key in settings)) { + settings[key] = defaultValue; + } + }); + + this.values = settings; + } + + async saveSettings() { + await GM.setValue(constants.settingsKey, JSON.stringify(this.values)); + } +} + +export default new Settings(); diff --git a/assets/js/qc-ext-colorService.js b/assets/js/qc-ext-colorService.js deleted file mode 100644 index 9f69e0e..0000000 --- a/assets/js/qc-ext-colorService.js +++ /dev/null @@ -1,303 +0,0 @@ -/* - * Copyright (C) 2016 Alexander Krivács Schrøder - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -// Parts based on code from: -// http://axonflux.com/handy-rgb-to-hsl-and-rgb-to-hsv-color-model-c - -var qcExt; - -(function(qcExt) { - 'use strict'; - - qcExt.app.service('colorService', ['$log', - function($log) { - $log.debug('START colorService()'); - - function hue2rgb(p, q, t) { - if (t < 0) { - t += 1; - } - - if (t > 1) { - t -= 1; - } - - if (t < 1 / 6) { - return p + (q - p) * 6 * t; - } - - if (t < 1 / 2) { - return q; - } - - if (t < 2 / 3) { - return p + (q - p) * (2 / 3 - t) * 6; - } - - return p; - } - - /** - * Converts an RGB color value to HSL. Conversion formula - * adapted from http://en.wikipedia.org/wiki/HSL_color_space. - * Assumes r, g, and b are contained in the set [0, 255] and - * returns h, s, and l in the set [0, 1]. - * - * @param {number} r The red color value - * @param {number} g The green color value - * @param {number} b The blue color value - * @return Array The HSL representation - */ - this.rgbToHsl = function(r, g, b) { - r /= 255; - g /= 255; - b /= 255; - var max = Math.max(r, g, b); - var min = Math.min(r, g, b); - var h; - var s; - var l = (max + min) / 2; - - if (max === min) { - h = s = 0; // Achromatic - } else { - var d = max - min; - - s = l > 0.5 ? d / (2 - max - min) : d / (max + min); - - switch (max) { - case r: - h = (g - b) / d + (g < b ? 6 : 0); - break; - - case g: - h = (b - r) / d + 2; - break; - - case b: - h = (r - g) / d + 4; - break; - } - h /= 6; - } - - return [h, s, l]; - }; - - /** - * Converts an HSL color value to RGB. Conversion formula - * adapted from http://en.wikipedia.org/wiki/HSL_color_space. - * Assumes h, s, and l are contained in the set [0, 1] and - * returns r, g, and b in the set [0, 255]. - * - * @param {number} h The hue - * @param {number} s The saturation - * @param {number} l The lightness - * @return Array The RGB representation - */ - this.hslToRgb = function(h, s, l) { - var r; - var g; - var b; - - if (s === 0) { - r = g = b = l; // Achromatic - } else { - var q = l < 0.5 ? l * (1 + s) : l + s - l * s; - var p = 2 * l - q; - - r = hue2rgb(p, q, h + 1 / 3); - g = hue2rgb(p, q, h); - b = hue2rgb(p, q, h - 1 / 3); - } - - return [ - Math.round(r * 255), - Math.round(g * 255), - Math.round(b * 255) - ]; - }; - - /** - * Converts an RGB color value to HSV. Conversion formula - * adapted from http://en.wikipedia.org/wiki/HSV_color_space. - * Assumes r, g, and b are contained in the set [0, 255] and - * returns h, s, and v in the set [0, 1]. - * - * @param {number} r The red color value - * @param {number} g The green color value - * @param {number} b The blue color value - * @return Array The HSV representation - */ - this.rgbToHsv = function(r, g, b) { - r = r / 255; - g = g / 255; - b = b / 255; - var max = Math.max(r, g, b); - var min = Math.min(r, g, b); - var h; - var s; - var v = max; - - var d = max - min; - - s = max === 0 ? 0 : d / max; - - if (max === min) { - h = 0; // Achromatic - } else { - switch (max) { - case r: - h = (g - b) / d + (g < b ? 6 : 0); - break; - - case g: - h = (b - r) / d + 2; - break; - - case b: - h = (r - g) / d + 4; - break; - } - h /= 6; - } - - return [h, s, v]; - }; - - /** - * Converts an HSV color value to RGB. Conversion formula - * adapted from http://en.wikipedia.org/wiki/HSV_color_space. - * Assumes h, s, and v are contained in the set [0, 1] and - * returns r, g, and b in the set [0, 255]. - * - * @param {number} h The hue - * @param {number} s The saturation - * @param {number} v The value - * @return Array The RGB representation - */ - this.hsvToRgb = function(h, s, v) { - var r; - var g; - var b; - - var i = Math.floor(h * 6); - var f = h * 6 - i; - var p = v * (1 - s); - var q = v * (1 - f * s); - var t = v * (1 - (1 - f) * s); - - switch (i % 6) { - case 0: - r = v; - g = t; - b = p; - break; - - case 1: - r = q; - g = v; - b = p; - break; - - case 2: - r = p; - g = v; - b = t; - break; - - case 3: - r = p; - g = q; - b = v; - break; - - case 4: - r = t; - g = p; - b = v; - break; - - case 5: - r = v; - g = p; - b = q; - break; - } - - return [ - Math.round(r * 255), - Math.round(g * 255), - Math.round(b * 255) - ]; - }; - - this.hexColorToRgb = function(hexColor) { - if (hexColor.charAt(0) === '#') { - hexColor = hexColor.substring(1); // Strip # - } - var rgb = parseInt(hexColor, 16); // Convert rrggbb to decimal - /* jshint bitwise:false */ - var r = rgb >> 16 & 0xff; // Extract red - var g = rgb >> 8 & 0xff; // Extract green - var b = rgb & 0xff; // Extract blue - /* jshint bitwise:true */ - return [r, g, b]; - }; - - this.rgbToHexColor = function(r, g, b) { - /* jshint bitwise:false */ - return '#' + ((1 << 24) + (r << 16) + (g << 8) + b) - .toString(16).slice(1); - /* jshint bitwise:true */ - }; - - this.getRgbRelativeLuminance = function(r, g, b) { - return 0.2126 * r + 0.7152 * g + 0.0722 * b; // Per ITU-R BT.709 - }; - - this.createTintOrShade = function(hexColor, iterations) { - if (typeof iterations === 'undefined') { - iterations = 1; - } - - var rgb = this.hexColorToRgb(hexColor); - var hsl = this.rgbToHsl(rgb[0], rgb[1], rgb[2]); - - var tint = hsl[2] < 0.5; - - for (var i = iterations; i > 0; i--) { - // If it's a dark color, make it lighter - // and vice versa. - if (tint) { - // Increase the lightness by - // 50% (tint) - hsl[2] = (hsl[2] + 1) / 2; - } else { - // Decrease the lightness by - // 50% (shade) - hsl[2] /= 2; - } - } - - rgb = this.hslToRgb(hsl[0], hsl[1], hsl[2]); - return this.rgbToHexColor(rgb[0], rgb[1], rgb[2]); - }; - - $log.debug('END colorService()'); - }]); -})(qcExt || (qcExt = {})); diff --git a/assets/js/qc-ext-comicService.js b/assets/js/qc-ext-comicService.js deleted file mode 100644 index 8200310..0000000 --- a/assets/js/qc-ext-comicService.js +++ /dev/null @@ -1,288 +0,0 @@ -/* - * Copyright (C) 2016, 2017 Alexander Krivács Schrøder - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -/* global constants */ - -var qcExt; - -(function(qcExt) { - 'use strict'; - - qcExt.app.service('comicService', ['$log', '$stateParams', '$location', - '$rootScope', '$http', 'latestComic', 'eventFactory', 'colorService', - 'styleService', 'messageReportingService', - function($log, $stateParams, $location, - $scope, $http, latestComic, Event, colorService, - styleService, messageReportingService) { - $log.debug('START comicService()'); - var comicDataLoadingEvent = - new Event(constants.comicdataLoadingEvent); - var comicDataLoadedEvent = - new Event(constants.comicdataLoadedEvent); - var comicDataErrorEvent = new Event(constants.comicdataErrorEvent); - - var self = this; - - var comicExtensionIndex = 0; - - function updateComic() { - $log.debug('comicService:updateComic()'); - var comic; - - if (typeof $stateParams.comic === 'string') { - comic = Number($stateParams.comic); - } else { - comic = latestComic; - } - - self.comic = comic; - self.nextComic = self.comic + 1 > latestComic ? - latestComic : self.comic + 1; - self.previousComic = self.comic - 1 < 1 ? 1 : self.comic - 1; - self.latestComic = latestComic; - comicExtensionIndex = 0; - self.comicExtension = - constants.comicExtensions[comicExtensionIndex]; - - if (qcExt.settings.scrollToTop) { - $(window).scrollTop(0); - } - } - - $scope.$on('$stateChangeSuccess', function() { - updateComic(); - self.refreshComicData(); - }); - - function onErrorLog(response) { - if (response.status !== 503) { - messageReportingService.reportError(response.data); - } else { - messageReportingService.reportError( - constants.messages.maintenance); - } - return response; - } - - this.refreshComicData = function() { - if (typeof self.comic === 'undefined') { - $log.debug('comicService::refreshComicData() called ' + - 'before the comicService was properly initialized. ' + - 'Ignored.'); - return; - } - - comicDataLoadingEvent.notify(self.comic); - var comicDataUrl = constants.comicDataUrl + self.comic; - - var urlParameters = {}; - if (qcExt.settings.editMode) { - urlParameters.token = qcExt.settings.editModeToken; - } - if (qcExt.settings.skipGuest) { - urlParameters.exclude = 'guest'; - } else if (qcExt.settings.skipNonCanon) { - urlParameters.exclude = 'non-canon'; - } - if (qcExt.settings.showAllMembers) { - urlParameters.include = 'all'; - } - var urlQuery = $.param(urlParameters); - if (urlQuery) { - comicDataUrl += '?' + urlQuery; - } - - $http.get(comicDataUrl) - .then(function(response) { - if (response.status === 503) { - comicDataErrorEvent.notify(response); - return; - } - if (response.status !== 200) { - onErrorLog(response); - comicDataErrorEvent.notify(response); - return; - } - - function fixItem(item) { - /* jshint eqeqeq:false */ - if (item.first == self.comic) { - item.first = null; - } - - if (item.last == self.comic) { - item.last = null; - } - /* jshint eqeqeq:true */ - - styleService.addItemStyle(item.id, - item.color); - } - - var comicData = response.data; - if (comicData.hasData) { - if (comicData.next !== null) { - self.nextComic = comicData.next; - } else { - self.nextComic = self.comic + 1 > latestComic ? - latestComic : self.comic + 1; - } - if (comicData.previous !== null) { - self.previousComic = comicData.previous; - } else { - self.previousComic = self.comic - 1 < 1 ? 1 : - self.comic - 1; - } - - angular.forEach(comicData.items, fixItem); - if (qcExt.settings.showAllMembers) { - angular.forEach(comicData.allItems, fixItem); - } - } else { - self.nextComic = self.comic + 1 > latestComic ? - latestComic : self.comic + 1; - self.previousComic = self.comic - 1 < 1 ? 1 : - self.comic - 1; - - if (qcExt.settings.showAllMembers) { - angular.forEach(comicData.allItems, fixItem); - } - } - - comicData.comic = self.comic; - self.comicData = comicData; - comicDataLoadedEvent.notify(self.comicData); - }, function(errorResponse) { - onErrorLog(errorResponse); - comicDataErrorEvent.notify(errorResponse); - }); - }; - - function onSuccessRefreshElseErrorLog(response) { - if (response.status === 200) { - self.refreshComicData(); - } else { - onErrorLog(response); - } - return response; - } - - this.addItem = function(item) { - var data = { - token: qcExt.settings.editModeToken, - comic: self.comic, - item: item - }; - return $http.post(constants.addItemToComicUrl, data) - .then(onSuccessRefreshElseErrorLog, onErrorLog); - }; - - this.removeItem = function(item) { - var data = { - token: qcExt.settings.editModeToken, - comic: self.comic, - item: item - }; - return $http.post(constants.removeItemFromComicUrl, data) - .then(onSuccessRefreshElseErrorLog, onErrorLog); - }; - - this.setTitle = function(title) { - var data = { - token: qcExt.settings.editModeToken, - comic: self.comic, - title: title - }; - return $http.post(constants.setComicTitleUrl, data) - .then(onSuccessRefreshElseErrorLog, onErrorLog); - }; - - this.setTagline = function(tagline) { - var data = { - token: qcExt.settings.editModeToken, - comic: self.comic, - tagline: tagline - }; - return $http.post(constants.setComicTaglineUrl, data) - .then(onSuccessRefreshElseErrorLog, onErrorLog); - }; - - this.setPublishDate = function(publishDate, isAccurate) { - var data = { - token: qcExt.settings.editModeToken, - comic: self.comic, - publishDate: publishDate, - isAccuratePublishDate: isAccurate - }; - return $http.post(constants.setPublishDateUrl, data) - .then(onSuccessRefreshElseErrorLog, onErrorLog); - }; - - this.setGuestComic = function(value) { - var data = { - token: qcExt.settings.editModeToken, - comic: self.comic, - value: value - }; - return $http.post(constants.setGuestComicUrl, data) - .then(onSuccessRefreshElseErrorLog, onErrorLog); - }; - - this.setNonCanon = function(value) { - var data = { - token: qcExt.settings.editModeToken, - comic: self.comic, - value: value - }; - return $http.post(constants.setNonCanonUrl, data) - .then(onSuccessRefreshElseErrorLog, onErrorLog); - }; - - this.gotoComic = function(comicNo) { - $location.url('/view.php?comic=' + comicNo); - }; - - this.canFallback = function() { - return comicExtensionIndex < - constants.comicExtensions.length - 1; - }; - - this.tryFallback = function() { - comicExtensionIndex++; - self.comicExtension = constants - .comicExtensions[comicExtensionIndex]; - }; - - this.first = function() { - self.gotoComic(1); - }; - - this.previous = function() { - self.gotoComic(self.previousComic); - }; - - this.next = function() { - self.gotoComic(self.nextComic); - }; - - this.last = function() { - self.gotoComic(latestComic); - }; - - $log.debug('END comicService()'); - }]); -})(qcExt || (qcExt = {})); diff --git a/assets/js/qc-ext-compileTemplateDirective.js b/assets/js/qc-ext-compileTemplateDirective.js deleted file mode 100644 index 318edb8..0000000 --- a/assets/js/qc-ext-compileTemplateDirective.js +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (C) 2016 Alexander Krivács Schrøder - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -var qcExt; - -(function(qcExt) { - 'use strict'; - - qcExt.app.directive('compileTemplate', ['$compile', '$parse', - function($compile, $parse) { - return { - link: function(scope, element, attr) { - var parsed = $parse(attr.ngBindHtml); - - function getStringValue() { - return (parsed(scope) || '').toString(); - } - - // Recompile if the template changes - scope.$watch(getStringValue, function() { - - // The -9999 makes it skip directives so that we do not - // recompile ourselves - $compile(element, null, -9999)(scope); - }); - } - }; - }]); -})(qcExt || (qcExt = {})); diff --git a/assets/js/qc-ext-eventFactory.js b/assets/js/qc-ext-eventFactory.js deleted file mode 100644 index db0b986..0000000 --- a/assets/js/qc-ext-eventFactory.js +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (C) 2016 Alexander Krivács Schrøder - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -var qcExt; - -(function(qcExt) { - 'use strict'; - - qcExt.app.factory('eventFactory', ['$rootScope', '$log', - function($rootScope, $log) { - var eventFactory = function(eventName) { - this.eventName = eventName; - }; - - eventFactory.prototype.subscribe = function(scope, callback) { - var handle = $rootScope.$on(this.eventName, callback); - - scope.$on('$destroy', handle); - }; - - eventFactory.prototype.notify = function(data) { - var eventData = [this.eventName]; - - if (typeof data !== 'undefined') { - eventData = eventData.concat(data); - } - - $log.debug('Event data: ', eventData); - $rootScope.$emit.apply($rootScope, eventData); - }; - - return eventFactory; - }]); -})(qcExt || (qcExt = {})); diff --git a/assets/js/qc-ext-messageReportingService.js b/assets/js/qc-ext-messageReportingService.js deleted file mode 100644 index 9d86af5..0000000 --- a/assets/js/qc-ext-messageReportingService.js +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Copyright (C) 2016 Alexander Krivács Schrøder - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -var qcExt; - -(function(qcExt) { - 'use strict'; - - qcExt.app.service('messageReportingService', ['$log', '$timeout', - function($log, $timeout) { - $log.debug('START messageReportingService()'); - - var messageQueue = []; - var isProcessing = false; - - function escapeHtml(text) { - return text.replace(/[\"&'\/<>]/g, function(a) { - return { - '"': '"', - '&': '&', - '\'': ''', - '/': '/', - '<': '<', - '>': '>' - }[a]; - }); - } - - function processMessages() { - isProcessing = true; - - var nextMessage = messageQueue.shift(); - if (typeof nextMessage === 'undefined') { - isProcessing = false; - return; - } - - var unique = Math.random().toString(36).slice(-5); - - var messageHtml = '
' + - escapeHtml(nextMessage.message) + - '
'; - - $('#messageSeat').append(messageHtml); - var messageElement = $('#' + unique); - messageElement.slideDown(); - - function removeMessage() { - messageElement.slideUp( - function() { - messageElement.remove(); - processMessages(); - }); - } - - var timeoutHandle = $timeout(removeMessage, 5000, false); - - messageElement.click(function() { - $timeout.cancel(timeoutHandle); - removeMessage(); - }); - } - - function reportMessage(type, message) { - messageQueue.push({type: type, message: message}); - if (!isProcessing) { processMessages(); } - } - - this.reportError = function(message) { - reportMessage('danger', message); - }; - - this.reportWarning = function(message) { - reportMessage('warning', message); - }; - - $log.debug('END messageReportingService()'); - }]); -})(qcExt || (qcExt = {})); diff --git a/assets/js/qc-ext-qcAddItemDirective.js b/assets/js/qc-ext-qcAddItemDirective.js deleted file mode 100644 index 2b25337..0000000 --- a/assets/js/qc-ext-qcAddItemDirective.js +++ /dev/null @@ -1,231 +0,0 @@ -/* - * Copyright (C) 2016 Alexander Krivács Schrøder - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -/* global constants */ - -var qcExt; - -(function(qcExt) { - 'use strict'; - - qcExt.app.directive('qcAddItem', function() { - return { - restrict: 'E', - replace: true, - scope: {}, - controller: ['$http', '$scope', '$log', '$timeout', '$filter', - 'comicService', 'eventFactory', - function($http, $scope, $log, $timeout, $filter, - comicService, Event) { - $log.debug('START qcAddItem()'); - - var self = this; - - this.unique = Math.random().toString(36).slice(-5); - - var itemsChangedEvent = - new Event(constants.itemsChangedEvent); - - $scope.safeApply = function(fn) { - var phase = this.$root.$$phase; - if (phase === '$apply' || phase === '$digest') { - if (fn && typeof fn === 'function') { - fn(); - } - } else { - this.$apply(fn); - } - }; - - var searchFieldId = '#addItem_' + this.unique + '_search'; - var dropdownId = '#addItem_' + this.unique + '_dropdown'; - var dropdownButtonId = '#addItem_' + this.unique + - '_dropdownButton'; - this.items = []; - - var addCastTemplate = 'Add new cast member '; - var addCastItem = { - id: -1, - type: 'cast', - shortName: addCastTemplate + '\'\'', - name: '' - }; - var addStorylineTemplate = 'Add new storyline '; - var addStorylineItem = { - id: -1, - type: 'storyline', - shortName: addStorylineTemplate + '\'\'', - name: '' - }; - var addLocationTemplate = 'Add new location '; - var addLocationItem = { - id: -1, - type: 'location', - shortName: addLocationTemplate + '\'\'', - name: '' - }; - - function loadItemData() { - $http.get(constants.itemDataUrl) - .then(function(response) { - var itemData = []; - if (response.status === 200) { - itemData = response.data; - } - - itemData.push(addCastItem); - itemData.push(addStorylineItem); - itemData.push(addLocationItem); - - $scope.safeApply(function() { - self.items = itemData; - }); - }); - } - loadItemData(); - - function escapeRegExp(s) { - return s.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&'); - } - - this.searchChanged = function() { - var filterText = self.itemFilterText; - - if (filterText.charAt(0) === '!') { - filterText = filterText.substr(1); - } else if (filterText.charAt(0) === '@') { - filterText = filterText.substr(1); - } else if (filterText.charAt(0) === '#') { - filterText = filterText.substr(1); - } - - addCastItem.shortName = addCastTemplate + - '\'' + filterText + '\''; - addCastItem.name = filterText; - addStorylineItem.shortName = addStorylineTemplate + - '\'' + filterText + '\''; - addStorylineItem.name = filterText; - addLocationItem.shortName = addLocationTemplate + - '\'' + filterText + '\''; - addLocationItem.name = filterText; - }; - - var triggeredFocus = false; - var dropdownOpen = false; - var firstRun = true; - - this.itemFilterText = ''; - this.itemFilter = function(value) { - var filterText = self.itemFilterText; - - var result = true; - if (filterText.charAt(0) === '!') { - result = value.type === 'cast'; - filterText = filterText.substr(1); - } else if (filterText.charAt(0) === '@') { - result = value.type === 'location'; - filterText = filterText.substr(1); - } else if (filterText.charAt(0) === '#') { - result = value.type === 'storyline'; - filterText = filterText.substr(1); - } - - var searchRegex = new RegExp( - escapeRegExp(filterText), 'i'); - result = result && - value.shortName.match(searchRegex) !== null; - - return result; - }; - // {shortName: ''}; - this.focusSearch = function() { - $log.debug('qcAdditem(): #1 Search focused'); - if (firstRun) { - $(dropdownId).on('shown.bs.dropdown', function() { - dropdownOpen = true; - $log.debug('qcAdditem(): #4 Dropdown opened'); - - // Opening the dropdown makes the search field - // lose focus. So set it again. - $(searchFieldId).focus(); - triggeredFocus = false; - - $(dropdownId + ' .dropdown-menu').width($( - dropdownId).width()); - }); - $(dropdownId).on('hidden.bs.dropdown', function() { - $log.debug('qcAdditem(): #5 Dropdown closed'); - dropdownOpen = false; - }); - - firstRun = false; - } - - if (!dropdownOpen && !triggeredFocus) { - $log.debug( - 'qcAdditem(): #2 Focus was user-initiated'); - triggeredFocus = true; - $timeout(function() { - if (!dropdownOpen) { - $log.debug( - 'qcAdditem(): #3 Toggle dropdown'); - $(dropdownButtonId).dropdown('toggle'); - } - }, 150); - } - }; - - this.keyPress = function(event) { - if (event.keyCode === 13) { - // ENTER key - - // Add the top item in the list - var filteredList = $filter('filter')(self.items, - self.itemFilter); - var chosenItem = filteredList[0]; - self.addItem(chosenItem); - } - }; - - /*#this.blurSearch = function() { - if (!intendedFocus) { - $log.debug('addItem(): blur!'); - } - };*/ - - this.addItem = function(item) { - comicService.addItem(item).then(function(response) { - if (response.status === 200) { - itemsChangedEvent.notify(); - $scope.safeApply(function() { - self.itemFilterText = ''; - }); - } - }); - }; - - itemsChangedEvent.subscribe($scope, function() { - loadItemData(); - }); - - $log.debug('END qcAddItem()'); - }], - controllerAs: 'a', - template: qcExt.variables.angularTemplates.addItem - }; - }); -})(qcExt || (qcExt = {})); diff --git a/assets/js/qc-ext-qcChangeLogDirective.js b/assets/js/qc-ext-qcChangeLogDirective.js deleted file mode 100644 index ba2e5f7..0000000 --- a/assets/js/qc-ext-qcChangeLogDirective.js +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright (C) 2016, 2017 Alexander Krivács Schrøder - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -/* global constants */ - -var qcExt; - -(function(qcExt) { - 'use strict'; - - qcExt.app.directive('qcChangeLog', function() { - return { - restrict: 'E', - replace: true, - scope: {}, - controller: ['$log', 'eventFactory', '$scope', - function($log, Event, $scope) { - $log.debug('START qcChangeLog()'); - - $log.debug(); - - this.versionUpdated = false; - this.currentVersion = GM_info.script.version; - this.previousVersion = null; - var self = this; - - var comicDataLoadedEvent = - new Event(constants.comicdataLoadedEvent); - - comicDataLoadedEvent.subscribe($scope, - function() { - if (qcExt.settings.version === undefined) { - // Version is undefined. We're a new user! - $log.debug('qcChangeLog(): Version undefined!'); - } else if (qcExt.settings.version !== - self.currentVersion) { - // Version is changed. Script has been updated! - // Show the change log dialog. - self.previousVersion = qcExt.settings.version; - $log.debug('qcChangeLog(): Version different!'); - } else { - return; - } - self.versionUpdated = true; - }); - - $('#changeLogDialog').on('hide.bs.modal', function() { - $log.debug('Saving settings...'); - qcExt.settings.version = self.currentVersion; - GM_setValue(constants.settingsKey, - JSON.stringify(qcExt.settings)); - }); - - this.close = function() { - $('#changeLogDialog').modal('hide'); - }; - - $log.debug('END qcChangeLog()'); - }], - controllerAs: 'clvm', - template: qcExt.variables.angularTemplates.changeLog - }; - }); -})(qcExt || (qcExt = {})); diff --git a/assets/js/qc-ext-qcComicNavDirective.js b/assets/js/qc-ext-qcComicNavDirective.js deleted file mode 100644 index c5bd014..0000000 --- a/assets/js/qc-ext-qcComicNavDirective.js +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (C) 2016, 2017 Alexander Krivács Schrøder - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -/* global constants */ - -var qcExt; - -(function(qcExt) { - 'use strict'; - - qcExt.app.directive('qcComicNav', function() { - return { - restrict: 'E', - replace: true, - scope: {}, - controller: ['$log', 'comicService', 'latestComic', 'eventFactory', - '$scope', - function($log, comicService, latestComic, Event, $scope) { - $log.debug('START qcComicNav()'); - - var comicDataLoadedEvent = - new Event(constants.comicdataLoadedEvent); - - this.currentComic = null; - this.latestComic = latestComic; - var self = this; - - this.go = function() { - $log.debug('qcComicNav.go(): ' + self.currentComic); - if (self.currentComic === undefined || - self.currentComic === null) { - self.currentComic = latestComic; - } else if (self.currentComic < 1) { - self.currentComic = 1; - } else if (self.currentComic > latestComic) { - self.currentComic = latestComic; - } - comicService.gotoComic(self.currentComic); - }; - - this.keyPress = function(event) { - if (event.keyCode === 13) { - // ENTER key - self.go(); - } - }; - - comicDataLoadedEvent.subscribe($scope, - function(event, comicData) { - self.currentComic = comicData.comic; - }); - - $log.debug('END qcComicNav()'); - }], - controllerAs: 'cn', - template: qcExt.variables.angularTemplates.comicNav - }; - }); -})(qcExt || (qcExt = {})); diff --git a/assets/js/qc-ext-qcDateDirective.js b/assets/js/qc-ext-qcDateDirective.js deleted file mode 100644 index 4b19b87..0000000 --- a/assets/js/qc-ext-qcDateDirective.js +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright (C) 2016, 2017 Alexander Krivács Schrøder - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -/* global constants */ - -var qcExt; - -(function(qcExt) { - 'use strict'; - - qcExt.app.directive('qcDate', function() { - return { - restrict: 'E', - replace: true, - scope: {}, - controller: ['$scope', '$log', 'eventFactory', - function($scope, $log, Event) { - var comicDataLoadingEvent = - new Event(constants.comicdataLoadingEvent); - var comicDataLoadedEvent = - new Event(constants.comicdataLoadedEvent); - - $log.debug('START qcDate()'); - - $scope.safeApply = function(fn) { - var phase = this.$root.$$phase; - - if (phase === '$apply' || phase === '$digest') { - if (fn && typeof fn === 'function') { - fn(); - } - } else { - this.$apply(fn); - } - }; - - var self = this; - this.settings = qcExt.settings; - this.date = null; - this.approximateDate = false; - comicDataLoadingEvent.subscribe($scope, - function() { - $scope.safeApply(function() { - self.date = null; - self.approximateDate = false; - }); - }); - comicDataLoadedEvent.subscribe($scope, - function(event, comicData) { - $scope.safeApply(function() { - self.approximateDate = !comicData.isAccuratePublishDate; - var publishDate = comicData.publishDate; - $log.debug('qcDate(): ', publishDate); - if (publishDate !== null && - publishDate !== undefined) { - var date = new Date(publishDate); - self.date = date; - } else { - self.date = null; - } - }); - }); - - $log.debug('END qcDate()'); - }], - controllerAs: 'd', - template: qcExt.variables.angularTemplates.date - }; - }); -})(qcExt || (qcExt = {})); diff --git a/assets/js/qc-ext-qcEditComicDataDirective.js b/assets/js/qc-ext-qcEditComicDataDirective.js deleted file mode 100644 index bb749d1..0000000 --- a/assets/js/qc-ext-qcEditComicDataDirective.js +++ /dev/null @@ -1,102 +0,0 @@ -/* - * Copyright (C) 2016 Alexander Krivács Schrøder - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -/* global constants */ - -var qcExt; - -(function(qcExt) { - 'use strict'; - - qcExt.app.directive('qcEditComicData', function() { - return { - restrict: 'E', - replace: true, - scope: {}, - controller: ['$scope', '$log', 'eventFactory', 'comicService', - function($scope, $log, Event, comicService) { - var comicDataLoadedEvent = - new Event(constants.comicdataLoadedEvent); - var itemsChangedEvent = - new Event(constants.itemsChangedEvent); - - $scope.safeApply = function(fn) { - var phase = this.$root.$$phase; - if (phase === '$apply' || phase === '$digest') { - if (fn && typeof fn === 'function') { - fn(); - } - } else { - this.$apply(fn); - } - }; - - var self = this; - - comicDataLoadedEvent - .subscribe($scope, function(event, comicData) { - $scope.safeApply(function() { - var editData = {comicData: comicData}; - - if (comicData.hasData) { - angular.forEach(comicData.items, - function(value) { - - if (!(value.type in editData)) { - editData[value.type] = {}; - } - - editData[value.type][value.id] = - value; - }); - } - - self.editData = editData; - }); - }); - - $('#editComicDataDialog').on('show.bs.modal', function() { - // If something needs to be done, do it here. - }); - - this.remove = function(item) { - comicService.removeItem(item).then(function(response) { - if (response.status === 200) { - itemsChangedEvent.notify(); - } - }); - }; - - this.changeGuestComic = function() { - comicService.setGuestComic( - self.editData.comicData.isGuestComic); - }; - - this.changeNonCanon = function() { - comicService.setNonCanon( - self.editData.comicData.isNonCanon); - }; - - this.close = function() { - $('#editComicDataDialog').modal('hide'); - }; - }], - controllerAs: 'ecdvm', - template: qcExt.variables.angularTemplates.editComicData - }; - }); -})(qcExt || (qcExt = {})); diff --git a/assets/js/qc-ext-qcExtraDirective.js b/assets/js/qc-ext-qcExtraDirective.js deleted file mode 100644 index 4eb3245..0000000 --- a/assets/js/qc-ext-qcExtraDirective.js +++ /dev/null @@ -1,271 +0,0 @@ -/* - * Copyright (C) 2016 Alexander Krivács Schrøder - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -/* global constants */ - -var qcExt; - -(function(qcExt) { - 'use strict'; - - function Controller($scope, $log, comicService, latestComic, Event, $sce) { - var comicDataLoadingEvent = new Event(constants.comicdataLoadingEvent); - var comicDataLoadedEvent = new Event(constants.comicdataLoadedEvent); - var comicDataErrorEvent = new Event(constants.comicdataErrorEvent); - - $scope.safeApply = function(fn) { - var phase = this.$root.$$phase; - - if (phase === '$apply' || phase === '$digest') { - if (fn && - typeof fn === 'function') { - fn(); - } - } else { - this.$apply(fn); - } - }; - - var self = this; - - this.comicService = comicService; - this.settings = qcExt.settings; - this.constants = constants; - this.items = {}; - this.allItems = {}; - this.editorData = {}; - this.messages = []; - this.missingDataInfo = []; - - function reset() { - self.isLoading = false; - self.items = {}; - self.allItems = {}; - self.editorData = {}; - self.messages.length = 0; - self.missingDataInfo.length = 0; - self.hasError = false; - self.hasWarning = false; - } - - function loading() { - reset(); - self.isLoading = true; - self.messages.push('Loading...'); - } - - comicDataLoadingEvent.subscribe($scope, function() { - $scope.safeApply(loading); - }); - - comicDataLoadedEvent.subscribe($scope, - function(event, comicData) { - $scope.safeApply(function() { - reset(); - - if (self.settings.editMode && - comicData.editorData) { - self.editorData = comicData.editorData; - self.editorData.missing.cast.any = - self.editorData.missing.cast.first !== null; - self.editorData.missing.location.any = - self.editorData.missing.location.first !== null; - self.editorData.missing.storyline.any = - self.editorData.missing.storyline.first !== null; - self.editorData.missing.title.any = - self.editorData.missing.title.first !== null; - self.editorData.missing.tagline.any = - self.editorData.missing.tagline.first !== null; - self.editorData.missing.any = - self.editorData.missing.cast.any || - self.editorData.missing.location.any || - self.editorData.missing.storyline.any || - self.editorData.missing.title.any || - self.editorData.missing.tagline.any; - - /* jshint eqeqeq:false */ - /* jscs:disable maximumLineLength */ - if (self.editorData.missing.cast.first == comicService.comic) { - self.editorData.missing.cast.first = null; - } - if (self.editorData.missing.cast.last == comicService.comic) { - self.editorData.missing.cast.last = null; - } - - if (self.editorData.missing.location.first == comicService.comic) { - self.editorData.missing.location.first = null; - } - if (self.editorData.missing.location.last == comicService.comic) { - self.editorData.missing.location.last = null; - } - - if (self.editorData.missing.storyline.first == comicService.comic) { - self.editorData.missing.storyline.first = null; - } - if (self.editorData.missing.storyline.last == comicService.comic) { - self.editorData.missing.storyline.last = null; - } - /* jscs:enable maximumLineLength */ - /* jshint eqeqeq:true */ - } - - function processItem(item) { - if (!(item.type in self.items)) { - self.items[item.type] = []; - } - self.items[item.type].push(item); - } - - function processAllItem(item) { - if (!(item.type in self.allItems)) { - self.allItems[item.type] = []; - } - self.allItems[item.type].push(item); - } - - if (!comicData.hasData) { - self.messages.push( - 'This strip has no navigation data yet' - ); - self.hasWarning = true; - - if (qcExt.settings.showAllMembers) { - angular.forEach(comicData.allItems, processAllItem); - } - return; - } - - var hasCast = false; - var hasLocation = false; - var hasStoryline = false; - angular.forEach(comicData.items, - function(item) { - processItem(item); - - if (item.type === 'cast') { - hasCast = true; - } else if (item.type === 'location') { - hasLocation = true; - } else if (item.type === 'storyline') { - hasStoryline = true; - } - } - ); - if (qcExt.settings.showAllMembers) { - angular.forEach(comicData.allItems, processAllItem); - } - - if (!hasCast) { - self.missingDataInfo.push('cast members'); - } - if (!hasLocation) { - self.missingDataInfo.push('a location'); - } - /* #if (!hasStoryline) { - self.missingDataInfo.push('a storyline'); - }*/ - if (!comicData.title) { - self.missingDataInfo.push('a title'); - } - if (!comicData.tagline && - comicService.comic > constants.taglineThreshold) { - self.missingDataInfo.push('a tagline'); - } - - if (qcExt.settings.version === undefined) { - // Version is undefined. We're a new user! - $log.debug('qcExtra(): Version undefined!'); - self.showWelcomeMessage = true; - } else if (qcExt.settings.version !== - self.currentVersion) { - // Version is changed. Script has been updated! - $log.debug('qcExtra(): Version different!'); - self.showUpdateMessage = true; - } - }); - }); - - comicDataErrorEvent.subscribe($scope, - function(event, data) { - $scope.safeApply(reset); - $scope.safeApply(function() { - if (data.status !== 503) { - self.messages.push('Error communicating with server'); - self.hasError = true; - } else { - self.messages.push(constants.messages.maintenance); - } - }); - }); - - this.getTypeDescription = function(type) { - switch (type) { - case 'cast': - return 'Cast Members'; - case 'storyline': - return 'Storylines'; - case 'location': - return 'Locations'; - - case 'all-cast': - return $sce.trustAsHtml('Cast Members
' + - '(Non-Present)'); - case 'all-storyline': - return $sce.trustAsHtml('Storylines
' + - '(Non-Present)'); - case 'all-location': - return $sce.trustAsHtml('Locations
' + - '(Non-Present)'); - } - }; - - this.openSettings = function() { - $('#settingsDialog').modal('show'); - }; - - this.editComicData = function() { - $('#editComicDataDialog').modal('show'); - }; - - this.showDetailsFor = function(item) { - $('#itemDetailsDialog').data('itemId', item.id); - $('#itemDetailsDialog').modal('show'); - }; - - this.enableTagModeFor = function(item) { - $log.debug(item); - }; - - this.showChangeLog = function() { - self.showWelcomeMessage = false; - self.showUpdateMessage = false; - $('#changeLogDialog').modal('show'); - }; - } - - qcExt.app.directive('qcExtra', function() { - return { - restrict: 'E', - replace: true, - scope: {}, - controller: ['$scope', '$log', 'comicService', 'latestComic', - 'eventFactory', '$sce', Controller], - controllerAs: 'e', - template: qcExt.variables.angularTemplates.extra - }; - }); -})(qcExt || (qcExt = {})); diff --git a/assets/js/qc-ext-qcItemDetailsDirective.js b/assets/js/qc-ext-qcItemDetailsDirective.js deleted file mode 100644 index b72c796..0000000 --- a/assets/js/qc-ext-qcItemDetailsDirective.js +++ /dev/null @@ -1,203 +0,0 @@ -/* - * Copyright (C) 2016 Alexander Krivács Schrøder - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -/* global constants */ - -var qcExt; - -(function(qcExt) { - 'use strict'; - - qcExt.app.directive('qcItemDetails', function() { - return { - restrict: 'E', - replace: true, - scope: {}, - controller: ['$log', '$http', '$scope', 'colorService', - 'comicService', 'messageReportingService', 'styleService', - function($log, $http, $scope, colorService, - comicService, messageReportingService, styleService) { - var self = this; - - this.isLoading = true; - this.settings = qcExt.settings; - - $scope.safeApply = function(fn) { - var phase = this.$root.$$phase; - if (phase === '$apply' || phase === '$digest') { - if (fn && typeof fn === 'function') { - fn(); - } - } else { - this.$apply(fn); - } - }; - - function getItemDetails() { - var itemId = $('#itemDetailsDialog').data('itemId'); - $log.debug('qcItemDetails::showModal() - item id:', - itemId); - - function handleRelationData(response) { - if (response.status === 200) { - var relationData = response.data; - - $.each(relationData, function(_, relation) { - relation.percentage = relation.count / - self.itemData.appearances * 100; - }); - - return relationData; - } - return null; - } - - function handleItemFriendsData(response) { - var friends = handleRelationData(response); - if (friends === null) { - friends = []; - } - $scope.safeApply(function() { - self.itemData.friends = friends; - }); - } - - function handleItemLocationsData(response) { - var locations = handleRelationData(response); - if (locations === null) { - locations = []; - } - $scope.safeApply(function() { - self.itemData.locations = locations; - }); - } - - function handleItemData(response) { - if (response.status === 200) { - var itemData = response.data; - - itemData.highlightColor = colorService - .createTintOrShade(itemData.color); - - if (itemData.hasImage) { - itemData.imagePath = - constants.characterImageBaseUrl + - itemData.id + '.' + - constants.characterImageExtension; - } - - $log.debug('qcItemDetails::showModal() - ' + - 'item data:', itemData); - - // If the color changes, also update the - // highlight color - $scope.safeApply(function() { - self.itemData = itemData; - self.isLoading = false; - - $scope.$watch(function() { - return self.itemData.color; - }, function() { - itemData.highlightColor = - colorService - .createTintOrShade( - itemData.color); - }); - }); - - $http.get(constants.itemFriendDataUrl + itemId) - .then(handleItemFriendsData); - $http.get(constants.itemLocationDataUrl + - itemId).then(handleItemLocationsData); - } else { - messageReportingService.reportError( - response.data); - } - } - - self.itemData = {}; - self.isLoading = true; - $http.get(constants.itemDataUrl + itemId) - .then(handleItemData); - } - - $('#itemDetailsDialog').on('show.bs.modal', getItemDetails); - - this.showInfoFor = function(id) { - $('#itemDetailsDialog').data('itemId', id); - getItemDetails(); - }; - - this.keypress = function(event, property) { - if (event.keyCode === 13) { - // ENTER key - self.update(property); - } - }; - - function onErrorLog(response) { - messageReportingService.reportError(response.data); - return response; - } - - function onSuccessRefreshElseErrorLog(response) { - if (response.status === 200) { - comicService.refreshComicData(); - } else { - onErrorLog(response); - } - return response; - } - - this.update = function(property) { - function updateItemColor(response) { - if (response.status === 200) { - if (property === 'color') { - $log.debug('qcItemDetails::update() - ' + - 'update item color'); - styleService.removeItemStyle( - self.itemData.id); - } - } - return onSuccessRefreshElseErrorLog(response); - } - - var data = { - token: qcExt.settings.editModeToken, - item: self.itemData.id, - property: property, - value: self.itemData[property] - }; - $http.post(constants.setItemDataPropertyUrl, data) - .then(updateItemColor, onErrorLog); - }; - - this.goToComic = function(comic) { - comicService.gotoComic(comic); - self.close(); - }; - - this.close = function() { - $('#itemDetailsDialog').modal('hide'); - }; - }], - controllerAs: 'idvm', - template: qcExt.variables.angularTemplates.itemDetails - }; - }); -})(qcExt || (qcExt = {})); - diff --git a/assets/js/qc-ext-qcNavDirective.js b/assets/js/qc-ext-qcNavDirective.js deleted file mode 100644 index 247206a..0000000 --- a/assets/js/qc-ext-qcNavDirective.js +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright (C) 2016 Alexander Krivács Schrøder - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -var qcExt; - -(function(qcExt) { - 'use strict'; - - qcExt.app.directive('qcNav', function() { - return { - restrict: 'E', - scope: {randomComic: '='}, - controller: ['$scope', 'comicService', 'latestComic', - function($scope, comicService, latestComic) { - this.comicService = comicService; - - function updateRandomComic() { - $scope.randomComic = Math.floor(Math.random() * - (parseInt(latestComic) + 1)); - } - - updateRandomComic(); - - this.first = function(event) { - event.preventDefault(); - event.stopPropagation(); - comicService.first(); - }; - - this.previous = function(event) { - event.preventDefault(); - event.stopPropagation(); - comicService.previous(); - }; - - this.next = function(event) { - event.preventDefault(); - event.stopPropagation(); - comicService.next(); - }; - - this.last = function(event) { - event.preventDefault(); - event.stopPropagation(); - comicService.last(); - }; - - this.random = function(event) { - event.preventDefault(); - event.stopPropagation(); - - comicService.gotoComic($scope.randomComic); - updateRandomComic(); - }; - }], - controllerAs: 'n', - template: qcExt.variables.angularTemplates.navigation - }; - }); -})(qcExt || (qcExt = {})); diff --git a/assets/js/qc-ext-qcNewsDirective.js b/assets/js/qc-ext-qcNewsDirective.js deleted file mode 100644 index 3062f42..0000000 --- a/assets/js/qc-ext-qcNewsDirective.js +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright (C) 2016 Alexander Krivács Schrøder - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -/* global constants */ - -var qcExt; - -(function(qcExt) { - 'use strict'; - - qcExt.app.directive('qcNews', function() { - return { - restrict: 'E', - replace: true, - scope: {}, - controller: ['$scope', '$sce', '$compile', 'eventFactory', - function($scope, $sce, $compile, Event) { - var comicDataLoadingEvent = - new Event(constants.comicdataLoadingEvent); - var comicDataLoadedEvent = - new Event(constants.comicdataLoadedEvent); - - $scope.safeApply = function(fn) { - var phase = this.$root.$$phase; - - if (phase === '$apply' || phase === '$digest') { - if (fn && typeof fn === 'function') { - fn(); - } - } else { - this.$apply(fn); - } - }; - - function nl2br(str, isXhtml) { - var breakTag = isXhtml || - typeof isXhtml === 'undefined' ? - '
' : '
'; - - return String(str).replace(/([^>\r\n]?)(\r\n|\n\r|\r|\n)/g, - '$1' + breakTag + '$2'); - } - - function angularizeLinks(str) { - var comicLinkRegexp = - /]*href=(?:"|')(?:http:\/\/(?:www\.)?questionablecontent.net\/)?view\.php\?comic=(\d+)(?:"|')[^>]*>/; - - return String(str).replace(comicLinkRegexp, - '
'); - } - - var self = this; - - this.news = $sce.trustAsHtml('Loading...'); - comicDataLoadingEvent.subscribe($scope, - function() { - $scope.safeApply(function() { - self.news = $sce.trustAsHtml('Loading...'); - }); - }); - comicDataLoadedEvent.subscribe($scope, - function(event, comicData) { - $scope.safeApply(function() { - self.news = $sce.trustAsHtml(nl2br( - angularizeLinks(comicData.news), false)); - }); - }); - }], - controllerAs: 'n', - template: - '
' - }; - }); -})(qcExt || (qcExt = {})); diff --git a/assets/js/qc-ext-qcRibbonDirective.js b/assets/js/qc-ext-qcRibbonDirective.js deleted file mode 100644 index 79eaf5f..0000000 --- a/assets/js/qc-ext-qcRibbonDirective.js +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright (C) 2016, 2017 Alexander Krivács Schrøder - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -/* global constants */ - -var qcExt; - -(function(qcExt) { - 'use strict'; - - qcExt.app.directive('qcRibbon', function() { - return { - restrict: 'E', - replace: true, - scope: {}, - controller: ['$scope', 'eventFactory', - function($scope, Event) { - var comicDataLoadedEvent = - new Event(constants.comicdataLoadedEvent); - - $scope.safeApply = function(fn) { - var phase = this.$root.$$phase; - - if (phase === '$apply' || phase === '$digest') { - if (fn && typeof fn === 'function') { - fn(); - } - } else { - this.$apply(fn); - } - }; - - this.settings = qcExt.settings; - this.isNonCanon = false; - this.isGuestComic = false; - this.isSmall = qcExt.settings.showSmallRibbonByDefault; - - var self = this; - comicDataLoadedEvent.subscribe($scope, - function(event, comicData) { - $scope.safeApply(function() { - self.isNonCanon = comicData.isNonCanon; - self.isGuestComic = comicData.isGuestComic; - }); - }); - }], - controllerAs: 'r', - template: qcExt.variables.angularTemplates.ribbon - }; - }); -})(qcExt || (qcExt = {})); diff --git a/assets/js/qc-ext-qcSetPublishDateDirective.js b/assets/js/qc-ext-qcSetPublishDateDirective.js deleted file mode 100644 index c106282..0000000 --- a/assets/js/qc-ext-qcSetPublishDateDirective.js +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Copyright (C) 2016, 2017 Alexander Krivács Schrøder - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -/* global constants */ - -var qcExt; - -(function(qcExt) { - 'use strict'; - - qcExt.app.directive('qcSetPublishDate', function() { - return { - restrict: 'E', - replace: true, - scope: {}, - controller: ['$scope', '$log', 'comicService', 'eventFactory', - 'messageReportingService', - function($scope, $log, comicService, Event, - messageReportingService) { - $log.debug('START qcSetPublishDate()'); - - var self = this; - - this.unique = Math.random().toString(36).slice(-5); - - var comicDataLoadedEvent = - new Event(constants.comicdataLoadedEvent); - - $scope.safeApply = function(fn) { - var phase = this.$root.$$phase; - if (phase === '$apply' || phase === '$digest') { - if (fn && typeof fn === 'function') { - fn(); - } - } else { - this.$apply(fn); - } - }; - - this.keyPress = function(event) { - if (event.keyCode === 13) { - // ENTER key - self.setPublishDate(); - } - }; - - this.setPublishDate = function() { - if (self.publishDate === null || self.publishDate === - undefined) { - // Error - messageReportingService.reportWarning( - 'The date entered is not valid!'); - return; - } - comicService.setPublishDate(self.publishDate, - self.isAccuratePublishDate); - }; - - this.publishDate = ''; - comicDataLoadedEvent.subscribe($scope, - function(event, comicData) { - $scope.safeApply(function() { - var publishDate = comicData.publishDate; - if (publishDate !== null && - publishDate !== undefined) { - var date = new Date(publishDate); - self.publishDate = date; - } else { - self.publishDate = null; - } - self.isAccuratePublishDate = - comicData.isAccuratePublishDate; - }); - }); - - $log.debug('END qcSetPublishDate()'); - }], - controllerAs: 's', - template: qcExt.variables.angularTemplates.setPublishDate - }; - }); -})(qcExt || (qcExt = {})); diff --git a/assets/js/qc-ext-qcSetTaglineDirective.js b/assets/js/qc-ext-qcSetTaglineDirective.js deleted file mode 100644 index 28c89f8..0000000 --- a/assets/js/qc-ext-qcSetTaglineDirective.js +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright (C) 2016 Alexander Krivács Schrøder - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -/* global constants */ - -var qcExt; - -(function(qcExt) { - 'use strict'; - - qcExt.app.directive('qcSetTagline', function() { - return { - restrict: 'E', - replace: true, - scope: {}, - controller: ['$scope', '$log', 'comicService', 'eventFactory', - function($scope, $log, comicService, Event) { - $log.debug('START qcSetTagline()'); - - var self = this; - - this.unique = Math.random().toString(36).slice(-5); - - var comicDataLoadedEvent = - new Event(constants.comicdataLoadedEvent); - - $scope.safeApply = function(fn) { - var phase = this.$root.$$phase; - if (phase === '$apply' || phase === '$digest') { - if (fn && typeof fn === 'function') { - fn(); - } - } else { - this.$apply(fn); - } - }; - - this.keyPress = function(event) { - if (event.keyCode === 13) { - // ENTER key - self.setTagline(); - } - }; - - this.setTagline = function() { - comicService.setTagline(self.tagline); - }; - - this.tagline = ''; - comicDataLoadedEvent.subscribe($scope, - function(event, comicData) { - $scope.safeApply(function() { - self.tagline = comicData.tagline; - }); - }); - - $log.debug('END qcSetTagline()'); - }], - controllerAs: 's', - template: qcExt.variables.angularTemplates.setTagline - }; - }); -})(qcExt || (qcExt = {})); diff --git a/assets/js/qc-ext-qcSetTitleDirective.js b/assets/js/qc-ext-qcSetTitleDirective.js deleted file mode 100644 index 7655dc1..0000000 --- a/assets/js/qc-ext-qcSetTitleDirective.js +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright (C) 2016 Alexander Krivács Schrøder - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -/* global constants */ - -var qcExt; - -(function(qcExt) { - 'use strict'; - - qcExt.app.directive('qcSetTitle', function() { - return { - restrict: 'E', - replace: true, - scope: {}, - controller: ['$scope', '$log', 'comicService', 'eventFactory', - function($scope, $log, comicService, Event) { - $log.debug('START qcSetTitle()'); - - var self = this; - - this.unique = Math.random().toString(36).slice(-5); - - var comicDataLoadedEvent = - new Event(constants.comicdataLoadedEvent); - - $scope.safeApply = function(fn) { - var phase = this.$root.$$phase; - if (phase === '$apply' || phase === '$digest') { - if (fn && typeof fn === 'function') { - fn(); - } - } else { - this.$apply(fn); - } - }; - - this.keyPress = function(event) { - if (event.keyCode === 13) { - // ENTER key - self.setTitle(); - } - }; - - this.setTitle = function() { - comicService.setTitle(self.title); - }; - - this.title = ''; - comicDataLoadedEvent.subscribe($scope, - function(event, comicData) { - $scope.safeApply(function() { - self.title = comicData.title; - }); - }); - - $log.debug('END qcSetTitle()'); - }], - controllerAs: 's', - template: qcExt.variables.angularTemplates.setTitle - }; - }); -})(qcExt || (qcExt = {})); diff --git a/assets/js/qc-ext-qcSettingsDirective.js b/assets/js/qc-ext-qcSettingsDirective.js deleted file mode 100644 index e503788..0000000 --- a/assets/js/qc-ext-qcSettingsDirective.js +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (C) 2016, 2017 Alexander Krivács Schrøder - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -/* global constants */ - -var qcExt; - -(function(qcExt) { - 'use strict'; - - qcExt.app.directive('qcSettings', function() { - return { - restrict: 'E', - replace: true, - scope: {}, - controller: ['$scope', 'comicService', '$log', - function($scope, comicService, $log) { - var self = this; - this.settings = qcExt.settings; - - $scope.$watchGroup([function() { - return self.settings.showAllMembers; - }, function() { - return self.settings.editMode; - }], function() { - comicService.refreshComicData(); - }); - - $('#settingsDialog').on('hide.bs.modal', function() { - $log.debug('Saving settings...'); - GM_setValue(constants.settingsKey, - JSON.stringify(self.settings)); - }); - - this.close = function() { - $('#settingsDialog').modal('hide'); - }; - }], - controllerAs: 'svm', - template: qcExt.variables.angularTemplates.settings - }; - }); -})(qcExt || (qcExt = {})); - diff --git a/assets/js/qc-ext-styleService.js b/assets/js/qc-ext-styleService.js deleted file mode 100644 index 0bb2469..0000000 --- a/assets/js/qc-ext-styleService.js +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Copyright (C) 2016 Alexander Krivács Schrøder - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -var qcExt; - -(function(qcExt) { - 'use strict'; - - qcExt.app.service('styleService', ['$log', 'colorService', - function($log, colorService) { - $log.debug('START styleService()'); - - function addStyle(style) { - var styleElement = - $(''); - $('head').append(styleElement); - return styleElement; - } - - var customStyles = {}; - var customStyleElements = {}; - - this.addCustomStyle = function(key, style) { - if (this.hasCustomStyle(key)) { - return; - } - - var styleElement = addStyle(style); - customStyles[key] = style; - customStyleElements[key] = styleElement; - }; - - this.removeCustomStyle = function(key) { - delete customStyles[key]; - customStyleElements[key].remove(); - delete customStyleElements[key]; - }; - - this.hasCustomStyle = function(key) { - return key in customStyles; - }; - - this.addItemStyle = function(id, color) { - var itemId = 'item_' + id; - if (!this.hasCustomStyle(itemId)) { - var qcNavItem = '#qcnav_item_' + id + ' > table'; - var qcNavItemWithColor = qcNavItem + '.with_color'; - - var backgroundColor = color; - var foregroundColor = colorService.createTintOrShade(color); - var hoverFocusColor = colorService - .createTintOrShade(color, 2); - - var itemStyle = - qcNavItemWithColor + '{' + - 'background-color:' + backgroundColor + ';' + - '}' + - qcNavItemWithColor + ',' + - qcNavItemWithColor + ' a.qcnav_name_link,' + - qcNavItemWithColor + ' a:link,' + - qcNavItemWithColor + ' a:visited{' + - 'color:' + foregroundColor + ';' + - '}' + - qcNavItem + ' a.qcnav_name_link{' + - 'cursor: pointer;' + - 'text-decoration: none;' + - '}' + - qcNavItemWithColor + ' a:hover,' + - qcNavItemWithColor + ' a:focus{' + - 'color: ' + hoverFocusColor + ';' + - '}'; - - this.addCustomStyle(itemId, itemStyle); - } - }; - - this.removeItemStyle = function(id) { - var itemId = 'item_' + id; - if (this.hasCustomStyle(itemId)) { - this.removeCustomStyle(itemId); - } - }; - - this.hasItemStyle = function(id) { - var itemId = 'item_' + id; - return this.hasCustomStyle(itemId); - }; - - $log.debug('END styleService()'); - }]); -})(qcExt || (qcExt = {})); diff --git a/assets/js/qc-ext-titleController.js b/assets/js/qc-ext-titleController.js deleted file mode 100644 index fc2233d..0000000 --- a/assets/js/qc-ext-titleController.js +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright (C) 2016 Alexander Krivács Schrøder - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -/* global constants */ - -var qcExt; - -(function(qcExt) { - 'use strict'; - - qcExt.app.controller('titleController', ['$log', '$scope', 'eventFactory', - function($log, $scope, Event) { - $log.debug('START titleController()'); - - this.title = 'Loading Questionable Content Extension...'; - - var comicDataLoadingEvent = - new Event(constants.comicdataLoadingEvent); - var comicDataLoadedEvent = - new Event(constants.comicdataLoadedEvent); - - $scope.safeApply = function(fn) { - var phase = this.$root.$$phase; - if (phase === '$apply' || phase === '$digest') { - if (fn && typeof fn === 'function') { - fn(); - } - } else { - this.$apply(fn); - } - }; - - var self = this; - - comicDataLoadingEvent.subscribe($scope, function(event, comic) { - $scope.safeApply(function() { - self.title = 'Loading #' + comic + - ' — Questionable Content'; - }); - }); - - comicDataLoadedEvent.subscribe($scope, function(event, comicData) { - $scope.safeApply(function() { - if (comicData.hasData && comicData.title) { - self.title = '#' + comicData.comic + ': ' + - comicData.title + ' — Questionable Content'; - } else { - self.title = '#' + comicData.comic + - ' — Questionable Content'; - } - }); - }); - - $log.debug('END titleController()'); - }]); -})(qcExt || (qcExt = {})); diff --git a/assets/js/settings.js b/assets/js/settings.js deleted file mode 100644 index ea33de2..0000000 --- a/assets/js/settings.js +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (C) 2016, 2017 Alexander Krivács Schrøder - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -/* global constants */ - -var qcExt; - -(function(qcExt) { - 'use strict'; - - var defaults = { - showDebugLogs: false, - scrollToTop: true, - - showAllMembers: false, - showCast: true, - showStorylines: true, - showLocations: true, - useColors: true, - - skipNonCanon: false, - skipGuest: false, - - editMode: false, - editModeToken: '', - - showIndicatorRibbon: true, - showSmallRibbonByDefault: false, - useCorrectTimeFormat: true - }; - - qcExt.settings = JSON.parse(GM_getValue(constants.settingsKey, - JSON.stringify(defaults))); - - // This makes sure that when new settings are added, users will - // automatically receive the default values for those new settings when - // they update. - $.each(defaults, function(key, defaultValue) { - if (!(key in qcExt.settings)) { - qcExt.settings[key] = defaultValue; - } - }); -})(qcExt || (qcExt = {})); diff --git a/assets/sass/style.scss b/assets/sass/style.scss index c82ffba..8ddac9c 100644 --- a/assets/sass/style.scss +++ b/assets/sass/style.scss @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016 Alexander Krivács Schrøder + * Copyright (C) 2016-2018 Alexander Krivács Schrøder * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -166,7 +166,9 @@ a { } .mask, .fill { - -webkit-backface-visibility: hidden; + -webkit-backface-visibility: hidden; + backface-visibility: hidden; + transition: -webkit-transform 1s; transition: -ms-transform 1s; transition: transform 1s; diff --git a/assets/templates/changeLog.html b/assets/templates/changeLog.html index 977e523..d7992cd 100644 --- a/assets/templates/changeLog.html +++ b/assets/templates/changeLog.html @@ -36,6 +36,11 @@

NextVersion NextDate

  • --> + +

    0.5.3 March 1, 2019

    +
      +
    • Switch to using the new API server (only minor improvements client side for this version, but lays the groundwork for quicker and better improvements going forward)
    • +

    0.5.2 October 3, 2018

      diff --git a/assets/templates/variables.post.template b/assets/templates/variables.post.template index b6e0505..a82094e 100644 --- a/assets/templates/variables.post.template +++ b/assets/templates/variables.post.template @@ -1 +1 @@ -})(qcExt || (qcExt = {})); +export default variables; diff --git a/assets/templates/variables.pre.template b/assets/templates/variables.pre.template index 292352e..169b376 100644 --- a/assets/templates/variables.pre.template +++ b/assets/templates/variables.pre.template @@ -1,7 +1,4 @@ -var qcExt; -(function(qcExt) { - 'use strict'; - - qcExt.variables = qcExt.variables || {}; - qcExt.variables.css = qcExt.variables.css || {}; - qcExt.variables.angularTemplates = qcExt.variables.angularTemplates || {}; +let variables = { + css: {}, + html: {} +}; diff --git a/create-release.sh b/create-release.sh deleted file mode 100755 index 43be084..0000000 --- a/create-release.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/bash - -if [ "$2" != "-cl" ] -then - echo "You must remember to update the changelog first!" - exit -fi - -# Update package.json with the new version number -sed -i "s/\"version\": .*,/echo -n \" \\\\\"version\\\\\": \\\\\"$1\\\\\",\"/ge" package.json - -# Build new version -grunt build - -# Copy to release -cp dist/qc-ext.min.user.js /var/www/html/questionablecontentextensions/web/releases/qc-ext.$1.user.js -cp dist/qc-ext.min.user.js /var/www/html/questionablecontentextensions/web/releases/qc-ext.latest.user.js -printf "', '$1', \$p->userscriptBanner));" | php > /var/www/html/questionablecontentextensions/web/releases/qc-ext.latest.meta.js - -# Don't forget to publish! -echo -echo "===========================" -echo "Don't forget to publish! :)" -echo "===========================" - diff --git a/flow-typed/npm/angular-ui_v0.2.x.js b/flow-typed/npm/angular-ui_v0.2.x.js new file mode 100644 index 0000000..0de2a9d --- /dev/null +++ b/flow-typed/npm/angular-ui_v0.2.x.js @@ -0,0 +1,31 @@ +/* + * Copyright (C) 2016-2018 Alexander Krivács Schrøder + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +declare module 'angular-ui' { + declare type StateData = { + url: string; + templateUrl?: string; + controller?: Function; + params: mixed; + }; + + declare interface $StateProvider { + state(name: string, stateData: StateData): void; + } + + declare type $StateParams = Object; +} diff --git a/flow-typed/npm/angular_v1.5.x.js b/flow-typed/npm/angular_v1.5.x.js new file mode 100644 index 0000000..8c33ccb --- /dev/null +++ b/flow-typed/npm/angular_v1.5.x.js @@ -0,0 +1,354 @@ +// flow-typed signature: d27f045262809aeea90a7dadeb395775 +// flow-typed version: 45acb9a3f7/angular_v1.5.x/flow_>=v0.47.x + +/** + * Credit to @faceleg for some of the typedefs seen here: + * https://github.com/solnet-aquarium/flow-interfaces-angular/blob/master/interfaces/angular.js + */ + +declare module angular { + // NOTE: if you don't use named scope bindings, remove string type in the end + // for stricter types + declare type ScopeBindings = "<" | "=" | "&" | ") => void; + + // I'm not sure how represent this properly: Angular DI declarations are a + // list of strings with a single function at the end. The function can vary, + // so it is a type param. + // + // NOTE: if you use compile step to mangle array, replace below with + // declare type $npm$angular$DependencyInjection = T + declare type $npm$angular$DependencyInjection = Array | Function; + + // Extending Array allows us to do the `jq[0]` expression and friends + // to get the actual underlying Element. + // TODO: This is supposed to be interchangeable with JQuery. Can we possibly + // check to see if JQuery's types are already defined? + declare interface JqliteElement extends Array { + remove: () => JqliteElement; + contents: () => JqliteElement; + injector: Function; + } + + declare type AngularLinkFunction = ( + scope: $Scope<*>, + element: JqliteElement, + attrs: mixed, + controller: mixed + ) => void; + + declare type AngularCompileLink = { + post?: AngularLinkFunction, + pre?: AngularLinkFunction + }; + + declare function bootstrap( + element: string|HTMLElement, + modules?: Array, + config?: any + ): any; + + // TODO: Attrs and controller should be properly typed. + declare function CompileFunction( + element: JqliteElement, + attrs: mixed, + controller: ControllerFunction + ): AngularLinkFunction; + + // TODO: Expand to cover the whole matrix of AECM, in any order. Probably + // should write something to handle it. + declare type DirectiveRestrict = "A" | "E" | "AE" | "EA"; + declare type Directive = {| + restrict?: DirectiveRestrict, + replace?: boolean, + template?: string, + templateUrl?: string, + scope?: Scope, + controller?: ControllerFunction, + link?: AngularLinkFunction, + controllerAs?: string, + bindToController?: boolean, + // TODO: flesh out this definition + compile?: (...a: any) => AngularCompileLink + |}; + + declare type DirectiveDeclaration = ( + name: string, + di: $npm$angular$DependencyInjection<(...a: Array<*>) => Directive> + ) => AngularModule; + + declare type Component = {| + bindings?: Scope, + template?: string, + templateUrl?: string, + controllerAs?: string, + controller?: $npm$angular$DependencyInjection< + Class<*> | ControllerFunction + >, + transclude?: boolean + |}; + + declare type ComponentDeclaration = ( + name: string, + component: Component + ) => AngularModule; + + declare type ControllerDeclaration = ( + name: string, + di: $npm$angular$DependencyInjection + ) => AngularModule; + + declare type ConfigDeclaration = ( + di: $npm$angular$DependencyInjection<(...a: Array<*>) => void> + ) => AngularModule; + + declare type FactoryDeclaration = ( + name: string, + di: $npm$angular$DependencyInjection + ) => AngularModule; + + declare type FilterDeclaration = ( + name: string, + di: $npm$angular$DependencyInjection + ) => AngularModule; + + declare type ServiceDeclaration = ( + name: string, + di: $npm$angular$DependencyInjection + ) => AngularModule; + + declare type RunDeclaration = ( + fn: $npm$angular$DependencyInjection<(...a: Array<*>) => void> + ) => AngularModule; + + declare type ValueDeclaration = (name: string, value: mixed) => AngularModule; + + declare type ConstantDeclaration = ( + name: string, + value: mixed + ) => AngularModule; + + declare type AngularModule = {| + controller: ControllerDeclaration, + component: ComponentDeclaration, + directive: DirectiveDeclaration, + run: RunDeclaration, + config: ConfigDeclaration, + factory: FactoryDeclaration, + filter: FilterDeclaration, + service: ServiceDeclaration, + value: ValueDeclaration, + constant: ConstantDeclaration, + name: string + |}; + + declare type Dependency = AngularModule | string; + + declare function module( + name: string, + deps?: ?Array + ): AngularModule; + + declare function element(html: string | Element | Document): JqliteElement; + declare function copy(object: T): T; + declare function extend(a: A, b: B): A & B; + declare function extend(a: A, b: B, c: C): A & B & C; + declare function extend(a: A, b: B, c: C, d: D): A & B & C & D; + declare function extend( + a: A, + b: B, + c: C, + d: D, + e: E + ): A & B & C & D & E; + + declare function forEach( + obj: Object, + iterator: (value: T, key: string) => void + ): void; + declare function forEach( + obj: Array, + iterator: (value: T, key: number) => void + ): void; + declare function fromJson(json: string): Object | Array<*> | string | number; + declare function toJson( + obj: Object | Array | string | Date | number | boolean, + pretty?: boolean | number + ): string; + declare function isDefined(val: any): boolean; + declare function isArray(value: Array): true; + declare function isArray(value: any): false; + declare function noop(): void; + declare type AngularQ = { + when: (value: T) => AngularPromise + }; + + declare type AngularPromise = { + then: (a: (resolve: U) => T) => AngularPromise<*>, + catch: (a: (e: Error) => U) => AngularPromise<*>, + finally: (a: (result: U | typeof Error) => T) => AngularPromise<*> + }; + + //**************************************************************************** + // Angular testing tools + //**************************************************************************** + + declare type AngularMock = { + inject: (...a: Array<*>) => Function, + module: (...a: Array) => () => void + }; + declare var mock: AngularMock; + + declare type StateProviderParams = { + url?: string, + abstract?: boolean, + params?: Object, + views?: Object, + data?: Object, + templateUrl?: string, + template?: string, + controller?: string | ControllerFunction, + resolve?: Object + }; + + declare type $StateProvider = { + state: (name: string, conf: StateProviderParams) => $StateProvider + }; + + //---------------------------------------------------------------------------- + // Service specific stuff + //---------------------------------------------------------------------------- + + declare type AngularHttpService = { + get: AngularHttpGet<*>; + post: AngularHttpPost<*>; + }; + + declare type AngularHttpGet = ( + url: string + ) => AngularPromise + + declare type AngularHttpPost = ( + url: string, + data: mixed + ) => AngularPromise; + + declare type AngularResourceResult = { + $promise: AngularPromise + }; + + declare type AngularResource = { + get: (options?: Object, callback?: Function) => AngularResourceResult + }; + + declare function AngularResourceFactory( + url: string, + defaultParams?: Object, + actions?: Object, + options?: Object + ): AngularResource; + + declare function AngularCompileService(a: JqliteElement): JqliteElement; + + declare type WatchExpression = string | ((scope: $Scope) => any); + declare type EvalExpression = string | (() => void); + declare type ApplyExpression = string | (() => void); + declare type Listener = ( + newValue: *, + oldValue: *, + $scope: $Scope + ) => any; + + declare type _Watch1 = ( + expression: WatchExpression, + listener: Listener, + objectEquality?: boolean + ) => () => void; + declare type _Watch2 = ( + listener: Listener, + objectEquality?: boolean + ) => () => void; + + declare type $Scope = {| + $new(isolate: boolean, parent: $Scope): $Scope, + $watch: _Watch1 & _Watch2, + $watchGroup( + expressions: Array>, + listener: Listener + ): () => void, + $watchCollection( + expression: WatchExpression, + listener: Listener + ): () => void, + $digest(): void, + $destroy(): void, + $eval(expression: EvalExpression, locals?: Object): void, + $evalAsync(expression: EvalExpression, locals?: Object): void, + $apply(expression?: ApplyExpression): void, + $applyAsync(expression?: ApplyExpression): void, + $on(name: string, listener: (event: *, ...Array<*>) => void): () => void, + $emit(name: string, ...Array<*>): void, + $broadcast(name: string, ...Array<*>): void, + + $$postDigest(cb: () => void): void, + + $id: string, + $parent: $Scope<*>, + $root: $Scope<*> + |} & T; + + declare type $Timeout = ( + fn?: Function, + delay?: number, + invokeApply?: boolean, + additionalParams?: * + ) => AngularPromise<*>; + + declare type $Log = { + log(...Array<*>): void; + info(...Array<*>): void; + warn(...Array<*>): void; + error(...Array<*>): void; + debug(...Array<*>): void; + } + + declare type $Location = { + absUrl(): string; + url(url?: string): string; + protocol(): string; + host(): string; + port(): number; + path(path: string|number): string|Object; + search(search:any, paramValue?: string|number|Array|boolean): Object; + hash(hash: string|number): string; + replace(): void; + state(state?: Object): Object; + } + declare type CompiledExpression = (context: Object, locals: Object) => string; + declare type $Sce = { + isEnabled(): boolean; + parseAs(type: string, expression: string): CompiledExpression; + trustAs(type: string, value: T): T; + trustAsHtml(value: T): T; + trustAsCss(value: T): T; + trustAsUrl(value: T): T; + trustAsResourceUrl(value: T): T; + trustAsJs(value: T): T; + getTrusted(type: string, maybeTrusted: T): T; + getTrustedHtml(value: T): T; + getTrustedCss(value: T): T; + getTrustedUrl(value: T): T; + getTrustedResourceUrl(value: T): T; + getTrustedJs(value: T): T; + parseAsHtml(expression: string): CompiledExpression; + parseAsCss(expression: string): CompiledExpression; + parseAsUrl(expression: string): CompiledExpression; + parseAsResourceUrl(expression: string): CompiledExpression; + parseAsJs(expression: string): CompiledExpression; + } + + declare type $Http = AngularHttpService; + + declare type $Filter = (name: string) => Function; +} diff --git a/flow-typed/npm/greasemonkey_v4.x.x.js b/flow-typed/npm/greasemonkey_v4.x.x.js new file mode 100644 index 0000000..85deac5 --- /dev/null +++ b/flow-typed/npm/greasemonkey_v4.x.x.js @@ -0,0 +1,89 @@ +/* + * Copyright (C) 2016-2018 Alexander Krivács Schrøder + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +declare module greasemonkey { + declare type GMInfoScriptObject = { + description: string; + excludes: string[]; + includes: string[]; + matches: string[]; + name: string; + namespace: string; + resources: any; + //run-at: string; + version: string; + } + + declare type GMInfoObject = { + script: GMInfoScriptObject; + scriptMetaStr: string; + scriptHandler: string; + version: string; + } + + declare class GMXHRResult extends XMLHttpRequest { + responseHeaders: string; + context?: any; + } + + declare class GMXHRProgressResult extends GMXHRResult { + lengthComputable: boolean; + loaded: number; + total: number; + } + + declare type GMXHRDetails = { + binary?: boolean; + context?: any; + data?: string; + headers?: {}; + method: "GET" | "POST" | "HEAD" | "PUT" | "PATCH" | "DELETE"; + overrideMimeType?: string; + password?: string; + synchronous?: boolean; + timeout?: number; + upload?: any; + url: string; + user?: string; + + onabort?: (result: GMXHRResult) => void; + onerror?: (result: GMXHRResult) => void; + onload?: (result: GMXHRResult) => void; + onprogress?: (result: GMXHRProgressResult) => void; + onreadystatechange?: (result: GMXHRProgressResult) => void; + ontimeout?: (result: GMXHRResult) => void; + } + + declare type GMObject = { + info: GMInfoObject; + + deleteValue(name: string): Promise; + getValue (name: string, defaultValue: ?T): Promise; + listValues(): Promise; + setValue < T: string | number | boolean > (name: string, value: T): Promise; + + getResourceUrl(resourceName: string): Promise; + + notification(text: string, title: string, image: ?string, onclick: ?() => void): void; + setClipboard(text: string): void; + openInTab(url: string, open_in_background: ?boolean): void; + + xmlHttpRequest(details: GMXHRDetails): void; +} + +declare module.exports: GMObject; +} diff --git a/flow-typed/npm/jquery_v3.x.x.js b/flow-typed/npm/jquery_v3.x.x.js new file mode 100644 index 0000000..c2f98af --- /dev/null +++ b/flow-typed/npm/jquery_v3.x.x.js @@ -0,0 +1,3686 @@ +// flow-typed signature: 636ef2bb589992a4e20b25eca3cb8513 +// flow-typed version: 9698a46399/jquery_v3.x.x/flow_>=v0.28.x + +/* eslint-disable max-len, no-unused-vars, flowtype/no-weak-types */ + +// Flow-typed type definitions for jQuery 3.x.x +// Project: http://jquery.com/ +// Author: Dieter Oberkofler + +// Original definitions by: +// Boris Yankov +// Christian Hoffmeister +// Steve Fenton +// Diullei Gomes +// Tass Iliopoulos +// Jason Swearingen +// Sean Hill +// Guus Goossens +// Kelly Summerlin +// Basarat Ali Syed +// Nicholas Wolverson +// Derek Cicerone +// Andrew Gaspar +// James Harrison Fisher +// Seikichi Kondo +// Benjamin Jackman +// Poul Sorensen +// Josh Strobl +// John Reilly +// Dick van den Brink + +/* ***************************************************************************** +Copyright (c: any) Microsoft Corporation. All rights reserved. +Licensed under the Apache License, Version 2.0 (the "License"); you may not us: void; +this file except in compliance with the License. You may obtain a copy of the +License at http://www.apache.org/licenses/LICENSE-2.0 + +THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +MERCHANTABLITY OR NON-INFRINGEMENT. + +See the Apache Version 2.0 License for specific language governing permissions +and limitations under the License. +***************************************************************************** */ + +/** + * Interface for the AJAX setting that will configure the AJAX request + */ +declare interface JQueryAjaxSettings { + /** + * The content type sent in the request header that tells the server what kind of response it will accept in return. If the accepts setting needs modification, it is recommended to do so once in the $.ajaxSetup() method. + */ + accepts?: any; + /** + * By default, all requests are sent asynchronously (i.e. this is set to true by default). If you need synchronous requests, set this option to false. Cross-domain requests and dataType: "jsonp" requests do not support synchronous operation. Note that synchronous requests may temporarily lock the browser, disabling any actions while the request is active. As of jQuery 1.8, the use of async: false with jqXHR ($.Deferred) is deprecated; you must use the success/error/complete callback options instead of the corresponding methods of the jqXHR object such as jqXHR.done() or the deprecated jqXHR.success(). + */ + async?: boolean; + /** + * A pre-request callback function that can be used to modify the jqXHR (in jQuery 1.4.x, XMLHTTPRequest: any) object before it is sent. Use this to set custom headers, etc. The jqXHR and settings objects are passed as arguments. This is an Ajax Event. Returning false in the beforeSend function will cancel the request. As of jQuery 1.5, the beforeSend option will be called regardless of the type of request. + */ + beforeSend?: (jqXHR: JQueryXHR, settings: JQueryAjaxSettings) => any; + /** + * If set to false, it will force requested pages not to be cached by the browser. Note: Setting cache to false will only work correctly with HEAD and GET requests. It works by appending "_={timestamp}" to the GET parameters. The parameter is not needed for other types of requests, except in IE8 when a POST is made to a URL that has already been requested by a GET. + */ + cache?: boolean; + /** + * A function to be called when the request finishes (after success and error callbacks are executed). The function gets passed two arguments: The jqXHR (in jQuery 1.4.x, XMLHTTPRequest: any) object and a string categorizing the status of the request ("success", "notmodified", "error", "timeout", "abort", or "parsererror"). As of jQuery 1.5, the complete setting can accept an array of functions. Each function will be called in turn. This is an Ajax Event. + */ + complete?: (jqXHR: JQueryXHR, textStatus: string) => any; + /** + * An object of string/regular-expression pairs that determine how jQuery will parse the response, given its content type. (version added: 1.5) + */ + contents?: { + [key: string]: any + }; + // According to jQuery.ajax source code, ajax's option actually allows contentType to set to "false" + // https://github.com/borisyankov/DefinitelyTyped/issues/742 + /** + * When sending data to the server, use this content type. Default is "application/x-www-form-urlencoded; charset=UTF-8", which is fine for most cases. If you explicitly pass in a content-type to $.ajax(), then it is always sent to the server (even if no data is sent). The W3C XMLHttpRequest specification dictates that the charset is always UTF-8; specifying another charset will not force the browser to change the encoding. + */ + contentType?: any; + /** + * This object will be made the context of all Ajax-related callbacks. By default, the context is an object that represents the ajax settings used in the call ($.ajaxSettings merged with the settings passed to $.ajax). + */ + context?: any; + /** + * An object containing dataType-to-dataType converters. Each converter's value is a function that returns the transformed value of the response. (version added: 1.5) + */ + converters?: { + [key: string]: any + }; + /** + * If you wish to force a crossDomain request (such as JSONP) on the same domain, set the value of crossDomain to true. This allows, for example, server-side redirection to another domain. (version added: 1.5) + */ + crossDomain?: boolean; + /** + * Data to be sent to the server. It is converted to a query string, if not already a string. It's appended to the url for GET-requests. See processData option to prevent this automatic processing. Object must be Key/Value pairs. If value is an Array, jQuery serializes multiple values with same key based on the value of the traditional setting (described below). + */ + data?: any; + /** + * A function to be used to handle the raw response data of XMLHttpRequest.This is a pre-filtering function to sanitize the response. You should return the sanitized data. The function accepts two arguments: The raw data returned from the server and the 'dataType' parameter. + */ + dataFilter?: (data: any, ty: any) => any; + /** + * The type of data that you're expecting back from the server. If none is specified, jQuery will try to infer it based on the MIME type of the response (an XML MIME type will yield XML, in 1.4 JSON will yield a JavaScript object, in 1.4 script will execute the script, and anything else will be returned as a string). + */ + dataType?: string; + /** + * A function to be called if the request fails. The function receives three arguments: The jqXHR (in jQuery 1.4.x, XMLHttpRequest: any) object, a string describing the type of error that occurred and an optional exception object, if one occurred. Possible values for the second argument (besides null) are "timeout", "error", "abort", and "parsererror". When an HTTP error occurs, errorThrown receives the textual portion of the HTTP status, such as "Not Found" or "Internal Server Error." As of jQuery 1.5, the error setting can accept an array of functions. Each function will be called in turn. Note: This handler is not called for cross-domain script and cross-domain JSONP requests. This is an Ajax Event. + */ + error?: (jqXHR: JQueryXHR, textStatus?: string, errorThrown?: string) => any; + /** + * Whether to trigger global Ajax event handlers for this request. The default is true. Set to false to prevent the global handlers like ajaxStart or ajaxStop from being triggered. This can be used to control various Ajax Events. + */ + global?: boolean; + /** + * An object of additional header key/value pairs to send along with requests using the XMLHttpRequest transport. The header X-Requested-With: XMLHttpRequest is always added, but its default XMLHttpRequest value can be changed here. Values in the headers setting can also be overwritten from within the beforeSend function. (version added: 1.5) + */ + headers?: { + [key: string]: any + }; + /** + * Allow the request to be successful only if the response has changed since the last request. This is done by checking the Last-Modified header. Default value is false, ignoring the header. In jQuery 1.4 this technique also checks the 'etag' specified by the server to catch unmodified data. + */ + ifModified?: boolean; + /** + * Allow the current environment to be recognized as "local," (e.g. the filesystem), even if jQuery does not recognize it as such by default. The following protocols are currently recognized as local: file, *-extension, and widget. If the isLocal setting needs modification, it is recommended to do so once in the $.ajaxSetup() method. (version added: 1.5.1) + */ + isLocal?: boolean; + /** + * Override the callback function name in a jsonp request. This value will be used instead of 'callback' in the 'callback=?' part of the query string in the url. So {jsonp:'onJSONPLoad'} would result in 'onJSONPLoad=?' passed to the server. As of jQuery 1.5, setting the jsonp option to false prevents jQuery from adding the "?callback" string to the URL or attempting to use "=?" for transformation. In this case, you should also explicitly set the jsonpCallback setting. For example, { jsonp: false, jsonpCallback: "callbackName" } + */ + jsonp?: any; + /** + * Specify the callback function name for a JSONP request. This value will be used instead of the random name automatically generated by jQuery. It is preferable to let jQuery generate a unique name as it'll make it easier to manage the requests and provide callbacks and error handling. You may want to specify the callback when you want to enable better browser caching of GET requests. As of jQuery 1.5, you can also use a function for this setting, in which case the value of jsonpCallback is set to the return value of that function. + */ + jsonpCallback?: any; + /** + * The HTTP method to use for the request (e.g. "POST", "GET", "PUT"). (version added: 1.9.0) + */ + method?: string; + /** + * A mime type to override the XHR mime type. (version added: 1.5.1) + */ + mimeType?: string; + /** + * A password to be used with XMLHttpRequest in response to an HTTP access authentication request. + */ + password?: string; + /** + * By default, data passed in to the data option as an object (technically, anything other than a string) will be processed and transformed into a query string, fitting to the default content-type "application/x-www-form-urlencoded". If you want to send a DOMDocument, or other non-processed data, set this option to false. + */ + processData?: boolean; + /** + * Only applies when the "script" transport is used (e.g., cross-domain requests with "jsonp" or "script" dataType and "GET" type). Sets the charset attribute on the script tag used in the request. Used when the character set on the local page is not the same as the one on the remote script. + */ + scriptCharset?: string; + /** + * An object of numeric HTTP codes and functions to be called when the response has the corresponding code. f the request is successful, the status code functions take the same parameters as the success callback; if it results in an error (including 3xx redirect), they take the same parameters as the error callback. (version added: 1.5) + */ + statusCode?: { + [key: string]: any + }; + /** + * A function to be called if the request succeeds. The function gets passed three arguments: The data returned from the server, formatted according to the dataType parameter; a string describing the status; and the jqXHR (in jQuery 1.4.x, XMLHttpRequest: any) object. As of jQuery 1.5, the success setting can accept an array of functions. Each function will be called in turn. This is an Ajax Event. + */ + success?: (data: any, textStatus?: string, jqXHR?: JQueryXHR) => any; + /** + * Set a timeout (in milliseconds) for the request. This will override any global timeout set with $.ajaxSetup(). The timeout period starts at the point the $.ajax call is made; if several other requests are in progress and the browser has no connections available, it is possible for a request to time out before it can be sent. In jQuery 1.4.x and below, the XMLHttpRequest object will be in an invalid state if the request times out; accessing any object members may throw an exception. In Firefox 3.0+ only, script and JSONP requests cannot be cancelled by a timeout; the script will run even if it arrives after the timeout period. + */ + timeout?: number; + /** + * Set this to true if you wish to use the traditional style of param serialization. + */ + traditional?: boolean; + /** + * The type of request to make ("POST" or "GET"), default is "GET". Note: Other HTTP request methods, such as PUT and DELETE, can also be used here, but they are not supported by all browsers. + */ + type?: string; + /** + * A string containing the URL to which the request is sent. + */ + url?: string; + /** + * A username to be used with XMLHttpRequest in response to an HTTP access authentication request. + */ + username?: string; + /** + * Callback for creating the XMLHttpRequest object. Defaults to the ActiveXObject when available (IE: any), the XMLHttpRequest otherwise. Override to provide your own implementation for XMLHttpRequest or enhancements to the factory. + */ + xhr?: any; + /** + * An object of fieldName-fieldValue pairs to set on the native XHR object. For example, you can use it to set withCredentials to true for cross-domain requests if needed. In jQuery 1.5, the withCredentials property was not propagated to the native XHR and thus CORS requests requiring it would ignore this flag. For this reason, we recommend using jQuery 1.5.1+ should you require the use of it. (version added: 1.5.1) + */ + xhrFields?: { + [key: string]: any + }; +} + +/** + * Interface for the jqXHR object + */ +declare class JQueryXHR { + /** + * The .overrideMimeType() method may be used in the beforeSend() callback function, for example, to modify the response content-type header. As of jQuery 1.5.1, the jqXHR object also contains the overrideMimeType() method (it was available in jQuery 1.4.x, as well, but was temporarily removed in jQuery 1.5). + */ + overrideMimeType(mimeType: string): any; + /** + * Cancel the request. + * + * @param statusText A string passed as the textStatus parameter for the done callback. Default value: "canceled" + */ + abort(statusText?: string): void; + /** + * Incorporates the functionality of the .done() and .fail() methods, allowing (as of jQuery 1.8) the underlying Promise to be manipulated. Refer to deferred.then() for implementation details. + */ + then( + doneCallback: (data: any, textStatus: string, jqXHR: JQueryXHR) => R, + failCallback?: ( + jqXHR: JQueryXHR, + textStatus: string, + errorThrown: any + ) => void + ): JQueryPromise; + /** + * Property containing the parsed response if the response Content-Type is json + */ + responseJSON?: any; + + /** + * Property containing the parsed response if the response Content-Type is text/plain + */ + responseText?: string; + + /** + * Status code of the response + */ + status?: number; + + /** + * A function to be called if the request fails. + */ + error(xhr: JQueryXHR, textStatus: string, errorThrown: string): void; + done( + doneCallback: (data: any, textStatus: string, xhr: JQueryXHR) => R + ): JQueryPromise; + fail( + failCallback: ( + xhr: JQueryXHR, + textStatus: string, + errorThrown: string + ) => void + ): void; +} + +/** + * Interface for the JQuery callback + */ +declare class JQueryCallback { + /** + * Add a callback or a collection of callbacks to a callback list. + * + * @param callbacks A function, or array of functions, that are to be added to the callback list. + */ + add(callbacks: Function): JQueryCallback; + /** + * Add a callback or a collection of callbacks to a callback list. + * + * @param callbacks A function, or array of functions, that are to be added to the callback list. + */ + add(callbacks: Function[]): JQueryCallback; + + /** + * Disable a callback list from doing anything more. + */ + disable(): JQueryCallback; + + /** + * Determine if the callbacks list has been disabled. + */ + disabled(): boolean; + + /** + * Remove all of the callbacks from a list. + */ + empty(): JQueryCallback; + + /** + * Call all of the callbacks with the given arguments + * + * @param arguments The argument or list of arguments to pass back to the callback list. + */ + fire(...arguments: any[]): JQueryCallback; + + /** + * Determine if the callbacks have already been called at least once. + */ + fired(): boolean; + + /** + * Call all callbacks in a list with the given context and arguments. + * + * @param context A reference to the context in which the callbacks in the list should be fired. + * @param arguments An argument, or array of arguments, to pass to the callbacks in the list. + */ + fireWith(context?: any, args?: any[]): JQueryCallback; + + /** + * Determine whether a supplied callback is in a list + * + * @param callback The callback to search for. + */ + has(callback: Function): boolean; + + /** + * Lock a callback list in its current state. + */ + lock(): JQueryCallback; + + /** + * Determine if the callbacks list has been locked. + */ + locked(): boolean; + + /** + * Remove a callback or a collection of callbacks from a callback list. + * + * @param callbacks A function, or array of functions, that are to be removed from the callback list. + */ + remove(callbacks: Function): JQueryCallback; + /** + * Remove a callback or a collection of callbacks from a callback list. + * + * @param callbacks A function, or array of functions, that are to be removed from the callback list. + */ + remove(callbacks: Function[]): JQueryCallback; +} + +/** + * Allows jQuery Promises to interop with non-jQuery promises + */ +declare class JQueryGenericPromise { + /** + * Add handlers to be called when the Deferred object is resolved, rejected, or still in progress. + * + * @param doneFilter A function that is called when the Deferred is resolved. + * @param failFilter An optional function that is called when the Deferred is rejected. + */ + then( + doneFilter: (value?: T, ...values: any[]) => U | JQueryPromise, + failFilter?: (...reasons: any[]) => any, + progressFilter?: (...progression: any[]) => any + ): JQueryPromise; + + /** + * Add handlers to be called when the Deferred object is resolved, rejected, or still in progress. + * + * @param doneFilter A function that is called when the Deferred is resolved. + * @param failFilter An optional function that is called when the Deferred is rejected. + */ + then( + doneFilter: (value?: T, ...values: any[]) => void, + failFilter?: (...reasons: any[]) => any, + progressFilter?: (...progression: any[]) => any + ): JQueryPromise; +} + +/** + * Interface for the JQuery promise/deferred callbacks + */ +declare interface JQueryPromiseCallback { + (value?: T, ...args: any[]): void; +} + +declare class JQueryPromiseOperator { + ( + callback1: JQueryPromiseCallback | JQueryPromiseCallback[], + ...callbacksN: Array< + JQueryPromiseCallback | JQueryPromiseCallback[] + > + ): JQueryPromise; +} + +/** + * Interface for the JQuery promise, part of callbacks + */ +declare class JQueryPromise extends JQueryGenericPromise { + /** + * Determine the current state of a Deferred object. + */ + state(): string; + /** + * Add handlers to be called when the Deferred object is either resolved or rejected. + * + * @param alwaysCallbacks1 A function, or array of functions, that is called when the Deferred is resolved or rejected. + * @param alwaysCallbacks2 Optional additional functions, or arrays of functions, that are called when the Deferred is resolved or rejected. + */ + always( + alwaysCallback1?: JQueryPromiseCallback | JQueryPromiseCallback[], + ...alwaysCallbacksN: Array< + JQueryPromiseCallback | JQueryPromiseCallback[] + > + ): JQueryPromise; + /** + * Add handlers to be called when the Deferred object is resolved. + * + * @param doneCallbacks1 A function, or array of functions, that are called when the Deferred is resolved. + * @param doneCallbacks2 Optional additional functions, or arrays of functions, that are called when the Deferred is resolved. + */ + done( + doneCallback1?: JQueryPromiseCallback | JQueryPromiseCallback[], + ...doneCallbackN: Array< + JQueryPromiseCallback | JQueryPromiseCallback[] + > + ): JQueryPromise; + /** + * Add handlers to be called when the Deferred object is rejected. + * + * @param failCallbacks1 A function, or array of functions, that are called when the Deferred is rejected. + * @param failCallbacks2 Optional additional functions, or arrays of functions, that are called when the Deferred is rejected. + */ + fail( + failCallback1?: JQueryPromiseCallback | JQueryPromiseCallback[], + ...failCallbacksN: Array< + JQueryPromiseCallback | JQueryPromiseCallback[] + > + ): JQueryPromise; + /** + * Add handlers to be called when the Deferred object generates progress notifications. + * + * @param progressCallbacks A function, or array of functions, to be called when the Deferred generates progress notifications. + */ + progress( + progressCallback1?: | JQueryPromiseCallback + | JQueryPromiseCallback[], + ...progressCallbackN: Array< + JQueryPromiseCallback | JQueryPromiseCallback[] + > + ): JQueryPromise; + + // Deprecated - given no typings + pipe( + doneFilter?: (x: any) => any, + failFilter?: (x: any) => any, + progressFilter?: (x: any) => any + ): JQueryPromise; +} + +/** + * Interface for the JQuery deferred, part of callbacks + */ +declare class JQueryDeferred extends JQueryGenericPromise { + /** + * Determine the current state of a Deferred object. + */ + state(): string; + /** + * Add handlers to be called when the Deferred object is either resolved or rejected. + * + * @param alwaysCallbacks1 A function, or array of functions, that is called when the Deferred is resolved or rejected. + * @param alwaysCallbacks2 Optional additional functions, or arrays of functions, that are called when the Deferred is resolved or rejected. + */ + always( + alwaysCallback1?: JQueryPromiseCallback | JQueryPromiseCallback[], + ...alwaysCallbacksN: Array< + JQueryPromiseCallback | JQueryPromiseCallback[] + > + ): JQueryDeferred; + /** + * Add handlers to be called when the Deferred object is resolved. + * + * @param doneCallbacks1 A function, or array of functions, that are called when the Deferred is resolved. + * @param doneCallbacks2 Optional additional functions, or arrays of functions, that are called when the Deferred is resolved. + */ + done( + doneCallback1?: JQueryPromiseCallback | JQueryPromiseCallback[], + ...doneCallbackN: Array< + JQueryPromiseCallback | JQueryPromiseCallback[] + > + ): JQueryDeferred; + /** + * Add handlers to be called when the Deferred object is rejected. + * + * @param failCallbacks1 A function, or array of functions, that are called when the Deferred is rejected. + * @param failCallbacks2 Optional additional functions, or arrays of functions, that are called when the Deferred is rejected. + */ + fail( + failCallback1?: JQueryPromiseCallback | JQueryPromiseCallback[], + ...failCallbacksN: Array< + JQueryPromiseCallback | JQueryPromiseCallback[] + > + ): JQueryDeferred; + /** + * Add handlers to be called when the Deferred object generates progress notifications. + * + * @param progressCallbacks A function, or array of functions, to be called when the Deferred generates progress notifications. + */ + progress( + progressCallback1?: | JQueryPromiseCallback + | JQueryPromiseCallback[], + ...progressCallbackN: Array< + JQueryPromiseCallback | JQueryPromiseCallback[] + > + ): JQueryDeferred; + + /** + * Call the progressCallbacks on a Deferred object with the given args. + * + * @param args Optional arguments that are passed to the progressCallbacks. + */ + notify(value?: any, ...args: any[]): JQueryDeferred; + + /** + * Call the progressCallbacks on a Deferred object with the given context and args. + * + * @param context Context passed to the progressCallbacks as the this object. + * @param args Optional arguments that are passed to the progressCallbacks. + */ + notifyWith(context: any, value?: any[]): JQueryDeferred; + + /** + * Reject a Deferred object and call any failCallbacks with the given args. + * + * @param args Optional arguments that are passed to the failCallbacks. + */ + reject(value?: any, ...args: any[]): JQueryDeferred; + /** + * Reject a Deferred object and call any failCallbacks with the given context and args. + * + * @param context Context passed to the failCallbacks as the this object. + * @param args An optional array of arguments that are passed to the failCallbacks. + */ + rejectWith(context: any, value?: any[]): JQueryDeferred; + + /** + * Resolve a Deferred object and call any doneCallbacks with the given args. + * + * @param value First argument passed to doneCallbacks. + * @param args Optional subsequent arguments that are passed to the doneCallbacks. + */ + resolve(value?: T, ...args: any[]): JQueryDeferred; + + /** + * Resolve a Deferred object and call any doneCallbacks with the given context and args. + * + * @param context Context passed to the doneCallbacks as the this object. + * @param args An optional array of arguments that are passed to the doneCallbacks. + */ + resolveWith(context: any, value?: T[]): JQueryDeferred; + + /** + * Return a Deferred's Promise object. + * + * @param target Object onto which the promise methods have to be attached + */ + promise(target?: any): JQueryPromise; + + // Deprecated - given no typings + pipe( + doneFilter?: (x: any) => any, + failFilter?: (x: any) => any, + progressFilter?: (x: any) => any + ): JQueryPromise; +} + +/** + * Interface of the JQuery extension of the W3C event object + */ +declare class BaseJQueryEventObject extends Event { + data: any; + delegateTarget: Element; + isDefaultPrevented(): boolean; + isImmediatePropagationStopped(): boolean; + isPropagationStopped(): boolean; + namespace: string; + originalEvent: Event; + preventDefault(): any; + relatedTarget: Element; + result: any; + stopImmediatePropagation(): void; + stopPropagation(): void; + target: EventTarget; + pageX: number; + pageY: number; + which: number; + metaKey: boolean; +} + +declare class JQueryInputEventObject extends BaseJQueryEventObject { + altKey: boolean; + ctrlKey: boolean; + metaKey: boolean; + shiftKey: boolean; +} + +declare class JQueryMouseEventObject extends JQueryInputEventObject { + button: number; + clientX: number; + clientY: number; + offsetX: number; + offsetY: number; + pageX: number; + pageY: number; + screenX: number; + screenY: number; +} + +declare class JQueryKeyEventObject extends JQueryInputEventObject { + char: any; + charCode: number; + key: any; + keyCode: number; +} + +declare class JQueryEventObject extends BaseJQueryEventObject {} + +/* + Collection of properties of the current browser +*/ + +declare class JQuerySupport { + ajax?: boolean; + boxModel?: boolean; + changeBubbles?: boolean; + checkClone?: boolean; + checkOn?: boolean; + cors?: boolean; + cssFloat?: boolean; + hrefNormalized?: boolean; + htmlSerialize?: boolean; + leadingWhitespace?: boolean; + noCloneChecked?: boolean; + noCloneEvent?: boolean; + opacity?: boolean; + optDisabled?: boolean; + optSelected?: boolean; + scriptEval(): boolean; + style?: boolean; + submitBubbles?: boolean; + tbody?: boolean; +} + +declare class JQueryParam { + /** + * Create a serialized representation of an array or object, suitable for use in a URL query string or Ajax request. + * + * @param obj An array or object to serialize. + */ + (obj: any): string; + + /** + * Create a serialized representation of an array or object, suitable for use in a URL query string or Ajax request. + * + * @param obj An array or object to serialize. + * @param traditional A Boolean indicating whether to perform a traditional "shallow" serialization. + */ + (obj: any, traditional: boolean): string; +} + +/** + * The class used to construct jQuery events (with $.Event). It is + * defined separately instead of inline in JQueryStatic to allow + * overriding the construction function with specific strings + * returning specific event objects. + */ +declare class JQueryEventConstructor { + (name: string, eventProperties?: any): JQueryEventObject; + new(name: string, eventProperties?: any): JQueryEventObject; +} + +/** + * The class used to specify coordinates. + */ +declare class JQueryCoordinates { + left: number; + top: number; +} + +/** + * Elements in the array returned by serializeArray() + */ +declare class JQuerySerializeArrayElement { + name: string; + value: string; +} + +declare interface JQueryAnimationOptions { + /** + * A string or number determining how long the animation will run. + */ + duration?: any; + /** + * A string indicating which easing function to use for the transition. + */ + easing?: string; + /** + * A function to call once the animation is complete. + */ + complete?: Function; + /** + * A function to be called for each animated property of each animated element. This function provides an opportunity to modify the Tween object to change the value of the property before it is set. + */ + step?: (now: number, tween: any) => any; + /** + * A function to be called after each step of the animation, only once per animated element regardless of the number of animated properties. (version added: 1.8) + */ + progress?: ( + animation: JQueryPromise, + progress: number, + remainingMs: number + ) => any; + /** + * A function to call when the animation begins. (version added: 1.8) + */ + start?: (animation: JQueryPromise) => any; + /** + * A function to be called when the animation completes (its Promise object is resolved). (version added: 1.8) + */ + done?: (animation: JQueryPromise, jumpedToEnd: boolean) => any; + /** + * A function to be called when the animation fails to complete (its Promise object is rejected). (version added: 1.8) + */ + fail?: (animation: JQueryPromise, jumpedToEnd: boolean) => any; + /** + * A function to be called when the animation completes or stops without completing (its Promise object is either resolved or rejected). (version added: 1.8) + */ + always?: (animation: JQueryPromise, jumpedToEnd: boolean) => any; + /** + * A Boolean indicating whether to place the animation in the effects queue. If false, the animation will begin immediately. As of jQuery 1.7, the queue option can also accept a string, in which case the animation is added to the queue represented by that string. When a custom queue name is used the animation does not automatically start; you must call .dequeue("queuename") to start it. + */ + queue?: any; + /** + * A map of one or more of the CSS properties defined by the properties argument and their corresponding easing functions. (version added: 1.4) + */ + specialEasing?: Object; +} + +declare class JQueryEasingFunction { + (percent: number): number; +} + +declare class JQueryEasingFunctions { + [name: string]: JQueryEasingFunction; + linear: JQueryEasingFunction; + swing: JQueryEasingFunction; +} + +/** + * Static members of jQuery (those on $ and jQuery themselves) + */ +declare class JQueryStatic { + /** + * Perform an asynchronous HTTP (Ajax: any) request. + * + * @param settings A set of key/value pairs that configure the Ajax request. All settings are optional. A default can be set for any option with $.ajaxSetup(). + */ + ajax(settings: JQueryAjaxSettings): JQueryXHR; + /** + * Perform an asynchronous HTTP (Ajax: any) request. + * + * @param url A string containing the URL to which the request is sent. + * @param settings A set of key/value pairs that configure the Ajax request. All settings are optional. A default can be set for any option with $.ajaxSetup(). + */ + ajax(url: string, settings?: JQueryAjaxSettings): JQueryXHR; + + /** + * Handle custom Ajax options or modify existing options before each request is sent and before they are processed by $.ajax(). + * + * @param dataTypes An optional string containing one or more space-separated dataTypes + * @param handler A handler to set default values for future Ajax requests. + */ + ajaxPrefilter( + dataTypes: string, + handler: ( + opts: any, + originalOpts: JQueryAjaxSettings, + jqXHR: JQueryXHR + ) => any + ): void; + /** + * Handle custom Ajax options or modify existing options before each request is sent and before they are processed by $.ajax(). + * + * @param handler A handler to set default values for future Ajax requests. + */ + ajaxPrefilter( + handler: ( + opts: any, + originalOpts: JQueryAjaxSettings, + jqXHR: JQueryXHR + ) => any + ): void; + + ajaxSettings: JQueryAjaxSettings; + + /** + * Set default values for future Ajax requests. Its use is not recommended. + * + * @param options A set of key/value pairs that configure the default Ajax request. All options are optional. + */ + ajaxSetup(options: JQueryAjaxSettings): void; + + /** + * Load data from the server using a HTTP GET request. + * + * @param url A string containing the URL to which the request is sent. + * @param success A callback function that is executed if the request succeeds. + * @param dataType The type of data expected from the server. Default: Intelligent Guess (xml, json, script, or html). + */ + get( + url: string, + success?: (data: any, textStatus: string, jqXHR: JQueryXHR) => any, + dataType?: string + ): JQueryXHR; + /** + * Load data from the server using a HTTP GET request. + * + * @param url A string containing the URL to which the request is sent. + * @param data A plain object or string that is sent to the server with the request. + * @param success A callback function that is executed if the request succeeds. + * @param dataType The type of data expected from the server. Default: Intelligent Guess (xml, json, script, or html). + */ + get( + url: string, + data?: Object | string, + success?: (data: any, textStatus: string, jqXHR: JQueryXHR) => any, + dataType?: string + ): JQueryXHR; + /** + * Load JSON-encoded data from the server using a GET HTTP request. + * + * @param url A string containing the URL to which the request is sent. + * @param success A callback function that is executed if the request succeeds. + */ + getJSON( + url: string, + success?: (data: any, textStatus: string, jqXHR: JQueryXHR) => any + ): JQueryXHR; + /** + * Load JSON-encoded data from the server using a GET HTTP request. + * + * @param url A string containing the URL to which the request is sent. + * @param data A plain object or string that is sent to the server with the request. + * @param success A callback function that is executed if the request succeeds. + */ + getJSON( + url: string, + data?: Object | string, + success?: (data: any, textStatus: string, jqXHR: JQueryXHR) => any + ): JQueryXHR; + /** + * Load a JavaScript file from the server using a GET HTTP request, then execute it. + * + * @param url A string containing the URL to which the request is sent. + * @param success A callback function that is executed if the request succeeds. + */ + getScript( + url: string, + success?: (script: string, textStatus: string, jqXHR: JQueryXHR) => any + ): JQueryXHR; + + /** + * Create a serialized representation of an array or object, suitable for use in a URL query string or Ajax request. + */ + param: JQueryParam; + + /** + * Load data from the server using a HTTP POST request. + * + * @param url A string containing the URL to which the request is sent. + * @param success A callback function that is executed if the request succeeds. Required if dataType is provided, but can be null in that case. + * @param dataType The type of data expected from the server. Default: Intelligent Guess (xml, json, script, text, html: any). + */ + post( + url: string, + success?: (data: any, textStatus: string, jqXHR: JQueryXHR) => any, + dataType?: string + ): JQueryXHR; + /** + * Load data from the server using a HTTP POST request. + * + * @param url A string containing the URL to which the request is sent. + * @param data A plain object or string that is sent to the server with the request. + * @param success A callback function that is executed if the request succeeds. Required if dataType is provided, but can be null in that case. + * @param dataType The type of data expected from the server. Default: Intelligent Guess (xml, json, script, text, html: any). + */ + post( + url: string, + data?: Object | string, + success?: (data: any, textStatus: string, jqXHR: JQueryXHR) => any, + dataType?: string + ): JQueryXHR; + + /** + * A multi-purpose callbacks list object that provides a powerful way to manage callback lists. + * + * @param flags An optional list of space-separated flags that change how the callback list behaves. + */ + Callbacks(flags?: string): JQueryCallback; + + /** + * Holds or releases the execution of jQuery's ready event. + * + * @param hold Indicates whether the ready hold is being requested or released + */ + holdReady(hold: boolean): void; + + /** + * Accepts a string containing a CSS selector which is then used to match a set of elements. + * + * @param selector A string containing a selector expression + * @param context A DOM Element, Document, or jQuery to use as context + */ + (selector: string, context?: Element | JQuery): JQuery; + + /** + * Accepts a string containing a CSS selector which is then used to match a set of elements. + * + * @param element A DOM element to wrap in a jQuery object. + */ + (element: Element): JQuery; + + /** + * Accepts a string containing a CSS selector which is then used to match a set of elements. + * + * @param elementArray An array containing a set of DOM elements to wrap in a jQuery object. + */ + (elementArray: Element[]): JQuery; + + /** + * Binds a function to be executed when the DOM has finished loading. + * + * @param callback A function to execute after the DOM is ready. + */ + (callback: (jQueryAlias?: JQueryStatic) => any): JQuery; + + /** + * Accepts a string containing a CSS selector which is then used to match a set of elements. + * + * @param object A plain object to wrap in a jQuery object. + */ + (object: {}): JQuery; + + /** + * Accepts a string containing a CSS selector which is then used to match a set of elements. + * + * @param object An existing jQuery object to clone. + */ + (object: JQuery): JQuery; + + /** + * Specify a function to execute when the DOM is fully loaded. + */ + (_: void): JQuery; + + /** + * Creates DOM elements on the fly from the provided string of raw HTML. + * + * @param html A string of HTML to create on the fly. Note that this parses HTML, not XML. + * @param ownerDocument A document in which the new elements will be created. + */ + (html: string, ownerDocument?: Document): JQuery; + + /** + * Creates DOM elements on the fly from the provided string of raw HTML. + * + * @param html A string defining a single, standalone, HTML element (e.g.
      or
      ). + * @param attributes An object of attributes, events, and methods to call on the newly-created element. + */ + (html: string, attributes: Object): JQuery; + + /** + * Relinquish jQuery's control of the $ variable. + * + * @param removeAll A Boolean indicating whether to remove all jQuery variables from the global scope (including jQuery itself). + */ + noConflict(removeAll?: boolean): JQueryStatic; + + /** + * Provides a way to execute callback functions based on one or more objects, usually Deferred objects that represent asynchronous events. + * + * @param deferreds One or more Deferred objects, or plain JavaScript objects. + */ + when( + ...deferreds: Array /* as JQueryDeferred */> + ): JQueryPromise; + + /** + * Hook directly into jQuery to override how particular CSS properties are retrieved or set, normalize CSS property naming, or create custom properties. + */ + cssHooks: { + [key: string]: any + }; + cssNumber: any; + + /** + * Store arbitrary data associated with the specified element. Returns the value that was set. + * + * @param element The DOM element to associate with the data. + * @param key A string naming the piece of data to set. + * @param value The new data value. + */ + data(element: Element, key: string, value: T): T; + /** + * Returns value: any at named data store for the element, as set by jQuery.data(element, name, value), or the full data store for the element. + * + * @param element The DOM element to associate with the data. + * @param key A string naming the piece of data to set. + */ + data(element: Element, key: string): any; + /** + * Returns value: any at named data store for the element, as set by jQuery.data(element, name, value), or the full data store for the element. + * + * @param element The DOM element to associate with the data. + */ + data(element: Element, _: void): any; + + /** + * Execute the next function on the queue for the matched element. + * + * @param element A DOM element from which to remove and execute a queued function. + * @param queueName A string containing the name of the queue. Defaults to fx, the standard effects queue. + */ + dequeue(element: Element, queueName?: string): void; + + /** + * Determine whether an element has any jQuery data associated with it. + * + * @param element A DOM element to be checked for data. + */ + hasData(element: Element): boolean; + + /** + * Show the queue of functions to be executed on the matched element. + * + * @param element A DOM element to inspect for an attached queue. + * @param queueName A string containing the name of the queue. Defaults to fx, the standard effects queue. + */ + queue(element: Element, queueName?: string, _: void): any[]; + /** + * Manipulate the queue of functions to be executed on the matched element. + * + * @param element A DOM element where the array of queued functions is attached. + * @param queueName A string containing the name of the queue. Defaults to fx, the standard effects queue. + * @param newQueue An array of functions to replace the current queue contents. + */ + queue(element: Element, queueName: string, newQueue: Function[]): JQuery; + /** + * Manipulate the queue of functions to be executed on the matched element. + * + * @param element A DOM element on which to add a queued function. + * @param queueName A string containing the name of the queue. Defaults to fx, the standard effects queue. + * @param callback The new function to add to the queue. + */ + queue(element: Element, queueName: string, callback: Function): JQuery; + + /** + * Remove a previously-stored piece of data. + * + * @param element A DOM element from which to remove data. + * @param name A string naming the piece of data to remove. + */ + removeData(element: Element, name?: string): JQuery; + + /** + * A constructor function that returns a chainable utility object with methods to register multiple callbacks into callback queues, invoke callback queues, and relay the success or failure state of any synchronous or asynchronous function. + * + * @param beforeStart A function that is called just before the constructor returns. + */ + Deferred( + beforeStart?: (deferred: JQueryDeferred) => any + ): JQueryDeferred; + + /** + * Effects + */ + + easing: JQueryEasingFunctions; + + fx: { + tick: () => void, + /** + * The rate (in milliseconds) at which animations fire. + */ + interval: number, + stop: () => void, + speeds: { + slow: number, + fast: number + }, + /** + * Globally disable all animations. + */ + off: boolean, + step: any + }; + + /** + * Takes a function and returns a new one that will always have a particular context. + * + * @param fnction The function whose context will be changed. + * @param context The object to which the context (this: any) of the function should be set. + * @param additionalArguments Any number of arguments to be passed to the function referenced in the function argument. + */ + proxy( + fnction: (...args: any[]) => any, + context: Object, + ...additionalArguments: any[] + ): any; + /** + * Takes a function and returns a new one that will always have a particular context. + * + * @param context The object to which the context (this: any) of the function should be set. + * @param name The name of the function whose context will be changed (should be a property of the context object). + * @param additionalArguments Any number of arguments to be passed to the function named in the name argument. + */ + proxy(context: Object, name: string, ...additionalArguments: any[]): any; + + Event: JQueryEventConstructor; + + /** + * Takes a string and throws an exception containing it. + * + * @param message The message to send out. + */ + error(message: any): JQuery; + + expr: any; + fn: any; // TODO: Decide how we want to type this + + isReady: boolean; + + // Properties + support: JQuerySupport; + + /** + * Check to see if a DOM element is a descendant of another DOM element. + * + * @param container The DOM element that may contain the other element. + * @param contained The DOM element that may be contained by (a descendant of) the other element. + */ + contains(container: Element, contained: Element): boolean; + + /** + * A generic iterator function, which can be used to seamlessly iterate over both objects and arrays. Arrays and array-like objects with a length property (such as a function's arguments object) are iterated by numeric index, from 0 to length-1. Other objects are iterated via their named properties. + * + * @param collection The object or array to iterate over. + * @param callback The function that will be executed on every object. + */ + each( + collection: T[], + callback: (indexInArray: number, valueOfElement: T) => any + ): any; + + /** + * A generic iterator function, which can be used to seamlessly iterate over both objects and arrays. Arrays and array-like objects with a length property (such as a function's arguments object) are iterated by numeric index, from 0 to length-1. Other objects are iterated via their named properties. + * + * @param collection The object or array to iterate over. + * @param callback The function that will be executed on every object. + */ + each( + collection: any, + callback: (indexInArray: any, valueOfElement: any) => any + ): any; + + /** + * Merge the contents of two or more objects together into the first object. + * + * @param target An object that will receive the new properties if additional objects are passed in or that will extend the jQuery namespace if it is the sole argument. + * @param object1 An object containing additional properties to merge in. + * @param objectN Additional objects containing properties to merge in. + */ + extend(target: any, object1?: any, ...objectN: any[]): any; + /** + * Merge the contents of two or more objects together into the first object. + * + * @param deep If true, the merge becomes recursive (aka. deep copy). + * @param target The object to extend. It will receive the new properties. + * @param object1 An object containing additional properties to merge in. + * @param objectN Additional objects containing properties to merge in. + */ + extend(deep: boolean, target: any, object1?: any, ...objectN: any[]): any; + + /** + * Execute some JavaScript code globally. + * + * @param code The JavaScript code to execute. + */ + globalEval(code: string): any; + + /** + * Finds the elements of an array which satisfy a filter function. The original array is not affected. + * + * @param array The array to search through. + * @param func The function to process each item against. The first argument to the function is the item, and the second argument is the index. The function should return a Boolean value. this will be the global window object. + * @param invert If "invert" is false, or not provided, then the function returns an array consisting of all elements for which "callback" returns true. If "invert" is true, then the function returns an array consisting of all elements for which "callback" returns false. + */ + grep( + array: T[], + func: (elementOfArray: T, indexInArray: number) => boolean, + invert?: boolean + ): T[]; + + /** + * Search for a specified value within an array and return its index (or -1 if not found). + * + * @param value The value to search for. + * @param array An array through which to search. + * @param fromIndex he index of the array at which to begin the search. The default is 0, which will search the whole array. + */ + inArray(value: T, array: T[], fromIndex?: number): number; + + /** + * Determine whether the argument is an array. + * + * @param obj Object to test whether or not it is an array. + */ + isArray(obj: any): boolean; + /** + * Check to see if an object is empty (contains no enumerable properties). + * + * @param obj The object that will be checked to see if it's empty. + */ + isEmptyObject(obj: any): boolean; + /** + * Determine if the argument passed is a Javascript function object. + * + * @param obj Object to test whether or not it is a function. + */ + isFunction(obj: any): boolean; + /** + * Determines whether its argument is a number. + * + * @param obj The value to be tested. + */ + isNumeric(value: any): boolean; + /** + * Check to see if an object is a plain object (created using "{}" or "new Object"). + * + * @param obj The object that will be checked to see if it's a plain object. + */ + isPlainObject(obj: any): boolean; + /** + * Determine whether the argument is a window. + * + * @param obj Object to test whether or not it is a window. + */ + isWindow(obj: any): boolean; + /** + * Check to see if a DOM node is within an XML document (or is an XML document). + * + * @param node he DOM node that will be checked to see if it's in an XML document. + */ + isXMLDoc(node: Node): boolean; + + /** + * Convert an array-like object into a true JavaScript array. + * + * @param obj Any object to turn into a native Array. + */ + makeArray(obj: any): any[]; + + /** + * Translate all items in an array or object to new array of items. + * + * @param array The Array to translate. + * @param callback The function to process each item against. The first argument to the function is the array item, the second argument is the index in array The function can return any value. Within the function, this refers to the global (window: any) object. + */ + map( + array: T[], + callback: (elementOfArray: T, indexInArray: number) => U + ): U[]; + /** + * Translate all items in an array or object to new array of items. + * + * @param arrayOrObject The Array or Object to translate. + * @param callback The function to process each item against. The first argument to the function is the value; the second argument is the index or key of the array or object property. The function can return any value to add to the array. A returned array will be flattened into the resulting array. Within the function, this refers to the global (window: any) object. + */ + map(arrayOrObject: any, callback: (value: any, indexOrKey: any) => any): any; + + /** + * Merge the contents of two arrays together into the first array. + * + * @param first The first array to merge, the elements of second added. + * @param second The second array to merge into the first, unaltered. + */ + merge(first: T[], second: T[]): T[]; + + /** + * An empty function. + */ + noop(_: void): any; + + /** + * Return a number representing the current time. + */ + now(_: void): number; + + /** + * Takes a well-formed JSON string and returns the resulting JavaScript object. + * + * @param json The JSON string to parse. + */ + parseJSON(json: string): any; + + /** + * Parses a string into an XML document. + * + * @param data a well-formed XML string to be parsed + */ + parseXML(data: string): any; + + /** + * Remove the whitespace from the beginning and end of a string. + * + * @param str Remove the whitespace from the beginning and end of a string. + */ + trim(str: string): string; + + /** + * Determine the internal JavaScript [[Class]] of an object. + * + * @param obj Object to get the internal JavaScript [[Class]] of. + */ + type(obj: any): string; + + /** + * Sorts an array of DOM elements, in place, with the duplicates removed. Note that this only works on arrays of DOM elements, not strings or numbers. + * + * @param array The Array of DOM elements. + */ + unique(array: Element[]): Element[]; + + /** + * Parses a string into an array of DOM nodes. + * + * @param data HTML string to be parsed + * @param context DOM element to serve as the context in which the HTML fragment will be created + * @param keepScripts A Boolean indicating whether to include scripts passed in the HTML string + */ + parseHTML(data: string, context?: HTMLElement, keepScripts?: boolean): any[]; + + /** + * Parses a string into an array of DOM nodes. + * + * @param data HTML string to be parsed + * @param context DOM element to serve as the context in which the HTML fragment will be created + * @param keepScripts A Boolean indicating whether to include scripts passed in the HTML string + */ + parseHTML(data: string, context?: Document, keepScripts?: boolean): any[]; +} + +/** + * The jQuery instance members + */ +declare class JQuery { + /** + * Register a handler to be called when Ajax requests complete. This is an AjaxEvent. + * + * @param handler The function to be invoked. + */ + ajaxComplete( + handler: ( + event: JQueryEventObject, + XMLHttpRequest: XMLHttpRequest, + ajaxOptions: any + ) => any + ): JQuery; + /** + * Register a handler to be called when Ajax requests complete with an error. This is an Ajax Event. + * + * @param handler The function to be invoked. + */ + ajaxError( + handler: ( + event: JQueryEventObject, + jqXHR: JQueryXHR, + ajaxSettings: JQueryAjaxSettings, + thrownError: any + ) => any + ): JQuery; + /** + * Attach a function to be executed before an Ajax request is sent. This is an Ajax Event. + * + * @param handler The function to be invoked. + */ + ajaxSend( + handler: ( + event: JQueryEventObject, + jqXHR: JQueryXHR, + ajaxOptions: JQueryAjaxSettings + ) => any + ): JQuery; + /** + * Register a handler to be called when the first Ajax request begins. This is an Ajax Event. + * + * @param handler The function to be invoked. + */ + ajaxStart(handler: () => any): JQuery; + /** + * Register a handler to be called when all Ajax requests have completed. This is an Ajax Event. + * + * @param handler The function to be invoked. + */ + ajaxStop(handler: () => any): JQuery; + /** + * Attach a function to be executed whenever an Ajax request completes successfully. This is an Ajax Event. + * + * @param handler The function to be invoked. + */ + ajaxSuccess( + handler: ( + event: JQueryEventObject, + XMLHttpRequest: XMLHttpRequest, + ajaxOptions: JQueryAjaxSettings + ) => any + ): JQuery; + + /** + * Load data from the server and place the returned HTML into the matched element. + * + * @param url A string containing the URL to which the request is sent. + * @param data A plain object or string that is sent to the server with the request. + * @param complete A callback function that is executed when the request completes. + */ + load( + url: string, + data?: string | Object, + complete?: ( + responseText: string, + textStatus: string, + XMLHttpRequest: XMLHttpRequest + ) => any + ): JQuery; + + /** + * Encode a set of form elements as a string for submission. + */ + serialize(_: void): string; + /** + * Encode a set of form elements as an array of names and values. + */ + serializeArray(_: void): JQuerySerializeArrayElement[]; + + /** + * Adds the specified class(es: any) to each of the set of matched elements. + * + * @param function A function returning one or more s: anypace-separated class names to be added to the existing class name(s). Receives the index position of the element in the set and the existing class name(s) as arguments. Within the function, this refers to the current element in the set. + */ + addClass(func: (index: number, className: string) => string): JQuery; + /** + * Adds the specified class(es: any) to each of the set of matched elements. + * + * @param className One or more space-separated classes to be added to the class attribute of each matched element. + */ + addClass(className: string): JQuery; + + /** + * Add the previous set of elements on the stack to the current set, optionally filtered by a selector. + */ + addBack(selector?: string): JQuery; + + /** + * Set one or more attributes for the set of matched elements. + * + * @param attributeName The name of the attribute to set. + * @param func A function returning the value to set. this is the current element. Receives the index position of the element in the set and the old attribute value as arguments. + */ + attr( + attributeName: string, + func: (index: number, attr: string) => string | number + ): JQuery; + /** + * Set one or more attributes for the set of matched elements. + * + * @param attributeName The name of the attribute to set. + * @param value A value to set for the attribute. + */ + attr(attributeName: string, value: string | number): JQuery; + /** + * Set one or more attributes for the set of matched elements. + * + * @param attributes An object of attribute-value pairs to set. + */ + attr(attributes: Object): JQuery; + /** + * Get the value of an attribute for the first element in the set of matched elements. + * + * @param attributeName The name of the attribute to get. + */ + attr(attributeName: string, _: void): string; + + /** + * Determine whether any of the matched elements are assigned the given class. + * + * @param className The class name to search for. + */ + hasClass(className: string): boolean; + + /** + * Set the HTML contents of each element in the set of matched elements. + * + * @param func A function returning the HTML content to set. Receives the index position of the element in the set and the old HTML value as arguments. jQuery empties the element before calling the function; use the oldhtml argument to reference the previous content. Within the function, this refers to the current element in the set. + */ + html(func: (index: number, oldhtml: string) => string): JQuery; + /** + * Set the HTML contents of each element in the set of matched elements. + * + * @param htmlString A string of HTML to set as the content of each matched element. + */ + html(htmlString: string): JQuery; + /** + * Get the HTML contents of the first element in the set of matched elements. + */ + html(_: void): string; + + /** + * Get the value of a property for the first element in the set of matched elements. + * + * @param propertyName The name of the property to get. + */ + prop(propertyName: string): any; + /** + * Set one or more properties for the set of matched elements. + * + * @param propertyName The name of the property to set. + * @param value A value to set for the property. + */ + prop(propertyName: string, value: string | number | boolean): JQuery; + /** + * Set one or more properties for the set of matched elements. + * + * @param properties An object of property-value pairs to set. + */ + prop(properties: Object): JQuery; + /** + * Set one or more properties for the set of matched elements. + * + * @param propertyName The name of the property to set. + * @param func A function returning the value to set. Receives the index position of the element in the set and the old property value as arguments. Within the function, the keyword this refers to the current element. + */ + prop( + propertyName: string, + func: (index: number, oldPropertyValue: any) => any + ): JQuery; + + /** + * Remove an attribute from each element in the set of matched elements. + * + * @param attributeName An attribute to remove; as of version 1.7, it can be a space-separated list of attributes. + */ + removeAttr(attributeName: string): JQuery; + + /** + * Remove a single class, multiple classes, or all classes from each element in the set of matched elements. + * + * @param className One or more space-separated classes to be removed from the class attribute of each matched element. + */ + removeClass(className?: string): JQuery; + /** + * Remove a single class, multiple classes, or all classes from each element in the set of matched elements. + * + * @param function A function returning one or more space-separated class names to be removed. Receives the index position of the element in the set and the old class value as arguments. + */ + removeClass(func: (index: number, className: string) => string): JQuery; + + /** + * Remove a property for the set of matched elements. + * + * @param propertyName The name of the property to remove. + */ + removeProp(propertyName: string): JQuery; + + /** + * Add or remove one or more classes from each element in the set of matched elements, depending on either the class's presence or the value of the switch argument. + * + * @param className One or more class names (separated by spaces) to be toggled for each element in the matched set. + * @param swtch A Boolean (not just truthy/falsy) value to determine whether the class should be added or removed. + */ + toggleClass(className: string, swtch?: boolean): JQuery; + /** + * Add or remove one or more classes from each element in the set of matched elements, depending on either the class's presence or the value of the switch argument. + * + * @param swtch A boolean value to determine whether the class should be added or removed. + */ + toggleClass(swtch?: boolean, _: void): JQuery; + /** + * Add or remove one or more classes from each element in the set of matched elements, depending on either the class's presence or the value of the switch argument. + * + * @param func A function that returns class names to be toggled in the class attribute of each element in the matched set. Receives the index position of the element in the set, the old class value, and the switch as arguments. + * @param swtch A boolean value to determine whether the class should be added or removed. + */ + toggleClass( + func: (index: number, className: string, swtch: boolean) => string, + swtch?: boolean + ): JQuery; + + /** + * Get the current value of the first element in the set of matched elements. + */ + val(_: void): any; + /** + * Set the value of each element in the set of matched elements. + * + * @param value A string of text, an array of strings or number corresponding to the value of each matched element to set as selected/checked. + */ + val(value: string | string[] | number): JQuery; + /** + * Set the value of each element in the set of matched elements. + * + * @param func A function returning the value to set. this is the current element. Receives the index position of the element in the set and the old value as arguments. + */ + val(func: (index: number, value: string) => string): JQuery; + + /** + * Set one or more CSS properties for the set of matched elements. + * + * @param propertyName A CSS property name. + * @param value A function returning the value to set. this is the current element. Receives the index position of the element in the set and the old value as arguments. + */ + css( + propertyName: string, + value: (index: number, value: string) => string | number + ): JQuery; + /** + * Set one or more CSS properties for the set of matched elements. + * + * @param propertyName A CSS property name. + * @param value A value to set for the property. + */ + css(propertyName: string, value: string | number): JQuery; + /** + * Set one or more CSS properties for the set of matched elements. + * + * @param properties An object of property-value pairs to set. + */ + css(properties: Object): JQuery; + /** + * Get the value of style properties for the first element in the set of matched elements. + * + * @param propertyName A CSS property. + */ + css(propertyName: string, _: void): string; + + /** + * Get the current computed height for the first element in the set of matched elements. + */ + height(_: void): number; + /** + * Set the CSS height of every matched element. + * + * @param value An integer representing the number of pixels, or an integer with an optional unit of measure appended (as a string). + */ + height(value: number | string): JQuery; + /** + * Set the CSS height of every matched element. + * + * @param func A function returning the height to set. Receives the index position of the element in the set and the old height as arguments. Within the function, this refers to the current element in the set. + */ + height(func: (index: number, height: number) => number | string): JQuery; + + /** + * Get the current computed height for the first element in the set of matched elements, including padding but not border. + */ + innerHeight(_: void): number; + + /** + * Sets the inner height on elements in the set of matched elements, including padding but not border. + * + * @param value An integer representing the number of pixels, or an integer along with an optional unit of measure appended (as a string). + */ + innerHeight(height: number | string): JQuery; + + /** + * Get the current computed width for the first element in the set of matched elements, including padding but not border. + */ + innerWidth(_: void): number; + + /** + * Sets the inner width on elements in the set of matched elements, including padding but not border. + * + * @param value An integer representing the number of pixels, or an integer along with an optional unit of measure appended (as a string). + */ + innerWidth(width: number | string): JQuery; + + /** + * Get the current coordinates of the first element in the set of matched elements, relative to the document. + */ + offset(_: void): JQueryCoordinates; + /** + * An object containing the properties top and left, which are integers indicating the new top and left coordinates for the elements. + * + * @param coordinates An object containing the properties top and left, which are integers indicating the new top and left coordinates for the elements. + */ + offset(coordinates: JQueryCoordinates): JQuery; + /** + * An object containing the properties top and left, which are integers indicating the new top and left coordinates for the elements. + * + * @param func A function to return the coordinates to set. Receives the index of the element in the collection as the first argument and the current coordinates as the second argument. The function should return an object with the new top and left properties. + */ + offset( + func: (index: number, coords: JQueryCoordinates) => JQueryCoordinates + ): JQuery; + + /** + * Get the current computed height for the first element in the set of matched elements, including padding, border, and optionally margin. Returns an integer (without "px") representation of the value or null if called on an empty set of elements. + * + * @param includeMargin A Boolean indicating whether to include the element's margin in the calculation. + */ + outerHeight(includeMargin?: boolean): number; + + /** + * Sets the outer height on elements in the set of matched elements, including padding and border. + * + * @param value An integer representing the number of pixels, or an integer along with an optional unit of measure appended (as a string). + */ + outerHeight(height: number | string): JQuery; + + /** + * Get the current computed width for the first element in the set of matched elements, including padding and border. + * + * @param includeMargin A Boolean indicating whether to include the element's margin in the calculation. + */ + outerWidth(includeMargin?: boolean): number; + + /** + * Sets the outer width on elements in the set of matched elements, including padding and border. + * + * @param value An integer representing the number of pixels, or an integer along with an optional unit of measure appended (as a string). + */ + outerWidth(width: number | string): JQuery; + + /** + * Get the current coordinates of the first element in the set of matched elements, relative to the offset parent. + */ + position(_: void): JQueryCoordinates; + + /** + * Get the current horizontal position of the scroll bar for the first element in the set of matched elements or set the horizontal position of the scroll bar for every matched element. + */ + scrollLeft(_: void): number; + /** + * Set the current horizontal position of the scroll bar for each of the set of matched elements. + * + * @param value An integer indicating the new position to set the scroll bar to. + */ + scrollLeft(value: number): JQuery; + + /** + * Get the current vertical position of the scroll bar for the first element in the set of matched elements or set the vertical position of the scroll bar for every matched element. + */ + scrollTop(_: void): number; + /** + * Set the current vertical position of the scroll bar for each of the set of matched elements. + * + * @param value An integer indicating the new position to set the scroll bar to. + */ + scrollTop(value: number): JQuery; + + /** + * Get the current computed width for the first element in the set of matched elements. + */ + width(_: void): number; + /** + * Set the CSS width of each element in the set of matched elements. + * + * @param value An integer representing the number of pixels, or an integer along with an optional unit of measure appended (as a string). + */ + width(value: number | string): JQuery; + /** + * Set the CSS width of each element in the set of matched elements. + * + * @param func A function returning the width to set. Receives the index position of the element in the set and the old width as arguments. Within the function, this refers to the current element in the set. + */ + width(func: (index: number, width: number) => number | string): JQuery; + + /** + * Remove from the queue all items that have not yet been run. + * + * @param queueName A string containing the name of the queue. Defaults to fx, the standard effects queue. + */ + clearQueue(queueName?: string): JQuery; + + /** + * Return the value: any at the named data store for the first element in the jQuery collection, as set by data(name, value) or by an HTML5 data-* attribute. + * + * @param key Name of the data stored. + */ + data(key: string, _: void): any; + /** + * Store arbitrary data associated with the matched elements. + * + * @param key A string naming the piece of data to set. + * @param value The new data value; it can be any Javascript type including Array or Object. + */ + data(key: string, value: any): JQuery; + /** + * Store arbitrary data associated with the matched elements. + * + * @param obj An object of key-value pairs of data to update. + */ + data(obj: { + [key: string]: any + }): JQuery; + /** + * Return the value: any at the named data store for the first element in the jQuery collection, as set by data(name, value) or by an HTML5 data-* attribute. + */ + data(_: void): any; + + /** + * Execute the next function on the queue for the matched elements. + * + * @param queueName A string containing the name of the queue. Defaults to fx, the standard effects queue. + */ + dequeue(queueName?: string): JQuery; + + /** + * Remove a previously-stored piece of data. + * + * @param name A string naming the piece of data to delete or space-separated string naming the pieces of data to delete. + */ + removeData(name: string): JQuery; + /** + * Remove a previously-stored piece of data. + * + * @param list An array of strings naming the pieces of data to delete. + */ + removeData(list: string[]): JQuery; + /** + * Remove all previously-stored piece of data. + */ + removeData(_: void): JQuery; + + /** + * Return a Promise object to observe when all actions of a certain type bound to the collection, queued or not, have finished. + * + * @param type The type of queue that needs to be observed. (default: fx) + * @param target Object onto which the promise methods have to be attached + */ + promise(type?: string, target?: Object): JQueryPromise; + + /** + * Perform a custom animation of a set of CSS properties. + * + * @param properties An object of CSS properties and values that the animation will move toward. + * @param duration A string or number determining how long the animation will run. + * @param complete A function to call once the animation is complete. + */ + animate( + properties: Object, + duration?: string | number, + complete?: Function + ): JQuery; + /** + * Perform a custom animation of a set of CSS properties. + * + * @param properties An object of CSS properties and values that the animation will move toward. + * @param duration A string or number determining how long the animation will run. + * @param easing A string indicating which easing function to use for the transition. (default: swing) + * @param complete A function to call once the animation is complete. + */ + animate( + properties: Object, + duration?: string | number, + easing?: string, + complete?: Function + ): JQuery; + /** + * Perform a custom animation of a set of CSS properties. + * + * @param properties An object of CSS properties and values that the animation will move toward. + * @param options A map of additional options to pass to the method. + */ + animate(properties: Object, options: JQueryAnimationOptions): JQuery; + + /** + * Set a timer to delay execution of subsequent items in the queue. + * + * @param duration An integer indicating the number of milliseconds to delay execution of the next item in the queue. + * @param queueName A string containing the name of the queue. Defaults to fx, the standard effects queue. + */ + delay(duration: number, queueName?: string): JQuery; + + /** + * Display the matched elements by fading them to opaque. + * + * @param duration A string or number determining how long the animation will run. + * @param complete A function to call once the animation is complete. + */ + fadeIn(duration?: number | string, complete?: Function): JQuery; + /** + * Display the matched elements by fading them to opaque. + * + * @param duration A string or number determining how long the animation will run. + * @param easing A string indicating which easing function to use for the transition. + * @param complete A function to call once the animation is complete. + */ + fadeIn( + duration?: number | string, + easing?: string, + complete?: Function + ): JQuery; + /** + * Display the matched elements by fading them to opaque. + * + * @param options A map of additional options to pass to the method. + */ + fadeIn(options: JQueryAnimationOptions): JQuery; + + /** + * Hide the matched elements by fading them to transparent. + * + * @param duration A string or number determining how long the animation will run. + * @param complete A function to call once the animation is complete. + */ + fadeOut(duration?: number | string, complete?: Function): JQuery; + /** + * Hide the matched elements by fading them to transparent. + * + * @param duration A string or number determining how long the animation will run. + * @param easing A string indicating which easing function to use for the transition. + * @param complete A function to call once the animation is complete. + */ + fadeOut( + duration?: number | string, + easing?: string, + complete?: Function + ): JQuery; + /** + * Hide the matched elements by fading them to transparent. + * + * @param options A map of additional options to pass to the method. + */ + fadeOut(options: JQueryAnimationOptions): JQuery; + + /** + * Adjust the opacity of the matched elements. + * + * @param duration A string or number determining how long the animation will run. + * @param opacity A number between 0 and 1 denoting the target opacity. + * @param complete A function to call once the animation is complete. + */ + fadeTo( + duration: string | number, + opacity: number, + complete?: Function + ): JQuery; + /** + * Adjust the opacity of the matched elements. + * + * @param duration A string or number determining how long the animation will run. + * @param opacity A number between 0 and 1 denoting the target opacity. + * @param easing A string indicating which easing function to use for the transition. + * @param complete A function to call once the animation is complete. + */ + fadeTo( + duration: string | number, + opacity: number, + easing?: string, + complete?: Function + ): JQuery; + + /** + * Display or hide the matched elements by animating their opacity. + * + * @param duration A string or number determining how long the animation will run. + * @param complete A function to call once the animation is complete. + */ + fadeToggle(duration?: number | string, complete?: Function): JQuery; + /** + * Display or hide the matched elements by animating their opacity. + * + * @param duration A string or number determining how long the animation will run. + * @param easing A string indicating which easing function to use for the transition. + * @param complete A function to call once the animation is complete. + */ + fadeToggle( + duration?: number | string, + easing?: string, + complete?: Function + ): JQuery; + /** + * Display or hide the matched elements by animating their opacity. + * + * @param options A map of additional options to pass to the method. + */ + fadeToggle(options: JQueryAnimationOptions): JQuery; + + /** + * Stop the currently-running animation, remove all queued animations, and complete all animations for the matched elements. + * + * @param queue The name of the queue in which to stop animations. + */ + finish(queue?: string): JQuery; + + /** + * Hide the matched elements. + * + * @param duration A string or number determining how long the animation will run. + * @param complete A function to call once the animation is complete. + */ + hide(duration?: number | string, complete?: Function): JQuery; + /** + * Hide the matched elements. + * + * @param duration A string or number determining how long the animation will run. + * @param easing A string indicating which easing function to use for the transition. + * @param complete A function to call once the animation is complete. + */ + hide( + duration?: number | string, + easing?: string, + complete?: Function + ): JQuery; + /** + * Hide the matched elements. + * + * @param options A map of additional options to pass to the method. + */ + hide(options: JQueryAnimationOptions): JQuery; + + /** + * Display the matched elements. + * + * @param duration A string or number determining how long the animation will run. + * @param complete A function to call once the animation is complete. + */ + show(duration?: number | string, complete?: Function): JQuery; + /** + * Display the matched elements. + * + * @param duration A string or number determining how long the animation will run. + * @param easing A string indicating which easing function to use for the transition. + * @param complete A function to call once the animation is complete. + */ + show( + duration?: number | string, + easing?: string, + complete?: Function + ): JQuery; + /** + * Display the matched elements. + * + * @param options A map of additional options to pass to the method. + */ + show(options: JQueryAnimationOptions): JQuery; + + /** + * Display the matched elements with a sliding motion. + * + * @param duration A string or number determining how long the animation will run. + * @param complete A function to call once the animation is complete. + */ + slideDown(duration?: number | string, complete?: Function): JQuery; + /** + * Display the matched elements with a sliding motion. + * + * @param duration A string or number determining how long the animation will run. + * @param easing A string indicating which easing function to use for the transition. + * @param complete A function to call once the animation is complete. + */ + slideDown( + duration?: number | string, + easing?: string, + complete?: Function + ): JQuery; + /** + * Display the matched elements with a sliding motion. + * + * @param options A map of additional options to pass to the method. + */ + slideDown(options: JQueryAnimationOptions): JQuery; + + /** + * Display or hide the matched elements with a sliding motion. + * + * @param duration A string or number determining how long the animation will run. + * @param complete A function to call once the animation is complete. + */ + slideToggle(duration?: number | string, complete?: Function): JQuery; + /** + * Display or hide the matched elements with a sliding motion. + * + * @param duration A string or number determining how long the animation will run. + * @param easing A string indicating which easing function to use for the transition. + * @param complete A function to call once the animation is complete. + */ + slideToggle( + duration?: number | string, + easing?: string, + complete?: Function + ): JQuery; + /** + * Display or hide the matched elements with a sliding motion. + * + * @param options A map of additional options to pass to the method. + */ + slideToggle(options: JQueryAnimationOptions): JQuery; + + /** + * Hide the matched elements with a sliding motion. + * + * @param duration A string or number determining how long the animation will run. + * @param complete A function to call once the animation is complete. + */ + slideUp(duration?: number | string, complete?: Function): JQuery; + /** + * Hide the matched elements with a sliding motion. + * + * @param duration A string or number determining how long the animation will run. + * @param easing A string indicating which easing function to use for the transition. + * @param complete A function to call once the animation is complete. + */ + slideUp( + duration?: number | string, + easing?: string, + complete?: Function + ): JQuery; + /** + * Hide the matched elements with a sliding motion. + * + * @param options A map of additional options to pass to the method. + */ + slideUp(options: JQueryAnimationOptions): JQuery; + + /** + * Stop the currently-running animation on the matched elements. + * + * @param clearQueue A Boolean indicating whether to remove queued animation as well. Defaults to false. + * @param jumpToEnd A Boolean indicating whether to complete the current animation immediately. Defaults to false. + */ + stop(clearQueue?: boolean, jumpToEnd?: boolean): JQuery; + /** + * Stop the currently-running animation on the matched elements. + * + * @param queue The name of the queue in which to stop animations. + * @param clearQueue A Boolean indicating whether to remove queued animation as well. Defaults to false. + * @param jumpToEnd A Boolean indicating whether to complete the current animation immediately. Defaults to false. + */ + stop(queue?: string, clearQueue?: boolean, jumpToEnd?: boolean): JQuery; + + /** + * Display or hide the matched elements. + * + * @param duration A string or number determining how long the animation will run. + * @param complete A function to call once the animation is complete. + */ + toggle(duration?: number | string, complete?: Function): JQuery; + /** + * Display or hide the matched elements. + * + * @param duration A string or number determining how long the animation will run. + * @param easing A string indicating which easing function to use for the transition. + * @param complete A function to call once the animation is complete. + */ + toggle( + duration?: number | string, + easing?: string, + complete?: Function + ): JQuery; + /** + * Display or hide the matched elements. + * + * @param options A map of additional options to pass to the method. + */ + toggle(options: JQueryAnimationOptions): JQuery; + /** + * Display or hide the matched elements. + * + * @param showOrHide A Boolean indicating whether to show or hide the elements. + */ + toggle(showOrHide: boolean): JQuery; + + /** + * Attach a handler to an event for the elements. + * + * @param eventType A string containing one or more DOM event types, such as "click" or "submit," or custom event names. + * @param eventData An object containing data that will be passed to the event handler. + * @param handler A function to execute each time the event is triggered. + */ + bind( + eventType: string, + eventData: any, + handler: (eventObject: JQueryEventObject) => any + ): JQuery; + /** + * Attach a handler to an event for the elements. + * + * @param eventType A string containing one or more DOM event types, such as "click" or "submit," or custom event names. + * @param handler A function to execute each time the event is triggered. + */ + bind( + eventType: string, + handler: (eventObject: JQueryEventObject) => any + ): JQuery; + /** + * Attach a handler to an event for the elements. + * + * @param eventType A string containing one or more DOM event types, such as "click" or "submit," or custom event names. + * @param eventData An object containing data that will be passed to the event handler. + * @param preventBubble Setting the third argument to false will attach a function that prevents the default action from occurring and stops the event from bubbling. The default is true. + */ + bind(eventType: string, eventData: any, preventBubble: boolean): JQuery; + /** + * Attach a handler to an event for the elements. + * + * @param eventType A string containing one or more DOM event types, such as "click" or "submit," or custom event names. + * @param preventBubble Setting the third argument to false will attach a function that prevents the default action from occurring and stops the event from bubbling. The default is true. + */ + bind(eventType: string, preventBubble: boolean): JQuery; + /** + * Attach a handler to an event for the elements. + * + * @param events An object containing one or more DOM event types and functions to execute for them. + */ + bind(events: any, _: void): JQuery; + + /** + * Trigger the "blur" event on an element + */ + blur(_: void): JQuery; + /** + * Bind an event handler to the "blur" JavaScript event + * + * @param handler A function to execute each time the event is triggered. + */ + blur(handler: (eventObject: JQueryEventObject) => any): JQuery; + /** + * Bind an event handler to the "blur" JavaScript event + * + * @param eventData An object containing data that will be passed to the event handler. + * @param handler A function to execute each time the event is triggered. + */ + blur( + eventData: any, + handler: (eventObject: JQueryEventObject) => any + ): JQuery; + + /** + * Trigger the "change" event on an element. + */ + change(_: void): JQuery; + /** + * Bind an event handler to the "change" JavaScript event + * + * @param handler A function to execute each time the event is triggered. + */ + change(handler: (eventObject: JQueryEventObject) => any): JQuery; + /** + * Bind an event handler to the "change" JavaScript event + * + * @param eventData An object containing data that will be passed to the event handler. + * @param handler A function to execute each time the event is triggered. + */ + change( + eventData: any, + handler: (eventObject: JQueryEventObject) => any + ): JQuery; + + /** + * Trigger the "click" event on an element. + */ + click(_: void): JQuery; + /** + * Bind an event handler to the "click" JavaScript event + * + * @param eventData An object containing data that will be passed to the event handler. + */ + click(handler: (eventObject: JQueryEventObject) => any): JQuery; + /** + * Bind an event handler to the "click" JavaScript event + * + * @param eventData An object containing data that will be passed to the event handler. + * @param handler A function to execute each time the event is triggered. + */ + click( + eventData: any, + handler: (eventObject: JQueryEventObject) => any + ): JQuery; + + /** + * Trigger the "dblclick" event on an element. + */ + dblclick(_: void): JQuery; + /** + * Bind an event handler to the "dblclick" JavaScript event + * + * @param handler A function to execute each time the event is triggered. + */ + dblclick(handler: (eventObject: JQueryEventObject) => any): JQuery; + /** + * Bind an event handler to the "dblclick" JavaScript event + * + * @param eventData An object containing data that will be passed to the event handler. + * @param handler A function to execute each time the event is triggered. + */ + dblclick( + eventData: any, + handler: (eventObject: JQueryEventObject) => any + ): JQuery; + + delegate( + selector: any, + eventType: string, + handler: (eventObject: JQueryEventObject) => any + ): JQuery; + delegate( + selector: any, + eventType: string, + eventData: any, + handler: (eventObject: JQueryEventObject) => any + ): JQuery; + + /** + * Trigger the "focus" event on an element. + */ + focus(_: void): JQuery; + /** + * Bind an event handler to the "focus" JavaScript event + * + * @param handler A function to execute each time the event is triggered. + */ + focus(handler: (eventObject: JQueryEventObject) => any): JQuery; + /** + * Bind an event handler to the "focus" JavaScript event + * + * @param eventData An object containing data that will be passed to the event handler. + * @param handler A function to execute each time the event is triggered. + */ + focus( + eventData: any, + handler: (eventObject: JQueryEventObject) => any + ): JQuery; + + /** + * Trigger the "focusin" event on an element. + */ + focusin(_: void): JQuery; + /** + * Bind an event handler to the "focusin" JavaScript event + * + * @param handler A function to execute each time the event is triggered. + */ + focusin(handler: (eventObject: JQueryEventObject) => any): JQuery; + /** + * Bind an event handler to the "focusin" JavaScript event + * + * @param eventData An object containing data that will be passed to the event handler. + * @param handler A function to execute each time the event is triggered. + */ + focusin( + eventData: Object, + handler: (eventObject: JQueryEventObject) => any + ): JQuery; + + /** + * Trigger the "focusout" event on an element. + */ + focusout(_: void): JQuery; + /** + * Bind an event handler to the "focusout" JavaScript event + * + * @param handler A function to execute each time the event is triggered. + */ + focusout(handler: (eventObject: JQueryEventObject) => any): JQuery; + /** + * Bind an event handler to the "focusout" JavaScript event + * + * @param eventData An object containing data that will be passed to the event handler. + * @param handler A function to execute each time the event is triggered. + */ + focusout( + eventData: Object, + handler: (eventObject: JQueryEventObject) => any + ): JQuery; + + /** + * Bind two handlers to the matched elements, to be executed when the mouse pointer enters and leaves the elements. + * + * @param handlerIn A function to execute when the mouse pointer enters the element. + * @param handlerOut A function to execute when the mouse pointer leaves the element. + */ + hover( + handlerIn: (eventObject: JQueryEventObject) => any, + handlerOut: (eventObject: JQueryEventObject) => any + ): JQuery; + /** + * Bind a single handler to the matched elements, to be executed when the mouse pointer enters or leaves the elements. + * + * @param handlerInOut A function to execute when the mouse pointer enters or leaves the element. + */ + hover(handlerInOut: (eventObject: JQueryEventObject) => any, _: void): JQuery; + + /** + * Trigger the "keydown" event on an element. + */ + keydown(_: void): JQuery; + /** + * Bind an event handler to the "keydown" JavaScript event + * + * @param handler A function to execute each time the event is triggered. + */ + keydown(handler: (eventObject: JQueryKeyEventObject) => any): JQuery; + /** + * Bind an event handler to the "keydown" JavaScript event + * + * @param eventData An object containing data that will be passed to the event handler. + * @param handler A function to execute each time the event is triggered. + */ + keydown( + eventData: any, + handler: (eventObject: JQueryKeyEventObject) => any + ): JQuery; + + /** + * Trigger the "keypress" event on an element. + */ + keypress(_: void): JQuery; + /** + * Bind an event handler to the "keypress" JavaScript event + * + * @param handler A function to execute each time the event is triggered. + */ + keypress(handler: (eventObject: JQueryKeyEventObject) => any): JQuery; + /** + * Bind an event handler to the "keypress" JavaScript event + * + * @param eventData An object containing data that will be passed to the event handler. + * @param handler A function to execute each time the event is triggered. + */ + keypress( + eventData: any, + handler: (eventObject: JQueryKeyEventObject) => any + ): JQuery; + + /** + * Trigger the "keyup" event on an element. + */ + keyup(_: void): JQuery; + /** + * Bind an event handler to the "keyup" JavaScript event + * + * @param handler A function to execute each time the event is triggered. + */ + keyup(handler: (eventObject: JQueryKeyEventObject) => any): JQuery; + /** + * Bind an event handler to the "keyup" JavaScript event + * + * @param eventData An object containing data that will be passed to the event handler. + * @param handler A function to execute each time the event is triggered. + */ + keyup( + eventData: any, + handler: (eventObject: JQueryKeyEventObject) => any + ): JQuery; + + /** + * Bind an event handler to the "load" JavaScript event. + * + * @param handler A function to execute when the event is triggered. + */ + load(handler: (eventObject: JQueryEventObject) => any): JQuery; + /** + * Bind an event handler to the "load" JavaScript event. + * + * @param eventData An object containing data that will be passed to the event handler. + * @param handler A function to execute when the event is triggered. + */ + load( + eventData: any, + handler: (eventObject: JQueryEventObject) => any + ): JQuery; + + /** + * Trigger the "mousedown" event on an element. + */ + mousedown(_: void): JQuery; + /** + * Bind an event handler to the "mousedown" JavaScript event. + * + * @param handler A function to execute when the event is triggered. + */ + mousedown(handler: (eventObject: JQueryMouseEventObject) => any): JQuery; + /** + * Bind an event handler to the "mousedown" JavaScript event. + * + * @param eventData An object containing data that will be passed to the event handler. + * @param handler A function to execute when the event is triggered. + */ + mousedown( + eventData: Object, + handler: (eventObject: JQueryMouseEventObject) => any + ): JQuery; + + /** + * Trigger the "mouseenter" event on an element. + */ + mouseenter(_: void): JQuery; + /** + * Bind an event handler to be fired when the mouse enters an element. + * + * @param handler A function to execute when the event is triggered. + */ + mouseenter(handler: (eventObject: JQueryMouseEventObject) => any): JQuery; + /** + * Bind an event handler to be fired when the mouse enters an element. + * + * @param eventData An object containing data that will be passed to the event handler. + * @param handler A function to execute when the event is triggered. + */ + mouseenter( + eventData: Object, + handler: (eventObject: JQueryMouseEventObject) => any + ): JQuery; + + /** + * Trigger the "mouseleave" event on an element. + */ + mouseleave(_: void): JQuery; + /** + * Bind an event handler to be fired when the mouse leaves an element. + * + * @param handler A function to execute when the event is triggered. + */ + mouseleave(handler: (eventObject: JQueryMouseEventObject) => any): JQuery; + /** + * Bind an event handler to be fired when the mouse leaves an element. + * + * @param eventData An object containing data that will be passed to the event handler. + * @param handler A function to execute when the event is triggered. + */ + mouseleave( + eventData: Object, + handler: (eventObject: JQueryMouseEventObject) => any + ): JQuery; + + /** + * Trigger the "mousemove" event on an element. + */ + mousemove(_: void): JQuery; + /** + * Bind an event handler to the "mousemove" JavaScript event. + * + * @param handler A function to execute when the event is triggered. + */ + mousemove(handler: (eventObject: JQueryMouseEventObject) => any): JQuery; + /** + * Bind an event handler to the "mousemove" JavaScript event. + * + * @param eventData An object containing data that will be passed to the event handler. + * @param handler A function to execute when the event is triggered. + */ + mousemove( + eventData: Object, + handler: (eventObject: JQueryMouseEventObject) => any + ): JQuery; + + /** + * Trigger the "mouseout" event on an element. + */ + mouseout(_: void): JQuery; + /** + * Bind an event handler to the "mouseout" JavaScript event. + * + * @param handler A function to execute when the event is triggered. + */ + mouseout(handler: (eventObject: JQueryMouseEventObject) => any): JQuery; + /** + * Bind an event handler to the "mouseout" JavaScript event. + * + * @param eventData An object containing data that will be passed to the event handler. + * @param handler A function to execute when the event is triggered. + */ + mouseout( + eventData: Object, + handler: (eventObject: JQueryMouseEventObject) => any + ): JQuery; + + /** + * Trigger the "mouseover" event on an element. + */ + mouseover(_: void): JQuery; + /** + * Bind an event handler to the "mouseover" JavaScript event. + * + * @param handler A function to execute when the event is triggered. + */ + mouseover(handler: (eventObject: JQueryMouseEventObject) => any): JQuery; + /** + * Bind an event handler to the "mouseover" JavaScript event. + * + * @param eventData An object containing data that will be passed to the event handler. + * @param handler A function to execute when the event is triggered. + */ + mouseover( + eventData: Object, + handler: (eventObject: JQueryMouseEventObject) => any + ): JQuery; + + /** + * Trigger the "mouseup" event on an element. + */ + mouseup(_: void): JQuery; + /** + * Bind an event handler to the "mouseup" JavaScript event. + * + * @param handler A function to execute when the event is triggered. + */ + mouseup(handler: (eventObject: JQueryMouseEventObject) => any): JQuery; + /** + * Bind an event handler to the "mouseup" JavaScript event. + * + * @param eventData An object containing data that will be passed to the event handler. + * @param handler A function to execute when the event is triggered. + */ + mouseup( + eventData: Object, + handler: (eventObject: JQueryMouseEventObject) => any + ): JQuery; + + /** + * Remove an event handler. + */ + off(_: void): JQuery; + /** + * Remove an event handler. + * + * @param events One or more space-separated event types and optional namespaces, or just namespaces, such as "click", "keydown.myPlugin", or ".myPlugin". + */ + off(events: string): JQuery; + /** + * Remove an event handler. + * + * @param events One or more space-separated event types and optional namespaces, or just namespaces, such as "click", "keydown.myPlugin", or ".myPlugin". + * @param selector A selector which should match the one originally passed to .on() when attaching event handlers. + * @param handler A handler function previous: anyly attached for the event(s), or the special value false. + */ + off( + events: string, + selector: string, + handler: (eventObject: JQueryEventObject) => any + ): JQuery; + /** + * Remove an event handler. + * + * @param events One or more space-separated event types and optional namespaces, or just namespaces, such as "click", "keydown.myPlugin", or ".myPlugin". + * @param selector A selector which should match the one originally passed to .on() when attaching event handlers. + */ + off( + events: string, + selector: string + ): JQuery; + /** + * Remove an event handler. + * + * @param events One or more space-separated event types and optional namespaces, or just namespaces, such as "click", "keydown.myPlugin", or ".myPlugin". + * @param handler A handler function previous: anyly attached for the event(s), or the special value false. Takes handler with extra args that can be attached with on(). + */ + off( + events: string, + handler: (eventObject: JQueryEventObject, ...args: any[]) => any + ): JQuery; + /** + * Remove an event handler. + * + * @param events: any An object where the string keys represent one or more space-separated event types and optional namespaces, and the values represent handler functions previously attached for the event(s). + * @param selector A selector which should match the one originally passed to .on() when attaching event handlers. + */ + off( + events: { + [key: string]: any + }, + selector?: string + ): JQuery; + + /** + * Attach an event handler function for one or more events to the selected elements. + * + * @param events One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin". + * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false. Rest parameter args is for optional parameters passed to jQuery.trigger(). Note that the actual parameters on the event handler function must be marked as optional (? syntax). + */ + on( + events: string, + handler: (eventObject: JQueryEventObject, ...args: any[]) => any + ): JQuery; + /** + * Attach an event handler function for one or more events to the selected elements. + * + * @param events One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin". + * @param data Data to be passed to the handler in event.data when an event is triggered. + * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false. + */ + on( + events: string, + data: any, + handler: (eventObject: JQueryEventObject, ...args: any[]) => any + ): JQuery; + /** + * Attach an event handler function for one or more events to the selected elements. + * + * @param events One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin". + * @param selector A selector string to filter the descendants of the selected elements that trigger the event. If the selector is null or omitted, the event is always triggered when it reaches the selected element. + * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false. + */ + on( + events: string, + selector: string, + handler: (eventObject: JQueryEventObject, ...eventData: any[]) => any + ): JQuery; + /** + * Attach an event handler function for one or more events to the selected elements. + * + * @param events One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin". + * @param selector A selector string to filter the descendants of the selected elements that trigger the event. If the selector is null or omitted, the event is always triggered when it reaches the selected element. + * @param data Data to be passed to the handler in event.data when an event is triggered. + * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false. + */ + on( + events: string, + selector: string, + data: any, + handler: (eventObject: JQueryEventObject, ...eventData: any[]) => any + ): JQuery; + /** + * Attach an event handler function for one or more events to the selected elements. + * + * @param events: any An object in which the string keys represent one or more space-separated event types and optional namespaces, and the values represent a handler function to be called for the event(s). + * @param selector A selector string to filter the descendants of the selected elements that will call the handler. If the selector is null or omitted, the handler is always called when it reaches the selected element. + * @param data Data to be passed to the handler in event.data when an event occurs. + */ + on( + events: { + [key: string]: any + }, + selector?: string, + data?: any + ): JQuery; + /** + * Attach an event handler function for one or more events to the selected elements. + * + * @param events: any An object in which the string keys represent one or more space-separated event types and optional namespaces, and the values represent a handler function to be called for the event(s). + * @param data Data to be passed to the handler in event.data when an event occurs. + */ + on( + events: { + [key: string]: any + }, + data?: any + ): JQuery; + + /** + * Attach a handler to an event for the elements. The handler is executed at most once per element per event type. + * + * @param events A string containing one or more JavaScript event types, such as "click" or "submit," or custom event names. + * @param handler A function to execute at the time the event is triggered. + */ + one(events: string, handler: (eventObject: JQueryEventObject) => any): JQuery; + /** + * Attach a handler to an event for the elements. The handler is executed at most once per element per event type. + * + * @param events A string containing one or more JavaScript event types, such as "click" or "submit," or custom event names. + * @param data An object containing data that will be passed to the event handler. + * @param handler A function to execute at the time the event is triggered. + */ + one( + events: string, + data: Object, + handler: (eventObject: JQueryEventObject) => any + ): JQuery; + + /** + * Attach a handler to an event for the elements. The handler is executed at most once per element per event type. + * + * @param events One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin". + * @param selector A selector string to filter the descendants of the selected elements that trigger the event. If the selector is null or omitted, the event is always triggered when it reaches the selected element. + * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false. + */ + one( + events: string, + selector: string, + handler: (eventObject: JQueryEventObject) => any + ): JQuery; + /** + * Attach a handler to an event for the elements. The handler is executed at most once per element per event type. + * + * @param events One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin". + * @param selector A selector string to filter the descendants of the selected elements that trigger the event. If the selector is null or omitted, the event is always triggered when it reaches the selected element. + * @param data Data to be passed to the handler in event.data when an event is triggered. + * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false. + */ + one( + events: string, + selector: string, + data: any, + handler: (eventObject: JQueryEventObject) => any + ): JQuery; + + /** + * Attach a handler to an event for the elements. The handler is executed at most once per element per event type. + * + * @param events: any An object in which the string keys represent one or more space-separated event types and optional namespaces, and the values represent a handler function to be called for the event(s). + * @param selector A selector string to filter the descendants of the selected elements that will call the handler. If the selector is null or omitted, the handler is always called when it reaches the selected element. + * @param data Data to be passed to the handler in event.data when an event occurs. + */ + one( + events: { + [key: string]: any + }, + selector?: string, + data?: any + ): JQuery; + + /** + * Attach a handler to an event for the elements. The handler is executed at most once per element per event type. + * + * @param events: any An object in which the string keys represent one or more space-separated event types and optional namespaces, and the values represent a handler function to be called for the event(s). + * @param data Data to be passed to the handler in event.data when an event occurs. + */ + one( + events: { + [key: string]: any + }, + data?: any + ): JQuery; + + /** + * Specify a function to execute when the DOM is fully loaded. + * + * @param handler A function to execute after the DOM is ready. + */ + ready(handler: (jQueryAlias?: JQueryStatic) => any): JQuery; + + /** + * Trigger the "resize" event on an element. + */ + resize(_: void): JQuery; + /** + * Bind an event handler to the "resize" JavaScript event. + * + * @param handler A function to execute each time the event is triggered. + */ + resize(handler: (eventObject: JQueryEventObject) => any): JQuery; + /** + * Bind an event handler to the "resize" JavaScript event. + * + * @param eventData An object containing data that will be passed to the event handler. + * @param handler A function to execute each time the event is triggered. + */ + resize( + eventData: Object, + handler: (eventObject: JQueryEventObject) => any + ): JQuery; + + /** + * Trigger the "scroll" event on an element. + */ + scroll(_: void): JQuery; + /** + * Bind an event handler to the "scroll" JavaScript event. + * + * @param handler A function to execute each time the event is triggered. + */ + scroll(handler: (eventObject: JQueryEventObject) => any): JQuery; + /** + * Bind an event handler to the "scroll" JavaScript event. + * + * @param eventData An object containing data that will be passed to the event handler. + * @param handler A function to execute each time the event is triggered. + */ + scroll( + eventData: Object, + handler: (eventObject: JQueryEventObject) => any + ): JQuery; + + /** + * Trigger the "select" event on an element. + */ + select(_: void): JQuery; + /** + * Bind an event handler to the "select" JavaScript event. + * + * @param handler A function to execute each time the event is triggered. + */ + select(handler: (eventObject: JQueryEventObject) => any): JQuery; + /** + * Bind an event handler to the "select" JavaScript event. + * + * @param eventData An object containing data that will be passed to the event handler. + * @param handler A function to execute each time the event is triggered. + */ + select( + eventData: Object, + handler: (eventObject: JQueryEventObject) => any + ): JQuery; + + /** + * Trigger the "submit" event on an element. + */ + submit(_: void): JQuery; + /** + * Bind an event handler to the "submit" JavaScript event + * + * @param handler A function to execute each time the event is triggered. + */ + submit(handler: (eventObject: JQueryEventObject) => any): JQuery; + /** + * Bind an event handler to the "submit" JavaScript event + * + * @param eventData An object containing data that will be passed to the event handler. + * @param handler A function to execute each time the event is triggered. + */ + submit( + eventData: any, + handler: (eventObject: JQueryEventObject) => any + ): JQuery; + + /** + * Execute all handlers and behaviors attached to the matched elements for the given event type. + * + * @param eventType A string containing a JavaScript event type, such as click or submit. + * @param extraParameters Additional parameters to pass along to the event handler. + */ + trigger(eventType: string, extraParameters?: any[] | Object): JQuery; + /** + * Execute all handlers and behaviors attached to the matched elements for the given event type. + * + * @param event A jQuery.Event object. + * @param extraParameters Additional parameters to pass along to the event handler. + */ + trigger(event: JQueryEventObject, extraParameters?: any[] | Object): JQuery; + + /** + * Execute all handlers attached to an element for an event. + * + * @param eventType A string containing a JavaScript event type, such as click or submit. + * @param extraParameters An array of additional parameters to pass along to the event handler. + */ + triggerHandler(eventType: string, ...extraParameters: any[]): Object; + + /** + * Execute all handlers attached to an element for an event. + * + * @param event A jQuery.Event object. + * @param extraParameters An array of additional parameters to pass along to the event handler. + */ + triggerHandler(event: JQueryEventObject, ...extraParameters: any[]): Object; + + /** + * Remove a previously-attached event handler from the elements. + * + * @param eventType A string containing a JavaScript event type, such as click or submit. + * @param handler The function that is to be no longer executed. + */ + unbind( + eventType?: string, + handler?: (eventObject: JQueryEventObject) => any + ): JQuery; + /** + * Remove a previously-attached event handler from the elements. + * + * @param eventType A string containing a JavaScript event type, such as click or submit. + * @param fls Unbinds the corresponding 'return false' function that was bound using .bind( eventType, false ). + */ + unbind(eventType: string, fls: boolean): JQuery; + /** + * Remove a previously-attached event handler from the elements. + * + * @param evt A JavaScript event object as passed to an event handler. + */ + unbind(evt: any): JQuery; + + /** + * Remove a handler from the event for all elements which match the current selector, based upon a specific set of root elements. + */ + undelegate(_: void): JQuery; + /** + * Remove a handler from the event for all elements which match the current selector, based upon a specific set of root elements. + * + * @param selector A selector which will be used to filter the event results. + * @param eventType A string containing a JavaScript event type, such as "click" or "keydown" + * @param handler A function to execute at the time the event is triggered. + */ + undelegate( + selector: string, + eventType: string, + handler?: (eventObject: JQueryEventObject) => any + ): JQuery; + /** + * Remove a handler from the event for all elements which match the current selector, based upon a specific set of root elements. + * + * @param selector A selector which will be used to filter the event results. + * @param events An object of one or more event types and previously bound functions to unbind from them. + */ + undelegate(selector: string, events: Object): JQuery; + /** + * Remove a handler from the event for all elements which match the current selector, based upon a specific set of root elements. + * + * @param namespace A string containing a namespace to unbind all events from. + */ + undelegate(namespace: string): JQuery; + + /** + * Bind an event handler to the "unload" JavaScript event. (DEPRECATED from v1.8) + * + * @param handler A function to execute when the event is triggered. + */ + unload(handler: (eventObject: JQueryEventObject) => any): JQuery; + /** + * Bind an event handler to the "unload" JavaScript event. (DEPRECATED from v1.8) + * + * @param eventData A plain object of data that will be passed to the event handler. + * @param handler A function to execute when the event is triggered. + */ + unload( + eventData: any, + handler: (eventObject: JQueryEventObject) => any + ): JQuery; + + /** + * The DOM node context originally passed to jQuery(); if none was passed then context will likely be the document. (DEPRECATED from v1.10: void; + */ + context: Element; + + jquery: string; + + /** + * Bind an event handler to the "error" JavaScript event. (DEPRECATED from v1.8) + * + * @param handler A function to execute when the event is triggered. + */ + error(handler: (eventObject: JQueryEventObject) => any): JQuery; + /** + * Bind an event handler to the "error" JavaScript event. (DEPRECATED from v1.8) + * + * @param eventData A plain object of data that will be passed to the event handler. + * @param handler A function to execute when the event is triggered. + */ + error( + eventData: any, + handler: (eventObject: JQueryEventObject) => any + ): JQuery; + + /** + * Add a collection of DOM elements onto the jQuery stack. + * + * @param elements An array of elements to push onto the stack and make into a new jQuery object. + */ + pushStack(elements: any[]): JQuery; + /** + * Add a collection of DOM elements onto the jQuery stack. + * + * @param elements An array of elements to push onto the stack and make into a new jQuery object. + * @param name The name of a jQuery method that generated the array of elements. + * @param arguments The arguments that were passed in to the jQuery method (for serialization). + */ + pushStack(elements: any[], name: string, arguments: any[]): JQuery; + + /** + * Insert content, specified by the parameter, after each element in the set of matched elements. + * + * param content1 HTML string, DOM element, array of elements, or jQuery object to insert after each element in the set of matched elements. + * param content2 One or more additional DOM elements, arrays of elements, HTML strings, or jQuery objects to insert after each element in the set of matched elements. + */ + after( + content1: JQuery | any[] | Element | Text | string, + ...content2: any[] + ): JQuery; + /** + * Insert content, specified by the parameter, after each element in the set of matched elements. + * + * param func A function that returns: any an HTML string, DOM element(s), or jQuery object to insert after each element in the set of matched elements. Receives the index position of the element in the set as an argument. Within the function, this refers to the current element in the set. + */ + after( + func: (index: number, html: string) => string | Element | JQuery + ): JQuery; + + /** + * Insert content, specified by the parameter, to the end of each element in the set of matched elements. + * + * param content1 DOM element, array of elements, HTML string, or jQuery object to insert at the end of each element in the set of matched elements. + * param content2 One or more additional DOM elements, arrays of elements, HTML strings, or jQuery objects to insert at the end of each element in the set of matched elements. + */ + append( + content1: JQuery | any[] | Element | Text | string, + ...content2: any[] + ): JQuery; + /** + * Insert content, specified by the parameter, to the end of each element in the set of matched elements. + * + * param func A function that returns: any an HTML string, DOM element(s), or jQuery object to insert at the end of each element in the set of matched elements. Receives the index position of the element in the set and the old HTML value of the element as arguments. Within the function, this refers to the current element in the set. + */ + append( + func: (index: number, html: string) => string | Element | JQuery + ): JQuery; + + /** + * Insert every element in the set of matched elements to the end of the target. + * + * @param target A s: anyelector, element, HTML string, array of elements, or jQuery object; the matched set of elements will be inserted at the end of the element(s) specified by this parameter. + */ + appendTo(target: JQuery | any[] | Element | string): JQuery; + + /** + * Insert content, specified by the parameter, before each element in the set of matched elements. + * + * param content1 HTML string, DOM element, array of elements, or jQuery object to insert before each element in the set of matched elements. + * param content2 One or more additional DOM elements, arrays of elements, HTML strings, or jQuery objects to insert before each element in the set of matched elements. + */ + before( + content1: JQuery | any[] | Element | Text | string, + ...content2: any[] + ): JQuery; + /** + * Insert content, specified by the parameter, before each element in the set of matched elements. + * + * param func A function that returns: any an HTML string, DOM element(s), or jQuery object to insert before each element in the set of matched elements. Receives the index position of the element in the set as an argument. Within the function, this refers to the current element in the set. + */ + before( + func: (index: number, html: string) => string | Element | JQuery + ): JQuery; + + /** + * Create a deep copy of the set of matched elements. + * + * param withDataAndEvents A Boolean indicating whether event handlers and data should be copied along with the elements. The default value is false. + * param deepWithDataAndEvents A Boolean indicating whether event handlers and data for all children of the cloned element should be copied. By default its value matches the first argument's value (which defaults to false). + */ + clone(withDataAndEvents?: boolean, deepWithDataAndEvents?: boolean): JQuery; + + /** + * Remove the set of matched elements from the DOM. + * + * param selector A selector expression that filters the set of matched elements to be removed. + */ + detach(selector?: string): JQuery; + + /** + * Remove all child nodes of the set of matched elements from the DOM. + */ + empty(_: void): JQuery; + + /** + * Insert every element in the set of matched elements after the target. + * + * param target A s: anyelector, element, array of elements, HTML string, or jQuery object; the matched set of elements will be inserted after the element(s) specified by this parameter. + */ + insertAfter(target: JQuery | any[] | Element | Text | string): JQuery; + + /** + * Insert every element in the set of matched elements before the target. + * + * param target A s: anyelector, element, array of elements, HTML string, or jQuery object; the matched set of elements will be inserted before the element(s) specified by this parameter. + */ + insertBefore(target: JQuery | any[] | Element | Text | string): JQuery; + + /** + * Insert content, specified by the parameter, to the beginning of each element in the set of matched elements. + * + * param content1 DOM element, array of elements, HTML string, or jQuery object to insert at the beginning of each element in the set of matched elements. + * param content2 One or more additional DOM elements, arrays of elements, HTML strings, or jQuery objects to insert at the beginning of each element in the set of matched elements. + */ + prepend( + content1: JQuery | any[] | Element | Text | string, + ...content2: any[] + ): JQuery; + /** + * Insert content, specified by the parameter, to the beginning of each element in the set of matched elements. + * + * param func A function that returns: any an HTML string, DOM element(s), or jQuery object to insert at the beginning of each element in the set of matched elements. Receives the index position of the element in the set and the old HTML value of the element as arguments. Within the function, this refers to the current element in the set. + */ + prepend( + func: (index: number, html: string) => string | Element | JQuery + ): JQuery; + + /** + * Insert every element in the set of matched elements to the beginning of the target. + * + * @param target A s: anyelector, element, HTML string, array of elements, or jQuery object; the matched set of elements will be inserted at the beginning of the element(s) specified by this parameter. + */ + prependTo(target: JQuery | any[] | Element | string): JQuery; + + /** + * Remove the set of matched elements from the DOM. + * + * @param selector A selector expression that filters the set of matched elements to be removed. + */ + remove(selector?: string): JQuery; + + /** + * Replace each target element with the set of matched elements. + * + * @param target A s: anyelector string, jQuery object, DOM element, or array of elements indicating which element(s) to replace. + */ + replaceAll(target: JQuery | any[] | Element | string): JQuery; + + /** + * Replace each element in the set of matched elements with the provided new content and return the set of elements that was removed. + * + * param newContent The content to insert. May be an HTML string, DOM element, array of DOM elements, or jQuery object. + */ + replaceWith(newContent: JQuery | any[] | Element | Text | string): JQuery; + /** + * Replace each element in the set of matched elements with the provided new content and return the set of elements that was removed. + * + * param func A function that returns content with which to replace the set of matched elements. + */ + replaceWith(func: () => Element | JQuery): JQuery; + + /** + * Set the content of each element in the set of matched elements to the specified text. + * + * @param text The text to set as the content of each matched element. When Number or Boolean is supplied, it will be converted to a String representation. + */ + text(text: string | number | boolean): JQuery; + /** + * Set the content of each element in the set of matched elements to the specified text. + * + * @param func A function returning the text content to set. Receives the index position of the element in the set and the old text value as arguments. + */ + text(func: (index: number, text: string) => string): JQuery; + /** + * Get the combined text contents of each element in the set of matched elements, including their descendants. + */ + text(_: void): string; + + /** + * Retrieve all the elements contained in the jQuery set, as an array. + */ + toArray(_: void): any[]; + + /** + * Remove the parents of the set of matched elements from the DOM, leaving the matched elements in their place. + */ + unwrap(_: void): JQuery; + + /** + * Wrap an HTML structure around each element in the set of matched elements. + * + * @param wrappingElement A selector, element, HTML string, or jQuery object specifying the structure to wrap around the matched elements. + */ + wrap(wrappingElement: JQuery | Element | string): JQuery; + /** + * Wrap an HTML structure around each element in the set of matched elements. + * + * @param func A callback function returning the HTML content or jQuery object to wrap around the matched elements. Receives the index position of the element in the set as an argument. Within the function, this refers to the current element in the set. + */ + wrap(func: (index: number) => string | JQuery): JQuery; + + /** + * Wrap an HTML structure around all elements in the set of matched elements. + * + * @param wrappingElement A selector, element, HTML string, or jQuery object specifying the structure to wrap around the matched elements. + */ + wrapAll(wrappingElement: JQuery | Element | string): JQuery; + wrapAll(func: (index: number) => string): JQuery; + + /** + * Wrap an HTML structure around the content of each element in the set of matched elements. + * + * @param wrappingElement An HTML snippet, selector expression, jQuery object, or DOM element specifying the structure to wrap around the content of the matched elements. + */ + wrapInner(wrappingElement: JQuery | Element | string): JQuery; + /** + * Wrap an HTML structure around the content of each element in the set of matched elements. + * + * @param func A callback function which generates a structure to wrap around the content of the matched elements. Receives the index position of the element in the set as an argument. Within the function, this refers to the current element in the set. + */ + wrapInner(func: (index: number) => string): JQuery; + + /** + * Iterate over a jQuery object, executing a function for each matched element. + * + * @param func A function to execute for each matched element. + */ + each(func: (index: number, elem: Element) => any): JQuery; + + /** + * Retrieve one of the elements matched by the jQuery object. + * + * @param index A zero-based integer indicating which element to retrieve. + */ + get(index: number): T; + /** + * Retrieve the elements matched by the jQuery object. + */ + get(_: void): any[]; + + /** + * Search for a given element from among the matched elements. + */ + index(_: void): number; + /** + * Search for a given element from among the matched elements. + * + * @param selector A selector representing a jQuery collection in which to look for an element. + */ + index(selector: string | JQuery | Element): number; + + /** + * The number of elements in the jQuery object. + */ + length: number; + /** + * A selector representing selector passed to jQuery(), if any, when creating the original set. + * version deprecated: 1.7, removed: 1.9 + */ + selector: string; + + [index: number]: HTMLElement; + + /** + * Add elements to the set of matched elements. + * + * @param selector A string representing a selector expression to find additional elements to add to the set of matched elements. + * @param context: any The point in the document at which the selector should begin matching; similar to the context argument of the $(selector, context) method. + */ + add(selector: string, context?: Element): JQuery; + /** + * Add elements to the set of matched elements. + * + * @param elements One or more elements to add to the set of matched elements. + */ + add(...elements: Element[]): JQuery; + /** + * Add elements to the set of matched elements. + * + * @param html An HTML fragment to add to the set of matched elements. + */ + add(html: string, _: void): JQuery; + /** + * Add elements to the set of matched elements. + * + * @param obj An existing jQuery object to add to the set of matched elements. + */ + add(obj: JQuery, _: void): JQuery; + + /** + * Get the children of each element in the set of matched elements, optionally filtered by a selector. + * + * @param selector A string containing a selector expression to match elements against. + */ + children(selector?: string): JQuery; + + /** + * For each element in the set, get the first element that matches the selector by testing the element itself and traversing up through its ancestors in the DOM tree. + * + * @param selector A string containing a selector expression to match elements against. + */ + closest(selector: string, _: void): JQuery; + /** + * For each element in the set, get the first element that matches the selector by testing the element itself and traversing up through its ancestors in the DOM tree. + * + * @param selector A string containing a selector expression to match elements against. + * @param context A DOM element within which a matching element may be found. If no context is passed in then the context of the jQuery set will be used instead. + */ + closest(selector: string, context?: Element): JQuery; + /** + * For each element in the set, get the first element that matches the selector by testing the element itself and traversing up through its ancestors in the DOM tree. + * + * @param obj A jQuery object to match elements against. + */ + closest(obj: JQuery, _: void): JQuery; + /** + * For each element in the set, get the first element that matches the selector by testing the element itself and traversing up through its ancestors in the DOM tree. + * + * @param element An element to match elements against. + */ + closest(element: Element, _: void): JQuery; + + /** + * Get an array of all the elements and selectors matched against the current element up through the DOM tree. + * + * @param selectors An array or string containing a selector expression to match elements against (can also be a jQuery object). + * @param context A DOM element within which a matching element may be found. If no context is passed in then the context of the jQuery set will be used instead. + */ + closest(selectors: any, context?: Element): any[]; + + /** + * Get the children of each element in the set of matched elements, including text and comment nodes. + */ + contents(_: void): JQuery; + + /** + * End the most recent filtering operation in the current chain and return the set of matched elements to its previous state. + */ + end(_: void): JQuery; + + /** + * Reduce the set of matched elements to the one at the specified index. + * + * @param index An integer indicating the 0-based position of the element. OR An integer indicating the position of the element, counting backwards from the last element in the set. + * + */ + eq(index: number): JQuery; + + /** + * Reduce the set of matched elements to those that match the selector or pass the function's test. + * + * @param selector A string containing a selector expression to match the current set of elements against. + */ + filter(selector: string): JQuery; + /** + * Reduce the set of matched elements to those that match the selector or pass the function's test. + * + * @param func A function used as a test for each element in the set. this is the current DOM element. + */ + filter(func: (index: number, element: Element) => any): JQuery; + /** + * Reduce the set of matched elements to those that match the selector or pass the function's test. + * + * @param element An element to match the current set of elements against. + */ + filter(element: Element): JQuery; + /** + * Reduce the set of matched elements to those that match the selector or pass the function's test. + * + * @param obj An existing jQuery object to match the current set of elements against. + */ + filter(obj: JQuery): JQuery; + + /** + * Get the descendants of each element in the current set of matched elements, filtered by a selector, jQuery object, or element. + * + * @param selector A string containing a selector expression to match elements against. + */ + find(selector: string): JQuery; + /** + * Get the descendants of each element in the current set of matched elements, filtered by a selector, jQuery object, or element. + * + * @param element An element to match elements against. + */ + find(element: Element): JQuery; + /** + * Get the descendants of each element in the current set of matched elements, filtered by a selector, jQuery object, or element. + * + * @param obj A jQuery object to match elements against. + */ + find(obj: JQuery): JQuery; + + /** + * Reduce the set of matched elements to the first in the set. + */ + first(_: void): JQuery; + + /** + * Reduce the set of matched elements to those that have a descendant that matches the selector or DOM element. + * + * @param selector A string containing a selector expression to match elements against. + */ + has(selector: string): JQuery; + /** + * Reduce the set of matched elements to those that have a descendant that matches the selector or DOM element. + * + * @param contained A DOM element to match elements against. + */ + has(contained: Element): JQuery; + + /** + * Check the current matched set of elements against a selector, element, or jQuery object and return true if at least one of these elements matches the given arguments. + * + * @param selector A string containing a selector expression to match elements against. + */ + is(selector: string): boolean; + /** + * Check the current matched set of elements against a selector, element, or jQuery object and return true if at least one of these elements matches the given arguments. + * + * @param func A function used as a test for the set of elements. It accepts one argument, index, which is the element's index in the jQuery collection.Within the function, this refers to the current DOM element. + */ + is(func: (index: number, element: Element) => boolean): boolean; + /** + * Check the current matched set of elements against a selector, element, or jQuery object and return true if at least one of these elements matches the given arguments. + * + * @param selection An existing jQuery object to match the current set of elements against. + */ + is(selection: JQuery): boolean; + /** + * Check the current matched set of elements against a selector, element, or jQuery object and return true if at least one of these elements matches the given arguments. + * + * @param elements One or more elements to match the current set of elements against. + */ + is(elements: Element | Element[]): boolean; + + /** + * Reduce the set of matched elements to the final one in the set. + */ + last(_: void): JQuery; + + /** + * Pass each element in the current matched set through a function, producing a new jQuery object containing the return values. + * + * @param callback A function object that will be invoked for each element in the current set. + */ + map(callback: (index: number, domElement: Element) => any): JQuery; + + /** + * Get the immediately following sibling of each element in the set of matched elements. If a selector is provided, it retrieves the next sibling only if it matches that selector. + * + * @param selector A string containing a selector expression to match elements against. + */ + next(selector?: string): JQuery; + + /** + * Get all following siblings of each element in the set of matched elements, optionally filtered by a selector. + * + * @param selector A string containing a selector expression to match elements against. + */ + nextAll(selector?: string): JQuery; + + /** + * Get all following siblings of each element up to but not including the element matched by the selector, DOM node, or jQuery object passed. + * + * @param selector A string containing a selector expression to indicate where to stop matching following sibling elements. + * @param filter A string containing a selector expression to match elements against. + */ + nextUntil(selector?: string, filter?: string): JQuery; + /** + * Get all following siblings of each element up to but not including the element matched by the selector, DOM node, or jQuery object passed. + * + * @param element A DOM node or jQuery object indicating where to stop matching following sibling elements. + * @param filter A string containing a selector expression to match elements against. + */ + nextUntil(element?: Element, filter?: string): JQuery; + /** + * Get all following siblings of each element up to but not including the element matched by the selector, DOM node, or jQuery object passed. + * + * @param obj A DOM node or jQuery object indicating where to stop matching following sibling elements. + * @param filter A string containing a selector expression to match elements against. + */ + nextUntil(obj?: JQuery, filter?: string): JQuery; + + /** + * Remove elements from the set of matched elements. + * + * @param selector A string containing a selector expression to match elements against. + */ + not(selector: string): JQuery; + /** + * Remove elements from the set of matched elements. + * + * @param func A function used as a test for each element in the set. this is the current DOM element. + */ + not(func: (index: number, element: Element) => boolean): JQuery; + /** + * Remove elements from the set of matched elements. + * + * @param elements One or more DOM elements to remove from the matched set. + */ + not(elements: Element | Element[]): JQuery; + /** + * Remove elements from the set of matched elements. + * + * @param obj An existing jQuery object to match the current set of elements against. + */ + not(obj: JQuery): JQuery; + + /** + * Get the closest ancestor element that is positioned. + */ + offsetParent(_: void): JQuery; + + /** + * Get the parent of each element in the current set of matched elements, optionally filtered by a selector. + * + * @param selector A string containing a selector expression to match elements against. + */ + parent(selector?: string): JQuery; + + /** + * Get the ancestors of each element in the current set of matched elements, optionally filtered by a selector. + * + * @param selector A string containing a selector expression to match elements against. + */ + parents(selector?: string): JQuery; + + /** + * Get the ancestors of each element in the current set of matched elements, up to but not including the element matched by the selector, DOM node, or jQuery object. + * + * @param selector A string containing a selector expression to indicate where to stop matching ancestor elements. + * @param filter A string containing a selector expression to match elements against. + */ + parentsUntil(selector?: string, filter?: string): JQuery; + /** + * Get the ancestors of each element in the current set of matched elements, up to but not including the element matched by the selector, DOM node, or jQuery object. + * + * @param element A DOM node or jQuery object indicating where to stop matching ancestor elements. + * @param filter A string containing a selector expression to match elements against. + */ + parentsUntil(element?: Element, filter?: string): JQuery; + /** + * Get the ancestors of each element in the current set of matched elements, up to but not including the element matched by the selector, DOM node, or jQuery object. + * + * @param obj A DOM node or jQuery object indicating where to stop matching ancestor elements. + * @param filter A string containing a selector expression to match elements against. + */ + parentsUntil(obj?: JQuery, filter?: string): JQuery; + + /** + * Get the immediately preceding sibling of each element in the set of matched elements, optionally filtered by a selector. + * + * @param selector A string containing a selector expression to match elements against. + */ + prev(selector?: string): JQuery; + + /** + * Get all preceding siblings of each element in the set of matched elements, optionally filtered by a selector. + * + * @param selector A string containing a selector expression to match elements against. + */ + prevAll(selector?: string): JQuery; + + /** + * Get all preceding siblings of each element up to but not including the element matched by the selector, DOM node, or jQuery object. + * + * @param selector A string containing a selector expression to indicate where to stop matching preceding sibling elements. + * @param filter A string containing a selector expression to match elements against. + */ + prevUntil(selector?: string, filter?: string): JQuery; + /** + * Get all preceding siblings of each element up to but not including the element matched by the selector, DOM node, or jQuery object. + * + * @param element A DOM node or jQuery object indicating where to stop matching preceding sibling elements. + * @param filter A string containing a selector expression to match elements against. + */ + prevUntil(element?: Element, filter?: string): JQuery; + /** + * Get all preceding siblings of each element up to but not including the element matched by the selector, DOM node, or jQuery object. + * + * @param obj A DOM node or jQuery object indicating where to stop matching preceding sibling elements. + * @param filter A string containing a selector expression to match elements against. + */ + prevUntil(obj?: JQuery, filter?: string): JQuery; + + /** + * Get the siblings of each element in the set of matched elements, optionally filtered by a selector. + * + * @param selector A string containing a selector expression to match elements against. + */ + siblings(selector?: string): JQuery; + + /** + * Reduce the set of matched elements to a subset specified by a range of indices. + * + * @param start An integer indicating the 0-based position at which the elements begin to be selected. If negative, it indicates an offset from the end of the set. + * @param end An integer indicating the 0-based position at which the elements stop being selected. If negative, it indicates an offset from the end of the set. If omitted, the range continues until the end of the set. + */ + slice(start: number, end?: number): JQuery; + + /** + * Show the queue of functions to be executed on the matched elements. + * + * @param queueName A string containing the name of the queue. Defaults to fx, the standard effects queue. + */ + queue(queueName?: string, _: void): any[]; + /** + * Manipulate the queue of functions to be executed, once for each matched element. + * + * @param newQueue An array of functions to replace the current queue contents. + */ + queue(newQueue: Function[]): JQuery; + /** + * Manipulate the queue of functions to be executed, once for each matched element. + * + * @param callback The new function to add to the queue, with a function to call that will dequeue the next item. + */ + queue(callback: Function): JQuery; + /** + * Manipulate the queue of functions to be executed, once for each matched element. + * + * @param queueName A string containing the name of the queue. Defaults to fx, the standard effects queue. + * @param newQueue An array of functions to replace the current queue contents. + */ + queue(queueName: string, newQueue: Function[]): JQuery; + /** + * Manipulate the queue of functions to be executed, once for each matched element. + * + * @param queueName A string containing the name of the queue. Defaults to fx, the standard effects queue. + * @param callback The new function to add to the queue, with a function to call that will dequeue the next item. + */ + queue(queueName: string, callback: Function): JQuery; +} + +declare module "jquery" { + declare module.exports: JQueryStatic; +} +declare var jQuery: JQueryStatic; +declare var $: JQueryStatic; diff --git a/licenseBanner.js b/licenseBanner.js new file mode 100644 index 0000000..8d20eb1 --- /dev/null +++ b/licenseBanner.js @@ -0,0 +1,38 @@ +/* + * Copyright (C) 2016-2018 Alexander Krivács Schrøder + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/* global module */ + +const licenseBanner = +`/* + * Copyright (C) 2016-2018 Alexander Krivács Schrøder + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */`; + +module.exports = licenseBanner; diff --git a/package-lock.json b/package-lock.json index f0af0fb..6a6516f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4,12 +4,377 @@ "lockfileVersion": 1, "requires": true, "dependencies": { + "@babel/code-frame": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.0.0.tgz", + "integrity": "sha512-OfC2uemaknXr87bdLUkWog7nYuliM9Ij5HUcajsVcMCpQrcLmtxRbVFTIqmcSkSeYRBFBRxs2FiUqFJDLdiebA==", + "dev": true, + "requires": { + "@babel/highlight": "7.0.0" + } + }, + "@babel/core": { + "version": "7.1.5", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.1.5.tgz", + "integrity": "sha512-vOyH020C56tQvte++i+rX2yokZcRfbv/kKcw+/BCRw/cK6dvsr47aCzm8oC1XHwMSEWbqrZKzZRLzLnq6SFMsg==", + "dev": true, + "requires": { + "@babel/code-frame": "7.0.0", + "@babel/generator": "7.1.5", + "@babel/helpers": "7.1.5", + "@babel/parser": "7.1.5", + "@babel/template": "7.1.2", + "@babel/traverse": "7.1.5", + "@babel/types": "7.1.5", + "convert-source-map": "1.6.0", + "debug": "3.2.6", + "json5": "0.5.1", + "lodash": "4.17.11", + "resolve": "1.8.1", + "semver": "5.4.1", + "source-map": "0.5.7" + }, + "dependencies": { + "debug": { + "version": "3.2.6", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz", + "integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==", + "dev": true, + "requires": { + "ms": "2.1.1" + } + }, + "lodash": { + "version": "4.17.11", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.11.tgz", + "integrity": "sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg==", + "dev": true + }, + "ms": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz", + "integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==", + "dev": true + }, + "resolve": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.8.1.tgz", + "integrity": "sha512-AicPrAC7Qu1JxPCZ9ZgCZlY35QgFnNqc+0LtbRNxnVw4TXvjQ72wnuL9JQcEBgXkI9JM8MsT9kaQoHcpCRJOYA==", + "dev": true, + "requires": { + "path-parse": "1.0.5" + } + } + } + }, + "@babel/generator": { + "version": "7.1.5", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.1.5.tgz", + "integrity": "sha512-IO31r62xfMI+wBJVmgx0JR9ZOHty8HkoYpQAjRWUGG9vykBTlGHdArZ8zoFtpUu2gs17K7qTl/TtPpiSi6t+MA==", + "dev": true, + "requires": { + "@babel/types": "7.1.5", + "jsesc": "2.5.2", + "lodash": "4.17.11", + "source-map": "0.5.7", + "trim-right": "1.0.1" + }, + "dependencies": { + "lodash": { + "version": "4.17.11", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.11.tgz", + "integrity": "sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg==", + "dev": true + } + } + }, + "@babel/helper-function-name": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.1.0.tgz", + "integrity": "sha512-A95XEoCpb3TO+KZzJ4S/5uW5fNe26DjBGqf1o9ucyLyCmi1dXq/B3c8iaWTfBk3VvetUxl16e8tIrd5teOCfGw==", + "dev": true, + "requires": { + "@babel/helper-get-function-arity": "7.0.0", + "@babel/template": "7.1.2", + "@babel/types": "7.1.5" + } + }, + "@babel/helper-get-function-arity": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/@babel/helper-get-function-arity/-/helper-get-function-arity-7.0.0.tgz", + "integrity": "sha512-r2DbJeg4svYvt3HOS74U4eWKsUAMRH01Z1ds1zx8KNTPtpTL5JAsdFv8BNyOpVqdFhHkkRDIg5B4AsxmkjAlmQ==", + "dev": true, + "requires": { + "@babel/types": "7.1.5" + } + }, + "@babel/helper-module-imports": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.0.0.tgz", + "integrity": "sha512-aP/hlLq01DWNEiDg4Jn23i+CXxW/owM4WpDLFUbpjxe4NS3BhLVZQ5i7E0ZrxuQ/vwekIeciyamgB1UIYxxM6A==", + "dev": true, + "requires": { + "@babel/types": "7.1.5" + } + }, + "@babel/helper-plugin-utils": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.0.0.tgz", + "integrity": "sha512-CYAOUCARwExnEixLdB6sDm2dIJ/YgEAKDM1MOeMeZu9Ld/bDgVo8aiWrXwcY7OBh+1Ea2uUcVRcxKk0GJvW7QA==", + "dev": true + }, + "@babel/helper-split-export-declaration": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.0.0.tgz", + "integrity": "sha512-MXkOJqva62dfC0w85mEf/LucPPS/1+04nmmRMPEBUB++hiiThQ2zPtX/mEWQ3mtzCEjIJvPY8nuwxXtQeQwUag==", + "dev": true, + "requires": { + "@babel/types": "7.1.5" + } + }, + "@babel/helpers": { + "version": "7.1.5", + "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.1.5.tgz", + "integrity": "sha512-2jkcdL02ywNBry1YNFAH/fViq4fXG0vdckHqeJk+75fpQ2OH+Az6076tX/M0835zA45E0Cqa6pV5Kiv9YOqjEg==", + "dev": true, + "requires": { + "@babel/template": "7.1.2", + "@babel/traverse": "7.1.5", + "@babel/types": "7.1.5" + } + }, + "@babel/highlight": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.0.0.tgz", + "integrity": "sha512-UFMC4ZeFC48Tpvj7C8UgLvtkaUuovQX+5xNWrsIoMG8o2z+XFKjKaN9iVmS84dPwVN00W4wPmqvYoZF3EGAsfw==", + "dev": true, + "requires": { + "chalk": "2.4.1", + "esutils": "2.0.2", + "js-tokens": "4.0.0" + }, + "dependencies": { + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "requires": { + "color-convert": "1.9.3" + } + }, + "chalk": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.1.tgz", + "integrity": "sha512-ObN6h1v2fTJSmUXoS3nMQ92LbDK9be4TV+6G+omQlGJFdcUX5heKi1LZ1YnRMIgwTLEj3E24bT6tYni50rlCfQ==", + "dev": true, + "requires": { + "ansi-styles": "3.2.1", + "escape-string-regexp": "1.0.5", + "supports-color": "5.5.0" + } + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "3.0.0" + } + } + } + }, + "@babel/parser": { + "version": "7.1.5", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.1.5.tgz", + "integrity": "sha512-WXKf5K5HT6X0kKiCOezJZFljsfxKV1FpU8Tf1A7ZpGvyd/Q4hlrJm2EwoH2onaUq3O4tLDp+4gk0hHPsMyxmOg==", + "dev": true + }, + "@babel/plugin-syntax-flow": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-flow/-/plugin-syntax-flow-7.0.0.tgz", + "integrity": "sha512-zGcuZWiWWDa5qTZ6iAnpG0fnX/GOu49pGR5PFvkQ9GmKNaSphXQnlNXh/LG20sqWtNrx/eB6krzfEzcwvUyeFA==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "7.0.0" + } + }, + "@babel/plugin-transform-flow-strip-types": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-flow-strip-types/-/plugin-transform-flow-strip-types-7.0.0.tgz", + "integrity": "sha512-WhXUNb4It5a19RsgKKbQPrjmy4yWOY1KynpEbNw7bnd1QTcrT/EIl3MJvnGgpgvrKyKbqX7nUNOJfkpLOnoDKA==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "7.0.0", + "@babel/plugin-syntax-flow": "7.0.0" + } + }, + "@babel/preset-flow": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/@babel/preset-flow/-/preset-flow-7.0.0.tgz", + "integrity": "sha512-bJOHrYOPqJZCkPVbG1Lot2r5OSsB+iUOaxiHdlOeB1yPWS6evswVHwvkDLZ54WTaTRIk89ds0iHmGZSnxlPejQ==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "7.0.0", + "@babel/plugin-transform-flow-strip-types": "7.0.0" + } + }, + "@babel/template": { + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.1.2.tgz", + "integrity": "sha512-SY1MmplssORfFiLDcOETrW7fCLl+PavlwMh92rrGcikQaRq4iWPVH0MpwPpY3etVMx6RnDjXtr6VZYr/IbP/Ag==", + "dev": true, + "requires": { + "@babel/code-frame": "7.0.0", + "@babel/parser": "7.1.5", + "@babel/types": "7.1.5" + } + }, + "@babel/traverse": { + "version": "7.1.5", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.1.5.tgz", + "integrity": "sha512-eU6XokWypl0MVJo+MTSPUtlfPePkrqsF26O+l1qFGlCKWwmiYAYy2Sy44Qw8m2u/LbPCsxYt90rghmqhYMGpPA==", + "dev": true, + "requires": { + "@babel/code-frame": "7.0.0", + "@babel/generator": "7.1.5", + "@babel/helper-function-name": "7.1.0", + "@babel/helper-split-export-declaration": "7.0.0", + "@babel/parser": "7.1.5", + "@babel/types": "7.1.5", + "debug": "3.2.6", + "globals": "11.8.0", + "lodash": "4.17.11" + }, + "dependencies": { + "debug": { + "version": "3.2.6", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz", + "integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==", + "dev": true, + "requires": { + "ms": "2.1.1" + } + }, + "lodash": { + "version": "4.17.11", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.11.tgz", + "integrity": "sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg==", + "dev": true + }, + "ms": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz", + "integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==", + "dev": true + } + } + }, + "@babel/types": { + "version": "7.1.5", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.1.5.tgz", + "integrity": "sha512-sJeqa/d9eM/bax8Ivg+fXF7FpN3E/ZmTrWbkk6r+g7biVYfALMnLin4dKijsaqEhpd2xvOGfQTkQkD31YCVV4A==", + "dev": true, + "requires": { + "esutils": "2.0.2", + "lodash": "4.17.11", + "to-fast-properties": "2.0.0" + }, + "dependencies": { + "lodash": { + "version": "4.17.11", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.11.tgz", + "integrity": "sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg==", + "dev": true + } + } + }, + "@octokit/rest": { + "version": "15.16.1", + "resolved": "https://registry.npmjs.org/@octokit/rest/-/rest-15.16.1.tgz", + "integrity": "sha512-86RGoibm8AJ3ZBlM0NdMI932wEZ/bdo2eEppHtliEYwJT9hsy5qt+i9HA+T8CC90r4atoFQDrY7mDLBcAjp9ow==", + "dev": true, + "requires": { + "before-after-hook": "1.2.0", + "btoa-lite": "1.0.0", + "debug": "3.2.6", + "http-proxy-agent": "2.1.0", + "https-proxy-agent": "2.2.1", + "lodash": "4.17.11", + "node-fetch": "2.2.1", + "universal-user-agent": "2.0.1", + "url-template": "2.0.8" + }, + "dependencies": { + "debug": { + "version": "3.2.6", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz", + "integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==", + "dev": true, + "requires": { + "ms": "2.1.1" + } + }, + "lodash": { + "version": "4.17.11", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.11.tgz", + "integrity": "sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg==", + "dev": true + }, + "ms": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz", + "integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==", + "dev": true + } + } + }, "abbrev": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz", "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==", "dev": true }, + "acorn": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-5.3.0.tgz", + "integrity": "sha512-Yej+zOJ1Dm/IMZzzj78OntP/r3zHEaKcyNoU2lAaxPtrseM6rF0xwqoz5Q5ysAiED9hTjI2hgtvLXitlCN1/Ug==", + "dev": true + }, + "acorn-jsx": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.0.0.tgz", + "integrity": "sha512-XkB50fn0MURDyww9+UYL3c1yLbOBz0ZFvrdYlGB8l+Ije1oSC75qAqrzSPjYQbdnQUzhlUGNKuesryAv0gxZOg==", + "dev": true + }, + "agent-base": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-4.2.1.tgz", + "integrity": "sha512-JVwXMr9nHYTUXsBFKUqhJwvlcYU/blreOEUkhNR2eXZIvwd+c+o5V4MgDPKWnMS/56awN3TRzIP+KoPn+roQtg==", + "dev": true, + "requires": { + "es6-promisify": "5.0.0" + } + }, + "ajv": { + "version": "6.5.4", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.5.4.tgz", + "integrity": "sha512-4Wyjt8+t6YszqaXnLDfMmG/8AlO5Zbcsy3ATHncCzjW/NoPzAId8AK6749Ybjmdt+kUY1gP60fCu46oDxPv/mg==", + "dev": true, + "requires": { + "fast-deep-equal": "2.0.1", + "fast-json-stable-stringify": "2.0.0", + "json-schema-traverse": "0.4.1", + "uri-js": "4.2.2" + } + }, + "ajv-keywords": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-3.2.0.tgz", + "integrity": "sha1-6GuBnGAs+IIa1jdBNpjx3sAhhHo=", + "dev": true + }, "align-text": { "version": "0.1.4", "resolved": "https://registry.npmjs.org/align-text/-/align-text-0.1.4.tgz", @@ -21,6 +386,12 @@ "repeat-string": "1.6.1" } }, + "ansi-escapes": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-3.1.0.tgz", + "integrity": "sha512-UgAb8H9D41AQnu/PbWlCofQVcnV4Gs2bBJi9eZPxfU/hgglFh3SMDMENRIqdr7H6XFnXdoknctFByVsCOotTVw==", + "dev": true + }, "ansi-regex": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", @@ -42,6 +413,21 @@ "sprintf-js": "1.0.3" } }, + "arr-diff": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-2.0.0.tgz", + "integrity": "sha1-jzuCf5Vai9ZpaX5KQlasPOrjVs8=", + "dev": true, + "requires": { + "arr-flatten": "1.1.0" + } + }, + "arr-flatten": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/arr-flatten/-/arr-flatten-1.1.0.tgz", + "integrity": "sha512-L3hKV5R/p5o81R7O02IGnwpDmkp6E982XhtbuwSe3O4qOtMMMtodicASA1Cny2U+aCXcNpml+m4dPsvsJ3jatg==", + "dev": true + }, "array-differ": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/array-differ/-/array-differ-1.0.0.tgz", @@ -69,6 +455,12 @@ "integrity": "sha1-r2rId6Jcx/dOBYiUdThY39sk/bY=", "dev": true }, + "array-unique": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.2.1.tgz", + "integrity": "sha1-odl8yvy8JiXMcPrc6zalDFiwGlM=", + "dev": true + }, "arrify": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/arrify/-/arrify-1.0.1.tgz", @@ -81,14 +473,59 @@ "integrity": "sha1-7GphrlZIDAw8skHJVhjiCJL5Zyo=", "dev": true }, + "babel-eslint": { + "version": "10.0.1", + "resolved": "https://registry.npmjs.org/babel-eslint/-/babel-eslint-10.0.1.tgz", + "integrity": "sha512-z7OT1iNV+TjOwHNLLyJk+HN+YVWX+CLE6fPD2SymJZOZQBs+QIexFjhm4keGTm8MW9xr4EC9Q0PbaLB24V5GoQ==", + "dev": true, + "requires": { + "@babel/code-frame": "7.0.0", + "@babel/parser": "7.1.5", + "@babel/traverse": "7.1.5", + "@babel/types": "7.1.5", + "eslint-scope": "3.7.1", + "eslint-visitor-keys": "1.0.0" + }, + "dependencies": { + "eslint-scope": { + "version": "3.7.1", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-3.7.1.tgz", + "integrity": "sha1-PWPD7f2gLgbgGkUq2IyqzHzctug=", + "dev": true, + "requires": { + "esrecurse": "4.2.1", + "estraverse": "4.2.0" + } + } + } + }, + "babel-polyfill": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-polyfill/-/babel-polyfill-6.26.0.tgz", + "integrity": "sha1-N5k3q8Z9eJWXCtxiHyhM2WbPIVM=", + "dev": true, + "requires": { + "babel-runtime": "6.26.0", + "core-js": "2.5.7", + "regenerator-runtime": "0.10.5" + } + }, "babel-runtime": { "version": "6.26.0", "resolved": "https://registry.npmjs.org/babel-runtime/-/babel-runtime-6.26.0.tgz", "integrity": "sha1-llxwWGaOgrVde/4E/yM3vItWR/4=", "dev": true, "requires": { - "core-js": "2.5.3", + "core-js": "2.5.7", "regenerator-runtime": "0.11.1" + }, + "dependencies": { + "regenerator-runtime": { + "version": "0.11.1", + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.11.1.tgz", + "integrity": "sha512-MguG95oij0fC3QV3URf4V2SDYGJhJnJGqvIIgdECeODCT98wSWDAJ94SSuVpYQUoTcGUIL6L4yNB7j1DFFHSBg==", + "dev": true + } } }, "babylon": { @@ -103,6 +540,18 @@ "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", "dev": true }, + "before-after-hook": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/before-after-hook/-/before-after-hook-1.2.0.tgz", + "integrity": "sha512-wI3QtdLppHNkmM1VgRVLCrlWCKk/YexlPicYbXPs4eYdd1InrUCTFsx5bX1iUQzzMsoRXXPpM1r+p7JEJJydag==", + "dev": true + }, + "big-integer": { + "version": "1.6.36", + "resolved": "https://registry.npmjs.org/big-integer/-/big-integer-1.6.36.tgz", + "integrity": "sha512-t70bfa7HYEA1D9idDbmuv7YbsbVkQ+Hp+8KFSul4aE5e/i1bjCNIRYJZlA8Q8p0r9T8cF/RVvwUgRA//FydEyg==", + "dev": true + }, "bin-version": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/bin-version/-/bin-version-1.0.4.tgz", @@ -132,6 +581,22 @@ } } }, + "binary": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/binary/-/binary-0.3.0.tgz", + "integrity": "sha1-n2BVO8XOjDOG87VTz/R0Yq3sqnk=", + "dev": true, + "requires": { + "buffers": "0.1.1", + "chainsaw": "0.1.0" + } + }, + "bluebird": { + "version": "3.4.7", + "resolved": "http://registry.npmjs.org/bluebird/-/bluebird-3.4.7.tgz", + "integrity": "sha1-9y12C+Cbf3bQjtj66Ysomo0F+rM=", + "dev": true + }, "body-parser": { "version": "1.14.2", "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.14.2.tgz", @@ -174,6 +639,17 @@ "concat-map": "0.0.1" } }, + "braces": { + "version": "1.8.5", + "resolved": "https://registry.npmjs.org/braces/-/braces-1.8.5.tgz", + "integrity": "sha1-uneWLhLf+WnWt2cR6RS3N4V79qc=", + "dev": true, + "requires": { + "expand-range": "1.8.2", + "preserve": "0.2.0", + "repeat-element": "1.1.2" + } + }, "browserify-zlib": { "version": "0.1.4", "resolved": "https://registry.npmjs.org/browserify-zlib/-/browserify-zlib-0.1.4.tgz", @@ -183,6 +659,30 @@ "pako": "0.2.9" } }, + "btoa-lite": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/btoa-lite/-/btoa-lite-1.0.0.tgz", + "integrity": "sha1-M3dm2hWAEhD92VbCLpxokaudAzc=", + "dev": true + }, + "buffer-indexof-polyfill": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/buffer-indexof-polyfill/-/buffer-indexof-polyfill-1.0.1.tgz", + "integrity": "sha1-qfuAbOgUXVQoUQznLyeLs2OmOL8=", + "dev": true + }, + "buffer-shims": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/buffer-shims/-/buffer-shims-1.0.0.tgz", + "integrity": "sha1-mXjOMXOIxkmth5MCjDR37wRKi1E=", + "dev": true + }, + "buffers": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/buffers/-/buffers-0.1.1.tgz", + "integrity": "sha1-skV5w77U1tOWru5tmorn9Ugqt7s=", + "dev": true + }, "builtin-modules": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-1.1.1.tgz", @@ -195,6 +695,21 @@ "integrity": "sha1-/TVGSkA/b5EXwt42Cez/nK4ABYg=", "dev": true }, + "caller-path": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/caller-path/-/caller-path-0.1.0.tgz", + "integrity": "sha1-lAhe9jWB7NPaqSREqP6U6CV3dR8=", + "dev": true, + "requires": { + "callsites": "0.2.0" + } + }, + "callsites": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/callsites/-/callsites-0.2.0.tgz", + "integrity": "sha1-r6uWJikQp/M8GaV3WCXGnzTjUMo=", + "dev": true + }, "camel-case": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/camel-case/-/camel-case-3.0.0.tgz", @@ -231,6 +746,15 @@ "lazy-cache": "1.0.4" } }, + "chainsaw": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/chainsaw/-/chainsaw-0.1.0.tgz", + "integrity": "sha1-XqtQsor+WAdNDVgpE4iCi15fvJg=", + "dev": true, + "requires": { + "traverse": "0.3.9" + } + }, "chalk": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", @@ -244,6 +768,24 @@ "supports-color": "2.0.0" } }, + "chardet": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/chardet/-/chardet-0.7.0.tgz", + "integrity": "sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA==", + "dev": true + }, + "charenc": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/charenc/-/charenc-0.0.2.tgz", + "integrity": "sha1-wKHS86cJLgN3S/qD8UwPxXkKhmc=", + "dev": true + }, + "circular-json": { + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/circular-json/-/circular-json-0.3.3.tgz", + "integrity": "sha512-UZK3NBx2Mca+b5LsG7bY183pHWt5Y1xts4P3Pz7ENTwGVnJOUWbRb3ocjvX7hx9tq/yTAdclXm9sZ38gNuem4A==", + "dev": true + }, "clean-css": { "version": "4.0.13", "resolved": "https://registry.npmjs.org/clean-css/-/clean-css-4.0.13.tgz", @@ -253,53 +795,25 @@ "source-map": "0.5.7" } }, - "cli": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/cli/-/cli-1.0.1.tgz", - "integrity": "sha1-IoF1NPJL+klQw01TLUjsvGIbjBQ=", + "cli-cursor": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-2.1.0.tgz", + "integrity": "sha1-s12sN2R5+sw+lHR9QdDQ9SOP/LU=", "dev": true, "requires": { - "exit": "0.1.2", - "glob": "7.1.2" - }, - "dependencies": { - "glob": { - "version": "7.1.2", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz", - "integrity": "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==", - "dev": true, - "requires": { - "fs.realpath": "1.0.0", - "inflight": "1.0.6", - "inherits": "2.0.3", - "minimatch": "3.0.4", - "once": "1.4.0", - "path-is-absolute": "1.0.1" - } - } + "restore-cursor": "2.0.0" } }, - "cli-table": { - "version": "0.3.1", - "resolved": "https://registry.npmjs.org/cli-table/-/cli-table-0.3.1.tgz", - "integrity": "sha1-9TsFJmqLGguTSz0IIebi3FkUriM=", - "dev": true, - "requires": { - "colors": "1.0.3" - }, - "dependencies": { - "colors": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/colors/-/colors-1.0.3.tgz", - "integrity": "sha1-BDP0TYCWgP3rYO0mDxsMJi6CpAs=", - "dev": true - } - } - }, - "cliui": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/cliui/-/cliui-2.1.0.tgz", - "integrity": "sha1-S0dXYP+AJkx2LDoXGQMukcf+oNE=", + "cli-width": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/cli-width/-/cli-width-2.2.0.tgz", + "integrity": "sha1-/xnt6Kml5XkyQUewwR8PvLq+1jk=", + "dev": true + }, + "cliui": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-2.1.0.tgz", + "integrity": "sha1-S0dXYP+AJkx2LDoXGQMukcf+oNE=", "dev": true, "requires": { "center-align": "0.1.3", @@ -307,12 +821,33 @@ "wordwrap": "0.0.2" } }, + "code-point-at": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz", + "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=", + "dev": true + }, "coffee-script": { "version": "1.10.0", "resolved": "https://registry.npmjs.org/coffee-script/-/coffee-script-1.10.0.tgz", "integrity": "sha1-EpOLz5vhlI+gBvkuDEyegXBRCMA=", "dev": true }, + "color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "dev": true, + "requires": { + "color-name": "1.1.3" + } + }, + "color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", + "dev": true + }, "colors": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/colors/-/colors-1.1.2.tgz", @@ -337,47 +872,6 @@ "json-parser": "0.2.4" } }, - "comment-parser": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/comment-parser/-/comment-parser-0.3.2.tgz", - "integrity": "sha1-PAPwd2uGo239mgosl8YwfzMggv4=", - "dev": true, - "requires": { - "readable-stream": "2.3.3" - }, - "dependencies": { - "isarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", - "dev": true - }, - "readable-stream": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.3.tgz", - "integrity": "sha512-m+qzzcn7KUxEmd1gMbchF+Y2eIUbieUaxkWtptyHywrX0rE8QEYqPC07Vuy4Wm32/xE16NcdBctb8S0Xe/5IeQ==", - "dev": true, - "requires": { - "core-util-is": "1.0.2", - "inherits": "2.0.3", - "isarray": "1.0.0", - "process-nextick-args": "1.0.7", - "safe-buffer": "5.1.1", - "string_decoder": "1.0.3", - "util-deprecate": "1.0.2" - } - }, - "string_decoder": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.0.3.tgz", - "integrity": "sha512-4AH6Z5fzNNBcH+6XDMfA/BTt87skxqJlO0lAh3Dker5zThcAxG6mKz+iGu308UKoPPQ8Dcqx/4JhujzltRa+hQ==", - "dev": true, - "requires": { - "safe-buffer": "5.1.1" - } - } - } - }, "concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", @@ -427,25 +921,25 @@ } } }, - "console-browserify": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/console-browserify/-/console-browserify-1.1.0.tgz", - "integrity": "sha1-8CQcRXMKn8YyOyBtvzjtx0HQuxA=", - "dev": true, - "requires": { - "date-now": "0.1.4" - } - }, "content-type": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.4.tgz", "integrity": "sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA==", "dev": true }, + "convert-source-map": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.6.0.tgz", + "integrity": "sha512-eFu7XigvxdZ1ETfbgPBohgyQ/Z++C0eEhTor0qRwBw9unw+L0/6V8wkSuGgzdThkiS5lSpdptOQPD8Ak40a+7A==", + "dev": true, + "requires": { + "safe-buffer": "5.1.1" + } + }, "core-js": { - "version": "2.5.3", - "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.5.3.tgz", - "integrity": "sha1-isw4NFgk8W2DZbfJtCWRaOjtYD4=", + "version": "2.5.7", + "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.5.7.tgz", + "integrity": "sha512-RszJCAxg/PP6uzXVXL6BsxSXx/B05oJAQ2vkJRjyjrEcNVycaqOmNb5OTxZPE3xa5gwZduqza6L9JOCenh/Ecw==", "dev": true }, "core-util-is": { @@ -454,17 +948,33 @@ "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=", "dev": true }, - "cst": { - "version": "0.4.10", - "resolved": "https://registry.npmjs.org/cst/-/cst-0.4.10.tgz", - "integrity": "sha512-U5ETe1IOjq2h56ZcBE3oe9rT7XryCH6IKgPMv0L7sSk6w29yR3p5egCK0T3BDNHHV95OoUBgXsqiVG+3a900Ag==", + "cross-spawn": { + "version": "6.0.5", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz", + "integrity": "sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==", "dev": true, "requires": { - "babel-runtime": "6.26.0", - "babylon": "6.18.0", - "source-map-support": "0.4.18" + "nice-try": "1.0.5", + "path-key": "2.0.1", + "semver": "5.6.0", + "shebang-command": "1.2.0", + "which": "1.2.14" + }, + "dependencies": { + "semver": { + "version": "5.6.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.6.0.tgz", + "integrity": "sha512-RS9R6R35NYgQn++fkDWaOmqGoj4Ek9gGs+DPxNUZKuwE183xjJroKvyo1IzVFeXvUrvmALy6FWD5xrdJT25gMg==", + "dev": true + } } }, + "crypt": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/crypt/-/crypt-0.0.2.tgz", + "integrity": "sha1-iNf/fsDfuG9xPch7u0LQRNPmxBs=", + "dev": true + }, "currently-unhandled": { "version": "0.4.1", "resolved": "https://registry.npmjs.org/currently-unhandled/-/currently-unhandled-0.4.1.tgz", @@ -474,24 +984,12 @@ "array-find-index": "1.0.2" } }, - "cycle": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/cycle/-/cycle-1.0.3.tgz", - "integrity": "sha1-IegLK+hYD5i0aPN5QwZisEbDStI=", - "dev": true - }, "dargs": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/dargs/-/dargs-2.1.0.tgz", "integrity": "sha1-RsJ/+rH/sTeO8hJZchNxn+YCvJM=", "dev": true }, - "date-now": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/date-now/-/date-now-0.1.4.tgz", - "integrity": "sha1-6vQ5/U1ISK105cx9vvIAZyueNFs=", - "dev": true - }, "dateformat": { "version": "1.0.12", "resolved": "https://registry.npmjs.org/dateformat/-/dateformat-1.0.12.tgz", @@ -517,88 +1015,79 @@ "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=", "dev": true }, - "deep-equal": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/deep-equal/-/deep-equal-1.0.1.tgz", - "integrity": "sha1-9dJgKStmDghO/0zbyfCK0yR0SLU=", - "dev": true - }, - "define-properties": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.3.tgz", - "integrity": "sha512-3MqfYKj2lLzdMSf8ZIZE/V+Zuy+BgD6f164e8K2w7dgnpKArBDerGYpM46IYYcjnkdPNMjPk9A6VFB8+3SKlXQ==", + "decompress-response": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-3.3.0.tgz", + "integrity": "sha1-gKTdMjdIOEv6JICDYirt7Jgq3/M=", "dev": true, "requires": { - "object-keys": "1.0.12" + "mimic-response": "1.0.1" } }, - "depd": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz", - "integrity": "sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak=", + "deep-is": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.3.tgz", + "integrity": "sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ=", "dev": true }, - "dom-serializer": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-0.1.0.tgz", - "integrity": "sha1-BzxpdUbOB4DOI75KKOKT5AvDDII=", + "del": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/del/-/del-3.0.0.tgz", + "integrity": "sha1-U+z2mf/LyzljdpGrE7rxYIGXZuU=", "dev": true, "requires": { - "domelementtype": "1.1.3", - "entities": "1.1.1" + "globby": "6.1.0", + "is-path-cwd": "1.0.0", + "is-path-in-cwd": "1.0.1", + "p-map": "1.2.0", + "pify": "3.0.0", + "rimraf": "2.2.8" }, "dependencies": { - "domelementtype": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-1.1.3.tgz", - "integrity": "sha1-vSh3PiZCiBrsUVRJJCmcXNgiGFs=", - "dev": true - }, - "entities": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/entities/-/entities-1.1.1.tgz", - "integrity": "sha1-blwtClYhtdra7O+AuQ7ftc13cvA=", + "pify": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", + "integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=", "dev": true } } }, - "domelementtype": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-1.3.0.tgz", - "integrity": "sha1-sXrtguirWeUt2cGbF1bg/BhyBMI=", + "depd": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz", + "integrity": "sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak=", "dev": true }, - "domhandler": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/domhandler/-/domhandler-2.3.0.tgz", - "integrity": "sha1-LeWaCCLVAn+r/28DLCsloqir5zg=", + "doctrine": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-2.1.0.tgz", + "integrity": "sha512-35mSku4ZXK0vfCuHEDAwt55dg2jNajHZ1odvF+8SSr82EsZY4QmXfuWso8oEd8zRhVObSN18aM0CjSdoBX7zIw==", "dev": true, "requires": { - "domelementtype": "1.3.0" + "esutils": "2.0.2" } }, - "domutils": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/domutils/-/domutils-1.5.1.tgz", - "integrity": "sha1-3NhIiib1Y9YQeeSMn3t+Mjc2gs8=", + "duplexer2": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/duplexer2/-/duplexer2-0.1.4.tgz", + "integrity": "sha1-ixLauHjA1p4+eJEFFmKjL8a93ME=", "dev": true, "requires": { - "dom-serializer": "0.1.0", - "domelementtype": "1.3.0" + "readable-stream": "2.1.5" } }, + "duplexer3": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/duplexer3/-/duplexer3-0.1.4.tgz", + "integrity": "sha1-7gHdHKwO08vH/b6jfcCo8c4ALOI=", + "dev": true + }, "ee-first": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", "integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=", "dev": true }, - "entities": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/entities/-/entities-1.0.0.tgz", - "integrity": "sha1-sph6o4ITR/zeZCsk/fyeT7cSvyY=", - "dev": true - }, "error-ex": { "version": "1.3.1", "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.1.tgz", @@ -608,24 +1097,288 @@ "is-arrayish": "0.2.1" } }, + "es6-promise": { + "version": "4.2.5", + "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.2.5.tgz", + "integrity": "sha512-n6wvpdE43VFtJq+lUDYDBFUwV8TZbuGXLV4D6wKafg13ldznKsyEvatubnmUe31zcvelSzOHF+XbaT+Bl9ObDg==", + "dev": true + }, + "es6-promisify": { + "version": "5.0.0", + "resolved": "http://registry.npmjs.org/es6-promisify/-/es6-promisify-5.0.0.tgz", + "integrity": "sha1-UQnWLz5W6pZ8S2NQWu8IKRyKUgM=", + "dev": true, + "requires": { + "es6-promise": "4.2.5" + } + }, "escape-string-regexp": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", "dev": true }, + "eslint": { + "version": "5.8.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-5.8.0.tgz", + "integrity": "sha512-Zok6Bru3y2JprqTNm14mgQ15YQu/SMDkWdnmHfFg770DIUlmMFd/gqqzCHekxzjHZJxXv3tmTpH0C1icaYJsRQ==", + "dev": true, + "requires": { + "@babel/code-frame": "7.0.0", + "ajv": "6.5.4", + "chalk": "2.4.1", + "cross-spawn": "6.0.5", + "debug": "4.1.0", + "doctrine": "2.1.0", + "eslint-scope": "4.0.0", + "eslint-utils": "1.3.1", + "eslint-visitor-keys": "1.0.0", + "espree": "4.1.0", + "esquery": "1.0.1", + "esutils": "2.0.2", + "file-entry-cache": "2.0.0", + "functional-red-black-tree": "1.0.1", + "glob": "7.1.3", + "globals": "11.8.0", + "ignore": "4.0.6", + "imurmurhash": "0.1.4", + "inquirer": "6.2.0", + "is-resolvable": "1.1.0", + "js-yaml": "3.12.0", + "json-stable-stringify-without-jsonify": "1.0.1", + "levn": "0.3.0", + "lodash": "4.17.11", + "minimatch": "3.0.4", + "mkdirp": "0.5.1", + "natural-compare": "1.4.0", + "optionator": "0.8.2", + "path-is-inside": "1.0.2", + "pluralize": "7.0.0", + "progress": "2.0.1", + "regexpp": "2.0.1", + "require-uncached": "1.0.3", + "semver": "5.6.0", + "strip-ansi": "4.0.0", + "strip-json-comments": "2.0.1", + "table": "5.1.0", + "text-table": "0.2.0" + }, + "dependencies": { + "ansi-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", + "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", + "dev": true + }, + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "requires": { + "color-convert": "1.9.3" + } + }, + "chalk": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.1.tgz", + "integrity": "sha512-ObN6h1v2fTJSmUXoS3nMQ92LbDK9be4TV+6G+omQlGJFdcUX5heKi1LZ1YnRMIgwTLEj3E24bT6tYni50rlCfQ==", + "dev": true, + "requires": { + "ansi-styles": "3.2.1", + "escape-string-regexp": "1.0.5", + "supports-color": "5.5.0" + } + }, + "debug": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.0.tgz", + "integrity": "sha512-heNPJUJIqC+xB6ayLAMHaIrmN9HKa7aQO8MGqKpvCA+uJYVcvR6l5kgdrhRuwPFHU7P5/A1w0BjByPHwpfTDKg==", + "dev": true, + "requires": { + "ms": "2.1.1" + } + }, + "esprima": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", + "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", + "dev": true + }, + "glob": { + "version": "7.1.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.3.tgz", + "integrity": "sha512-vcfuiIxogLV4DlGBHIUOwI0IbrJ8HWPc4MU7HzviGeNho/UJDfi6B5p3sHeWIQ0KGIU0Jpxi5ZHxemQfLkkAwQ==", + "dev": true, + "requires": { + "fs.realpath": "1.0.0", + "inflight": "1.0.6", + "inherits": "2.0.3", + "minimatch": "3.0.4", + "once": "1.4.0", + "path-is-absolute": "1.0.1" + } + }, + "js-yaml": { + "version": "3.12.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.12.0.tgz", + "integrity": "sha512-PIt2cnwmPfL4hKNwqeiuz4bKfnzHTBv6HyVgjahA6mPLwPDzjDWrplJBMjHUFxku/N3FlmrbyPclad+I+4mJ3A==", + "dev": true, + "requires": { + "argparse": "1.0.9", + "esprima": "4.0.1" + } + }, + "lodash": { + "version": "4.17.11", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.11.tgz", + "integrity": "sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg==", + "dev": true + }, + "ms": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz", + "integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==", + "dev": true + }, + "semver": { + "version": "5.6.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.6.0.tgz", + "integrity": "sha512-RS9R6R35NYgQn++fkDWaOmqGoj4Ek9gGs+DPxNUZKuwE183xjJroKvyo1IzVFeXvUrvmALy6FWD5xrdJT25gMg==", + "dev": true + }, + "strip-ansi": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", + "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", + "dev": true, + "requires": { + "ansi-regex": "3.0.0" + } + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "3.0.0" + } + }, + "table": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/table/-/table-5.1.0.tgz", + "integrity": "sha512-e542in22ZLhD/fOIuXs/8yDZ9W61ltF8daM88rkRNtgTIct+vI2fTnAyu/Db2TCfEcI8i7mjZz6meLq0nW7TYg==", + "dev": true, + "requires": { + "ajv": "6.5.4", + "lodash": "4.17.11", + "slice-ansi": "1.0.0", + "string-width": "2.1.1" + } + } + } + }, + "eslint-plugin-flowtype": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-flowtype/-/eslint-plugin-flowtype-3.2.0.tgz", + "integrity": "sha512-baJmzngM6UKbEkJ5OY3aGw2zjXBt5L2QKZvTsOlXX7yHKIjNRrlJx2ods8Rng6EdqPR9rVNIQNYHpTs0qfn2qA==", + "dev": true, + "requires": { + "lodash": "4.17.11" + }, + "dependencies": { + "lodash": { + "version": "4.17.11", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.11.tgz", + "integrity": "sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg==", + "dev": true + } + } + }, + "eslint-scope": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-4.0.0.tgz", + "integrity": "sha512-1G6UTDi7Jc1ELFwnR58HV4fK9OQK4S6N985f166xqXxpjU6plxFISJa2Ba9KCQuFa8RCnj/lSFJbHo7UFDBnUA==", + "dev": true, + "requires": { + "esrecurse": "4.2.1", + "estraverse": "4.2.0" + } + }, + "eslint-utils": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-1.3.1.tgz", + "integrity": "sha512-Z7YjnIldX+2XMcjr7ZkgEsOj/bREONV60qYeB/bjMAqqqZ4zxKyWX+BOUkdmRmA9riiIPVvo5x86m5elviOk0Q==", + "dev": true + }, + "eslint-visitor-keys": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.0.0.tgz", + "integrity": "sha512-qzm/XxIbxm/FHyH341ZrbnMUpe+5Bocte9xkmFMzPMjRaZMcXww+MpBptFvtU+79L362nqiLhekCxCxDPaUMBQ==", + "dev": true + }, + "espree": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/espree/-/espree-4.1.0.tgz", + "integrity": "sha512-I5BycZW6FCVIub93TeVY1s7vjhP9CY6cXCznIRfiig7nRviKZYdRnj/sHEWC6A7WE9RDWOFq9+7OsWSYz8qv2w==", + "dev": true, + "requires": { + "acorn": "6.0.4", + "acorn-jsx": "5.0.0", + "eslint-visitor-keys": "1.0.0" + }, + "dependencies": { + "acorn": { + "version": "6.0.4", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-6.0.4.tgz", + "integrity": "sha512-VY4i5EKSKkofY2I+6QLTbTTN/UvEQPCo6eiwzzSaSWfpaDhOmStMCMod6wmuPciNq+XS0faCglFu2lHZpdHUtg==", + "dev": true + } + } + }, "esprima": { "version": "2.7.3", "resolved": "https://registry.npmjs.org/esprima/-/esprima-2.7.3.tgz", "integrity": "sha1-luO3DVd59q1JzQMmc9HDEnZ7pYE=", "dev": true }, + "esquery": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.0.1.tgz", + "integrity": "sha512-SmiyZ5zIWH9VM+SRUReLS5Q8a7GxtRdxEBVZpm98rJM7Sb+A9DVCndXfkeFUd3byderg+EbDkfnevfCwynWaNA==", + "dev": true, + "requires": { + "estraverse": "4.2.0" + } + }, + "esrecurse": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.2.1.tgz", + "integrity": "sha512-64RBB++fIOAXPw3P9cy89qfMlvZEXZkqqJkjqqXIvzP5ezRZjW+lPWjw35UX/3EhUPFYbg5ER4JYgDw4007/DQ==", + "dev": true, + "requires": { + "estraverse": "4.2.0" + } + }, "estraverse": { "version": "4.2.0", "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.2.0.tgz", "integrity": "sha1-De4/7TH81GlhjOc0IJn8GvoL2xM=", "dev": true }, + "estree-walker": { + "version": "0.5.1", + "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-0.5.1.tgz", + "integrity": "sha512-7HgCgz1axW7w5aOvgOQkoR1RMBkllygJrssU3BvymKQ95lxXYv6Pon17fBRDm9qhkvXZGijOULoSF9ShOk/ZLg==", + "dev": true + }, + "esutils": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.2.tgz", + "integrity": "sha1-Cr9PHKpbyx96nYrMbepPqqBLrJs=", + "dev": true + }, "eventemitter2": { "version": "0.4.14", "resolved": "https://registry.npmjs.org/eventemitter2/-/eventemitter2-0.4.14.tgz", @@ -638,10 +1391,80 @@ "integrity": "sha1-BjJjj42HfMghB9MKD/8aF8uhzQw=", "dev": true }, - "eyes": { - "version": "0.1.8", - "resolved": "https://registry.npmjs.org/eyes/-/eyes-0.1.8.tgz", - "integrity": "sha1-Ys8SAjTGg3hdkCNIqADvPgzCC8A=", + "expand-brackets": { + "version": "0.1.5", + "resolved": "https://registry.npmjs.org/expand-brackets/-/expand-brackets-0.1.5.tgz", + "integrity": "sha1-3wcoTjQqgHzXM6xa9yQR5YHRF3s=", + "dev": true, + "requires": { + "is-posix-bracket": "0.1.1" + } + }, + "expand-range": { + "version": "1.8.2", + "resolved": "https://registry.npmjs.org/expand-range/-/expand-range-1.8.2.tgz", + "integrity": "sha1-opnv/TNf4nIeuujiV+x5ZE/IUzc=", + "dev": true, + "requires": { + "fill-range": "2.2.3" + } + }, + "external-editor": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/external-editor/-/external-editor-3.0.3.tgz", + "integrity": "sha512-bn71H9+qWoOQKyZDo25mOMVpSmXROAsTJVVVYzrrtol3d4y+AsKjf4Iwl2Q+IuT0kFSQ1qo166UuIwqYq7mGnA==", + "dev": true, + "requires": { + "chardet": "0.7.0", + "iconv-lite": "0.4.24", + "tmp": "0.0.33" + }, + "dependencies": { + "iconv-lite": { + "version": "0.4.24", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", + "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", + "dev": true, + "requires": { + "safer-buffer": "2.1.2" + } + }, + "tmp": { + "version": "0.0.33", + "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz", + "integrity": "sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==", + "dev": true, + "requires": { + "os-tmpdir": "1.0.2" + } + } + } + }, + "extglob": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/extglob/-/extglob-0.3.2.tgz", + "integrity": "sha1-Lhj/PS9JqydlzskCPwEdqo2DSaE=", + "dev": true, + "requires": { + "is-extglob": "1.0.0" + } + }, + "fast-deep-equal": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz", + "integrity": "sha1-ewUhjd+WZ79/Nwv3/bLLFf3Qqkk=", + "dev": true + }, + "fast-json-stable-stringify": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz", + "integrity": "sha1-1RQsDK7msRifh9OnYREGT4bIu/I=", + "dev": true + }, + "fast-levenshtein": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", + "integrity": "sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=", "dev": true }, "faye-websocket": { @@ -663,6 +1486,35 @@ "object-assign": "4.1.1" } }, + "file-entry-cache": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-2.0.0.tgz", + "integrity": "sha1-w5KZDD5oR4PYOLjISkXYoEhFg2E=", + "dev": true, + "requires": { + "flat-cache": "1.3.2", + "object-assign": "4.1.1" + } + }, + "filename-regex": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/filename-regex/-/filename-regex-2.0.1.tgz", + "integrity": "sha1-wcS5vuPglyXdsQa3XB4wH+LxiyY=", + "dev": true + }, + "fill-range": { + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-2.2.3.tgz", + "integrity": "sha1-ULd9/X5Gm8dJJHCWNpn+eoSFpyM=", + "dev": true, + "requires": { + "is-number": "2.1.0", + "isobject": "2.1.0", + "randomatic": "1.1.7", + "repeat-element": "1.1.2", + "repeat-string": "1.6.1" + } + }, "find-up": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/find-up/-/find-up-1.1.2.tgz", @@ -709,16 +1561,204 @@ } } }, + "flat-cache": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-1.3.2.tgz", + "integrity": "sha512-KByBY8c98sLUAGpnmjEdWTrtrLZRtZdwds+kAL/ciFXTCb7AZgqKsAnVnYFQj1hxepwO8JKN/8AsRWwLq+RK0A==", + "dev": true, + "requires": { + "circular-json": "0.3.3", + "del": "3.0.0", + "graceful-fs": "4.1.11", + "write": "0.2.1" + } + }, + "flow-bin": { + "version": "0.84.0", + "resolved": "https://registry.npmjs.org/flow-bin/-/flow-bin-0.84.0.tgz", + "integrity": "sha512-ocji8eEYp+YfICsm+F6cIHUcD7v5sb0/ADEXm6gyUKdjQzmSckMrPUdZtyfP973t3YGHKliUMxMvIBHyR5LbXQ==", + "dev": true + }, + "flow-remove-types": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/flow-remove-types/-/flow-remove-types-1.2.3.tgz", + "integrity": "sha512-ypq/U3V+t9atYiOuSJd40tekCra03EHKoRsiK/wXGrsZimuum0kdwVY7Yv0HTaoXgHW1WiayomYd+Q3kkvPl9Q==", + "dev": true, + "requires": { + "babylon": "6.18.0", + "vlq": "0.2.3" + } + }, + "flow-typed": { + "version": "2.5.1", + "resolved": "https://registry.npmjs.org/flow-typed/-/flow-typed-2.5.1.tgz", + "integrity": "sha1-D/VlzJTSr4xVd0S6NktvFHJqa58=", + "dev": true, + "requires": { + "@octokit/rest": "15.16.1", + "babel-polyfill": "6.26.0", + "colors": "1.1.2", + "fs-extra": "5.0.0", + "glob": "7.1.3", + "got": "7.1.0", + "md5": "2.2.1", + "mkdirp": "0.5.1", + "rimraf": "2.6.2", + "semver": "5.6.0", + "table": "4.0.3", + "through": "2.3.8", + "unzipper": "0.8.14", + "which": "1.3.1", + "yargs": "4.8.1" + }, + "dependencies": { + "cliui": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-3.2.0.tgz", + "integrity": "sha1-EgYBU3qRbSmUD5NNo7SNWFo5IT0=", + "dev": true, + "requires": { + "string-width": "1.0.2", + "strip-ansi": "3.0.1", + "wrap-ansi": "2.1.0" + } + }, + "glob": { + "version": "7.1.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.3.tgz", + "integrity": "sha512-vcfuiIxogLV4DlGBHIUOwI0IbrJ8HWPc4MU7HzviGeNho/UJDfi6B5p3sHeWIQ0KGIU0Jpxi5ZHxemQfLkkAwQ==", + "dev": true, + "requires": { + "fs.realpath": "1.0.0", + "inflight": "1.0.6", + "inherits": "2.0.3", + "minimatch": "3.0.4", + "once": "1.4.0", + "path-is-absolute": "1.0.1" + } + }, + "is-fullwidth-code-point": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", + "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", + "dev": true, + "requires": { + "number-is-nan": "1.0.1" + } + }, + "rimraf": { + "version": "2.6.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.2.tgz", + "integrity": "sha512-lreewLK/BlghmxtfH36YYVg1i8IAce4TI7oao75I1g245+6BctqTVQiBP3YUJ9C6DQOXJmkYR9X9fCLtCOJc5w==", + "dev": true, + "requires": { + "glob": "7.1.3" + } + }, + "semver": { + "version": "5.6.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.6.0.tgz", + "integrity": "sha512-RS9R6R35NYgQn++fkDWaOmqGoj4Ek9gGs+DPxNUZKuwE183xjJroKvyo1IzVFeXvUrvmALy6FWD5xrdJT25gMg==", + "dev": true + }, + "string-width": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", + "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", + "dev": true, + "requires": { + "code-point-at": "1.1.0", + "is-fullwidth-code-point": "1.0.0", + "strip-ansi": "3.0.1" + } + }, + "which": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", + "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", + "dev": true, + "requires": { + "isexe": "2.0.0" + } + }, + "window-size": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/window-size/-/window-size-0.2.0.tgz", + "integrity": "sha1-tDFbtCFKPXBY6+7okuE/ok2YsHU=", + "dev": true + }, + "yargs": { + "version": "4.8.1", + "resolved": "http://registry.npmjs.org/yargs/-/yargs-4.8.1.tgz", + "integrity": "sha1-wMQpJMpKqmsObaFznfshZDn53cA=", + "dev": true, + "requires": { + "cliui": "3.2.0", + "decamelize": "1.2.0", + "get-caller-file": "1.0.3", + "lodash.assign": "4.2.0", + "os-locale": "1.4.0", + "read-pkg-up": "1.0.1", + "require-directory": "2.1.1", + "require-main-filename": "1.0.1", + "set-blocking": "2.0.0", + "string-width": "1.0.2", + "which-module": "1.0.0", + "window-size": "0.2.0", + "y18n": "3.2.1", + "yargs-parser": "2.4.1" + } + } + } + }, + "for-in": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/for-in/-/for-in-1.0.2.tgz", + "integrity": "sha1-gQaNKVqBQuwKxybG4iAMMPttXoA=", + "dev": true + }, + "for-own": { + "version": "0.1.5", + "resolved": "https://registry.npmjs.org/for-own/-/for-own-0.1.5.tgz", + "integrity": "sha1-UmXGgaTylNq78XyVCbZ2OqhFEM4=", + "dev": true, + "requires": { + "for-in": "1.0.2" + } + }, + "fs-extra": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-5.0.0.tgz", + "integrity": "sha512-66Pm4RYbjzdyeuqudYqhFiNBbCIuI9kgRqLPSHIlXHidW8NIQtVdkM1yeZ4lXwuhbTETv3EUGMNHAAw6hiundQ==", + "dev": true, + "requires": { + "graceful-fs": "4.1.11", + "jsonfile": "4.0.0", + "universalify": "0.1.2" + } + }, "fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", "dev": true }, - "function-bind": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", - "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", + "fstream": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/fstream/-/fstream-1.0.11.tgz", + "integrity": "sha1-XB+x8RdHcRTwYyoOtLcbPLD9MXE=", + "dev": true, + "requires": { + "graceful-fs": "4.1.11", + "inherits": "2.0.3", + "mkdirp": "0.5.1", + "rimraf": "2.2.8" + } + }, + "functional-red-black-tree": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz", + "integrity": "sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc=", "dev": true }, "gaze": { @@ -730,12 +1770,24 @@ "globule": "1.2.0" } }, + "get-caller-file": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-1.0.3.tgz", + "integrity": "sha512-3t6rVToeoZfYSGd8YoLFR2DJkiQrIiUrGcjvFX2mDw3bn6k2OtwHN0TNCLbBO+w8qTvimhDkv+LSscbJY1vE6w==", + "dev": true + }, "get-stdin": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/get-stdin/-/get-stdin-4.0.1.tgz", "integrity": "sha1-uWjGsKBDhDJJAui/Gl3zJXmkUP4=", "dev": true }, + "get-stream": { + "version": "3.0.0", + "resolved": "http://registry.npmjs.org/get-stream/-/get-stream-3.0.0.tgz", + "integrity": "sha1-jpQ9E1jcN1VQVOy+LtsFqhdO3hQ=", + "dev": true + }, "getobject": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/getobject/-/getobject-0.1.0.tgz", @@ -756,6 +1808,44 @@ "path-is-absolute": "1.0.1" } }, + "glob-base": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/glob-base/-/glob-base-0.3.0.tgz", + "integrity": "sha1-27Fk9iIbHAscz4Kuoyi0l98Oo8Q=", + "dev": true, + "requires": { + "glob-parent": "2.0.0", + "is-glob": "2.0.1" + } + }, + "glob-parent": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-2.0.0.tgz", + "integrity": "sha1-gTg9ctsFT8zPUzbaqQLxgvbtuyg=", + "dev": true, + "requires": { + "is-glob": "2.0.1" + } + }, + "globals": { + "version": "11.8.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-11.8.0.tgz", + "integrity": "sha512-io6LkyPVuzCHBSQV9fmOwxZkUk6nIaGmxheLDgmuFv89j0fm2aqDbIXKAGfzCMHqz3HLF2Zf8WSG6VqMh2qFmA==", + "dev": true + }, + "globby": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/globby/-/globby-6.1.0.tgz", + "integrity": "sha1-9abXDoOV4hyFj7BInWTfAkJNUGw=", + "dev": true, + "requires": { + "array-union": "1.0.2", + "glob": "7.0.6", + "object-assign": "4.1.1", + "pify": "2.3.0", + "pinkie-promise": "2.0.1" + } + }, "globule": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/globule/-/globule-1.2.0.tgz", @@ -789,6 +1879,28 @@ } } }, + "got": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/got/-/got-7.1.0.tgz", + "integrity": "sha512-Y5WMo7xKKq1muPsxD+KmrR8DH5auG7fBdDVueZwETwV6VytKyU9OX/ddpq2/1hp1vIPvVb4T81dKQz3BivkNLw==", + "dev": true, + "requires": { + "decompress-response": "3.3.0", + "duplexer3": "0.1.4", + "get-stream": "3.0.0", + "is-plain-obj": "1.1.0", + "is-retry-allowed": "1.1.0", + "is-stream": "1.1.0", + "isurl": "1.0.0", + "lowercase-keys": "1.0.1", + "p-cancelable": "0.3.0", + "p-timeout": "1.2.1", + "safe-buffer": "5.1.1", + "timed-out": "4.0.1", + "url-parse-lax": "1.0.0", + "url-to-options": "1.0.1" + } + }, "graceful-fs": { "version": "4.1.11", "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.11.tgz", @@ -839,6 +1951,12 @@ } } }, + "grunt-babel": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/grunt-babel/-/grunt-babel-8.0.0.tgz", + "integrity": "sha512-WuiZFvGzcyzlEoPIcY1snI234ydDWeWWV5bpnB7PZsOLHcDsxWKnrR1rMWEUsbdVPPjvIirwFNsuo4CbJmsdFQ==", + "dev": true + }, "grunt-contrib-compass": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/grunt-contrib-compass/-/grunt-contrib-compass-1.1.1.tgz", @@ -874,27 +1992,13 @@ "pretty-bytes": "4.0.2" } }, - "grunt-contrib-jshint": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/grunt-contrib-jshint/-/grunt-contrib-jshint-1.1.0.tgz", - "integrity": "sha1-Np2QmyWTxA6L55lAshNAhQx5Oaw=", - "dev": true, - "requires": { - "chalk": "1.1.3", - "hooker": "0.2.3", - "jshint": "2.9.5" - } - }, - "grunt-contrib-uglify": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/grunt-contrib-uglify/-/grunt-contrib-uglify-2.2.1.tgz", - "integrity": "sha1-ij7+xp4ddXbuFoRfwFJja1uMDTo=", + "grunt-contrib-uglify-es": { + "version": "git://github.com/gruntjs/grunt-contrib-uglify.git#ccb95a70cad6a4e9e902d3bd5d0e38a4de09a1e1", "dev": true, "requires": { "chalk": "1.1.3", "maxmin": "1.1.0", - "object.assign": "4.1.0", - "uglify-js": "2.8.29", + "uglify-es": "3.3.9", "uri-path": "1.0.0" } }, @@ -910,31 +2014,92 @@ "tiny-lr": "0.2.1" } }, + "grunt-eslint": { + "version": "21.0.0", + "resolved": "https://registry.npmjs.org/grunt-eslint/-/grunt-eslint-21.0.0.tgz", + "integrity": "sha512-HJocD9P35lpCvy6pPPCTgzBavzckrT1nt7lpqV55Vy8E6LQJv4RortXoH1jJTYhO5DYY7RPATv7Uc4383PUYqQ==", + "dev": true, + "requires": { + "chalk": "2.4.1", + "eslint": "5.8.0" + }, + "dependencies": { + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "requires": { + "color-convert": "1.9.3" + } + }, + "chalk": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.1.tgz", + "integrity": "sha512-ObN6h1v2fTJSmUXoS3nMQ92LbDK9be4TV+6G+omQlGJFdcUX5heKi1LZ1YnRMIgwTLEj3E24bT6tYni50rlCfQ==", + "dev": true, + "requires": { + "ansi-styles": "3.2.1", + "escape-string-regexp": "1.0.5", + "supports-color": "5.5.0" + } + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "3.0.0" + } + } + } + }, "grunt-files-to-javascript-variables": { - "version": "git://github.com/alexschrod/grunt-files-to-javascript-variables.git#863aa75d3309fd90f023bc2713088889c78f6429", + "version": "git://github.com/alexschrod/grunt-files-to-javascript-variables.git#49698ce0a51eea980d38627ec8a0ac9290816274", "dev": true, "requires": { "comment-json": "0.1.11", "mime": "1.2.11" } }, - "grunt-jscs": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/grunt-jscs/-/grunt-jscs-3.0.1.tgz", - "integrity": "sha1-H65Q4+lV3546nZQlrsIqzK4AgJI=", + "grunt-flow": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/grunt-flow/-/grunt-flow-2.0.0.tgz", + "integrity": "sha512-0yE1lipeub5LNwecv3CRHj9AaLI60TxbTEAzu/FXlzSRsetoGlUmapxP0eY8I1u0oszWnLH6R8zaG0J82wc8aw==", "dev": true, "requires": { - "hooker": "0.2.3", - "jscs": "3.0.7", - "lodash": "4.6.1", - "vow": "0.4.17" + "chalk": "2.3.2" }, "dependencies": { - "lodash": { - "version": "4.6.1", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.6.1.tgz", - "integrity": "sha1-3wDBFkrSNrGDz8OIel6NOMxjy7w=", - "dev": true + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "requires": { + "color-convert": "1.9.3" + } + }, + "chalk": { + "version": "2.3.2", + "resolved": "http://registry.npmjs.org/chalk/-/chalk-2.3.2.tgz", + "integrity": "sha512-ZM4j2/ld/YZDc3Ma8PgN7gyAk+kHMMMyzLNryCPGhWrsfAuDVeuid5bpRFTDgMH9JBK2lA4dyyAkkZYF/WcqDQ==", + "dev": true, + "requires": { + "ansi-styles": "3.2.1", + "escape-string-regexp": "1.0.5", + "supports-color": "5.5.0" + } + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "3.0.0" + } } } }, @@ -998,6 +2163,15 @@ } } }, + "grunt-rollup": { + "version": "8.2.0", + "resolved": "https://registry.npmjs.org/grunt-rollup/-/grunt-rollup-8.2.0.tgz", + "integrity": "sha512-wUK1XdeB9nZ+YQbiK41XfWnL2HGan+p9Rx84OpCS2zrIjX4ohKmDrQ/L4ocRNwBy8SZQmz3ZETMPbvYu1ipOKA==", + "dev": true, + "requires": { + "rollup": "0.51.7" + } + }, "gzip-size": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/gzip-size/-/gzip-size-1.0.0.tgz", @@ -1017,18 +2191,27 @@ "ansi-regex": "2.1.1" } }, - "has-color": { - "version": "0.1.7", - "resolved": "https://registry.npmjs.org/has-color/-/has-color-0.1.7.tgz", - "integrity": "sha1-ZxRKUmDDT8PMpnfQQdr1L+e3iy8=", + "has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", "dev": true }, - "has-symbols": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.0.tgz", - "integrity": "sha1-uhqPGvKg/DllD1yFA2dwQSIGO0Q=", + "has-symbol-support-x": { + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/has-symbol-support-x/-/has-symbol-support-x-1.4.2.tgz", + "integrity": "sha512-3ToOva++HaW+eCpgqZrCfN51IPB+7bJNVT6CUATzueB5Heb8o6Nam0V3HG5dlDvZU1Gn5QLcbahiKw/XVk5JJw==", "dev": true }, + "has-to-string-tag-x": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/has-to-string-tag-x/-/has-to-string-tag-x-1.4.1.tgz", + "integrity": "sha512-vdbKfmw+3LoOYVr+mtxHaX5a96+0f3DljYd8JOqvOLsf5mw2Otda2qCDT9qRqLAhrjyQ0h7ual5nOiASpsGNFw==", + "dev": true, + "requires": { + "has-symbol-support-x": "1.4.2" + } + }, "he": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/he/-/he-1.1.1.tgz", @@ -1063,19 +2246,6 @@ "uglify-js": "2.8.29" } }, - "htmlparser2": { - "version": "3.8.3", - "resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-3.8.3.tgz", - "integrity": "sha1-mWwosZFRaovoZQGn15dX5ccMEGg=", - "dev": true, - "requires": { - "domelementtype": "1.3.0", - "domhandler": "2.3.0", - "domutils": "1.5.1", - "entities": "1.0.0", - "readable-stream": "1.1.14" - } - }, "http-errors": { "version": "1.3.1", "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.3.1.tgz", @@ -1092,11 +2262,59 @@ "integrity": "sha1-6hoE+2St/wJC6ZdPKX3Uw8rSceE=", "dev": true }, - "i": { - "version": "0.3.6", - "resolved": "https://registry.npmjs.org/i/-/i-0.3.6.tgz", - "integrity": "sha1-2WyScyB28HJxG2sQ/X1PZa2O4j0=", - "dev": true + "http-proxy-agent": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-2.1.0.tgz", + "integrity": "sha512-qwHbBLV7WviBl0rQsOzH6o5lwyOIvwp/BdFnvVxXORldu5TmjFfjzBcWUWS5kWAZhmv+JtiDhSuQCp4sBfbIgg==", + "dev": true, + "requires": { + "agent-base": "4.2.1", + "debug": "3.1.0" + }, + "dependencies": { + "debug": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", + "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", + "dev": true, + "requires": { + "ms": "2.0.0" + } + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", + "dev": true + } + } + }, + "https-proxy-agent": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-2.2.1.tgz", + "integrity": "sha512-HPCTS1LW51bcyMYbxUIOO4HEOlQ1/1qRaFWcyxvwaqUS9TY88aoEuHUY33kuAh1YhVVaDQhLZsnPd+XNARWZlQ==", + "dev": true, + "requires": { + "agent-base": "4.2.1", + "debug": "3.2.6" + }, + "dependencies": { + "debug": { + "version": "3.2.6", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz", + "integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==", + "dev": true, + "requires": { + "ms": "2.1.1" + } + }, + "ms": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz", + "integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==", + "dev": true + } + } }, "iconv-lite": { "version": "0.4.19", @@ -1104,6 +2322,18 @@ "integrity": "sha512-oTZqweIP51xaGPI4uPa56/Pri/480R+mo7SeU+YETByQNhDG55ycFyNLIgta9vXhILrxXDmF7ZGhqZIcuN0gJQ==", "dev": true }, + "ignore": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-4.0.6.tgz", + "integrity": "sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg==", + "dev": true + }, + "imurmurhash": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", + "integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=", + "dev": true + }, "indent-string": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-2.1.0.tgz", @@ -1123,18 +2353,100 @@ "wrappy": "1.0.2" } }, - "inherit": { - "version": "2.2.6", - "resolved": "https://registry.npmjs.org/inherit/-/inherit-2.2.6.tgz", - "integrity": "sha1-8WFLBshUToEo5CKchjR9tzrZeI0=", - "dev": true - }, "inherits": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", "dev": true }, + "inquirer": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-6.2.0.tgz", + "integrity": "sha512-QIEQG4YyQ2UYZGDC4srMZ7BjHOmNk1lR2JQj5UknBapklm6WHA+VVH7N+sUdX3A7NeCfGF8o4X1S3Ao7nAcIeg==", + "dev": true, + "requires": { + "ansi-escapes": "3.1.0", + "chalk": "2.4.1", + "cli-cursor": "2.1.0", + "cli-width": "2.2.0", + "external-editor": "3.0.3", + "figures": "2.0.0", + "lodash": "4.17.11", + "mute-stream": "0.0.7", + "run-async": "2.3.0", + "rxjs": "6.3.3", + "string-width": "2.1.1", + "strip-ansi": "4.0.0", + "through": "2.3.8" + }, + "dependencies": { + "ansi-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", + "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", + "dev": true + }, + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "requires": { + "color-convert": "1.9.3" + } + }, + "chalk": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.1.tgz", + "integrity": "sha512-ObN6h1v2fTJSmUXoS3nMQ92LbDK9be4TV+6G+omQlGJFdcUX5heKi1LZ1YnRMIgwTLEj3E24bT6tYni50rlCfQ==", + "dev": true, + "requires": { + "ansi-styles": "3.2.1", + "escape-string-regexp": "1.0.5", + "supports-color": "5.5.0" + } + }, + "figures": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/figures/-/figures-2.0.0.tgz", + "integrity": "sha1-OrGi0qYsi/tDGgyUy3l6L84nyWI=", + "dev": true, + "requires": { + "escape-string-regexp": "1.0.5" + } + }, + "lodash": { + "version": "4.17.11", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.11.tgz", + "integrity": "sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg==", + "dev": true + }, + "strip-ansi": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", + "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", + "dev": true, + "requires": { + "ansi-regex": "3.0.0" + } + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "3.0.0" + } + } + } + }, + "invert-kv": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/invert-kv/-/invert-kv-1.0.0.tgz", + "integrity": "sha1-EEqOSqym09jNFXqO+L+rLXo//bY=", + "dev": true + }, "is-arrayish": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", @@ -1156,6 +2468,33 @@ "builtin-modules": "1.1.1" } }, + "is-dotfile": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/is-dotfile/-/is-dotfile-1.0.3.tgz", + "integrity": "sha1-pqLzL/0t+wT1yiXs0Pa4PPeYoeE=", + "dev": true + }, + "is-equal-shallow": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/is-equal-shallow/-/is-equal-shallow-0.1.3.tgz", + "integrity": "sha1-IjgJj8Ih3gvPpdnqxMRdY4qhxTQ=", + "dev": true, + "requires": { + "is-primitive": "2.0.0" + } + }, + "is-extendable": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-0.1.1.tgz", + "integrity": "sha1-YrEQ4omkcUGOPsNqYX1HLjAd/Ik=", + "dev": true + }, + "is-extglob": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-1.0.0.tgz", + "integrity": "sha1-rEaBd8SUNAWgkvyPKXYMb/xiBsA=", + "dev": true + }, "is-finite": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/is-finite/-/is-finite-1.0.2.tgz", @@ -1165,149 +2504,181 @@ "number-is-nan": "1.0.1" } }, - "is-utf8": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/is-utf8/-/is-utf8-0.2.1.tgz", - "integrity": "sha1-Sw2hRCEE0bM2NA6AeX6GXPOffXI=", + "is-fullwidth-code-point": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", + "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", "dev": true }, - "isarray": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", - "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=", + "is-glob": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-2.0.1.tgz", + "integrity": "sha1-0Jb5JqPe1WAPP9/ZEZjLCIjC2GM=", + "dev": true, + "requires": { + "is-extglob": "1.0.0" + } + }, + "is-module": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-module/-/is-module-1.0.0.tgz", + "integrity": "sha1-Mlj7afeMFNW4FdZkM2tM/7ZEFZE=", "dev": true }, - "isexe": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", - "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", + "is-number": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-2.1.0.tgz", + "integrity": "sha1-Afy7s5NGOlSPL0ZszhbezknbkI8=", + "dev": true, + "requires": { + "kind-of": "3.2.2" + } + }, + "is-object": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-object/-/is-object-1.0.1.tgz", + "integrity": "sha1-iVJojF7C/9awPsyF52ngKQMINHA=", "dev": true }, - "isstream": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", - "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=", + "is-path-cwd": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-path-cwd/-/is-path-cwd-1.0.0.tgz", + "integrity": "sha1-0iXsIxMuie3Tj9p2dHLmLmXxEG0=", "dev": true }, - "js-yaml": { - "version": "3.5.5", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.5.5.tgz", - "integrity": "sha1-A3fDgBfKvHMisNH7zSWkkWQfL74=", + "is-path-in-cwd": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-path-in-cwd/-/is-path-in-cwd-1.0.1.tgz", + "integrity": "sha512-FjV1RTW48E7CWM7eE/J2NJvAEEVektecDBVBE5Hh3nM1Jd0kvhHtX68Pr3xsDf857xt3Y4AkwVULK1Vku62aaQ==", "dev": true, "requires": { - "argparse": "1.0.9", - "esprima": "2.7.3" + "is-path-inside": "1.0.1" } }, - "jscs": { - "version": "3.0.7", - "resolved": "https://registry.npmjs.org/jscs/-/jscs-3.0.7.tgz", - "integrity": "sha1-cUG03/W4bjLQ6Z12S4NnZ8MNIBo=", + "is-path-inside": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-1.0.1.tgz", + "integrity": "sha1-jvW33lBDej/cprToZe96pVy0gDY=", "dev": true, "requires": { - "chalk": "1.1.3", - "cli-table": "0.3.1", - "commander": "2.9.0", - "cst": "0.4.10", - "estraverse": "4.2.0", - "exit": "0.1.2", - "glob": "5.0.15", - "htmlparser2": "3.8.3", - "js-yaml": "3.4.6", - "jscs-jsdoc": "2.0.0", - "jscs-preset-wikimedia": "1.0.0", - "jsonlint": "1.6.2", - "lodash": "3.10.1", - "minimatch": "3.0.4", - "natural-compare": "1.2.2", - "pathval": "0.1.1", - "prompt": "0.2.14", - "reserved-words": "0.1.2", - "resolve": "1.1.7", - "strip-bom": "2.0.0", - "strip-json-comments": "1.0.4", - "to-double-quotes": "2.0.0", - "to-single-quotes": "2.0.1", - "vow": "0.4.17", - "vow-fs": "0.3.6", - "xmlbuilder": "3.1.0" - }, - "dependencies": { - "glob": { - "version": "5.0.15", - "resolved": "https://registry.npmjs.org/glob/-/glob-5.0.15.tgz", - "integrity": "sha1-G8k2ueAvSmA/zCIuz3Yz0wuLk7E=", - "dev": true, - "requires": { - "inflight": "1.0.6", - "inherits": "2.0.3", - "minimatch": "3.0.4", - "once": "1.4.0", - "path-is-absolute": "1.0.1" - } - }, - "js-yaml": { - "version": "3.4.6", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.4.6.tgz", - "integrity": "sha1-a+GyP2JJ9T0pM3D9TRqqY84bTrA=", - "dev": true, - "requires": { - "argparse": "1.0.9", - "esprima": "2.7.3", - "inherit": "2.2.6" - } - } + "path-is-inside": "1.0.2" } }, - "jscs-jsdoc": { + "is-plain-obj": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-1.1.0.tgz", + "integrity": "sha1-caUMhCnfync8kqOQpKA7OfzVHT4=", + "dev": true + }, + "is-posix-bracket": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/is-posix-bracket/-/is-posix-bracket-0.1.1.tgz", + "integrity": "sha1-MzTceXdDaOkvAW5vvAqI9c1ua8Q=", + "dev": true + }, + "is-primitive": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-primitive/-/is-primitive-2.0.0.tgz", + "integrity": "sha1-IHurkWOEmcB7Kt8kCkGochADRXU=", + "dev": true + }, + "is-promise": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-promise/-/is-promise-2.1.0.tgz", + "integrity": "sha1-eaKp7OfwlugPNtKy87wWwf9L8/o=", + "dev": true + }, + "is-resolvable": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-resolvable/-/is-resolvable-1.1.0.tgz", + "integrity": "sha512-qgDYXFSR5WvEfuS5dMj6oTMEbrrSaM0CrFk2Yiq/gXnBvD9pMa2jGXxyhGLfvhZpuMZe18CJpFxAt3CRs42NMg==", + "dev": true + }, + "is-retry-allowed": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-retry-allowed/-/is-retry-allowed-1.1.0.tgz", + "integrity": "sha1-EaBgVotnM5REAz0BJaYaINVk+zQ=", + "dev": true + }, + "is-stream": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz", + "integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=", + "dev": true + }, + "is-utf8": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/is-utf8/-/is-utf8-0.2.1.tgz", + "integrity": "sha1-Sw2hRCEE0bM2NA6AeX6GXPOffXI=", + "dev": true + }, + "isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", + "dev": true + }, + "isexe": { "version": "2.0.0", - "resolved": "https://registry.npmjs.org/jscs-jsdoc/-/jscs-jsdoc-2.0.0.tgz", - "integrity": "sha1-9T684CmqMSW9iCkLpQ1k1FEKSHE=", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", + "dev": true + }, + "isobject": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-2.1.0.tgz", + "integrity": "sha1-8GVWEJaj8dou9GJy+BXIQNh+DIk=", "dev": true, "requires": { - "comment-parser": "0.3.2", - "jsdoctypeparser": "1.2.0" + "isarray": "1.0.0" + }, + "dependencies": { + "isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", + "dev": true + } } }, - "jscs-preset-wikimedia": { + "isurl": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/jscs-preset-wikimedia/-/jscs-preset-wikimedia-1.0.0.tgz", - "integrity": "sha1-//VjNCA4/C6IJre7cwnDrjQG/H4=", - "dev": true - }, - "jsdoctypeparser": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/jsdoctypeparser/-/jsdoctypeparser-1.2.0.tgz", - "integrity": "sha1-597cFToRhJ/8UUEUSuhqfvDCU5I=", + "resolved": "https://registry.npmjs.org/isurl/-/isurl-1.0.0.tgz", + "integrity": "sha512-1P/yWsxPlDtn7QeRD+ULKQPaIaN6yF368GZ2vDfv0AL0NwpStafjWCDDdn0k8wgFMWpVAqG7oJhxHnlud42i9w==", "dev": true, "requires": { - "lodash": "3.10.1" + "has-to-string-tag-x": "1.4.1", + "is-object": "1.0.1" } }, - "jshint": { - "version": "2.9.5", - "resolved": "https://registry.npmjs.org/jshint/-/jshint-2.9.5.tgz", - "integrity": "sha1-HnJSkVzmgbQIJ+4UJIxG006apiw=", + "jquery": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/jquery/-/jquery-3.2.1.tgz", + "integrity": "sha1-XE2d5lKvbNCncBVKYxu6ErAVx4c=", + "dev": true + }, + "js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", + "dev": true + }, + "js-yaml": { + "version": "3.5.5", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.5.5.tgz", + "integrity": "sha1-A3fDgBfKvHMisNH7zSWkkWQfL74=", "dev": true, "requires": { - "cli": "1.0.1", - "console-browserify": "1.1.0", - "exit": "0.1.2", - "htmlparser2": "3.8.3", - "lodash": "3.7.0", - "minimatch": "3.0.4", - "shelljs": "0.3.0", - "strip-json-comments": "1.0.4" - }, - "dependencies": { - "lodash": { - "version": "3.7.0", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-3.7.0.tgz", - "integrity": "sha1-Nni9irmVBXwHreg27S7wh9qBHUU=", - "dev": true - } + "argparse": "1.0.9", + "esprima": "2.7.3" } }, + "jsesc": { + "version": "2.5.2", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-2.5.2.tgz", + "integrity": "sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA==", + "dev": true + }, "json-parser": { "version": "0.2.4", "resolved": "https://registry.npmjs.org/json-parser/-/json-parser-0.2.4.tgz", @@ -1325,22 +2696,33 @@ } } }, - "jsonlint": { - "version": "1.6.2", - "resolved": "https://registry.npmjs.org/jsonlint/-/jsonlint-1.6.2.tgz", - "integrity": "sha1-VzcEUIX1XrRVxosf9OvAG9UOiDA=", + "json-schema-traverse": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", + "dev": true + }, + "json-stable-stringify-without-jsonify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", + "integrity": "sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE=", + "dev": true + }, + "json5": { + "version": "0.5.1", + "resolved": "http://registry.npmjs.org/json5/-/json5-0.5.1.tgz", + "integrity": "sha1-Hq3nrMASA0rYTiOWdn6tn6VJWCE=", + "dev": true + }, + "jsonfile": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz", + "integrity": "sha1-h3Gq4HmbZAdrdmQPygWPnBDjPss=", "dev": true, "requires": { - "JSV": "4.0.2", - "nomnom": "1.8.1" + "graceful-fs": "4.1.11" } }, - "JSV": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/JSV/-/JSV-4.0.2.tgz", - "integrity": "sha1-0Hf2glVx+CEy+d/67Vh7QCn+/1c=", - "dev": true - }, "kind-of": { "version": "3.2.2", "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", @@ -1356,6 +2738,31 @@ "integrity": "sha1-odePw6UEdMuAhF07O24dpJpEbo4=", "dev": true }, + "lcid": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/lcid/-/lcid-1.0.0.tgz", + "integrity": "sha1-MIrMr6C8SDo4Z7S28rlQYlHRuDU=", + "dev": true, + "requires": { + "invert-kv": "1.0.0" + } + }, + "levn": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/levn/-/levn-0.3.0.tgz", + "integrity": "sha1-OwmSTt+fCDwEkP3UwLxEIeBHZO4=", + "dev": true, + "requires": { + "prelude-ls": "1.1.2", + "type-check": "0.3.2" + } + }, + "listenercount": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/listenercount/-/listenercount-1.0.1.tgz", + "integrity": "sha1-hMinKrWcRyUyFIDJdeZQg0LnCTc=", + "dev": true + }, "livereload-js": { "version": "2.2.3", "resolved": "https://registry.npmjs.org/livereload-js/-/livereload-js-2.2.3.tgz", @@ -1393,6 +2800,12 @@ "integrity": "sha1-W/Rejkm6QYnhfUgnid/RW9FAt7Y=", "dev": true }, + "lodash.assign": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/lodash.assign/-/lodash.assign-4.2.0.tgz", + "integrity": "sha1-DZnzzNem0mHRm9rrkkUAXShYCOc=", + "dev": true + }, "longest": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/longest/-/longest-1.0.1.tgz", @@ -1415,6 +2828,27 @@ "integrity": "sha1-miyr0bno4K6ZOkv31YdcOcQujqw=", "dev": true }, + "lowercase-keys": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-1.0.1.tgz", + "integrity": "sha512-G2Lj61tXDnVFFOi8VZds+SoQjtQC3dgokKdDG2mTm1tx4m50NUHBOZSBwQQHyy0V12A0JTG4icfZQH+xPyh8VA==", + "dev": true + }, + "macos-release": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/macos-release/-/macos-release-1.1.0.tgz", + "integrity": "sha512-mmLbumEYMi5nXReB9js3WGsB8UE6cDBWyIO62Z4DNx6GbRhDxHNjA1MlzSpJ2S2KM1wyiPRA0d19uHWYYvMHjA==", + "dev": true + }, + "magic-string": { + "version": "0.22.4", + "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.22.4.tgz", + "integrity": "sha512-kxBL06p6iO2qPBHsqGK2b3cRwiRGpnmSuVWNhwHcMX7qJOUr1HvricYP1LZOCdkQBUp0jiWg2d6WJwR3vYgByw==", + "dev": true, + "requires": { + "vlq": "0.2.3" + } + }, "map-obj": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/map-obj/-/map-obj-1.0.1.tgz", @@ -1445,6 +2879,17 @@ } } }, + "md5": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/md5/-/md5-2.2.1.tgz", + "integrity": "sha1-U6s41f48iJG6RlMp6iP6wFQBJvk=", + "dev": true, + "requires": { + "charenc": "0.0.2", + "crypt": "0.0.2", + "is-buffer": "1.1.6" + } + }, "media-typer": { "version": "0.3.0", "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", @@ -1469,9 +2914,30 @@ "trim-newlines": "1.0.0" } }, + "micromatch": { + "version": "2.3.11", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-2.3.11.tgz", + "integrity": "sha1-hmd8l9FyCzY0MdBNDRUpO9OMFWU=", + "dev": true, + "requires": { + "arr-diff": "2.0.0", + "array-unique": "0.2.1", + "braces": "1.8.5", + "expand-brackets": "0.1.5", + "extglob": "0.3.2", + "filename-regex": "2.0.1", + "is-extglob": "1.0.0", + "is-glob": "2.0.1", + "kind-of": "3.2.2", + "normalize-path": "2.1.1", + "object.omit": "2.0.1", + "parse-glob": "3.0.4", + "regex-cache": "0.4.4" + } + }, "mime": { "version": "1.2.11", - "resolved": "https://registry.npmjs.org/mime/-/mime-1.2.11.tgz", + "resolved": "http://registry.npmjs.org/mime/-/mime-1.2.11.tgz", "integrity": "sha1-WCA+7Ybjpe8XrtK32evUfwpg3RA=", "dev": true }, @@ -1490,6 +2956,18 @@ "mime-db": "1.30.0" } }, + "mimic-fn": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-1.2.0.tgz", + "integrity": "sha512-jf84uxzwiuiIVKiOLpfYk7N46TSy8ubTonmneY9vrpHNAnp0QBt2BxWV9dO3/j+BoVAb+a5G6YDPW3M5HOdMWQ==", + "dev": true + }, + "mimic-response": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-1.0.1.tgz", + "integrity": "sha512-j5EctnkH7amfV/q5Hgmoal1g2QHFJRraOtmx0JpIqkxhBhI/lJSl1nMpQ45hVarwNETOoWEimndZ4QK0RHxuxQ==", + "dev": true + }, "minimatch": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", @@ -1507,7 +2985,7 @@ }, "mkdirp": { "version": "0.5.1", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", + "resolved": "http://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", "dev": true, "requires": { @@ -1516,7 +2994,7 @@ "dependencies": { "minimist": { "version": "0.0.8", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", + "resolved": "http://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", "dev": true } @@ -1547,9 +3025,9 @@ "dev": true }, "natural-compare": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.2.2.tgz", - "integrity": "sha1-H5bWDjFBysG20FZTzg2urHY69qo=", + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", + "integrity": "sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=", "dev": true }, "ncname": { @@ -1561,10 +3039,10 @@ "xml-char-classes": "1.0.0" } }, - "ncp": { - "version": "0.4.2", - "resolved": "https://registry.npmjs.org/ncp/-/ncp-0.4.2.tgz", - "integrity": "sha1-q8xsvT7C7Spyn/bnwfqPAXhKhXQ=", + "nice-try": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/nice-try/-/nice-try-1.0.5.tgz", + "integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==", "dev": true }, "no-case": { @@ -1576,40 +3054,11 @@ "lower-case": "1.1.4" } }, - "nomnom": { - "version": "1.8.1", - "resolved": "https://registry.npmjs.org/nomnom/-/nomnom-1.8.1.tgz", - "integrity": "sha1-IVH3Ikcrp55Qp2/BJbuMjy5Nwqc=", - "dev": true, - "requires": { - "chalk": "0.4.0", - "underscore": "1.6.0" - }, - "dependencies": { - "ansi-styles": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-1.0.0.tgz", - "integrity": "sha1-yxAt8cVvUSPquLZ817mAJ6AnkXg=", - "dev": true - }, - "chalk": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-0.4.0.tgz", - "integrity": "sha1-UZmj3c0MHv4jvAjBsCewYXbgxk8=", - "dev": true, - "requires": { - "ansi-styles": "1.0.0", - "has-color": "0.1.7", - "strip-ansi": "0.1.1" - } - }, - "strip-ansi": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-0.1.1.tgz", - "integrity": "sha1-OeipjQRNFQZgq+SmgIrPcLt7yZE=", - "dev": true - } - } + "node-fetch": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.2.1.tgz", + "integrity": "sha512-ObXBpNCD3A/vYQiQtEWl7DuqjAXjfptYFuGHLdPl5U19/6kJuZV+8uMHLrkj3wJrJoyfg4nhgyFixZdaZoAiEQ==", + "dev": true }, "nopt": { "version": "3.0.6", @@ -1632,6 +3081,15 @@ "validate-npm-package-license": "3.0.1" } }, + "normalize-path": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-2.1.1.tgz", + "integrity": "sha1-GrKLVW4Zg2Oowab35vogE3/mrtk=", + "dev": true, + "requires": { + "remove-trailing-separator": "1.1.0" + } + }, "number-is-nan": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz", @@ -1644,22 +3102,14 @@ "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=", "dev": true }, - "object-keys": { - "version": "1.0.12", - "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.0.12.tgz", - "integrity": "sha512-FTMyFUm2wBcGHnH2eXmz7tC6IwlqQZ6mVZ+6dm6vZ4IQIHjs6FdNsQBuKGPuUUUY6NfJw2PshC08Tn6LzLDOag==", - "dev": true - }, - "object.assign": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.0.tgz", - "integrity": "sha512-exHJeq6kBKj58mqGyTQ9DFvrZC/eR6OwxzoM9YRoGBqrXYonaFyGiFMuc9VZrXf7DarreEwMpurG3dd+CNyW5w==", + "object.omit": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/object.omit/-/object.omit-2.0.1.tgz", + "integrity": "sha1-Gpx0SCnznbuFjHbKNXmuKlTr0fo=", "dev": true, "requires": { - "define-properties": "1.1.3", - "function-bind": "1.1.1", - "has-symbols": "1.0.0", - "object-keys": "1.0.12" + "for-own": "0.1.5", + "is-extendable": "0.1.1" } }, "on-finished": { @@ -1686,12 +3136,80 @@ "integrity": "sha1-ofeDj4MUxRbwXs78vEzP4EtO14k=", "dev": true }, + "optionator": { + "version": "0.8.2", + "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.8.2.tgz", + "integrity": "sha1-NkxeQJ0/TWMB1sC0wFu6UBgK62Q=", + "dev": true, + "requires": { + "deep-is": "0.1.3", + "fast-levenshtein": "2.0.6", + "levn": "0.3.0", + "prelude-ls": "1.1.2", + "type-check": "0.3.2", + "wordwrap": "1.0.0" + }, + "dependencies": { + "wordwrap": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz", + "integrity": "sha1-J1hIEIkUVqQXHI0CJkQa3pDLyus=", + "dev": true + } + } + }, + "os-locale": { + "version": "1.4.0", + "resolved": "http://registry.npmjs.org/os-locale/-/os-locale-1.4.0.tgz", + "integrity": "sha1-IPnxeuKe00XoveWDsT0gCYA8FNk=", + "dev": true, + "requires": { + "lcid": "1.0.0" + } + }, + "os-name": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/os-name/-/os-name-2.0.1.tgz", + "integrity": "sha1-uaOGNhwXrjohc27wWZQFyajF3F4=", + "dev": true, + "requires": { + "macos-release": "1.1.0", + "win-release": "1.1.1" + } + }, "os-tmpdir": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=", "dev": true }, + "p-cancelable": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/p-cancelable/-/p-cancelable-0.3.0.tgz", + "integrity": "sha512-RVbZPLso8+jFeq1MfNvgXtCRED2raz/dKpacfTNxsx6pLEpEomM7gah6VeHSYV3+vo0OAi4MkArtQcWWXuQoyw==", + "dev": true + }, + "p-finally": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz", + "integrity": "sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4=", + "dev": true + }, + "p-map": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/p-map/-/p-map-1.2.0.tgz", + "integrity": "sha512-r6zKACMNhjPJMTl8KcFH4li//gkrXWfbD6feV8l6doRHlzljFWGJ2AP6iKaCJXyZmAUMOPtvbW7EXkbWO/pLEA==", + "dev": true + }, + "p-timeout": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/p-timeout/-/p-timeout-1.2.1.tgz", + "integrity": "sha1-XrOzU7f86Z8QGhA4iAuwVOu+o4Y=", + "dev": true, + "requires": { + "p-finally": "1.0.0" + } + }, "pako": { "version": "0.2.9", "resolved": "https://registry.npmjs.org/pako/-/pako-0.2.9.tgz", @@ -1707,6 +3225,18 @@ "no-case": "2.3.2" } }, + "parse-glob": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/parse-glob/-/parse-glob-3.0.4.tgz", + "integrity": "sha1-ssN2z7EfNVE7rdFz7wu246OIORw=", + "dev": true, + "requires": { + "glob-base": "0.3.0", + "is-dotfile": "1.0.3", + "is-extglob": "1.0.0", + "is-glob": "2.0.1" + } + }, "parse-json": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-2.2.0.tgz", @@ -1737,6 +3267,24 @@ "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", "dev": true }, + "path-is-inside": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/path-is-inside/-/path-is-inside-1.0.2.tgz", + "integrity": "sha1-NlQX3t5EQw0cEa9hAn+s8HS9/FM=", + "dev": true + }, + "path-key": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz", + "integrity": "sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A=", + "dev": true + }, + "path-parse": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.5.tgz", + "integrity": "sha1-PBrfhx6pzWyUMbbqK9dKD/BVxME=", + "dev": true + }, "path-type": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/path-type/-/path-type-1.1.0.tgz", @@ -1748,12 +3296,6 @@ "pinkie-promise": "2.0.1" } }, - "pathval": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/pathval/-/pathval-0.1.1.tgz", - "integrity": "sha1-CPkRzcqczllCiA2ngXvAtyO2bYI=", - "dev": true - }, "pify": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", @@ -1784,10 +3326,28 @@ "find-up": "1.1.2" } }, - "pkginfo": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/pkginfo/-/pkginfo-0.4.1.tgz", - "integrity": "sha1-tUGO8EOd5UJfxJlQQtztFPsqhP8=", + "pluralize": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/pluralize/-/pluralize-7.0.0.tgz", + "integrity": "sha512-ARhBOdzS3e41FbkW/XWrTEtukqqLoK5+Z/4UeDaLuSW+39JPeFgs4gCGqsrJHVZX0fUrx//4OF0K1CUGwlIFow==", + "dev": true + }, + "prelude-ls": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz", + "integrity": "sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ=", + "dev": true + }, + "prepend-http": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/prepend-http/-/prepend-http-1.0.4.tgz", + "integrity": "sha1-1PRWKwzjaW5BrFLQ4ALlemNdxtw=", + "dev": true + }, + "preserve": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/preserve/-/preserve-0.2.0.tgz", + "integrity": "sha1-gV7R9uvGWSb4ZbMQwHE7yzMVzks=", "dev": true }, "pretty-bytes": { @@ -1802,18 +3362,17 @@ "integrity": "sha1-FQ4gt1ZZCtP5EJPyWk8q2L/zC6M=", "dev": true }, - "prompt": { - "version": "0.2.14", - "resolved": "https://registry.npmjs.org/prompt/-/prompt-0.2.14.tgz", - "integrity": "sha1-V3VPZPVD/XsIRXB8gY7OYY8F/9w=", - "dev": true, - "requires": { - "pkginfo": "0.4.1", - "read": "1.0.7", - "revalidator": "0.1.8", - "utile": "0.2.1", - "winston": "0.8.3" - } + "progress": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.1.tgz", + "integrity": "sha512-OE+a6vzqazc+K6LxJrX5UPyKFvGnL5CYmq2jFGNIBWHpc4QyE49/YOumcrpQFJpfejmvRtbJzgO1zPmMCqlbBg==", + "dev": true + }, + "punycode": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", + "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==", + "dev": true }, "qs": { "version": "5.1.0", @@ -1821,6 +3380,47 @@ "integrity": "sha1-TZMuXH6kEcynajEtOaYGIA/VDNk=", "dev": true }, + "randomatic": { + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/randomatic/-/randomatic-1.1.7.tgz", + "integrity": "sha512-D5JUjPyJbaJDkuAazpVnSfVkLlpeO3wDlPROTMLGKG1zMFNFRgrciKo1ltz/AzNTkqE0HzDx655QOL51N06how==", + "dev": true, + "requires": { + "is-number": "3.0.0", + "kind-of": "4.0.0" + }, + "dependencies": { + "is-number": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", + "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", + "dev": true, + "requires": { + "kind-of": "3.2.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "1.1.6" + } + } + } + }, + "kind-of": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-4.0.0.tgz", + "integrity": "sha1-IIE989cSkosgc3hpGkUGb65y3Vc=", + "dev": true, + "requires": { + "is-buffer": "1.1.6" + } + } + } + }, "raw-body": { "version": "2.1.7", "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.1.7.tgz", @@ -1846,15 +3446,6 @@ } } }, - "read": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/read/-/read-1.0.7.tgz", - "integrity": "sha1-s9oZvQUkMal2cdRKQmNK33ELQMQ=", - "dev": true, - "requires": { - "mute-stream": "0.0.7" - } - }, "read-pkg": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-1.1.0.tgz", @@ -1877,15 +3468,18 @@ } }, "readable-stream": { - "version": "1.1.14", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz", - "integrity": "sha1-fPTFTvZI44EwhMY23SB54WbAgdk=", + "version": "2.1.5", + "resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-2.1.5.tgz", + "integrity": "sha1-ZvqLcg4UOLNkaB8q0aY8YYRIydA=", "dev": true, "requires": { + "buffer-shims": "1.0.0", "core-util-is": "1.0.2", "inherits": "2.0.3", - "isarray": "0.0.1", - "string_decoder": "0.10.31" + "isarray": "1.0.0", + "process-nextick-args": "1.0.7", + "string_decoder": "0.10.31", + "util-deprecate": "1.0.2" } }, "redent": { @@ -1899,9 +3493,24 @@ } }, "regenerator-runtime": { - "version": "0.11.1", - "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.11.1.tgz", - "integrity": "sha512-MguG95oij0fC3QV3URf4V2SDYGJhJnJGqvIIgdECeODCT98wSWDAJ94SSuVpYQUoTcGUIL6L4yNB7j1DFFHSBg==", + "version": "0.10.5", + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.10.5.tgz", + "integrity": "sha1-M2w+/BIgrc7dosn6tntaeVWjNlg=", + "dev": true + }, + "regex-cache": { + "version": "0.4.4", + "resolved": "https://registry.npmjs.org/regex-cache/-/regex-cache-0.4.4.tgz", + "integrity": "sha512-nVIZwtCjkC9YgvWkpM55B5rBhBYRZhAaJbgcFYXXsHnbZ9UZI9nnVWYZpBlCqv9ho2eZryPnWrZGsOdPwVWXWQ==", + "dev": true, + "requires": { + "is-equal-shallow": "0.1.3" + } + }, + "regexpp": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/regexpp/-/regexpp-2.0.1.tgz", + "integrity": "sha512-lv0M6+TkDVniA3aD1Eg0DVpfU/booSu7Eev3TDO/mZKHBfVjgCGTV4t4buppESEYDtkArYFOxTJWv6S5C+iaNw==", "dev": true }, "relateurl": { @@ -1910,6 +3519,18 @@ "integrity": "sha1-VNvzd+UUQKypCkzSdGANP/LYiKk=", "dev": true }, + "remove-trailing-separator": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/remove-trailing-separator/-/remove-trailing-separator-1.1.0.tgz", + "integrity": "sha1-wkvOKig62tW8P1jg1IJJuSN52O8=", + "dev": true + }, + "repeat-element": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/repeat-element/-/repeat-element-1.1.2.tgz", + "integrity": "sha1-7wiaF40Ug7quTZPrmLT55OEdmQo=", + "dev": true + }, "repeat-string": { "version": "1.6.1", "resolved": "https://registry.npmjs.org/repeat-string/-/repeat-string-1.6.1.tgz", @@ -1925,12 +3546,36 @@ "is-finite": "1.0.2" } }, - "reserved-words": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/reserved-words/-/reserved-words-0.1.2.tgz", - "integrity": "sha1-AKCUD5jNUBrqqsMWQR2a3FKzGrE=", + "require-directory": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", + "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=", + "dev": true + }, + "require-main-filename": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-1.0.1.tgz", + "integrity": "sha1-l/cXtp1IeE9fUmpsWqj/3aBVpNE=", "dev": true }, + "require-uncached": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/require-uncached/-/require-uncached-1.0.3.tgz", + "integrity": "sha1-Tg1W1slmL9MeQwEcS5WqSZVUIdM=", + "dev": true, + "requires": { + "caller-path": "0.1.0", + "resolve-from": "1.0.1" + }, + "dependencies": { + "resolve-from": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-1.0.1.tgz", + "integrity": "sha1-Jsv+k10a7uq7Kbw/5a6wHpPUQiY=", + "dev": true + } + } + }, "resolve": { "version": "1.1.7", "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.1.7.tgz", @@ -1952,12 +3597,27 @@ "resolve-from": "2.0.0" } }, - "revalidator": { - "version": "0.1.8", - "resolved": "https://registry.npmjs.org/revalidator/-/revalidator-0.1.8.tgz", - "integrity": "sha1-/s5hv6DBtSoga9axgZgYS91SOjs=", - "dev": true - }, + "restore-cursor": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-2.0.0.tgz", + "integrity": "sha1-n37ih/gv0ybU/RYpI9YhKe7g368=", + "dev": true, + "requires": { + "onetime": "2.0.1", + "signal-exit": "3.0.2" + }, + "dependencies": { + "onetime": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-2.0.1.tgz", + "integrity": "sha1-BnQoIw/WdEOyeUsiu6UotoZ5YtQ=", + "dev": true, + "requires": { + "mimic-fn": "1.2.0" + } + } + } + }, "right-align": { "version": "0.1.3", "resolved": "https://registry.npmjs.org/right-align/-/right-align-0.1.3.tgz", @@ -1973,12 +3633,129 @@ "integrity": "sha1-5Dm+Kq7jJzIZUnMPmaiSnk/FBYI=", "dev": true }, + "rollup": { + "version": "0.51.7", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-0.51.7.tgz", + "integrity": "sha512-QOdK6Z+MznqYpvrw82IsjOdUwAU2b8DGe4TIrExUdp6HlyX3QTUuUt/0YcrJBHxUuY5X9uFXNmwxC4FkW9qYuA==", + "dev": true + }, + "rollup-plugin-babel": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/rollup-plugin-babel/-/rollup-plugin-babel-4.0.3.tgz", + "integrity": "sha512-/PP0MgbPQyRywI4zRIJim6ySjTcOLo4kQbEbROqp9kOR3kHC3FeU++QpBDZhS2BcHtJTVZMVbBV46flbBN5zxQ==", + "dev": true, + "requires": { + "@babel/helper-module-imports": "7.0.0", + "rollup-pluginutils": "2.3.3" + }, + "dependencies": { + "estree-walker": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-0.5.2.tgz", + "integrity": "sha512-XpCnW/AE10ws/kDAs37cngSkvgIR8aN3G0MS85m7dUpuK2EREo9VJ00uvw6Dg/hXEpfsE1I1TvJOJr+Z+TL+ig==", + "dev": true + }, + "rollup-pluginutils": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/rollup-pluginutils/-/rollup-pluginutils-2.3.3.tgz", + "integrity": "sha512-2XZwja7b6P5q4RZ5FhyX1+f46xi1Z3qBKigLRZ6VTZjwbN0K1IFGMlwm06Uu0Emcre2Z63l77nq/pzn+KxIEoA==", + "dev": true, + "requires": { + "estree-walker": "0.5.2", + "micromatch": "2.3.11" + } + } + } + }, + "rollup-plugin-commonjs": { + "version": "8.2.6", + "resolved": "https://registry.npmjs.org/rollup-plugin-commonjs/-/rollup-plugin-commonjs-8.2.6.tgz", + "integrity": "sha512-qK0+uhktmnAgZkHkqFuajNmPw93fjrO7+CysDaxWE5jrUR9XSlSvuao5ZJP+XizxA8weakhgYYBtbVz9SGBpjA==", + "dev": true, + "requires": { + "acorn": "5.3.0", + "estree-walker": "0.5.1", + "magic-string": "0.22.4", + "resolve": "1.5.0", + "rollup-pluginutils": "2.0.1" + }, + "dependencies": { + "resolve": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.5.0.tgz", + "integrity": "sha512-hgoSGrc3pjzAPHNBg+KnFcK2HwlHTs/YrAGUr6qgTVUZmXv1UEXXl0bZNBKMA9fud6lRYFdPGz0xXxycPzmmiw==", + "dev": true, + "requires": { + "path-parse": "1.0.5" + } + } + } + }, + "rollup-plugin-node-resolve": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/rollup-plugin-node-resolve/-/rollup-plugin-node-resolve-3.0.2.tgz", + "integrity": "sha512-ZwmMip/yqw6cmDQJuCQJ1G7gw2z11iGUtQNFYrFZHmqadRHU+OZGC3nOXwXu+UTvcm5lzDspB1EYWrkTgPWybw==", + "dev": true, + "requires": { + "builtin-modules": "1.1.1", + "is-module": "1.0.0", + "resolve": "1.1.7" + } + }, + "rollup-plugin-virtual": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/rollup-plugin-virtual/-/rollup-plugin-virtual-1.0.1.tgz", + "integrity": "sha512-HCTBpV8MwP5lNzZrHD2moVxHIToHU1EkzkKGVj6Z0DcgUfxrxrZmeQirQeLz2yhnkJqRjwiVywK9CS8jDYakrw==", + "dev": true + }, + "rollup-pluginutils": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/rollup-pluginutils/-/rollup-pluginutils-2.0.1.tgz", + "integrity": "sha1-fslbNXP2VDpGpkYb2afFRFJdD8A=", + "dev": true, + "requires": { + "estree-walker": "0.3.1", + "micromatch": "2.3.11" + }, + "dependencies": { + "estree-walker": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-0.3.1.tgz", + "integrity": "sha1-5rGlHPcpJSTnI3wxLl/mZgwc4ao=", + "dev": true + } + } + }, + "run-async": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/run-async/-/run-async-2.3.0.tgz", + "integrity": "sha1-A3GrSuC91yDUFm19/aZP96RFpsA=", + "dev": true, + "requires": { + "is-promise": "2.1.0" + } + }, + "rxjs": { + "version": "6.3.3", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.3.3.tgz", + "integrity": "sha512-JTWmoY9tWCs7zvIk/CvRjhjGaOd+OVBM987mxFo+OW66cGpdKjZcpmc74ES1sB//7Kl/PAe8+wEakuhG4pcgOw==", + "dev": true, + "requires": { + "tslib": "1.9.3" + } + }, "safe-buffer": { "version": "5.1.1", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.1.tgz", "integrity": "sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg==", "dev": true }, + "safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", + "dev": true + }, "semver": { "version": "5.4.1", "resolved": "https://registry.npmjs.org/semver/-/semver-5.4.1.tgz", @@ -2000,10 +3777,31 @@ "semver": "5.4.1" } }, - "shelljs": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/shelljs/-/shelljs-0.3.0.tgz", - "integrity": "sha1-NZbmMHp4FUT1kfN9phg2DzHbV7E=", + "set-blocking": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", + "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=", + "dev": true + }, + "setimmediate": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/setimmediate/-/setimmediate-1.0.5.tgz", + "integrity": "sha1-KQy7Iy4waULX1+qbg3Mqt4VvgoU=", + "dev": true + }, + "shebang-command": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz", + "integrity": "sha1-RKrGW2lbAzmJaMOfNj/uXer98eo=", + "dev": true, + "requires": { + "shebang-regex": "1.0.0" + } + }, + "shebang-regex": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz", + "integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=", "dev": true }, "signal-exit": { @@ -2012,21 +3810,21 @@ "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=", "dev": true }, + "slice-ansi": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-1.0.0.tgz", + "integrity": "sha512-POqxBK6Lb3q6s047D/XsDVNPnF9Dl8JSaqe9h9lURl0OdNqy/ujDrOiIHtsqXMGbWWTIomRzAMaTyawAU//Reg==", + "dev": true, + "requires": { + "is-fullwidth-code-point": "2.0.0" + } + }, "source-map": { "version": "0.5.7", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", "dev": true }, - "source-map-support": { - "version": "0.4.18", - "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.4.18.tgz", - "integrity": "sha512-try0/JqxPLF9nOjvSta7tVondkP5dwgyLDjVoyMDlmjugT2lRZ1OfsrYTkCd2hkDnJTKRbO/Rl3orm8vlsUzbA==", - "dev": true, - "requires": { - "source-map": "0.5.7" - } - }, "spdx-correct": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-1.0.2.tgz", @@ -2054,12 +3852,6 @@ "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=", "dev": true }, - "stack-trace": { - "version": "0.0.10", - "resolved": "https://registry.npmjs.org/stack-trace/-/stack-trace-0.0.10.tgz", - "integrity": "sha1-VHxws0fo0ytOEI6hoqFZ5f3eGcA=", - "dev": true - }, "statuses": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.4.0.tgz", @@ -2072,6 +3864,33 @@ "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=", "dev": true }, + "string-width": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", + "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", + "dev": true, + "requires": { + "is-fullwidth-code-point": "2.0.0", + "strip-ansi": "4.0.0" + }, + "dependencies": { + "ansi-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", + "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", + "dev": true + }, + "strip-ansi": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", + "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", + "dev": true, + "requires": { + "ansi-regex": "3.0.0" + } + } + } + }, "strip-ansi": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", @@ -2100,9 +3919,9 @@ } }, "strip-json-comments": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-1.0.4.tgz", - "integrity": "sha1-HhX7ysl9Pumb8tc7TGVrCCu6+5E=", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", + "integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=", "dev": true }, "supports-color": { @@ -2111,6 +3930,75 @@ "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=", "dev": true }, + "table": { + "version": "4.0.3", + "resolved": "http://registry.npmjs.org/table/-/table-4.0.3.tgz", + "integrity": "sha512-S7rnFITmBH1EnyKcvxBh1LjYeQMmnZtCXSEbHcH6S0NoKit24ZuFO/T1vDcLdYsLQkM188PVVhQmzKIuThNkKg==", + "dev": true, + "requires": { + "ajv": "6.5.4", + "ajv-keywords": "3.2.0", + "chalk": "2.4.1", + "lodash": "4.17.11", + "slice-ansi": "1.0.0", + "string-width": "2.1.1" + }, + "dependencies": { + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "requires": { + "color-convert": "1.9.3" + } + }, + "chalk": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.1.tgz", + "integrity": "sha512-ObN6h1v2fTJSmUXoS3nMQ92LbDK9be4TV+6G+omQlGJFdcUX5heKi1LZ1YnRMIgwTLEj3E24bT6tYni50rlCfQ==", + "dev": true, + "requires": { + "ansi-styles": "3.2.1", + "escape-string-regexp": "1.0.5", + "supports-color": "5.5.0" + } + }, + "lodash": { + "version": "4.17.11", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.11.tgz", + "integrity": "sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg==", + "dev": true + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "3.0.0" + } + } + } + }, + "text-table": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", + "integrity": "sha1-f17oI66AUgfACvLfSoTsP8+lcLQ=", + "dev": true + }, + "through": { + "version": "2.3.8", + "resolved": "http://registry.npmjs.org/through/-/through-2.3.8.tgz", + "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=", + "dev": true + }, + "timed-out": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/timed-out/-/timed-out-4.0.1.tgz", + "integrity": "sha1-8y6srFoXW+ol1/q1Zas+2HQe9W8=", + "dev": true + }, "tiny-lr": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/tiny-lr/-/tiny-lr-0.2.1.tgz", @@ -2134,16 +4022,16 @@ "os-tmpdir": "1.0.2" } }, - "to-double-quotes": { + "to-fast-properties": { "version": "2.0.0", - "resolved": "https://registry.npmjs.org/to-double-quotes/-/to-double-quotes-2.0.0.tgz", - "integrity": "sha1-qvIx1vqUiUn4GTAburRITYWI5Kc=", + "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz", + "integrity": "sha1-3F5pjL0HkmW8c+A3doGk5Og/YW4=", "dev": true }, - "to-single-quotes": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/to-single-quotes/-/to-single-quotes-2.0.1.tgz", - "integrity": "sha1-fMKRUfD18sQZRvEZ9ZMv5VQXASU=", + "traverse": { + "version": "0.3.9", + "resolved": "https://registry.npmjs.org/traverse/-/traverse-0.3.9.tgz", + "integrity": "sha1-cXuPIgzAu3tE5AUUwisui7xw2Lk=", "dev": true }, "trim-newlines": { @@ -2152,6 +4040,27 @@ "integrity": "sha1-WIeWa7WCpFA6QetST301ARgVphM=", "dev": true }, + "trim-right": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/trim-right/-/trim-right-1.0.1.tgz", + "integrity": "sha1-yy4SAwZ+DI3h9hQJS5/kVwTqYAM=", + "dev": true + }, + "tslib": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.9.3.tgz", + "integrity": "sha512-4krF8scpejhaOgqzBEcGM7yDIEfi0/8+8zDRZhNZZ2kjmHJ4hv3zCbQWxoJGz1iw5U0Jl0nma13xzHXcncMavQ==", + "dev": true + }, + "type-check": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.3.2.tgz", + "integrity": "sha1-WITKtRLPHTVeP7eE8wgEsrUg23I=", + "dev": true, + "requires": { + "prelude-ls": "1.1.2" + } + }, "type-is": { "version": "1.6.15", "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.15.tgz", @@ -2168,6 +4077,30 @@ "integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=", "dev": true }, + "uglify-es": { + "version": "3.3.9", + "resolved": "https://registry.npmjs.org/uglify-es/-/uglify-es-3.3.9.tgz", + "integrity": "sha512-r+MU0rfv4L/0eeW3xZrd16t4NZfK8Ld4SWVglYBb7ez5uXFWHuVRs6xCTrf1yirs9a4j4Y27nn7SRfO6v67XsQ==", + "dev": true, + "requires": { + "commander": "2.13.0", + "source-map": "0.6.1" + }, + "dependencies": { + "commander": { + "version": "2.13.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.13.0.tgz", + "integrity": "sha512-MVuS359B+YzaWqjCL/c+22gfryv+mCBPHAv3zyVI2GN8EY6IRP8VwtasXn8jyyhvvq84R4ImN1OKRtcbIasjYA==", + "dev": true + }, + "source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true + } + } + }, "uglify-js": { "version": "2.8.29", "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-2.8.29.tgz", @@ -2186,68 +4119,96 @@ "dev": true, "optional": true }, - "underscore": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.6.0.tgz", - "integrity": "sha1-izixDKze9jM3uLJOT/htRa6lKag=", - "dev": true - }, "underscore.string": { "version": "3.2.3", "resolved": "https://registry.npmjs.org/underscore.string/-/underscore.string-3.2.3.tgz", "integrity": "sha1-gGmSYzZl1eX8tNsfs6hi62jp5to=", "dev": true }, + "universal-user-agent": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/universal-user-agent/-/universal-user-agent-2.0.1.tgz", + "integrity": "sha512-vz+heWVydO0iyYAa65VHD7WZkYzhl7BeNVy4i54p4TF8OMiLSXdbuQe4hm+fmWAsL+rVibaQHXfhvkw3c1Ws2w==", + "dev": true, + "requires": { + "os-name": "2.0.1" + } + }, + "universalify": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz", + "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==", + "dev": true + }, "unpipe": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", "integrity": "sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw=", "dev": true }, + "unzipper": { + "version": "0.8.14", + "resolved": "https://registry.npmjs.org/unzipper/-/unzipper-0.8.14.tgz", + "integrity": "sha512-8rFtE7EP5ssOwGpN2dt1Q4njl0N1hUXJ7sSPz0leU2hRdq6+pra57z4YPBlVqm40vcgv6ooKZEAx48fMTv9x4w==", + "dev": true, + "requires": { + "big-integer": "1.6.36", + "binary": "0.3.0", + "bluebird": "3.4.7", + "buffer-indexof-polyfill": "1.0.1", + "duplexer2": "0.1.4", + "fstream": "1.0.11", + "listenercount": "1.0.1", + "readable-stream": "2.1.5", + "setimmediate": "1.0.5" + } + }, "upper-case": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/upper-case/-/upper-case-1.1.3.tgz", "integrity": "sha1-9rRQHC7EzdJrp4vnIilh3ndiFZg=", "dev": true }, + "uri-js": { + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.2.2.tgz", + "integrity": "sha512-KY9Frmirql91X2Qgjry0Wd4Y+YTdrdZheS8TFwvkbLWf/G5KNJDCh6pKL5OZctEW4+0Baa5idK2ZQuELRwPznQ==", + "dev": true, + "requires": { + "punycode": "2.1.1" + } + }, "uri-path": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/uri-path/-/uri-path-1.0.0.tgz", "integrity": "sha1-l0fwGDWJM8Md4PzP2C0TjmcmLjI=", "dev": true }, - "util-deprecate": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", - "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", - "dev": true - }, - "utile": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/utile/-/utile-0.2.1.tgz", - "integrity": "sha1-kwyI6ZCY1iIINMNWy9mncFItkNc=", + "url-parse-lax": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/url-parse-lax/-/url-parse-lax-1.0.0.tgz", + "integrity": "sha1-evjzA2Rem9eaJy56FKxovAYJ2nM=", "dev": true, "requires": { - "async": "0.2.10", - "deep-equal": "1.0.1", - "i": "0.3.6", - "mkdirp": "0.5.1", - "ncp": "0.4.2", - "rimraf": "2.2.8" - }, - "dependencies": { - "async": { - "version": "0.2.10", - "resolved": "https://registry.npmjs.org/async/-/async-0.2.10.tgz", - "integrity": "sha1-trvgsGdLnXGXCMo43owjfLUmw9E=", - "dev": true - } + "prepend-http": "1.0.4" } }, - "uuid": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-2.0.3.tgz", - "integrity": "sha1-Z+LoY3lyFVMN/zGOW/nc6/1Hsho=", + "url-template": { + "version": "2.0.8", + "resolved": "https://registry.npmjs.org/url-template/-/url-template-2.0.8.tgz", + "integrity": "sha1-/FZaPMy/93MMd19WQflVV5FDnyE=", + "dev": true + }, + "url-to-options": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/url-to-options/-/url-to-options-1.0.1.tgz", + "integrity": "sha1-FQWgOiiaSMvXpDTvuu7FBV9WM6k=", + "dev": true + }, + "util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", "dev": true }, "validate-npm-package-license": { @@ -2260,33 +4221,12 @@ "spdx-expression-parse": "1.0.4" } }, - "vow": { - "version": "0.4.17", - "resolved": "https://registry.npmjs.org/vow/-/vow-0.4.17.tgz", - "integrity": "sha512-A3/9bWFqf6gT0jLR4/+bT+IPTe1mQf+tdsW6+WI5geP9smAp8Kbbu4R6QQCDKZN/8TSCqTlXVQm12QliB4rHfg==", + "vlq": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/vlq/-/vlq-0.2.3.tgz", + "integrity": "sha512-DRibZL6DsNhIgYQ+wNdWDL2SL3bKPlVrRiBqV5yuMm++op8W4kGFtaQfCs4KEJn0wBZcHVHJ3eoywX8983k1ow==", "dev": true }, - "vow-fs": { - "version": "0.3.6", - "resolved": "https://registry.npmjs.org/vow-fs/-/vow-fs-0.3.6.tgz", - "integrity": "sha1-LUxZviLivyYY3fWXq0uqkjvnIA0=", - "dev": true, - "requires": { - "glob": "7.0.6", - "uuid": "2.0.3", - "vow": "0.4.17", - "vow-queue": "0.4.3" - } - }, - "vow-queue": { - "version": "0.4.3", - "resolved": "https://registry.npmjs.org/vow-queue/-/vow-queue-0.4.3.tgz", - "integrity": "sha512-/poAKDTFL3zYbeQg7cl4BGcfP4sGgXKrHnRFSKj97dteUFu8oyXMwIcdwu8NSx/RmPGIuYx1Bik/y5vU4H/VKw==", - "dev": true, - "requires": { - "vow": "0.4.17" - } - }, "websocket-driver": { "version": "0.7.0", "resolved": "https://registry.npmjs.org/websocket-driver/-/websocket-driver-0.7.0.tgz", @@ -2312,73 +4252,91 @@ "isexe": "2.0.0" } }, + "which-module": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/which-module/-/which-module-1.0.0.tgz", + "integrity": "sha1-u6Y8qGGUiZT/MHc2CJ47lgJsKk8=", + "dev": true + }, + "win-release": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/win-release/-/win-release-1.1.1.tgz", + "integrity": "sha1-X6VeAr58qTTt/BJmVjLoSbcuUgk=", + "dev": true, + "requires": { + "semver": "5.4.1" + } + }, "window-size": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/window-size/-/window-size-0.1.0.tgz", "integrity": "sha1-VDjNLqk7IC76Ohn+iIeu58lPnJ0=", "dev": true }, - "winston": { - "version": "0.8.3", - "resolved": "https://registry.npmjs.org/winston/-/winston-0.8.3.tgz", - "integrity": "sha1-ZLar9M0Brcrv1QCTk7HY6L7BnbA=", + "wordwrap": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.2.tgz", + "integrity": "sha1-t5Zpu0LstAn4PVg8rVLKF+qhZD8=", + "dev": true + }, + "wrap-ansi": { + "version": "2.1.0", + "resolved": "http://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz", + "integrity": "sha1-2Pw9KE3QV5T+hJc8rs3Rz4JP3YU=", "dev": true, "requires": { - "async": "0.2.10", - "colors": "0.6.2", - "cycle": "1.0.3", - "eyes": "0.1.8", - "isstream": "0.1.2", - "pkginfo": "0.3.1", - "stack-trace": "0.0.10" + "string-width": "1.0.2", + "strip-ansi": "3.0.1" }, "dependencies": { - "async": { - "version": "0.2.10", - "resolved": "https://registry.npmjs.org/async/-/async-0.2.10.tgz", - "integrity": "sha1-trvgsGdLnXGXCMo43owjfLUmw9E=", - "dev": true - }, - "colors": { - "version": "0.6.2", - "resolved": "https://registry.npmjs.org/colors/-/colors-0.6.2.tgz", - "integrity": "sha1-JCP+ZnisDF2uiFLl0OW+CMmXq8w=", - "dev": true + "is-fullwidth-code-point": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", + "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", + "dev": true, + "requires": { + "number-is-nan": "1.0.1" + } }, - "pkginfo": { - "version": "0.3.1", - "resolved": "https://registry.npmjs.org/pkginfo/-/pkginfo-0.3.1.tgz", - "integrity": "sha1-Wyn2qB9wcXFC4J52W76rl7T4HiE=", - "dev": true + "string-width": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", + "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", + "dev": true, + "requires": { + "code-point-at": "1.1.0", + "is-fullwidth-code-point": "1.0.0", + "strip-ansi": "3.0.1" + } } } }, - "wordwrap": { - "version": "0.0.2", - "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.2.tgz", - "integrity": "sha1-t5Zpu0LstAn4PVg8rVLKF+qhZD8=", - "dev": true - }, "wrappy": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", "dev": true }, + "write": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/write/-/write-0.2.1.tgz", + "integrity": "sha1-X8A4KOJkzqP+kUVUdvejxWbLB1c=", + "dev": true, + "requires": { + "mkdirp": "0.5.1" + } + }, "xml-char-classes": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/xml-char-classes/-/xml-char-classes-1.0.0.tgz", "integrity": "sha1-ZGV4SKIP/F31g6Qq2KJ3tFErvE0=", "dev": true }, - "xmlbuilder": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-3.1.0.tgz", - "integrity": "sha1-LIaIjy1OrehQ+jjKf3Ij9yCVFuE=", - "dev": true, - "requires": { - "lodash": "3.10.1" - } + "y18n": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-3.2.1.tgz", + "integrity": "sha1-bRX7qITAhnnA136I53WegR4H+kE=", + "dev": true }, "yargs": { "version": "3.10.0", @@ -2399,6 +4357,24 @@ "dev": true } } + }, + "yargs-parser": { + "version": "2.4.1", + "resolved": "http://registry.npmjs.org/yargs-parser/-/yargs-parser-2.4.1.tgz", + "integrity": "sha1-hVaN488VD/SfpRgl8DqMiA3cxcQ=", + "dev": true, + "requires": { + "camelcase": "3.0.0", + "lodash.assign": "4.2.0" + }, + "dependencies": { + "camelcase": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-3.0.0.tgz", + "integrity": "sha1-MvxLn82vhF/N9+c7uXysImHwqwo=", + "dev": true + } + } } } } diff --git a/package.json b/package.json index 3560fb9..7b93784 100644 --- a/package.json +++ b/package.json @@ -1,19 +1,48 @@ { - "name": "questionable-content-spa", - "version": "0.5.2", - "author": "Alexander Krivács Schrøder", - "devDependencies": { - "grunt": "~1.0.1", - "grunt-contrib-compass": "~1.1", - "grunt-contrib-concat": "~1.0", - "grunt-contrib-htmlmin": "~2.3", - "grunt-contrib-jshint": "~1.1", - "grunt-contrib-uglify": "~2.2", - "grunt-contrib-watch": "~1.0", - "grunt-files-to-javascript-variables": "git://github.com/alexschrod/grunt-files-to-javascript-variables.git#master", - "grunt-jscs": "~3.0", - "load-grunt-tasks": "~3.5" - }, - "licenseBanner": "/* \n * Copyright (C) 2016 Alexander Krivács Schrøder \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see .\n */\n", - "userscriptBanner": "// ==UserScript==\n// @name Questionable Content Single-Page Application with Extra Features\n// @namespace https://questionablextensions.net/\n// @version <%= pkg.version %>\n// @author Alexander Krivács Schrøder\n// @description Converts questionablecontent.net into a single-page application and adds extra features, such as character, location and storyline navigation.\n// @homepage https://questionablextensions.net/\n// @icon https://questionablextensions.net/images/icon.png\n// @icon64 https://questionablextensions.net/images/icon64.png\n// @updateURL https://questionablextensions.net/releases/qc-ext.latest.meta.js\n// @downloadURL https://questionablextensions.net/releases/qc-ext.latest.user.js\n// @supportURL https://github.com/Questionable-Content-Extensions/client/issues\n// @match *://*.questionablecontent.net/\n// @match *://*.questionablecontent.net/index.php\n// @match *://*.questionablecontent.net/view.php*\n// @require https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.1/jquery.js\n// @require https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.6/js/bootstrap.min.js\n// @require https://questionablextensions.net/scripts/angular.custom.js\n// @require https://cdnjs.cloudflare.com/ajax/libs/angular-ui-router/0.2.18/angular-ui-router.min.js\n// @connect questionablextensions.net\n// @connect localhost\n// @grant GM_getValue\n// @grant GM_setValue\n// @grant GM_xmlhttpRequest\n// @grant GM.xmlHttpRequest\n// @noframes\n// ==/UserScript==\n" + "name": "questionable-content-spa", + "version": "0.5.3", + "description": "Questionable Content Single-Page Application with Extra Features", + "main": "app.js", + "scripts": { + "print-userscript-banner": "node scripts/print-userscript-banner.js", + "test": "echo \"Error: no test specified\" && exit 1" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/Questionable-Content-Extensions/client.git" + }, + "author": "Alexander Krivács Schrøder", + "license": "GPL-3.0", + "bugs": { + "url": "https://github.com/Questionable-Content-Extensions/client/issues" + }, + "homepage": "https://questionablextensions.net/", + "devDependencies": { + "@babel/core": "^7.1.5", + "@babel/preset-flow": "^7.0.0", + "babel-eslint": "^10.0.1", + "eslint": "^5.8.0", + "eslint-plugin-flowtype": "^3.2.0", + "flow-bin": "^0.84.0", + "flow-remove-types": "^1.2.3", + "flow-typed": "^2.5.1", + "grunt": "~1.0.1", + "grunt-babel": "^8.0.0", + "grunt-contrib-compass": "~1.1", + "grunt-contrib-concat": "~1.0", + "grunt-contrib-htmlmin": "~2.3", + "grunt-contrib-uglify-es": "git://github.com/gruntjs/grunt-contrib-uglify.git#harmony", + "grunt-contrib-watch": "~1.0", + "grunt-eslint": "^21.0.0", + "grunt-files-to-javascript-variables": "git://github.com/alexschrod/grunt-files-to-javascript-variables.git#master", + "grunt-flow": "^2.0.0", + "grunt-rollup": "^8.1.0", + "jquery": "^3.2.1", + "load-grunt-tasks": "~3.5", + "rollup-plugin-babel": "^4.0.3", + "rollup-plugin-commonjs": "^8.2.6", + "rollup-plugin-node-resolve": "^3.0.0", + "rollup-plugin-virtual": "^1.0.1" + }, + "dependencies": {} } diff --git a/provision.sh b/provision.sh index d503e56..205dcbb 100644 --- a/provision.sh +++ b/provision.sh @@ -15,8 +15,6 @@ sudo apt-get install -y build-essential # Install grunt, jsonlint and jshint sudo npm install -g grunt -sudo npm install -g jsonlint -sudo npm install -g jshint # Install latest stable Ruby curl -sSL https://get.rvm.io | bash -s stable --ruby diff --git a/scripts/print-userscript-banner.js b/scripts/print-userscript-banner.js new file mode 100644 index 0000000..cb807ea --- /dev/null +++ b/scripts/print-userscript-banner.js @@ -0,0 +1,31 @@ +/* global require, process */ + +const fs = require('fs'); + +const readStream = fs.createReadStream('dist/qc-ext.user.js', { + flags: 'r', + encoding: 'utf-8', + fd: null, + mode: 0o666, + bufferSize: 64 * 1024 +}); + +const USER_SCRIPT_END_MARKER = '==/UserScript=='; + +let userScriptBanner = ''; +readStream.on('data', function(data) { + userScriptBanner += data; + + const scriptEndIndex = userScriptBanner.indexOf(USER_SCRIPT_END_MARKER); + + if (scriptEndIndex > -1) { + readStream.destroy(); + userScriptBanner = userScriptBanner.substr(0, scriptEndIndex + USER_SCRIPT_END_MARKER.length + 1); + fs.writeFile('dist/qc-ext.meta.js', userScriptBanner, (err) => { + if (err) { + console.error(err); // eslint-disable-line no-console + return process.exit(1); + } + }); + } +}); diff --git a/userScriptBanner.js b/userScriptBanner.js new file mode 100644 index 0000000..1347f17 --- /dev/null +++ b/userScriptBanner.js @@ -0,0 +1,50 @@ +/* + * Copyright (C) 2016-2018 Alexander Krivács Schrøder + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/* global module */ + +const userScriptBanner = +`// ==UserScript== +// @name Questionable Content Single-Page Application with Extra Features +// @namespace https://questionablextensions.net/ +// @version <%= pkg.version %> +// @author Alexander Krivács Schrøder +// @description Converts questionablecontent.net into a single-page application and adds extra features, such as character, location and storyline navigation. +// @homepage https://questionablextensions.net/ +// @icon https://questionablextensions.net/images/icon.png +// @icon64 https://questionablextensions.net/images/icon64.png +// @updateURL https://questionablextensions.net/releases/qc-ext.latest.meta.js +// @downloadURL https://questionablextensions.net/releases/qc-ext.latest.user.js +// @supportURL https://github.com/Questionable-Content-Extensions/client/issues +// @match *://*.questionablecontent.net/ +// @match *://*.questionablecontent.net/index.php +// @match *://*.questionablecontent.net/view.php* +// @require https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.1/jquery.js +// @require https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.6/js/bootstrap.min.js +// @require https://questionablextensions.net/scripts/angular.custom.js +// @require https://cdnjs.cloudflare.com/ajax/libs/angular-ui-router/0.2.18/angular-ui-router.min.js +// @connect questionablextensions.net +// @connect questionablecontent.herokuapp.com +// @connect localhost +// @grant GM.openInTab +// @grant GM.setValue +// @grant GM.getValue +// @grant GM.xmlHttpRequest +// @noframes +// ==/UserScript==`; + +module.exports = userScriptBanner;