Commit Graph

16 Commits

Author SHA1 Message Date
Jérémie Astori
a13c08a45b
Enforce correct order for previews on server-side prefectch rather than at client parsing
This has the benefit of not adding `.preview` divs everywhere, anytime we use `parse()`, and also to un-tie the position of the preview blocks from the result of the helper. This means that templates that call `parse` and have some extra markup after that are not constrained anymore.

This is effectively an alternative, better way to fix https://github.com/thelounge/lounge/issues/1343, but the initial fix that was put in place (https://github.com/thelounge/lounge/pull/1347) is still relevant, for example to make sure a preview stays hidden (and does not add extra margin/padding/etc.) if the link does not prefetch.
2017-07-21 01:06:42 -04:00
Jérémie Astori
28200830ed
Move preview toggle buttons next to their respective URLs and switch from ellipsis to caret 2017-07-08 04:36:26 -04:00
Jérémie Astori
64ebe0f437
Support multiple previews per message
- Load up to 5 previews per message (to avoid abuse)
- Do not load multiple times the same URL
- Prepare preview containers per message instead of appending (to maintain correct order)
- Store an array of previews instead of a single preview in `Msg` objects
- Consolidate preview rendering for new messages and upon refresh/load history (when rendering entire channels)
- Update `parse` tests to reflect previous point
- Add test for multiple URLs
- Switch preview tests from `assert` API to `expect` API
2017-07-08 04:34:12 -04:00
Pavel Djundik
f6dd616d5e Update to eslint 4 and enforce extra rules 2017-06-19 09:58:29 +03:00
Pavel Djundik
bd9e41f2c1 Fix localtime test to correctly use UTC 2017-06-03 10:29:52 +03:00
Pavel Djundik
7ae364e360 Merge pull request #1100 from thelounge/xpaw/0x04
Add support for 0x04 hex colors
2017-05-06 13:43:14 +03:00
Pavel Djundik
700d3c1ff2 Use moment to render dates everywhere 2017-05-01 21:31:31 +03:00
Pavel Djundik
0b645d54c6 Add support for 0x04 hex colors
Ref: https://modern.ircdocs.horse/formatting.html#hex-color
2017-04-29 09:50:26 +03:00
Jérémie Astori
648cfd12db Use moment on the client to display friendly dates
Also, unread and date markers are now half-transparent based on their colors and not parent opacity. This is necessary to display a non-translucide tooltip.
2017-04-22 00:38:19 -04:00
Jérémie Astori
03e3444a35 Explain the modules of the message parser and add tests
- Add comments and descriptions to:
  - `findChannels.js`
  - `parseStyle`
  - `findLinks`
  - `fill`
  - `anyIntersection`
  - `merge`
  - `parse`
- Minor optimizations to `parseStyle`
- Add tests for `fill`
2017-04-21 20:31:27 +03:00
Jérémie Astori
90f4a94bb2 Use template literals in parse
Also make it output double quotes for consistency with web stuff.
2017-04-21 20:31:27 +03:00
Jérémie Astori
5b4c00d8ca Extract findLinks into its own file and add tests
Tests were taken from 5a249c30b1/test/findLinks.js.
The underlying code is different but the tests are the same.
2017-04-21 20:31:27 +03:00
Bonuspunkt
eb1360c3af Add message parser tests 2017-04-21 20:31:27 +03:00
Pavel Djundik
3b2e3fc08c Enforce more space and new line rules 2017-03-18 21:40:39 +02:00
Pavel Djundik
fb87bd3a58 Webpack 2016-12-27 19:15:30 +02:00
Jérémie Astori
1ff011dfaf Add a simple (first) test for localetime Handlebars helper 2016-10-20 01:49:34 +02:00