* #10 add localization * #10 revert locale from dev page * #10 add more examples * #10 localize auth panel * #10 localize some comment message * #10 localize some comment form message * #10 translate vote messages * #10 translate comment message * #10 use messages value for translate reference * #10 fix compile issue * #10 use messages value for translate reference * #10 use messages value for translate reference * #10 use messages value for translate reference * #10 use messages value for translate reference * #10 use messages value for translate reference * #10 translate comment message * #10 translate comment form * #10 translate comment form * #10 translate root component * #10 translate user info * #10 translate settings * #10 translate settings * #10 translate toolbar * #10 translate errors messages * #10 sort dict * #10 fix after rebase * #10 localize anonymousLoginForm * #10 localize emailLoginForm * #10 update size-limit * #10 localize subscribe by rss * #10 localize subscribe by email * #10 add de locale * #10 increase limit size * #10 auto generate loadLocale * #10 add some documentation * #10 fix error messages * fix typo * don't bundle en locale * fix message id * change size limits * Update extract message pattern Co-Authored-By: Pavel Mineev <pavel@mineev.me> Co-authored-by: Pavel Mineev <pavel@mineev.me>
65 lines
2.0 KiB
TypeScript
65 lines
2.0 KiB
TypeScript
import { Sorting, AuthProvider, Theme } from './types';
|
|
import * as configConstant from './constants.config';
|
|
|
|
export const BASE_URL = configConstant.BASE_URL;
|
|
export const API_BASE = configConstant.API_BASE;
|
|
export const NODE_ID = configConstant.NODE_ID;
|
|
export const COMMENT_NODE_CLASSNAME_PREFIX = configConstant.COMMENT_NODE_CLASSNAME_PREFIX;
|
|
export const LAST_COMMENTS_NODE_CLASSNAME = 'remark42__last-comments';
|
|
export const DEFAULT_LAST_COMMENTS_MAX = 15;
|
|
export const DEFAULT_MAX_COMMENT_SIZE = 1000;
|
|
export const MAX_SHOWN_ROOT_COMMENTS = 10;
|
|
|
|
export const DEFAULT_SORT: Sorting = '-active';
|
|
|
|
/* matches auth providers to UI label */
|
|
export const PROVIDER_NAMES: { [P in AuthProvider['name']]: string } = {
|
|
google: 'Google',
|
|
twitter: 'Twitter',
|
|
facebook: 'Facebook',
|
|
github: 'GitHub',
|
|
yandex: 'Yandex',
|
|
dev: 'Dev',
|
|
anonymous: 'Anonymous',
|
|
email: 'Email',
|
|
};
|
|
|
|
/** locastorage key for collapsed comments */
|
|
export const LS_COLLAPSE_KEY = '__remarkCollapsed';
|
|
|
|
/** locastorage key for hidden users */
|
|
export const LS_HIDDEN_USERS_KEY = '__remarkHiddenUsers';
|
|
|
|
/** cookie key under which sort preference resides */
|
|
export const COOKIE_SORT_KEY = 'remarkSort';
|
|
|
|
export const THEMES: Theme[] = ['light', 'dark'];
|
|
|
|
export const IS_MOBILE = /Android|webOS|iPhone|iPad|iPod|Opera Mini|Windows Phone/i.test(navigator.userAgent);
|
|
|
|
/**
|
|
* Defines if browser storage features (cookies, localsrotage)
|
|
* are available or blocked via browser preferences
|
|
*/
|
|
export const IS_STORAGE_AVAILABLE: boolean = (() => {
|
|
try {
|
|
localStorage.setItem('localstorage_availability_test', '');
|
|
localStorage.removeItem('localstorage_availability_test');
|
|
} catch (e) {
|
|
return false;
|
|
}
|
|
return true;
|
|
})();
|
|
|
|
/**
|
|
* Defines whether iframe loaded in cross origin environment
|
|
* Usefull for checking if some privacy restriction may be applied
|
|
*/
|
|
export const IS_THIRD_PARTY: boolean = (() => {
|
|
try {
|
|
return window.parent.location.host !== window.location.host;
|
|
} catch (e) {
|
|
return true;
|
|
}
|
|
})();
|