From 53c6442f752b2ed51e3c9b8b9eed235ffba8d75e Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Wed, 7 Nov 2018 00:28:35 +0300 Subject: www: babel-polyfill --- juick-server/package.json | 9 ++++++++- juick-server/src/main/assets/embed.js | 8 +++----- juick-server/src/main/assets/scripts.js | 8 ++++---- juick-server/webpack.config.js | 1 - juick-server/yarn.lock | 18 ++++++++++++++++++ 5 files changed, 33 insertions(+), 11 deletions(-) diff --git a/juick-server/package.json b/juick-server/package.json index 91eb3038..7f55f092 100644 --- a/juick-server/package.json +++ b/juick-server/package.json @@ -14,7 +14,13 @@ "babel": { "presets": [ [ - "@babel/preset-env" + "@babel/preset-env", + { + "useBuiltIns": "usage", + "targets": { + "browsers": "ie >= 9, android >= 4.2" + } + } ] ] }, @@ -42,6 +48,7 @@ "webpack-cli": "^3.1.2" }, "dependencies": { + "@babel/polyfill": "^7.0.0", "classlist.js": "^1.1.20150312", "element-closest": "^2.0.2", "evil-icons": "^1.10.1", diff --git a/juick-server/src/main/assets/embed.js b/juick-server/src/main/assets/embed.js index 25c37142..d4cbab8e 100644 --- a/juick-server/src/main/assets/embed.js +++ b/juick-server/src/main/assets/embed.js @@ -285,7 +285,7 @@ function embedLinks(aNodes, container) { * @param {string} beforeNodeSelector * @param {string} allLinksSelector */ -function embedLinksToX(x, beforeNodeSelector, allLinksSelector) { +export function embedLinksToX(x, beforeNodeSelector, allLinksSelector) { let isCtsPost = false; let allLinks = x.querySelectorAll(allLinksSelector); @@ -323,7 +323,7 @@ function embedLinksToPost() { /** * Embed all the links in all messages/replies on the page. */ -function embedAll() { +export function embedAll() { if (document.querySelector('#content article[data-mid]')) { embedLinksToArticles(); } else { @@ -331,6 +331,4 @@ function embedAll() { } } -exports.embedAll = embedAll; -exports.embedLinksToX = embedLinksToX; -exports.format = juickFormat; +export const format = juickFormat; diff --git a/juick-server/src/main/assets/scripts.js b/juick-server/src/main/assets/scripts.js index 697919bd..e757261f 100644 --- a/juick-server/src/main/assets/scripts.js +++ b/juick-server/src/main/assets/scripts.js @@ -3,7 +3,7 @@ require('element-closest'); require('classlist.js'); require('url-search-params-polyfill'); require('formdata-polyfill'); -import * as killy from './embed'; +import { embedLinksToX, embedAll, format } from './embed'; if (!('remove' in Element.prototype)) { // Firefox <23 Element.prototype.remove = function() { @@ -181,7 +181,7 @@ function wsIncomingReply(msg) { ${msg.timestamp} -
${killy.format(msg.body, msg.mid, false)}
${photoDiv} +
${format(msg.body, msg.mid, false)}
${photoDiv}
`; @@ -197,7 +197,7 @@ function wsIncomingReply(msg) { e.preventDefault(); }); - killy.embedLinksToX(li.querySelector('.msg-cont'), '.msg-links', '.msg-txt a'); + embedLinksToX(li.querySelector('.msg-cont'), '.msg-links', '.msg-txt a'); document.getElementById('replies').appendChild(li); @@ -867,7 +867,7 @@ ready(function() { }); initES(); - killy.embedAll(); + embedAll(); var elSelector = 'header', elClassHidden = 'header--hidden', elClassBackground = 'header--background', diff --git a/juick-server/webpack.config.js b/juick-server/webpack.config.js index f6fdbcf7..42c0a775 100644 --- a/juick-server/webpack.config.js +++ b/juick-server/webpack.config.js @@ -1,4 +1,3 @@ -const webpack = require('webpack'); const MiniCssExtractPlugin = require('mini-css-extract-plugin'); const StyleLintPlugin = require('stylelint-webpack-plugin'); const UglifyJsPlugin = require('uglifyjs-webpack-plugin'); diff --git a/juick-server/yarn.lock b/juick-server/yarn.lock index 1d6a0d4b..e5325cd5 100644 --- a/juick-server/yarn.lock +++ b/juick-server/yarn.lock @@ -519,6 +519,14 @@ "@babel/helper-regex" "^7.0.0" regexpu-core "^4.1.3" +"@babel/polyfill@^7.0.0": + version "7.0.0" + resolved "https://registry.yarnpkg.com/@babel/polyfill/-/polyfill-7.0.0.tgz#c8ff65c9ec3be6a1ba10113ebd40e8750fb90bff" + integrity sha512-dnrMRkyyr74CRelJwvgnnSUDh2ge2NCTyHVwpOdvRMHtJUyxLtMAfhBN3s64pY41zdw0kgiLPh6S20eb1NcX6Q== + dependencies: + core-js "^2.5.7" + regenerator-runtime "^0.11.1" + "@babel/preset-env@^7.1.0": version "7.1.0" resolved "https://registry.yarnpkg.com/@babel/preset-env/-/preset-env-7.1.0.tgz#e67ea5b0441cfeab1d6f41e9b5c79798800e8d11" @@ -1554,6 +1562,11 @@ copy-descriptor@^0.1.0: resolved "https://registry.yarnpkg.com/copy-descriptor/-/copy-descriptor-0.1.1.tgz#676f6eb3c39997c2ee1ac3a924fd6124748f578d" integrity sha1-Z29us8OZl8LuGsOpJP1hJHSPV40= +core-js@^2.5.7: + version "2.5.7" + resolved "https://registry.yarnpkg.com/core-js/-/core-js-2.5.7.tgz#f972608ff0cead68b841a16a932d0b183791814e" + integrity sha512-RszJCAxg/PP6uzXVXL6BsxSXx/B05oJAQ2vkJRjyjrEcNVycaqOmNb5OTxZPE3xa5gwZduqza6L9JOCenh/Ecw== + core-util-is@~1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7" @@ -5046,6 +5059,11 @@ regenerate@^1.2.1, regenerate@^1.4.0: resolved "https://registry.yarnpkg.com/regenerate/-/regenerate-1.4.0.tgz#4a856ec4b56e4077c557589cae85e7a4c8869a11" integrity sha512-1G6jJVDWrt0rK99kBjvEtziZNCICAuvIPkSiUFIQxVP06RCVpq3dmDo2oi6ABpYaDYaTRr67BEhL8r1wgEZZKg== +regenerator-runtime@^0.11.1: + version "0.11.1" + resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.11.1.tgz#be05ad7f9bf7d22e056f9726cee5017fbf19e2e9" + integrity sha512-MguG95oij0fC3QV3URf4V2SDYGJhJnJGqvIIgdECeODCT98wSWDAJ94SSuVpYQUoTcGUIL6L4yNB7j1DFFHSBg== + regenerator-transform@^0.13.3: version "0.13.3" resolved "https://registry.yarnpkg.com/regenerator-transform/-/regenerator-transform-0.13.3.tgz#264bd9ff38a8ce24b06e0636496b2c856b57bcbb" -- cgit v1.2.3