From bf965b4d3e983562ee8308785956b13ff3fb31fc Mon Sep 17 00:00:00 2001 From: Baptiste Lemoine Date: Thu, 27 Feb 2020 13:48:21 +0100 Subject: [PATCH] hop --- app/javascript/mastodon/actions/accounts.js | 2 +- .../mastodon/components/column_header.js | 20 +-- .../intersection_observer_article.js | 2 +- app/javascript/mastodon/components/status.js | 12 +- .../mastodon/features/blocks/index.js | 2 +- .../compose/components/navigation_bar.js | 2 +- .../mastodon/features/domain_blocks/index.js | 2 +- .../mastodon/features/favourites/index.js | 2 +- .../components/account_authorize.js | 24 ++-- .../features/follow_requests/index.js | 2 +- .../mastodon/features/followers/index.js | 10 +- .../mastodon/features/following/index.js | 2 +- .../features/getting_started/index.js | 8 +- .../mastodon/features/lists/index.js | 2 +- .../mastodon/features/mutes/index.js | 2 +- .../features/status/components/card.js | 2 +- .../ui/components/__tests__/column-test.js | 2 +- .../features/ui/components/columns_area.js | 2 +- .../features/ui/components/link_footer.js | 28 ++-- .../ui/components/navigation_panel.js | 132 +++++++++--------- .../features/ui/components/tabs_bar.js | 48 +++---- .../mastodon/features/video/index.js | 8 +- .../mastodon/reducers/notifications.js | 4 +- app/javascript/mastodon/reducers/timelines.js | 4 +- app/javascript/mastodon/selectors/index.js | 2 +- .../service_worker/web_push_notifications.js | 2 +- .../mastodon/store/configureStore.js | 2 +- .../mastodon/utils/snowstorm-min.js | 130 ++++++++++++++--- postcss.config.js | 10 +- 29 files changed, 281 insertions(+), 189 deletions(-) diff --git a/app/javascript/mastodon/actions/accounts.js b/app/javascript/mastodon/actions/accounts.js index d4a824e2c..4af36e998 100644 --- a/app/javascript/mastodon/actions/accounts.js +++ b/app/javascript/mastodon/actions/accounts.js @@ -106,7 +106,7 @@ export function fetchAccount(id) { dispatch, getState, db.transaction('accounts', 'read').objectStore('accounts').index('id'), - id + id, ).then(() => db.close(), error => { db.close(); throw error; diff --git a/app/javascript/mastodon/components/column_header.js b/app/javascript/mastodon/components/column_header.js index 1a7c546c7..964dfa3bd 100644 --- a/app/javascript/mastodon/components/column_header.js +++ b/app/javascript/mastodon/components/column_header.js @@ -121,11 +121,11 @@ class ColumnHeader extends React.PureComponent { className='text-btn column-header__setting-btn' onClick={this.handlePin} > ); + id='column_header.unpin' + defaultMessage='Unpin' + />); moveButtons = (
); @@ -157,11 +157,11 @@ class ColumnHeader extends React.PureComponent { className='text-btn column-header__setting-btn' onClick={this.handlePin} > + id='column_header.pin' + defaultMessage='Pin' + /> ); } diff --git a/app/javascript/mastodon/components/intersection_observer_article.js b/app/javascript/mastodon/components/intersection_observer_article.js index e453730ba..124b34b02 100644 --- a/app/javascript/mastodon/components/intersection_observer_article.js +++ b/app/javascript/mastodon/components/intersection_observer_article.js @@ -44,7 +44,7 @@ export default class IntersectionObserverArticle extends React.Component { intersectionObserverWrapper.observe( id, this.node, - this.handleIntersection + this.handleIntersection, ); this.componentMounted = true; diff --git a/app/javascript/mastodon/components/status.js b/app/javascript/mastodon/components/status.js index a756c5190..14484debe 100644 --- a/app/javascript/mastodon/components/status.js +++ b/app/javascript/mastodon/components/status.js @@ -557,12 +557,12 @@ class Status extends ImmutablePureComponent {
{isStaff && (
- - - -
+ + + +
)} {accountIds.map(id => - + , )} diff --git a/app/javascript/mastodon/features/compose/components/navigation_bar.js b/app/javascript/mastodon/features/compose/components/navigation_bar.js index d7c9c9818..226e9fe79 100644 --- a/app/javascript/mastodon/features/compose/components/navigation_bar.js +++ b/app/javascript/mastodon/features/compose/components/navigation_bar.js @@ -42,7 +42,7 @@ export default class NavigationBar extends ImmutablePureComponent { href='/settings/profile' className='navigation-bar__profile-edit' > - + {domains.map(domain => - + , )} diff --git a/app/javascript/mastodon/features/favourites/index.js b/app/javascript/mastodon/features/favourites/index.js index 249e6a044..75cb00c0e 100644 --- a/app/javascript/mastodon/features/favourites/index.js +++ b/app/javascript/mastodon/features/favourites/index.js @@ -79,7 +79,7 @@ class Favourites extends ImmutablePureComponent { bindToDocument={!multiColumn} > {accountIds.map(id => - + , )} diff --git a/app/javascript/mastodon/features/follow_requests/components/account_authorize.js b/app/javascript/mastodon/features/follow_requests/components/account_authorize.js index 6116d6d8c..9bc258f27 100644 --- a/app/javascript/mastodon/features/follow_requests/components/account_authorize.js +++ b/app/javascript/mastodon/features/follow_requests/components/account_authorize.js @@ -56,9 +56,9 @@ class AccountAuthorize extends ImmutablePureComponent { > {shortNumberFormat(account.get('statuses_count'))} + id='account.posts' + defaultMessage='Toots' + /> {shortNumberFormat(account.get('following_count'))} + id='account.follows' + defaultMessage='Follows' + /> {shortNumberFormat(account.get('followers_count'))} + id='account.followers' + defaultMessage='Followers' + /> - +
+ /> {intl.formatMessage(messages.authorize)}
+ /> {intl.formatMessage(messages.reject)}
diff --git a/app/javascript/mastodon/features/follow_requests/index.js b/app/javascript/mastodon/features/follow_requests/index.js index 57ef44145..bef56fab5 100644 --- a/app/javascript/mastodon/features/follow_requests/index.js +++ b/app/javascript/mastodon/features/follow_requests/index.js @@ -68,7 +68,7 @@ class FollowRequests extends ImmutablePureComponent { bindToDocument={!multiColumn} > {accountIds.map(id => - + , )} diff --git a/app/javascript/mastodon/features/followers/index.js b/app/javascript/mastodon/features/followers/index.js index 3d7f9b6b4..4026846d1 100644 --- a/app/javascript/mastodon/features/followers/index.js +++ b/app/javascript/mastodon/features/followers/index.js @@ -72,13 +72,13 @@ class Followers extends ImmutablePureComponent { ); } - const emptyMessage = blockedBy ? : ) : (; + />); return ( @@ -98,11 +98,11 @@ class Followers extends ImmutablePureComponent { bindToDocument={!multiColumn} > {blockedBy ? [] : accountIds.map(id => - , + />), )} diff --git a/app/javascript/mastodon/features/following/index.js b/app/javascript/mastodon/features/following/index.js index 284ae2c11..5112bfa9d 100644 --- a/app/javascript/mastodon/features/following/index.js +++ b/app/javascript/mastodon/features/following/index.js @@ -93,7 +93,7 @@ class Following extends ImmutablePureComponent { bindToDocument={!multiColumn} > {blockedBy ? [] : accountIds.map(id => - + , )} diff --git a/app/javascript/mastodon/features/getting_started/index.js b/app/javascript/mastodon/features/getting_started/index.js index adbc147d1..d9838e1c7 100644 --- a/app/javascript/mastodon/features/getting_started/index.js +++ b/app/javascript/mastodon/features/getting_started/index.js @@ -106,20 +106,20 @@ class GettingStarted extends ImmutablePureComponent { if (profile_directory) { navItems.push( - + , ); height += 48; } navItems.push( - + , ); height += 34; } else if (profile_directory) { navItems.push( - + , ); height += 48; @@ -129,7 +129,7 @@ class GettingStarted extends ImmutablePureComponent { , , , - + , ); height += 48*4; diff --git a/app/javascript/mastodon/features/lists/index.js b/app/javascript/mastodon/features/lists/index.js index 7f7f5009c..ca1fa1f5e 100644 --- a/app/javascript/mastodon/features/lists/index.js +++ b/app/javascript/mastodon/features/lists/index.js @@ -74,7 +74,7 @@ class Lists extends ImmutablePureComponent { bindToDocument={!multiColumn} > {lists.map(list => - + , )} diff --git a/app/javascript/mastodon/features/mutes/index.js b/app/javascript/mastodon/features/mutes/index.js index 91dd268c1..3f58a62d2 100644 --- a/app/javascript/mastodon/features/mutes/index.js +++ b/app/javascript/mastodon/features/mutes/index.js @@ -68,7 +68,7 @@ class Mutes extends ImmutablePureComponent { bindToDocument={!multiColumn} > {accountIds.map(id => - + , )} diff --git a/app/javascript/mastodon/features/status/components/card.js b/app/javascript/mastodon/features/status/components/card.js index 2993fe29a..b8344a667 100644 --- a/app/javascript/mastodon/features/status/components/card.js +++ b/app/javascript/mastodon/features/status/components/card.js @@ -98,7 +98,7 @@ export default class Card extends React.PureComponent { }, }, ]), - 0 + 0, ); }; diff --git a/app/javascript/mastodon/features/ui/components/__tests__/column-test.js b/app/javascript/mastodon/features/ui/components/__tests__/column-test.js index 11cc1b6e8..89cb2458d 100644 --- a/app/javascript/mastodon/features/ui/components/__tests__/column-test.js +++ b/app/javascript/mastodon/features/ui/components/__tests__/column-test.js @@ -19,7 +19,7 @@ describe('', () => { const wrapper = mount(
- + , ); wrapper.find(ColumnHeader).find('button').simulate('click'); expect(global.requestAnimationFrame.mock.calls.length).toEqual(1); diff --git a/app/javascript/mastodon/features/ui/components/columns_area.js b/app/javascript/mastodon/features/ui/components/columns_area.js index 926a30c1e..fd7918efc 100644 --- a/app/javascript/mastodon/features/ui/components/columns_area.js +++ b/app/javascript/mastodon/features/ui/components/columns_area.js @@ -270,7 +270,7 @@ class ColumnsArea extends ImmutablePureComponent { {React.Children.map(children, child => React.cloneElement(child, { multiColumn: true }))}
) - ; + ; } } diff --git a/app/javascript/mastodon/features/ui/components/link_footer.js b/app/javascript/mastodon/features/ui/components/link_footer.js index be9be9366..008756be0 100644 --- a/app/javascript/mastodon/features/ui/components/link_footer.js +++ b/app/javascript/mastodon/features/ui/components/link_footer.js @@ -214,8 +214,8 @@ class LinkFooter extends React.PureComponent { href='/invites' target='_blank' >
· } {withHotkeys &&
  • ·
  • ·
  • ·
  • ·
  • ·
  • diff --git a/app/javascript/mastodon/features/ui/components/navigation_panel.js b/app/javascript/mastodon/features/ui/components/navigation_panel.js index 4775e9aa7..ed4396af1 100644 --- a/app/javascript/mastodon/features/ui/components/navigation_panel.js +++ b/app/javascript/mastodon/features/ui/components/navigation_panel.js @@ -17,26 +17,26 @@ const NavigationPanel = () => ( data-preview-title-id='column.home' data-preview-icon='home' > + id='tabs_bar.home' + defaultMessage='Home' + /> + id='tabs_bar.local_timeline' + defaultMessage='Local' + /> ( data-preview-title-id='column.public' data-preview-icon='globe' > + id='tabs_bar.federated_timeline' + defaultMessage='Federated' + /> -
    +
    + id='tabs_bar.notifications' + defaultMessage='Notifications' + /> + id='navigation_bar.direct' + defaultMessage='Direct messages' + /> -
    +
    + id='navigation_bar.favourites' + defaultMessage='Favourites' + /> + id='navigation_bar.bookmarks' + defaultMessage='Bookmarks' + /> + id='navigation_bar.lists' + defaultMessage='Lists' + /> {profile_directory && } + id='getting_started.directory' + defaultMessage='Profile directory' + />} @@ -135,24 +135,24 @@ const NavigationPanel = () => ( className='column-link column-link--transparent' href='/settings/preferences' > + id='navigation_bar.preferences' + defaultMessage='Preferences' + /> + id='navigation_bar.follows_and_followers' + defaultMessage='Follows and followers' + /> {showTrends &&
    } {showTrends && } diff --git a/app/javascript/mastodon/features/ui/components/tabs_bar.js b/app/javascript/mastodon/features/ui/components/tabs_bar.js index 480812fed..248fa936c 100644 --- a/app/javascript/mastodon/features/ui/components/tabs_bar.js +++ b/app/javascript/mastodon/features/ui/components/tabs_bar.js @@ -14,20 +14,20 @@ export const links = [ data-preview-title-id='column.home' data-preview-icon='home' >, + id='tabs_bar.home' + defaultMessage='Home' + />, , , + id='tabs_bar.local_timeline' + defaultMessage='Local' + />, , + id='tabs_bar.federated_timeline' + defaultMessage='Federated' + />, , + id='tabs_bar.search' + defaultMessage='Search' + />, , ]; diff --git a/app/javascript/mastodon/features/video/index.js b/app/javascript/mastodon/features/video/index.js index 9d8918906..9d4534b56 100644 --- a/app/javascript/mastodon/features/video/index.js +++ b/app/javascript/mastodon/features/video/index.js @@ -522,16 +522,16 @@ class Video extends React.PureComponent { aria-label={intl.formatMessage(messages.hide)} onClick={this.toggleReveal} >} {(!fullscreen && onOpenVideo) && } {onCloseVideo && } diff --git a/app/javascript/mastodon/reducers/notifications.js b/app/javascript/mastodon/reducers/notifications.js index 60e901e39..ed1ba0272 100644 --- a/app/javascript/mastodon/reducers/notifications.js +++ b/app/javascript/mastodon/reducers/notifications.js @@ -72,11 +72,11 @@ const expandNormalizedNotifications = (state, notifications, next, isLoadingRece mutable.update(usePendingItems ? 'pendingItems' : 'items', list => { const lastIndex = 1 + list.findLastIndex( - item => item !== null && (compareId(item.get('id'), items.last().get('id')) > 0 || item.get('id') === items.last().get('id')) + item => item !== null && (compareId(item.get('id'), items.last().get('id')) > 0 || item.get('id') === items.last().get('id')), ); const firstIndex = 1 + list.take(lastIndex).findLastIndex( - item => item !== null && compareId(item.get('id'), items.first().get('id')) > 0 + item => item !== null && compareId(item.get('id'), items.first().get('id')) > 0, ); return list.take(firstIndex).concat(items, list.skip(lastIndex)); diff --git a/app/javascript/mastodon/reducers/timelines.js b/app/javascript/mastodon/reducers/timelines.js index 0d7222e10..63b76773d 100644 --- a/app/javascript/mastodon/reducers/timelines.js +++ b/app/javascript/mastodon/reducers/timelines.js @@ -54,7 +54,7 @@ const expandNormalizedTimeline = (state, timeline, statuses, next, isPartial, is return oldIds.take(firstIndex + 1).concat( isPartial && oldIds.get(firstIndex) !== null ? newIds.unshift(null) : newIds, - oldIds.skip(lastIndex) + oldIds.skip(lastIndex), ); }); } @@ -166,7 +166,7 @@ export default function timelines(state = initialState, action) { return state.update( action.timeline, initialTimeline, - map => map.set('online', false).update(action.usePendingItems ? 'pendingItems' : 'items', items => items.first() ? items.unshift(null) : items) + map => map.set('online', false).update(action.usePendingItems ? 'pendingItems' : 'items', items => items.first() ? items.unshift(null) : items), ); default: return state; diff --git a/app/javascript/mastodon/selectors/index.js b/app/javascript/mastodon/selectors/index.js index 6a48f3b3f..673268c5a 100644 --- a/app/javascript/mastodon/selectors/index.js +++ b/app/javascript/mastodon/selectors/index.js @@ -117,7 +117,7 @@ export const makeGetStatus = () => { map.set('account', accountBase); map.set('filtered', filtered); }); - } + }, ); }; diff --git a/app/javascript/mastodon/service_worker/web_push_notifications.js b/app/javascript/mastodon/service_worker/web_push_notifications.js index 1ab0dc0fa..958e5fc12 100644 --- a/app/javascript/mastodon/service_worker/web_push_notifications.js +++ b/app/javascript/mastodon/service_worker/web_push_notifications.js @@ -117,7 +117,7 @@ const handlePush = (event) => { badge: '/badge.png', data: { access_token, preferred_locale, url: '/web/notifications' }, }); - }) + }), ); }; diff --git a/app/javascript/mastodon/store/configureStore.js b/app/javascript/mastodon/store/configureStore.js index 7e7472841..e18af842f 100644 --- a/app/javascript/mastodon/store/configureStore.js +++ b/app/javascript/mastodon/store/configureStore.js @@ -10,6 +10,6 @@ export default function configureStore() { thunk, loadingBarMiddleware({ promiseTypeSuffixes: ['REQUEST', 'SUCCESS', 'FAIL'] }), errorsMiddleware(), - soundsMiddleware() + soundsMiddleware(), ), window.__REDUX_DEVTOOLS_EXTENSION__ ? window.__REDUX_DEVTOOLS_EXTENSION__() : f => f)); }; diff --git a/app/javascript/mastodon/utils/snowstorm-min.js b/app/javascript/mastodon/utils/snowstorm-min.js index 733b45f06..bd3fa7693 100644 --- a/app/javascript/mastodon/utils/snowstorm-min.js +++ b/app/javascript/mastodon/utils/snowstorm-min.js @@ -8,22 +8,114 @@ Code provided under the BSD License http://schillmania.com/projects/snowstorm/license.txt */ -var snowStorm=function(g,f){function k(a,d){isNaN(d)&&(d=0);return Math.random()*a+d}function x(){g.setTimeout(function(){a.start(!0)},20);a.events.remove(m?f:g,"mousemove",x)}function y(){(!a.excludeMobile||!D)&&x();a.events.remove(g,"load",y)}this.excludeMobile=this.autoStart=!0;this.flakesMax=128;this.flakesMaxActive=64;this.animationInterval=33;this.useGPU=!0;this.className=null;this.excludeMobile=!0;this.flakeBottom=null;this.followMouse=!0;this.snowColor="#fff";this.snowCharacter="•";this.snowStick= -!0;this.targetElement=null;this.useMeltEffect=!0;this.usePixelPosition=this.usePositionFixed=this.useTwinkleEffect=!1;this.freezeOnBlur=!0;this.flakeRightOffset=this.flakeLeftOffset=0;this.flakeHeight=this.flakeWidth=8;this.vMaxX=5;this.vMaxY=4;this.zIndex=0;var a=this,q,m=navigator.userAgent.match(/msie/i),E=navigator.userAgent.match(/msie 6/i),D=navigator.userAgent.match(/mobile|opera m(ob|in)/i),r=m&&"BackCompat"===f.compatMode||E,h=null,n=null,l=null,p=null,s=null,z=null,A=null,v=1,t=!1,w=!1, -u;a:{try{f.createElement("div").style.opacity="0.5"}catch(F){u=!1;break a}u=!0}var B=!1,C=f.createDocumentFragment();q=function(){function c(b){g.setTimeout(b,1E3/(a.animationInterval||20))}function d(a){return void 0!==h.style[a]?a:null}var e,b=g.requestAnimationFrame||g.webkitRequestAnimationFrame||g.mozRequestAnimationFrame||g.oRequestAnimationFrame||g.msRequestAnimationFrame||c;e=b?function(){return b.apply(g,arguments)}:null;var h;h=f.createElement("div");e={transform:{ie:d("-ms-transform"), -moz:d("MozTransform"),opera:d("OTransform"),webkit:d("webkitTransform"),w3:d("transform"),prop:null},getAnimationFrame:e};e.transform.prop=e.transform.w3||e.transform.moz||e.transform.webkit||e.transform.ie||e.transform.opera;h=null;return e}();this.timer=null;this.flakes=[];this.active=this.disabled=!1;this.meltFrameCount=20;this.meltFrames=[];this.setXY=function(c,d,e){if(!c)return!1;a.usePixelPosition||w?(c.style.left=d-a.flakeWidth+"px",c.style.top=e-a.flakeHeight+"px"):r?(c.style.right=100-100* -(d/h)+"%",c.style.top=Math.min(e,s-a.flakeHeight)+"px"):a.flakeBottom?(c.style.right=100-100*(d/h)+"%",c.style.top=Math.min(e,s-a.flakeHeight)+"px"):(c.style.right=100-100*(d/h)+"%",c.style.bottom=100-100*(e/l)+"%")};this.events=function(){function a(c){c=b.call(c);var d=c.length;e?(c[1]="on"+c[1],3b.vX?b.vX=0.2:0>b.vX&&-0.2b.vY&&(b.vY=0.2)};this.move=function(){var c=b.vX*v;b.x+=c;b.y+=b.vY*b.vAmp;b.x>=h||h-b.xc&&b.x-a.flakeLeftOffset<-a.flakeWidth&&(b.x=h-a.flakeWidth-1);b.refresh();l+p-b.y+a.flakeHeight -b.type&&!b.melting&&0.998b.twinkleFrame?0.97a.flakesMaxActive)a.flakes[a.flakes.length-1].active=-1;a.targetElement.appendChild(C)};this.timerInit=function(){a.timer= -!0;a.snow()};this.init=function(){var c;for(c=0;cb.vX?b.vX=0.2:0>b.vX&&-0.2b.vY&&(b.vY=0.2); + };this.move=function(){ + var c=b.vX*v;b.x+=c;b.y+=b.vY*b.vAmp;b.x>=h||h-b.xc&&b.x-a.flakeLeftOffset<-a.flakeWidth&&(b.x=h-a.flakeWidth-1);b.refresh();l+p-b.y+a.flakeHeight +b.type&&!b.melting&&0.998b.twinkleFrame?0.97a.flakesMaxActive)a.flakes[a.flakes.length-1].active=-1;a.targetElement.appendChild(C); + };this.timerInit=function(){ + a.timer= +!0;a.snow(); + };this.init=function(){ + var c;for(c=0;c