From d3454e70a5855164d17c563fe15e8674b5a5ae2e Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Fri, 22 Jul 2016 16:51:43 +0300 Subject: * drop jQuery dependency --- juick-www/.eslintrc | 32 + juick-www/package.json | 8 +- .../src/main/java/com/juick/www/Discover.java | 2 +- juick-www/src/main/java/com/juick/www/Errors.java | 2 +- juick-www/src/main/java/com/juick/www/Help.java | 2 +- juick-www/src/main/java/com/juick/www/Home.java | 13 +- .../src/main/java/com/juick/www/NewMessage.java | 17 +- juick-www/src/main/java/com/juick/www/PM.java | 4 +- .../src/main/java/com/juick/www/PageTemplates.java | 37 +- .../src/main/java/com/juick/www/Settings.java | 2 +- juick-www/src/main/java/com/juick/www/SignUp.java | 4 +- juick-www/src/main/java/com/juick/www/User.java | 8 +- .../src/main/java/com/juick/www/UserThread.java | 30 +- juick-www/src/main/java/ru/sape/SapePageLinks.java | 14 +- juick-www/src/main/static/scripts.js | 1051 ++++++++++---------- juick-www/src/main/webapp/WEB-INF/web.xml | 8 + juick-www/webpack.config.js | 13 +- 17 files changed, 651 insertions(+), 596 deletions(-) create mode 100644 juick-www/.eslintrc diff --git a/juick-www/.eslintrc b/juick-www/.eslintrc new file mode 100644 index 00000000..70f0fc89 --- /dev/null +++ b/juick-www/.eslintrc @@ -0,0 +1,32 @@ +{ + // Extend existing configuration + // from ESlint and eslint-plugin-react defaults. + "extends": [ + "eslint:recommended" + //, "plugin:react/recommended" + ], + // Enable ES6 support. If you want to use custom Babel + // features, you will need to enable a custom parser + // as described in a section below. + "parserOptions": { + "ecmaVersion": 6, + "sourceType": "module" + }, + "env": { + "browser": true, + "node": true + }, + // Enable custom plugin known as eslint-plugin-react + "plugins": [ + // "react" + ], + "rules": { + // Disable `no-console` rule + "no-console": 0, + // Give a warning if identifiers contain underscores + "no-underscore-dangle": 1, + // Default to single quotes and raise an error if something + // else is used + "quotes": [2, "single"] + } +} \ No newline at end of file diff --git a/juick-www/package.json b/juick-www/package.json index 31bab35b..f8ab05f3 100644 --- a/juick-www/package.json +++ b/juick-www/package.json @@ -13,12 +13,18 @@ "license": "AGPLv3", "devDependencies": { "css-loader": "^0.23.1", - "expose-loader": "^0.7.1", + "eslint": "^3.1.1", + "eslint-loader": "^1.4.1", "extract-text-webpack-plugin": "^1.0.1", "globby": "^4.1.0", "script-loader": "^0.7.0", "style-loader": "^0.13.1", "uglify-loader": "^1.3.0", "webpack": "^1.13.1" + }, + "dependencies": { + "autosize": "^3.0.16", + "element-closest": "^2.0.1", + "whatwg-fetch": "^1.0.0" } } diff --git a/juick-www/src/main/java/com/juick/www/Discover.java b/juick-www/src/main/java/com/juick/www/Discover.java index e94d6e99..c1bcacc7 100644 --- a/juick-www/src/main/java/com/juick/www/Discover.java +++ b/juick-www/src/main/java/com/juick/www/Discover.java @@ -84,7 +84,7 @@ public class Discover { } else if (paramBefore > 0 || mids.size() < 5) { head = ""; } - PageTemplates.pageHead(out, title, head); + PageTemplates.pageHead(out, visitor, title, head); PageTemplates.pageNavigation(out, visitor, null); PageTemplates.pageHomeColumn(out, sql, visitor); diff --git a/juick-www/src/main/java/com/juick/www/Errors.java b/juick-www/src/main/java/com/juick/www/Errors.java index 45fa3d51..4ab10229 100644 --- a/juick-www/src/main/java/com/juick/www/Errors.java +++ b/juick-www/src/main/java/com/juick/www/Errors.java @@ -26,7 +26,7 @@ public class Errors { response.setStatus(404); response.setContentType("text/html; charset=UTF-8"); try (PrintWriter out = response.getWriter()) { - PageTemplates.pageHead(out, "404 Страница не найдена", null); + PageTemplates.pageHead(out, visitor, "404 Страница не найдена", null); PageTemplates.pageNavigation(out, visitor, null); PageTemplates.pageHomeColumn(out, sql, visitor); diff --git a/juick-www/src/main/java/com/juick/www/Help.java b/juick-www/src/main/java/com/juick/www/Help.java index e0ecab2b..a8bfaf3f 100644 --- a/juick-www/src/main/java/com/juick/www/Help.java +++ b/juick-www/src/main/java/com/juick/www/Help.java @@ -62,7 +62,7 @@ public class Help { response.setContentType("text/html; charset=UTF-8"); try (PrintWriter out = response.getWriter()) { - PageTemplates.pageHead(out, "Помощь", null); + PageTemplates.pageHead(out, visitor, "Помощь", null); PageTemplates.pageNavigation(out, visitor, null); out.println("