From 4a146a0d189280dbd15098f42850ca550e0d7910 Mon Sep 17 00:00:00 2001 From: blackle Date: Mon, 23 Jan 2017 21:02:13 -0500 Subject: Make boost animation an SVG that uses SCSS colours --- app/assets/stylesheets/components.scss | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'app/assets/stylesheets/components.scss') diff --git a/app/assets/stylesheets/components.scss b/app/assets/stylesheets/components.scss index 73d1acccd..e1710580c 100644 --- a/app/assets/stylesheets/components.scss +++ b/app/assets/stylesheets/components.scss @@ -663,12 +663,13 @@ } } +@import 'boost'; + button i.fa-retweet { height: 19px; width: 22px; - background: image-url('boost_sprite.png') no-repeat; background-position: 0 0; - transition: background-position 0.9s steps(11); + transition: background-position 0.9s steps(10); transition-duration: 0s; &::before { @@ -678,7 +679,7 @@ button i.fa-retweet { button.active i.fa-retweet { transition-duration: 0.9s; - background-position: 0 -209px; + background-position: 0 100%; } .status-card { -- cgit From 80cefd5b3cd9c8efa435f684a33fe1562696b74a Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Tue, 24 Jan 2017 17:05:44 +0100 Subject: Fix #204, fix #515 - URL truncating is now a style so copypasting is not affected, replaced onClick handler with onMouseUp/Down to detect text selection not trigger onClick handler then --- .../components/components/status_content.jsx | 27 ++++++++++++++++++++-- app/assets/stylesheets/components.scss | 11 +++++++++ app/lib/formatter.rb | 7 ++++-- spec/lib/formatter_spec.rb | 2 +- 4 files changed, 42 insertions(+), 5 deletions(-) (limited to 'app/assets/stylesheets/components.scss') diff --git a/app/assets/javascripts/components/components/status_content.jsx b/app/assets/javascripts/components/components/status_content.jsx index f2c88cee0..68224b7ba 100644 --- a/app/assets/javascripts/components/components/status_content.jsx +++ b/app/assets/javascripts/components/components/status_content.jsx @@ -56,12 +56,35 @@ const StatusContent = React.createClass({ e.stopPropagation(); }, + handleMouseDown (e) { + this.startXY = [e.clientX, e.clientY]; + }, + + handleMouseUp (e) { + const [ startX, startY ] = this.startXY; + const [ deltaX, deltaY ] = [Math.abs(e.clientX - startX), Math.abs(e.clientY - startY)]; + + if (deltaX + deltaY < 5) { + this.props.onClick(); + } + + this.startXY = null; + }, + render () { - const { status, onClick } = this.props; + const { status } = this.props; const content = { __html: emojify(status.get('content')) }; - return
; + return ( +
+ ); }, }); diff --git a/app/assets/stylesheets/components.scss b/app/assets/stylesheets/components.scss index e1710580c..4a3a7df5f 100644 --- a/app/assets/stylesheets/components.scss +++ b/app/assets/stylesheets/components.scss @@ -60,6 +60,17 @@ } } +.invisible { + font-size: 0; + line-height: 0; +} + +.ellipsis { + &:after { + content: "…"; + } +} + .lightbox .icon-button { color: $color1; } diff --git a/app/lib/formatter.rb b/app/lib/formatter.rb index 3565611bc..1fa5b83fb 100644 --- a/app/lib/formatter.rb +++ b/app/lib/formatter.rb @@ -65,8 +65,11 @@ class Formatter end def link_html(url) - link_text = truncate(url.gsub(/\Ahttps?:\/\/(www\.)?/, ''), length: 30) - "#{link_text}" + prefix = url.match(/\Ahttps?:\/\/(www\.)?/).to_s + text = url[prefix.length, 30] + suffix = url[prefix.length + 30..-1] + + "#{prefix}#{text}#{suffix}" end def hashtag_html(match) diff --git a/spec/lib/formatter_spec.rb b/spec/lib/formatter_spec.rb index 7b8259fa6..6ec28f5d8 100644 --- a/spec/lib/formatter_spec.rb +++ b/spec/lib/formatter_spec.rb @@ -17,7 +17,7 @@ RSpec.describe Formatter do end it 'contains a link' do - expect(subject).to match('google.com') + expect(subject).to match('google.com') end end -- cgit From adda642c63d01e362e0629ee956e9b3af9748644 Mon Sep 17 00:00:00 2001 From: Misty De Meo Date: Tue, 24 Jan 2017 11:07:46 -0800 Subject: Fix `invisible` CSS class --- app/assets/stylesheets/components.scss | 2 ++ 1 file changed, 2 insertions(+) (limited to 'app/assets/stylesheets/components.scss') diff --git a/app/assets/stylesheets/components.scss b/app/assets/stylesheets/components.scss index 4a3a7df5f..de6a45963 100644 --- a/app/assets/stylesheets/components.scss +++ b/app/assets/stylesheets/components.scss @@ -63,6 +63,8 @@ .invisible { font-size: 0; line-height: 0; + display: inline-block; + width: 0; } .ellipsis { -- cgit