mirror of
https://framagit.org/tykayn/mastodon.git
synced 2023-08-25 08:33:12 +02:00
hop
This commit is contained in:
parent
27fe6cb789
commit
bf965b4d3e
@ -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;
|
||||
|
@ -121,11 +121,11 @@ class ColumnHeader extends React.PureComponent {
|
||||
className='text-btn column-header__setting-btn'
|
||||
onClick={this.handlePin}
|
||||
><Icon
|
||||
id='times'
|
||||
id='times'
|
||||
/> <FormattedMessage
|
||||
id='column_header.unpin'
|
||||
defaultMessage='Unpin'
|
||||
/></button >);
|
||||
id='column_header.unpin'
|
||||
defaultMessage='Unpin'
|
||||
/></button >);
|
||||
|
||||
moveButtons = (
|
||||
<div
|
||||
@ -138,7 +138,7 @@ class ColumnHeader extends React.PureComponent {
|
||||
className='text-btn column-header__setting-btn'
|
||||
onClick={this.handleMoveLeft}
|
||||
><Icon
|
||||
id='chevron-left'
|
||||
id='chevron-left'
|
||||
/></button >
|
||||
<button
|
||||
title={formatMessage(messages.moveRight)}
|
||||
@ -146,7 +146,7 @@ class ColumnHeader extends React.PureComponent {
|
||||
className='text-btn column-header__setting-btn'
|
||||
onClick={this.handleMoveRight}
|
||||
><Icon
|
||||
id='chevron-right'
|
||||
id='chevron-right'
|
||||
/></button >
|
||||
</div >
|
||||
);
|
||||
@ -157,11 +157,11 @@ class ColumnHeader extends React.PureComponent {
|
||||
className='text-btn column-header__setting-btn'
|
||||
onClick={this.handlePin}
|
||||
><Icon
|
||||
id='plus'
|
||||
id='plus'
|
||||
/> <FormattedMessage
|
||||
id='column_header.pin'
|
||||
defaultMessage='Pin'
|
||||
/>
|
||||
id='column_header.pin'
|
||||
defaultMessage='Pin'
|
||||
/>
|
||||
</button >);
|
||||
}
|
||||
|
||||
|
@ -44,7 +44,7 @@ export default class IntersectionObserverArticle extends React.Component {
|
||||
intersectionObserverWrapper.observe(
|
||||
id,
|
||||
this.node,
|
||||
this.handleIntersection
|
||||
this.handleIntersection,
|
||||
);
|
||||
|
||||
this.componentMounted = true;
|
||||
|
@ -557,12 +557,12 @@ class Status extends ImmutablePureComponent {
|
||||
<div className='status__info'>
|
||||
|
||||
{isStaff && (<div className='administrate-stuff pull-left'>
|
||||
<a
|
||||
href={`/admin/accounts/${status.getIn(['account', 'id'])}`}
|
||||
>
|
||||
<i className='fa fa-gears' />
|
||||
</a >
|
||||
</div >
|
||||
<a
|
||||
href={`/admin/accounts/${status.getIn(['account', 'id'])}`}
|
||||
>
|
||||
<i className='fa fa-gears' />
|
||||
</a >
|
||||
</div >
|
||||
)}
|
||||
<a
|
||||
href={status.get('url')}
|
||||
|
@ -68,7 +68,7 @@ class Blocks extends ImmutablePureComponent {
|
||||
bindToDocument={!multiColumn}
|
||||
>
|
||||
{accountIds.map(id =>
|
||||
<AccountContainer key={id} id={id} />
|
||||
<AccountContainer key={id} id={id} />,
|
||||
)}
|
||||
</ScrollableList>
|
||||
</Column>
|
||||
|
@ -42,7 +42,7 @@ export default class NavigationBar extends ImmutablePureComponent {
|
||||
href='/settings/profile'
|
||||
className='navigation-bar__profile-edit'
|
||||
>
|
||||
<i className='fa fa-pencil'></i >
|
||||
<i className='fa fa-pencil' />
|
||||
<FormattedMessage
|
||||
id='navigation_bar.edit_profile'
|
||||
defaultMessage='Edit profile'
|
||||
|
@ -69,7 +69,7 @@ class Blocks extends ImmutablePureComponent {
|
||||
bindToDocument={!multiColumn}
|
||||
>
|
||||
{domains.map(domain =>
|
||||
<DomainContainer key={domain} domain={domain} />
|
||||
<DomainContainer key={domain} domain={domain} />,
|
||||
)}
|
||||
</ScrollableList>
|
||||
</Column>
|
||||
|
@ -79,7 +79,7 @@ class Favourites extends ImmutablePureComponent {
|
||||
bindToDocument={!multiColumn}
|
||||
>
|
||||
{accountIds.map(id =>
|
||||
<AccountContainer key={id} id={id} withNote={false} />
|
||||
<AccountContainer key={id} id={id} withNote={false} />,
|
||||
)}
|
||||
</ScrollableList>
|
||||
</Column>
|
||||
|
@ -56,9 +56,9 @@ class AccountAuthorize extends ImmutablePureComponent {
|
||||
>
|
||||
<i className='fa fa-comment' />
|
||||
<strong >{shortNumberFormat(account.get('statuses_count'))}</strong > <FormattedMessage
|
||||
id='account.posts'
|
||||
defaultMessage='Toots'
|
||||
/>
|
||||
id='account.posts'
|
||||
defaultMessage='Toots'
|
||||
/>
|
||||
</NavLink >
|
||||
|
||||
<NavLink
|
||||
@ -68,9 +68,9 @@ class AccountAuthorize extends ImmutablePureComponent {
|
||||
title={intl.formatNumber(account.get('following_count'))}
|
||||
>
|
||||
<strong >{shortNumberFormat(account.get('following_count'))}</strong > <FormattedMessage
|
||||
id='account.follows'
|
||||
defaultMessage='Follows'
|
||||
/>
|
||||
id='account.follows'
|
||||
defaultMessage='Follows'
|
||||
/>
|
||||
</NavLink >
|
||||
|
||||
<NavLink
|
||||
@ -80,12 +80,12 @@ class AccountAuthorize extends ImmutablePureComponent {
|
||||
title={intl.formatNumber(account.get('followers_count'))}
|
||||
>
|
||||
<strong >{shortNumberFormat(account.get('followers_count'))}</strong > <FormattedMessage
|
||||
id='account.followers'
|
||||
defaultMessage='Followers'
|
||||
/>
|
||||
id='account.followers'
|
||||
defaultMessage='Followers'
|
||||
/>
|
||||
</NavLink >
|
||||
|
||||
</span >
|
||||
</span >
|
||||
|
||||
<div
|
||||
className='account__header__content'
|
||||
@ -101,7 +101,7 @@ class AccountAuthorize extends ImmutablePureComponent {
|
||||
<i
|
||||
className='fa fa-check'
|
||||
title={intl.formatMessage(messages.authorize)}
|
||||
></i >
|
||||
/>
|
||||
{intl.formatMessage(messages.authorize)}
|
||||
</div >
|
||||
<div
|
||||
@ -111,7 +111,7 @@ class AccountAuthorize extends ImmutablePureComponent {
|
||||
<i
|
||||
className='fa fa-times'
|
||||
title={intl.formatMessage(messages.reject)}
|
||||
></i >
|
||||
/>
|
||||
{intl.formatMessage(messages.reject)}
|
||||
</div >
|
||||
</div >
|
||||
|
@ -68,7 +68,7 @@ class FollowRequests extends ImmutablePureComponent {
|
||||
bindToDocument={!multiColumn}
|
||||
>
|
||||
{accountIds.map(id =>
|
||||
<AccountAuthorizeContainer key={id} id={id} />
|
||||
<AccountAuthorizeContainer key={id} id={id} />,
|
||||
)}
|
||||
</ScrollableList>
|
||||
</Column>
|
||||
|
@ -72,13 +72,13 @@ class Followers extends ImmutablePureComponent {
|
||||
);
|
||||
}
|
||||
|
||||
const emptyMessage = blockedBy ? <FormattedMessage
|
||||
const emptyMessage = blockedBy ? (<FormattedMessage
|
||||
id='empty_column.account_unavailable'
|
||||
defaultMessage='Profile unavailable'
|
||||
/> : <FormattedMessage
|
||||
/>) : (<FormattedMessage
|
||||
id='account.followers.empty'
|
||||
defaultMessage='No one follows this user yet.'
|
||||
/>;
|
||||
/>);
|
||||
|
||||
return (
|
||||
<Column >
|
||||
@ -98,11 +98,11 @@ class Followers extends ImmutablePureComponent {
|
||||
bindToDocument={!multiColumn}
|
||||
>
|
||||
{blockedBy ? [] : accountIds.map(id =>
|
||||
<AccountContainer
|
||||
(<AccountContainer
|
||||
key={id}
|
||||
id={id}
|
||||
withNote={false}
|
||||
/>,
|
||||
/>),
|
||||
)}
|
||||
</ScrollableList >
|
||||
</Column >
|
||||
|
@ -93,7 +93,7 @@ class Following extends ImmutablePureComponent {
|
||||
bindToDocument={!multiColumn}
|
||||
>
|
||||
{blockedBy ? [] : accountIds.map(id =>
|
||||
<AccountContainer key={id} id={id} withNote={false} />
|
||||
<AccountContainer key={id} id={id} withNote={false} />,
|
||||
)}
|
||||
</ScrollableList>
|
||||
</Column>
|
||||
|
@ -106,20 +106,20 @@ class GettingStarted extends ImmutablePureComponent {
|
||||
|
||||
if (profile_directory) {
|
||||
navItems.push(
|
||||
<ColumnLink key={i++} icon='address-book' text={intl.formatMessage(messages.profile_directory)} to='/directory' />
|
||||
<ColumnLink key={i++} icon='address-book' text={intl.formatMessage(messages.profile_directory)} to='/directory' />,
|
||||
);
|
||||
|
||||
height += 48;
|
||||
}
|
||||
|
||||
navItems.push(
|
||||
<ColumnSubheading key={i++} text={intl.formatMessage(messages.personal)} />
|
||||
<ColumnSubheading key={i++} text={intl.formatMessage(messages.personal)} />,
|
||||
);
|
||||
|
||||
height += 34;
|
||||
} else if (profile_directory) {
|
||||
navItems.push(
|
||||
<ColumnLink key={i++} icon='address-book' text={intl.formatMessage(messages.profile_directory)} to='/directory' />
|
||||
<ColumnLink key={i++} icon='address-book' text={intl.formatMessage(messages.profile_directory)} to='/directory' />,
|
||||
);
|
||||
|
||||
height += 48;
|
||||
@ -129,7 +129,7 @@ class GettingStarted extends ImmutablePureComponent {
|
||||
<ColumnLink key={i++} icon='envelope' text={intl.formatMessage(messages.direct)} to='/timelines/direct' />,
|
||||
<ColumnLink key={i++} icon='bookmark' text={intl.formatMessage(messages.bookmarks)} to='/bookmarks' />,
|
||||
<ColumnLink key={i++} icon='star' text={intl.formatMessage(messages.favourites)} to='/favourites' />,
|
||||
<ColumnLink key={i++} icon='list-ul' text={intl.formatMessage(messages.lists)} to='/lists' />
|
||||
<ColumnLink key={i++} icon='list-ul' text={intl.formatMessage(messages.lists)} to='/lists' />,
|
||||
);
|
||||
|
||||
height += 48*4;
|
||||
|
@ -74,7 +74,7 @@ class Lists extends ImmutablePureComponent {
|
||||
bindToDocument={!multiColumn}
|
||||
>
|
||||
{lists.map(list =>
|
||||
<ColumnLink key={list.get('id')} to={`/timelines/list/${list.get('id')}`} icon='list-ul' text={list.get('title')} />
|
||||
<ColumnLink key={list.get('id')} to={`/timelines/list/${list.get('id')}`} icon='list-ul' text={list.get('title')} />,
|
||||
)}
|
||||
</ScrollableList>
|
||||
</Column>
|
||||
|
@ -68,7 +68,7 @@ class Mutes extends ImmutablePureComponent {
|
||||
bindToDocument={!multiColumn}
|
||||
>
|
||||
{accountIds.map(id =>
|
||||
<AccountContainer key={id} id={id} />
|
||||
<AccountContainer key={id} id={id} />,
|
||||
)}
|
||||
</ScrollableList>
|
||||
</Column>
|
||||
|
@ -98,7 +98,7 @@ export default class Card extends React.PureComponent {
|
||||
},
|
||||
},
|
||||
]),
|
||||
0
|
||||
0,
|
||||
);
|
||||
};
|
||||
|
||||
|
@ -19,7 +19,7 @@ describe('<Column />', () => {
|
||||
const wrapper = mount(
|
||||
<Column heading='notifications'>
|
||||
<div className='scrollable' />
|
||||
</Column>
|
||||
</Column>,
|
||||
);
|
||||
wrapper.find(ColumnHeader).find('button').simulate('click');
|
||||
expect(global.requestAnimationFrame.mock.calls.length).toEqual(1);
|
||||
|
@ -270,7 +270,7 @@ class ColumnsArea extends ImmutablePureComponent {
|
||||
{React.Children.map(children, child => React.cloneElement(child, { multiColumn: true }))}
|
||||
</div >
|
||||
)
|
||||
;
|
||||
;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -214,8 +214,8 @@ class LinkFooter extends React.PureComponent {
|
||||
href='/invites'
|
||||
target='_blank'
|
||||
><FormattedMessage
|
||||
id='getting_started.invite'
|
||||
defaultMessage='Invite people'
|
||||
id='getting_started.invite'
|
||||
defaultMessage='Invite people'
|
||||
/></a > · </li >}
|
||||
{withHotkeys && <li >
|
||||
<Link to='/keyboard-shortcuts'><FormattedMessage
|
||||
@ -231,48 +231,48 @@ class LinkFooter extends React.PureComponent {
|
||||
href='/about/more'
|
||||
target='_blank'
|
||||
><FormattedMessage
|
||||
id='navigation_bar.info'
|
||||
defaultMessage='About this server'
|
||||
id='navigation_bar.info'
|
||||
defaultMessage='About this server'
|
||||
/></a > ·
|
||||
</li >
|
||||
<li ><a
|
||||
href='https://joinmastodon.org/apps'
|
||||
target='_blank'
|
||||
><FormattedMessage
|
||||
id='navigation_bar.apps'
|
||||
defaultMessage='Mobile apps'
|
||||
id='navigation_bar.apps'
|
||||
defaultMessage='Mobile apps'
|
||||
/></a > ·
|
||||
</li >
|
||||
<li ><a
|
||||
href='/terms'
|
||||
target='_blank'
|
||||
><FormattedMessage
|
||||
id='getting_started.terms'
|
||||
defaultMessage='Terms of service'
|
||||
id='getting_started.terms'
|
||||
defaultMessage='Terms of service'
|
||||
/></a > ·
|
||||
</li >
|
||||
<li ><a
|
||||
href='/settings/applications'
|
||||
target='_blank'
|
||||
><FormattedMessage
|
||||
id='getting_started.developers'
|
||||
defaultMessage='Developers'
|
||||
id='getting_started.developers'
|
||||
defaultMessage='Developers'
|
||||
/></a > ·
|
||||
</li >
|
||||
<li ><a
|
||||
href='https://docs.joinmastodon.org'
|
||||
target='_blank'
|
||||
><FormattedMessage
|
||||
id='getting_started.documentation'
|
||||
defaultMessage='Documentation'
|
||||
id='getting_started.documentation'
|
||||
defaultMessage='Documentation'
|
||||
/></a > ·
|
||||
</li >
|
||||
<li ><a
|
||||
href='/auth/sign_out'
|
||||
onClick={this.handleLogoutClick}
|
||||
><FormattedMessage
|
||||
id='navigation_bar.logout'
|
||||
defaultMessage='Logout'
|
||||
id='navigation_bar.logout'
|
||||
defaultMessage='Logout'
|
||||
/></a ></li >
|
||||
</ul >
|
||||
|
||||
|
@ -17,26 +17,26 @@ const NavigationPanel = () => (
|
||||
data-preview-title-id='column.home'
|
||||
data-preview-icon='home'
|
||||
><Icon
|
||||
className='column-link__icon'
|
||||
id='home'
|
||||
fixedWidth
|
||||
className='column-link__icon'
|
||||
id='home'
|
||||
fixedWidth
|
||||
/><FormattedMessage
|
||||
id='tabs_bar.home'
|
||||
defaultMessage='Home'
|
||||
/></NavLink >
|
||||
id='tabs_bar.home'
|
||||
defaultMessage='Home'
|
||||
/></NavLink >
|
||||
<NavLink
|
||||
className='column-link column-link--transparent'
|
||||
to='/timelines/public/local'
|
||||
data-preview-title-id='column.community'
|
||||
data-preview-icon='users'
|
||||
><Icon
|
||||
className='column-link__icon'
|
||||
id='users'
|
||||
fixedWidth
|
||||
className='column-link__icon'
|
||||
id='users'
|
||||
fixedWidth
|
||||
/><FormattedMessage
|
||||
id='tabs_bar.local_timeline'
|
||||
defaultMessage='Local'
|
||||
/></NavLink >
|
||||
id='tabs_bar.local_timeline'
|
||||
defaultMessage='Local'
|
||||
/></NavLink >
|
||||
|
||||
<NavLink
|
||||
className='column-link column-link--transparent'
|
||||
@ -45,87 +45,87 @@ const NavigationPanel = () => (
|
||||
data-preview-title-id='column.public'
|
||||
data-preview-icon='globe'
|
||||
><Icon
|
||||
className='column-link__icon'
|
||||
id='globe'
|
||||
fixedWidth
|
||||
className='column-link__icon'
|
||||
id='globe'
|
||||
fixedWidth
|
||||
/><FormattedMessage
|
||||
id='tabs_bar.federated_timeline'
|
||||
defaultMessage='Federated'
|
||||
/></NavLink >
|
||||
id='tabs_bar.federated_timeline'
|
||||
defaultMessage='Federated'
|
||||
/></NavLink >
|
||||
|
||||
</div >
|
||||
<div className='spacer'></div >
|
||||
<div className='spacer' />
|
||||
<NavLink
|
||||
className='column-link column-link--transparent'
|
||||
to='/notifications'
|
||||
data-preview-title-id='column.notifications'
|
||||
data-preview-icon='bell'
|
||||
><NotificationsCounterIcon
|
||||
className='column-link__icon'
|
||||
className='column-link__icon'
|
||||
/><FormattedMessage
|
||||
id='tabs_bar.notifications'
|
||||
defaultMessage='Notifications'
|
||||
/></NavLink >
|
||||
id='tabs_bar.notifications'
|
||||
defaultMessage='Notifications'
|
||||
/></NavLink >
|
||||
<NavLink
|
||||
className='column-link column-link--transparent'
|
||||
to='/timelines/direct'
|
||||
><Icon
|
||||
className='column-link__icon'
|
||||
id='envelope'
|
||||
fixedWidth
|
||||
className='column-link__icon'
|
||||
id='envelope'
|
||||
fixedWidth
|
||||
/><FormattedMessage
|
||||
id='navigation_bar.direct'
|
||||
defaultMessage='Direct messages'
|
||||
/></NavLink >
|
||||
id='navigation_bar.direct'
|
||||
defaultMessage='Direct messages'
|
||||
/></NavLink >
|
||||
<FollowRequestsNavLink />
|
||||
|
||||
<div className='spacer'></div >
|
||||
<div className='spacer' />
|
||||
|
||||
<NavLink
|
||||
className='column-link column-link--transparent'
|
||||
to='/favourites'
|
||||
><Icon
|
||||
className='column-link__icon'
|
||||
id='star'
|
||||
fixedWidth
|
||||
className='column-link__icon'
|
||||
id='star'
|
||||
fixedWidth
|
||||
/><FormattedMessage
|
||||
id='navigation_bar.favourites'
|
||||
defaultMessage='Favourites'
|
||||
/></NavLink >
|
||||
id='navigation_bar.favourites'
|
||||
defaultMessage='Favourites'
|
||||
/></NavLink >
|
||||
<NavLink
|
||||
className='column-link column-link--transparent'
|
||||
to='/bookmarks'
|
||||
><Icon
|
||||
className='column-link__icon'
|
||||
id='bookmark'
|
||||
fixedWidth
|
||||
className='column-link__icon'
|
||||
id='bookmark'
|
||||
fixedWidth
|
||||
/><FormattedMessage
|
||||
id='navigation_bar.bookmarks'
|
||||
defaultMessage='Bookmarks'
|
||||
/></NavLink >
|
||||
id='navigation_bar.bookmarks'
|
||||
defaultMessage='Bookmarks'
|
||||
/></NavLink >
|
||||
<NavLink
|
||||
className='column-link column-link--transparent'
|
||||
to='/lists'
|
||||
><Icon
|
||||
className='column-link__icon'
|
||||
id='list-ul'
|
||||
fixedWidth
|
||||
className='column-link__icon'
|
||||
id='list-ul'
|
||||
fixedWidth
|
||||
/><FormattedMessage
|
||||
id='navigation_bar.lists'
|
||||
defaultMessage='Lists'
|
||||
/></NavLink >
|
||||
id='navigation_bar.lists'
|
||||
defaultMessage='Lists'
|
||||
/></NavLink >
|
||||
{profile_directory &&
|
||||
<NavLink
|
||||
className='column-link column-link--transparent'
|
||||
to='/directory'
|
||||
><Icon
|
||||
className='column-link__icon'
|
||||
id='address-book-o'
|
||||
fixedWidth
|
||||
className='column-link__icon'
|
||||
id='address-book-o'
|
||||
fixedWidth
|
||||
/><FormattedMessage
|
||||
id='getting_started.directory'
|
||||
defaultMessage='Profile directory'
|
||||
/></NavLink >}
|
||||
id='getting_started.directory'
|
||||
defaultMessage='Profile directory'
|
||||
/></NavLink >}
|
||||
|
||||
<ListPanel />
|
||||
|
||||
@ -135,24 +135,24 @@ const NavigationPanel = () => (
|
||||
className='column-link column-link--transparent'
|
||||
href='/settings/preferences'
|
||||
><Icon
|
||||
className='column-link__icon'
|
||||
id='cog'
|
||||
fixedWidth
|
||||
className='column-link__icon'
|
||||
id='cog'
|
||||
fixedWidth
|
||||
/><FormattedMessage
|
||||
id='navigation_bar.preferences'
|
||||
defaultMessage='Preferences'
|
||||
/></a >
|
||||
id='navigation_bar.preferences'
|
||||
defaultMessage='Preferences'
|
||||
/></a >
|
||||
<a
|
||||
className='column-link column-link--transparent'
|
||||
href='/relationships'
|
||||
><Icon
|
||||
className='column-link__icon'
|
||||
id='users'
|
||||
fixedWidth
|
||||
className='column-link__icon'
|
||||
id='users'
|
||||
fixedWidth
|
||||
/><FormattedMessage
|
||||
id='navigation_bar.follows_and_followers'
|
||||
defaultMessage='Follows and followers'
|
||||
/></a >
|
||||
id='navigation_bar.follows_and_followers'
|
||||
defaultMessage='Follows and followers'
|
||||
/></a >
|
||||
|
||||
{showTrends && <div className='flex-spacer' />}
|
||||
{showTrends && <TrendsContainer />}
|
||||
|
@ -14,20 +14,20 @@ export const links = [
|
||||
data-preview-title-id='column.home'
|
||||
data-preview-icon='home'
|
||||
><Icon
|
||||
id='home'
|
||||
fixedWidth
|
||||
id='home'
|
||||
fixedWidth
|
||||
/><FormattedMessage
|
||||
id='tabs_bar.home'
|
||||
defaultMessage='Home'
|
||||
/></NavLink >,
|
||||
id='tabs_bar.home'
|
||||
defaultMessage='Home'
|
||||
/></NavLink >,
|
||||
<NavLink
|
||||
className='tabs-bar__link'
|
||||
to='/notifications'
|
||||
data-preview-title-id='column.notifications'
|
||||
data-preview-icon='bell'
|
||||
><NotificationsCounterIcon /><FormattedMessage
|
||||
id='tabs_bar.notifications'
|
||||
defaultMessage='Notifications'
|
||||
id='tabs_bar.notifications'
|
||||
defaultMessage='Notifications'
|
||||
/></NavLink >,
|
||||
<NavLink
|
||||
className='tabs-bar__link'
|
||||
@ -35,12 +35,12 @@ export const links = [
|
||||
data-preview-title-id='column.community'
|
||||
data-preview-icon='users'
|
||||
><Icon
|
||||
id='users'
|
||||
fixedWidth
|
||||
id='users'
|
||||
fixedWidth
|
||||
/><FormattedMessage
|
||||
id='tabs_bar.local_timeline'
|
||||
defaultMessage='Local'
|
||||
/></NavLink >,
|
||||
id='tabs_bar.local_timeline'
|
||||
defaultMessage='Local'
|
||||
/></NavLink >,
|
||||
<NavLink
|
||||
className='tabs-bar__link'
|
||||
exact
|
||||
@ -48,24 +48,24 @@ export const links = [
|
||||
data-preview-title-id='column.public'
|
||||
data-preview-icon='globe'
|
||||
><Icon
|
||||
id='globe'
|
||||
fixedWidth
|
||||
id='globe'
|
||||
fixedWidth
|
||||
/><FormattedMessage
|
||||
id='tabs_bar.federated_timeline'
|
||||
defaultMessage='Federated'
|
||||
/></NavLink >,
|
||||
id='tabs_bar.federated_timeline'
|
||||
defaultMessage='Federated'
|
||||
/></NavLink >,
|
||||
<NavLink
|
||||
className='tabs-bar__link optional'
|
||||
to='/search'
|
||||
data-preview-title-id='tabs_bar.search'
|
||||
data-preview-icon='bell'
|
||||
><Icon
|
||||
id='search'
|
||||
fixedWidth
|
||||
id='search'
|
||||
fixedWidth
|
||||
/><FormattedMessage
|
||||
id='tabs_bar.search'
|
||||
defaultMessage='Search'
|
||||
/></NavLink >,
|
||||
id='tabs_bar.search'
|
||||
defaultMessage='Search'
|
||||
/></NavLink >,
|
||||
<NavLink
|
||||
className='tabs-bar__link'
|
||||
style={{ flexGrow: '0', flexBasis: '30px' }}
|
||||
@ -73,8 +73,8 @@ export const links = [
|
||||
data-preview-title-id='getting_started.heading'
|
||||
data-preview-icon='bars'
|
||||
><Icon
|
||||
id='bars'
|
||||
fixedWidth
|
||||
id='bars'
|
||||
fixedWidth
|
||||
/></NavLink >,
|
||||
];
|
||||
|
||||
|
@ -522,16 +522,16 @@ class Video extends React.PureComponent {
|
||||
aria-label={intl.formatMessage(messages.hide)}
|
||||
onClick={this.toggleReveal}
|
||||
><Icon
|
||||
id='eye-slash'
|
||||
fixedWidth
|
||||
id='eye-slash'
|
||||
fixedWidth
|
||||
/></button >}
|
||||
{(!fullscreen && onOpenVideo) && <button
|
||||
type='button'
|
||||
aria-label={intl.formatMessage(messages.expand)}
|
||||
onClick={this.handleOpenVideo}
|
||||
><Icon
|
||||
id='expand'
|
||||
fixedWidth
|
||||
id='expand'
|
||||
fixedWidth
|
||||
/></button >}
|
||||
{onCloseVideo && <button type='button' aria-label={intl.formatMessage(messages.close)} onClick={this.handleCloseVideo}><Icon id='compress' fixedWidth /></button>}
|
||||
<button type='button' aria-label={intl.formatMessage(messages.download)}><a className='video-player__download__icon' href={this.props.src} download><Icon id={'download'} fixedWidth /></a></button>
|
||||
|
@ -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));
|
||||
|
@ -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;
|
||||
|
@ -117,7 +117,7 @@ export const makeGetStatus = () => {
|
||||
map.set('account', accountBase);
|
||||
map.set('filtered', filtered);
|
||||
});
|
||||
}
|
||||
},
|
||||
);
|
||||
};
|
||||
|
||||
|
@ -117,7 +117,7 @@ const handlePush = (event) => {
|
||||
badge: '/badge.png',
|
||||
data: { access_token, preferred_locale, url: '/web/notifications' },
|
||||
});
|
||||
})
|
||||
}),
|
||||
);
|
||||
};
|
||||
|
||||
|
@ -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));
|
||||
};
|
||||
|
130
app/javascript/mastodon/utils/snowstorm-min.js
vendored
130
app/javascript/mastodon/utils/snowstorm-min.js
vendored
@ -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],3<d&&c.pop()):3===d&&c.push(!1);return c}function d(a,b){var c=a.shift(),d=[f[b]];if(e)c[d](a[0],a[1]);else c[d].apply(c,a)}var e=!g.addEventListener&&g.attachEvent,b=Array.prototype.slice,f={add:e?"attachEvent":
|
||||
"addEventListener",remove:e?"detachEvent":"removeEventListener"};return{add:function(){d(a(arguments),"add")},remove:function(){d(a(arguments),"remove")}}}();this.randomizeWind=function(){var c;c=k(a.vMaxX,0.2);z=1===parseInt(k(2),10)?-1*c:c;A=k(a.vMaxY,0.2);if(this.flakes)for(c=0;c<this.flakes.length;c++)this.flakes[c].active&&this.flakes[c].setVelocities()};this.scrollHandler=function(){var c;p=a.flakeBottom?0:parseInt(g.scrollY||f.documentElement.scrollTop||(r?f.body.scrollTop:0),10);isNaN(p)&&
|
||||
(p=0);if(!t&&!a.flakeBottom&&a.flakes)for(c=0;c<a.flakes.length;c++)0===a.flakes[c].active&&a.flakes[c].stick()};this.resizeHandler=function(){g.innerWidth||g.innerHeight?(h=g.innerWidth-16-a.flakeRightOffset,l=a.flakeBottom||g.innerHeight):(h=(f.documentElement.clientWidth||f.body.clientWidth||f.body.scrollWidth)-(!m?8:0)-a.flakeRightOffset,l=a.flakeBottom||f.documentElement.clientHeight||f.body.clientHeight||f.body.scrollHeight);s=f.body.offsetHeight;n=parseInt(h/2,10)};this.resizeHandlerAlt=function(){h=
|
||||
a.targetElement.offsetWidth-a.flakeRightOffset;l=a.flakeBottom||a.targetElement.offsetHeight;n=parseInt(h/2,10);s=f.body.offsetHeight};this.freeze=function(){if(a.disabled)return!1;a.disabled=1;a.timer=null};this.resume=function(){if(a.disabled)a.disabled=0;else return!1;a.timerInit()};this.toggleSnow=function(){a.flakes.length?(a.active=!a.active,a.active?(a.show(),a.resume()):(a.stop(),a.freeze())):a.start()};this.stop=function(){var c;this.freeze();for(c=0;c<this.flakes.length;c++)this.flakes[c].o.style.display=
|
||||
"none";a.events.remove(g,"scroll",a.scrollHandler);a.events.remove(g,"resize",a.resizeHandler);a.freezeOnBlur&&(m?(a.events.remove(f,"focusout",a.freeze),a.events.remove(f,"focusin",a.resume)):(a.events.remove(g,"blur",a.freeze),a.events.remove(g,"focus",a.resume)))};this.show=function(){var a;for(a=0;a<this.flakes.length;a++)this.flakes[a].o.style.display="block"};this.SnowFlake=function(c,d,e){var b=this;this.type=c;this.x=d||parseInt(k(h-20),10);this.y=!isNaN(e)?e:-k(l)-12;this.vY=this.vX=null;
|
||||
this.vAmpTypes=[1,1.2,1.4,1.6,1.8];this.vAmp=this.vAmpTypes[this.type]||1;this.melting=!1;this.meltFrameCount=a.meltFrameCount;this.meltFrames=a.meltFrames;this.twinkleFrame=this.meltFrame=0;this.active=1;this.fontSize=10+10*(this.type/5);this.o=f.createElement("div");this.o.innerHTML=a.snowCharacter;a.className&&this.o.setAttribute("class",a.className);this.o.style.color=a.snowColor;this.o.style.position=t?"fixed":"absolute";a.useGPU&&q.transform.prop&&(this.o.style[q.transform.prop]="translate3d(0px, 0px, 0px)");
|
||||
this.o.style.width=a.flakeWidth+"px";this.o.style.height=a.flakeHeight+"px";this.o.style.fontFamily="arial,verdana";this.o.style.cursor="default";this.o.style.overflow="hidden";this.o.style.fontWeight="normal";this.o.style.zIndex=a.zIndex;C.appendChild(this.o);this.refresh=function(){if(isNaN(b.x)||isNaN(b.y))return!1;a.setXY(b.o,b.x,b.y)};this.stick=function(){r||a.targetElement!==f.documentElement&&a.targetElement!==f.body?b.o.style.top=l+p-a.flakeHeight+"px":a.flakeBottom?b.o.style.top=a.flakeBottom+
|
||||
"px":(b.o.style.display="none",b.o.style.bottom="0%",b.o.style.position="fixed",b.o.style.display="block")};this.vCheck=function(){0<=b.vX&&0.2>b.vX?b.vX=0.2:0>b.vX&&-0.2<b.vX&&(b.vX=-0.2);0<=b.vY&&0.2>b.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.x<a.flakeWidth?b.x=0:0>c&&b.x-a.flakeLeftOffset<-a.flakeWidth&&(b.x=h-a.flakeWidth-1);b.refresh();l+p-b.y+a.flakeHeight<a.flakeHeight?(b.active=0,a.snowStick?b.stick():b.recycle()):(a.useMeltEffect&&(b.active&&3>
|
||||
b.type&&!b.melting&&0.998<Math.random())&&(b.melting=!0,b.melt()),a.useTwinkleEffect&&(0>b.twinkleFrame?0.97<Math.random()&&(b.twinkleFrame=parseInt(8*Math.random(),10)):(b.twinkleFrame--,u?b.o.style.opacity=b.twinkleFrame&&0===b.twinkleFrame%2?0:1:b.o.style.visibility=b.twinkleFrame&&0===b.twinkleFrame%2?"hidden":"visible")))};this.animate=function(){b.move()};this.setVelocities=function(){b.vX=z+k(0.12*a.vMaxX,0.1);b.vY=A+k(0.12*a.vMaxY,0.1)};this.setOpacity=function(a,b){if(!u)return!1;a.style.opacity=
|
||||
b};this.melt=function(){!a.useMeltEffect||!b.melting?b.recycle():b.meltFrame<b.meltFrameCount?(b.setOpacity(b.o,b.meltFrames[b.meltFrame]),b.o.style.fontSize=b.fontSize-b.fontSize*(b.meltFrame/b.meltFrameCount)+"px",b.o.style.lineHeight=a.flakeHeight+2+0.75*a.flakeHeight*(b.meltFrame/b.meltFrameCount)+"px",b.meltFrame++):b.recycle()};this.recycle=function(){b.o.style.display="none";b.o.style.position=t?"fixed":"absolute";b.o.style.bottom="auto";b.setVelocities();b.vCheck();b.meltFrame=0;b.melting=
|
||||
!1;b.setOpacity(b.o,1);b.o.style.padding="0px";b.o.style.margin="0px";b.o.style.fontSize=b.fontSize+"px";b.o.style.lineHeight=a.flakeHeight+2+"px";b.o.style.textAlign="center";b.o.style.verticalAlign="baseline";b.x=parseInt(k(h-a.flakeWidth-20),10);b.y=parseInt(-1*k(l),10)-a.flakeHeight;b.refresh();b.o.style.display="block";b.active=1};this.recycle();this.refresh()};this.snow=function(){var c=0,d=null,e,d=0;for(e=a.flakes.length;d<e;d++)1===a.flakes[d].active&&(a.flakes[d].move(),c++),a.flakes[d].melting&&
|
||||
a.flakes[d].melt();c<a.flakesMaxActive&&(d=a.flakes[parseInt(k(a.flakes.length),10)],0===d.active&&(d.melting=!0));a.timer&&q.getAnimationFrame(a.snow)};this.mouseMove=function(c){if(!a.followMouse)return!0;c=parseInt(c.clientX,10);c<n?v=-2+2*(c/n):(c-=n,v=2*(c/n))};this.createSnow=function(c,d){var e;for(e=0;e<c;e++)if(a.flakes[a.flakes.length]=new a.SnowFlake(parseInt(k(6),10)),d||e>a.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<a.meltFrameCount;c++)a.meltFrames.push(1-c/a.meltFrameCount);a.randomizeWind();a.createSnow(a.flakesMax);a.events.add(g,"resize",a.resizeHandler);a.events.add(g,"scroll",a.scrollHandler);a.freezeOnBlur&&(m?(a.events.add(f,"focusout",a.freeze),a.events.add(f,"focusin",a.resume)):(a.events.add(g,"blur",a.freeze),a.events.add(g,"focus",a.resume)));a.resizeHandler();a.scrollHandler();a.followMouse&&a.events.add(m?f:g,"mousemove",a.mouseMove);a.animationInterval=
|
||||
Math.max(20,a.animationInterval);a.timerInit()};this.start=function(c){if(B){if(c)return!0}else B=!0;if("string"===typeof a.targetElement&&(c=a.targetElement,a.targetElement=f.getElementById(c),!a.targetElement))throw Error('Snowstorm: Unable to get targetElement "'+c+'"');a.targetElement||(a.targetElement=f.body||f.documentElement);a.targetElement!==f.documentElement&&a.targetElement!==f.body&&(a.resizeHandler=a.resizeHandlerAlt,a.usePixelPosition=!0);a.resizeHandler();a.usePositionFixed=a.usePositionFixed&&
|
||||
!r&&!a.flakeBottom;if(g.getComputedStyle)try{w="relative"===g.getComputedStyle(a.targetElement,null).getPropertyValue("position")}catch(d){w=!1}t=a.usePositionFixed;h&&(l&&!a.disabled)&&(a.init(),a.active=!0)};a.autoStart&&a.events.add(g,"load",y,!1);return this}(window, document);
|
||||
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], 3<d&&c.pop()):3===d&&c.push(!1);return c;
|
||||
}function d(a, b){
|
||||
var c=a.shift(), d=[f[b]];if(e)c[d](a[0], a[1]);else c[d].apply(c, a);
|
||||
}var e=!g.addEventListener&&g.attachEvent, b=Array.prototype.slice, f={ add:e?'attachEvent':
|
||||
'addEventListener', remove:e?'detachEvent':'removeEventListener' };return{ add:function(){
|
||||
d(a(arguments), 'add');
|
||||
}, remove:function(){
|
||||
d(a(arguments), 'remove');
|
||||
} };
|
||||
}();this.randomizeWind=function(){
|
||||
var c;c=k(a.vMaxX, 0.2);z=1===parseInt(k(2), 10)?-1*c:c;A=k(a.vMaxY, 0.2);if(this.flakes)for(c=0;c<this.flakes.length;c++)this.flakes[c].active&&this.flakes[c].setVelocities();
|
||||
};this.scrollHandler=function(){
|
||||
var c;p=a.flakeBottom?0:parseInt(g.scrollY||f.documentElement.scrollTop||(r?f.body.scrollTop:0), 10);isNaN(p)&&
|
||||
(p=0);if(!t&&!a.flakeBottom&&a.flakes)for(c=0;c<a.flakes.length;c++)0===a.flakes[c].active&&a.flakes[c].stick();
|
||||
};this.resizeHandler=function(){
|
||||
g.innerWidth||g.innerHeight?(h=g.innerWidth-16-a.flakeRightOffset, l=a.flakeBottom||g.innerHeight):(h=(f.documentElement.clientWidth||f.body.clientWidth||f.body.scrollWidth)-(!m?8:0)-a.flakeRightOffset, l=a.flakeBottom||f.documentElement.clientHeight||f.body.clientHeight||f.body.scrollHeight);s=f.body.offsetHeight;n=parseInt(h/2, 10);
|
||||
};this.resizeHandlerAlt=function(){
|
||||
h=
|
||||
a.targetElement.offsetWidth-a.flakeRightOffset;l=a.flakeBottom||a.targetElement.offsetHeight;n=parseInt(h/2, 10);s=f.body.offsetHeight;
|
||||
};this.freeze=function(){
|
||||
if(a.disabled)return!1;a.disabled=1;a.timer=null;
|
||||
};this.resume=function(){
|
||||
if(a.disabled)a.disabled=0;else return!1;a.timerInit();
|
||||
};this.toggleSnow=function(){
|
||||
a.flakes.length?(a.active=!a.active, a.active?(a.show(), a.resume()):(a.stop(), a.freeze())):a.start();
|
||||
};this.stop=function(){
|
||||
var c;this.freeze();for(c=0;c<this.flakes.length;c++)this.flakes[c].o.style.display=
|
||||
'none';a.events.remove(g, 'scroll', a.scrollHandler);a.events.remove(g, 'resize', a.resizeHandler);a.freezeOnBlur&&(m?(a.events.remove(f, 'focusout', a.freeze), a.events.remove(f, 'focusin', a.resume)):(a.events.remove(g, 'blur', a.freeze), a.events.remove(g, 'focus', a.resume)));
|
||||
};this.show=function(){
|
||||
var a;for(a=0;a<this.flakes.length;a++)this.flakes[a].o.style.display='block';
|
||||
};this.SnowFlake=function(c, d, e){
|
||||
var b=this;this.type=c;this.x=d||parseInt(k(h-20), 10);this.y=!isNaN(e)?e:-k(l)-12;this.vY=this.vX=null;
|
||||
this.vAmpTypes=[1, 1.2, 1.4, 1.6, 1.8];this.vAmp=this.vAmpTypes[this.type]||1;this.melting=!1;this.meltFrameCount=a.meltFrameCount;this.meltFrames=a.meltFrames;this.twinkleFrame=this.meltFrame=0;this.active=1;this.fontSize=10+10*(this.type/5);this.o=f.createElement('div');this.o.innerHTML=a.snowCharacter;a.className&&this.o.setAttribute('class', a.className);this.o.style.color=a.snowColor;this.o.style.position=t?'fixed':'absolute';a.useGPU&&q.transform.prop&&(this.o.style[q.transform.prop]='translate3d(0px, 0px, 0px)');
|
||||
this.o.style.width=a.flakeWidth+'px';this.o.style.height=a.flakeHeight+'px';this.o.style.fontFamily='arial,verdana';this.o.style.cursor='default';this.o.style.overflow='hidden';this.o.style.fontWeight='normal';this.o.style.zIndex=a.zIndex;C.appendChild(this.o);this.refresh=function(){
|
||||
if(isNaN(b.x)||isNaN(b.y))return!1;a.setXY(b.o, b.x, b.y);
|
||||
};this.stick=function(){
|
||||
r||a.targetElement!==f.documentElement&&a.targetElement!==f.body?b.o.style.top=l+p-a.flakeHeight+'px':a.flakeBottom?b.o.style.top=a.flakeBottom+
|
||||
'px':(b.o.style.display='none', b.o.style.bottom='0%', b.o.style.position='fixed', b.o.style.display='block');
|
||||
};this.vCheck=function(){
|
||||
0<=b.vX&&0.2>b.vX?b.vX=0.2:0>b.vX&&-0.2<b.vX&&(b.vX=-0.2);0<=b.vY&&0.2>b.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.x<a.flakeWidth?b.x=0:0>c&&b.x-a.flakeLeftOffset<-a.flakeWidth&&(b.x=h-a.flakeWidth-1);b.refresh();l+p-b.y+a.flakeHeight<a.flakeHeight?(b.active=0, a.snowStick?b.stick():b.recycle()):(a.useMeltEffect&&(b.active&&3>
|
||||
b.type&&!b.melting&&0.998<Math.random())&&(b.melting=!0, b.melt()), a.useTwinkleEffect&&(0>b.twinkleFrame?0.97<Math.random()&&(b.twinkleFrame=parseInt(8*Math.random(), 10)):(b.twinkleFrame--, u?b.o.style.opacity=b.twinkleFrame&&0===b.twinkleFrame%2?0:1:b.o.style.visibility=b.twinkleFrame&&0===b.twinkleFrame%2?'hidden':'visible')));
|
||||
};this.animate=function(){
|
||||
b.move();
|
||||
};this.setVelocities=function(){
|
||||
b.vX=z+k(0.12*a.vMaxX, 0.1);b.vY=A+k(0.12*a.vMaxY, 0.1);
|
||||
};this.setOpacity=function(a, b){
|
||||
if(!u)return!1;a.style.opacity=
|
||||
b;
|
||||
};this.melt=function(){
|
||||
!a.useMeltEffect||!b.melting?b.recycle():b.meltFrame<b.meltFrameCount?(b.setOpacity(b.o, b.meltFrames[b.meltFrame]), b.o.style.fontSize=b.fontSize-b.fontSize*(b.meltFrame/b.meltFrameCount)+'px', b.o.style.lineHeight=a.flakeHeight+2+0.75*a.flakeHeight*(b.meltFrame/b.meltFrameCount)+'px', b.meltFrame++):b.recycle();
|
||||
};this.recycle=function(){
|
||||
b.o.style.display='none';b.o.style.position=t?'fixed':'absolute';b.o.style.bottom='auto';b.setVelocities();b.vCheck();b.meltFrame=0;b.melting=
|
||||
!1;b.setOpacity(b.o, 1);b.o.style.padding='0px';b.o.style.margin='0px';b.o.style.fontSize=b.fontSize+'px';b.o.style.lineHeight=a.flakeHeight+2+'px';b.o.style.textAlign='center';b.o.style.verticalAlign='baseline';b.x=parseInt(k(h-a.flakeWidth-20), 10);b.y=parseInt(-1*k(l), 10)-a.flakeHeight;b.refresh();b.o.style.display='block';b.active=1;
|
||||
};this.recycle();this.refresh();
|
||||
};this.snow=function(){
|
||||
var c=0, d=null, e, d=0;for(e=a.flakes.length;d<e;d++)1===a.flakes[d].active&&(a.flakes[d].move(), c++), a.flakes[d].melting&&
|
||||
a.flakes[d].melt();c<a.flakesMaxActive&&(d=a.flakes[parseInt(k(a.flakes.length), 10)], 0===d.active&&(d.melting=!0));a.timer&&q.getAnimationFrame(a.snow);
|
||||
};this.mouseMove=function(c){
|
||||
if(!a.followMouse)return!0;c=parseInt(c.clientX, 10);c<n?v=-2+2*(c/n):(c-=n, v=2*(c/n));
|
||||
};this.createSnow=function(c, d){
|
||||
var e;for(e=0;e<c;e++)if(a.flakes[a.flakes.length]=new a.SnowFlake(parseInt(k(6), 10)), d||e>a.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<a.meltFrameCount;c++)a.meltFrames.push(1-c/a.meltFrameCount);a.randomizeWind();a.createSnow(a.flakesMax);a.events.add(g, 'resize', a.resizeHandler);a.events.add(g, 'scroll', a.scrollHandler);a.freezeOnBlur&&(m?(a.events.add(f, 'focusout', a.freeze), a.events.add(f, 'focusin', a.resume)):(a.events.add(g, 'blur', a.freeze), a.events.add(g, 'focus', a.resume)));a.resizeHandler();a.scrollHandler();a.followMouse&&a.events.add(m?f:g, 'mousemove', a.mouseMove);a.animationInterval=
|
||||
Math.max(20, a.animationInterval);a.timerInit();
|
||||
};this.start=function(c){
|
||||
if(B){
|
||||
if(c)return!0;
|
||||
}else B=!0;if('string'===typeof a.targetElement&&(c=a.targetElement, a.targetElement=f.getElementById(c), !a.targetElement))throw Error('Snowstorm: Unable to get targetElement "'+c+'"');a.targetElement||(a.targetElement=f.body||f.documentElement);a.targetElement!==f.documentElement&&a.targetElement!==f.body&&(a.resizeHandler=a.resizeHandlerAlt, a.usePixelPosition=!0);a.resizeHandler();a.usePositionFixed=a.usePositionFixed&&
|
||||
!r&&!a.flakeBottom;if(g.getComputedStyle)try{
|
||||
w='relative'===g.getComputedStyle(a.targetElement, null).getPropertyValue('position');
|
||||
}catch(d){
|
||||
w=!1;
|
||||
}t=a.usePositionFixed;h&&(l&&!a.disabled)&&(a.init(), a.active=!0);
|
||||
};a.autoStart&&a.events.add(g, 'load', y, !1);return this;
|
||||
}(window, document);
|
||||
|
@ -4,9 +4,9 @@ module.exports = {
|
||||
require('postcss-flexbugs-fixes'),
|
||||
require('postcss-preset-env')({
|
||||
autoprefixer: {
|
||||
flexbox: 'no-2009'
|
||||
flexbox: 'no-2009',
|
||||
},
|
||||
stage: 3
|
||||
})
|
||||
]
|
||||
}
|
||||
stage: 3,
|
||||
}),
|
||||
],
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user